codegeneration is cool
The expression "1+2+3" is converted to:
(list-ec (:list e1 (gx:. gx:unit gx-ffi:number gx:fido (gx:unit 1))) (:list e2 (gx:. gx:unit gx-ffi:number gx:fido (list-ec (:list e1 (gx:. gx:unit gx-ffi:number gx:fido (gx:unit 2))) (:list e2 (gx:. gx:unit gx-ffi:number gx:fido (gx:unit 3))) (+ e1 e2)))) (+ e1 e2))
For those who is curious and have some theoretical background:
* list-ec -- list comprehension
* :list -- generator of list comprehension
* gx:. -- function composition
* gx:unit -- wrap a value to a list
* gx:fido -- take the first element from a sorted list
* gx:gx-ffi:number -- convert to a number
Categories:
Generative XML