I've often wanted a small scheme interpreter that can run out of SoC flash.
I'm sure they exist, but anyway, easy to whip one up.
Scheme is pretty much the same as lisp, but does away with the cons cell.
That's not at all the case. "pair" is a fundamental data type (as are vector and string) and cons/car/cdr fundamental functions in any version of Scheme from 1975 to today's R7RS Small. The primary differences between Lisp and Scheme are Scheme's use of a single namespace and lexical binding vs Lisp's separate namespace for functions and dynamic scoping. Common Lisp (which came a decade after Scheme) made lexical scoping the default.
It is certainly true that much idiomatic Scheme does not make much if any use of cons cells -- and is largely equivalent to C with added GC -- but they are still always there.
There are also other things such as guaranteed tail-call optimisation, call/cc, delay/force, exceptions.
Even a 6502 could run it
Of course. A 6502 is a powerful CPU that can run anything that can fit into 64k. As an 8 bit CPU it has to handle pointers and integers in chunks, but that's true of any 8 bit CPU.
car:
sta tmpl
stx tmph
ldy #1
lda (tmpl),y
tax
dey
lda (tmpl),y
rts
cdr: ; jsr 6
sta tmpl ;3
stx tmph ;3
ldy #3 ;2
lda (tmpl),y ;5
tax ;2
dey ;2
lda (tmpl),y ;5
rts ;6 tot = 34
I guess on Z80 you'd do something like:
cdr: ; call 17
inc hl ;11
inc hl ;11
ld e,(hl) ;7
inc hl ;11
ld d,(hl) ;7
ex de,hl ; 4
ret ;10 tot = 77
The z80 code is shorter at 7 bytes (5 for car) vs 13 bytes, but as is common, twice as many cycles at 77 (55 for car) vs 34.