Fixes in lambda/function definitions (body args). Cleanup of examples and decumentation. Added convenience methods for JS interop, lists and objects.

This commit is contained in:
Kuba Antosik
2021-04-04 18:35:26 +10:00
parent 8d23e5264e
commit 0cebbe52cb
24 changed files with 655 additions and 120 deletions

View File

@@ -0,0 +1,3 @@
# Not implemented (yet)
This set of examples shows the limitations of Ronin's LISP.

View File

@@ -0,0 +1,44 @@
;To inspect the results of these tests,
;open your browser's debugging tools
;
(usually F12)
and navigate to the
;JavaScript console.
(clear)
(def mydog
(object "color" "gold" "coat" "long" :speed "quick" :health "good"))
(debug mydog)
(test "My dog's color is"
(get mydog "color") "gold")
(test "My dog's coat is"
(get mydog "coat") "long")
(test "My dog's speed is"
(get mydog "speed") "quick")
;the last one passes only because :health
;in the set instruction above
;resolves to undefined - and
;technically you can have one object value
;for key=undefined
(test "My dog's health is"
(get mydog :health) "good")
;You can, however, use obj:param syntax to
;get properties of objects.
;A shorthand for
(get obj "param")
.
;
(test "Get color" mydog:color "gold")
;Also,
(:coat mydog)
;is another shorthand.
(test "Get coat shorthand function"
(:coat mydog) "long")