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:
3
examples/not-implemented-yet/README.md
Normal file
3
examples/not-implemented-yet/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Not implemented (yet)
|
||||
|
||||
This set of examples shows the limitations of Ronin's LISP.
|
||||
44
examples/not-implemented-yet/object-symbols.lisp
Normal file
44
examples/not-implemented-yet/object-symbols.lisp
Normal 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")
|
||||
Reference in New Issue
Block a user