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
|
@ -28,3 +28,30 @@ An opinionated lisp implementation developed in the most intuitive way I could c
|
||||||
)
|
)
|
||||||
) ; => '(<function add> 1 2)
|
) ; => '(<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) (
|
(fn takevalue(origin) (
|
||||||
(print (concat "Origin: (" origin.x ", " origin.y ")"))
|
(print (concat "Origin: (" origin.x ", " origin.y ")")) ; => Origin: (0, 0)
|
||||||
(print origin)
|
(print origin) ; => Map({"x": Float(0.0), "y": Float(0.0)})
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
Reference in a new issue