Fork me on GitHub
#yamlscript
<
2023-12-13
>
Ingy döt Net00:12:28

Posted this in #C03S1KBA2 but I just got let bindings and lambda functions working in YS! Here's an example of using let-over-lambda closures in YS:

$ cat sample/lol.ys 
!yamlscript/v0

defn lol(x):
  y =: 2 * x
  =>: \(% + y)

say:
  lol(10): 4
$ ys --compile sample/lol.ys 
(defn lol [x] (let [y (_* 2 x)] (fn [_1] (+ _1 y))))
(say ((lol 10) 4))
$ ys sample/lol.ys 
24

👀 1
Ingy döt Net19:12:37

The tree program is so much better now that the original Dec 1 version.

Ingy döt Net19:12:54

Implement as you blog :\