Skip to content
Turtle Kitty edited this page Oct 6, 2015 · 3 revisions

lib

This defines the function that will be called when the program is imported as a module.
It can accept arguments and options just like any other function.
It can return any value. The return value will be the value of the (load ...) expression that imported the module.

; foo.sxy

(lib (x y)
    (list x y 5))

; bar.sxy

(use fooner (load "foo.sxy" 2 3)) -> (2 3 5)
(fooner.map (_ (* _ 2))) -> (4 6 10)
Clone this wiki locally