ScratchData LogoScratchData
Back to mlcreater's profile

Interpreter-v2 (Lisp/Scheme-like language)

MLmlcreater•Created June 20, 2025
Interpreter-v2 (Lisp/Scheme-like language)
0
0
1 views
View on Scratch

Description

(now with an embarrassingly slow preprocessor!) This project works like https://scratch.mit.edu/projects/1119747201 but much slower, though with the new syntactic form: (labels ((f1 (lambda ... ...)) (f2 (lambda ... ...)) ...) body) "Labels" binds each name (f1, f2, ...) to a function, and evaluates body, so that each function definition as well as body can refer to any of the functions; this makes recursion easier to write. Examples: (labels ((map (lambda (f list) (if (pair? list) (cons (f (car list)) (map f (cdr list))) '())))) (map cdr '((a b) (c d) (e f)))) => ((b) (d) (f)) (labels ((a (lambda (x) (if (pair? x) (d (car x)) x))) (d (lambda (x) (a (cdr x))))) (a '((y . ((w . v) . x)) . z))) => v (labels ((a (lambda () (a)))) (a)) ; an infinite loop

Project Details

Project ID1190749870
CreatedJune 20, 2025
Last ModifiedJune 28, 2025
SharedJune 28, 2025
Visibilityvisible
CommentsAllowed

Remix Information

Parent ProjectView Parent
Root ProjectView Root