Welcome to my site.
For some reason, I am demonstrating that scheme ~= JS here.
To open the developer tool console:
then try these
NOTE: None of this code runs through a custom interpreter or parser, this is done entirely with the JS parser. This is valid JavaScript, it just looks an awful lot like scheme.
with (scheme) conjure
(define `myNumber` (plus, 3, 4))
(log `the value of myNumber is`, myNumber)
with (scheme) conjure
(define `x`
(plus, 3, 4))
(cond
(equal, x, 9)
(log `when true`, x)
(log `when false`, x))
with (scheme) conjure
(define `myFn`
(lambda `arg1 arg2`
(plus, arg1, arg2)))
(log `result` (myFn, 15, 15))
with (scheme) conjure (... some code)
|
start conjuring scheme code |
(define `variableName` (value))
|
define something as having a value. In the parentheses, anything can go. |
(define `variableName`, value))
|
alternate spelling |
(log `variableName` (value))
|
log a message and a value. In the parentheses, anything can go, including function calls |
(log `log message`, value)
|
alternate spelling |
(lambda `arg1 arg2 argn` (fn, arg1, arg2, argn))
|
create an anonymous function |
(lambda `arg1 arg2 argn` (fn (arg1, arg2, argn)))
|
create an anonymous function (alternate spelling) |
(cond (testFn) (consequentFn) (alternateFn))
|
conditional statement |