Readme additions
This commit is contained in:
parent
bc32c26164
commit
0e4a95f54d
2 changed files with 30 additions and 2 deletions
27
README.md
27
README.md
|
@ -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
|
||||
```
|
|
@ -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)})
|
||||
))
|
||||
|
||||
|
|
Reference in a new issue