Readme additions

This commit is contained in:
Apache 2024-06-25 00:39:43 -05:00
parent bc32c26164
commit 0e4a95f54d
Signed by: apache
GPG key ID: 6B10F3EAF14F4C77
2 changed files with 30 additions and 2 deletions

View file

@ -27,4 +27,31 @@ An opinionated lisp implementation developed in the most intuitive way I could c
1 ,(sub 3 1)
)
) ; => '(<function add> 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
```

View file

@ -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)})
))