YaSL is a minimalistic programming language inspired by the Lisp language family. Try out the examples below! Code examples: > (set x 3) (+ x 2) 5 > (list (list 1 2) (list 3 4)) ((1 2) (3 4)) > (let ((x 3) (y 4)) (+ x y)) 5 > (set add1 (fn (x) (+ x 1))) (add1 3) 4 > (set map (fn (ls fnc) (if ls (pair (fnc (head ls)) (map (tail ls) fnc)) ls))) (map (list 1 2 3) (fn (x) (+ x 1))) (2 3 4) > (set combine (fn (ls fnc id) (if ls (fnc (head ls) (combine (tail ls) fnc id)) id))) (combine (list 1 2 3 4) * 1) 24 > (set ! (fn (n) (if (< n 2) 1 (* n (! (- n 1)))))) (! 10) 3628800 > (set index (fn (ls i) (if (< i 2) (head ls) (index (tail ls) (- i 1))))) (index (list 'a 'b 'c 'd) 3) c > (set inc (macro (v) `(set ,v (+ ,v 1)))) (let ((x 3)) (inc x) x) 4 > (set dyn-fn (macro body `(macro args `((fn ,@',body) ,@args))))
YaSL stands for "Yet another Scratch Lisp". It is based on the Lisp family of programming languages, all of which are based on simple 'pairs' (called 'cons cells') and 'words' (called 'atoms') in some way. Because code and data are both made up of the same basic building blocks, Lisp languages can get very creative with metaprogramming (i.e. programming programs that manipulate programs). YaSL has built-in support for macros that return the actual expression to be evaluated. Latest changes (18/06/2022): Added 'apply' primitive Features for nerds: - Lisp-like syntax - Code quotation - Global environment and lexical scopes - First-class lists, functions and macros - Garbage collection