関数を作る関数
手続き型言語では(template等抜きに)素直に実現するには)スタックポインタの都合で不可能ですが、関数型言語ではとてもおなじみ。カリー化もこの類。
You should avoid using variables that are local to the top level function as an unevaluated part of the nested function.
こんな風に書かれてはいましたが…。
>> make-constant: func [x][does [x] ] >> a: make-constant 10 >> a == 10 ; できてるような… >> make-add: func [x][func [y][x + y] ] >> b: make-add 10 >> b 20 == 30 ; できてるできてる
bindなる関数も存在しますが…!?