Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Lisp is fun!

Name: Alexander Dubček 2015-03-24 6:14

I wrote a toy Lisp interpreter this weekend. Programming is pretty much a video game!

https://bitbucket.org/dhoskin/thp

(LET ((f (LAMBDA (x) (IF (x (f (CDR x))) recursion!))))
(f (QUOTE (a b c d e))))

→ args: ((a b c d e))
→ args: ((b c d e))
→ args: ((c d e))
→ args: ((d e))
→ args: ((e))
→ args: (nil)
→ recursion!

Name: Anonymous 2015-03-25 9:37

>>5 >>6
In other Lisps, I think you can't refer to variables created inside the variable declaring part of LET. You need to sublet. *cough*

For example, instead of:

(let ((factory (lambda (x) (lambda (y) (cons x y))))
(helloer (factory 'hello)))
(helloer 'world))


you need to do:

(let ((factory (lambda (x) (lambda (y) (cons x y)))))
(let ((helloer (factory 'hello)))
(helloer 'world)))

Name: Anonymous 2015-03-25 9:38

>>5 >>6
Also, I'm anxious to try your new version with closures, let us know when you check it in :)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List