diff --git a/README.md b/README.md index 360fb0f..39c2f1f 100644 --- a/README.md +++ b/README.md @@ -27,4 +27,31 @@ An opinionated lisp implementation developed in the most intuitive way I could c 1 ,(sub 3 1) ) ) ; => '( 1 2) +``` + +### Maps can be indexed with . + +```lisp +; In this example, ball_pos is a map +(print ball_pos.x ball_pos.y) + +; This is just syntax sugar for +(get ball_pos "x") +``` + +### Functions can be defined and called like so + +```lisp +(fn hello(name) ( + (print (concat "Hello, " name "!")) +)) + +(hello "Joe") ; => "Hello, Joe!" + + +; Anonymous function creation +( + (fn(x) (print x)) + 15 +) ; => 15 ``` \ No newline at end of file diff --git a/src/test.lisp b/src/test.lisp index d09e17e..b6856e2 100644 --- a/src/test.lisp +++ b/src/test.lisp @@ -1,4 +1,5 @@ (fn takevalue(origin) ( - (print (concat "Origin: (" origin.x ", " origin.y ")")) - (print origin) + (print (concat "Origin: (" origin.x ", " origin.y ")")) ; => Origin: (0, 0) + (print origin) ; => Map({"x": Float(0.0), "y": Float(0.0)}) )) +