-
Notifications
You must be signed in to change notification settings - Fork 4
opt
Turtle Kitty edited this page Oct 6, 2015
·
4 revisions
This operator accesses the optional arguments sent to a function.
(fun foo ()
(list opt.x opt.y opt.z))
(foo x: 1 y: 2 z: 3) -> (1 2 3)
(foo x: 1 y: 2) -> (1 2 null)
(foo) -> (null null null)
At the top level of a program, opt holds a list of command line options that were preceded by dashes.
; foo.sxy
(sys.say opt)
; command line
./sexy run foo.sxy -x 1 -y 2 --cheese yes
(record: x 1 y 2 cheese yes)