[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sc-users] let type statements in SC?
Hello,
I do the following in lisp all the time:
(let ((joe 2)(momma 1))
(defun blah (armyboots)
(* joe momma armyboots)))
Looking over some work I've started, I'm realizing that being able to do so
in SC would help me reuse a fair amount of code. Is there a suave way to
bind variables and functions within protected environments inside of
programs? While this doesn't work, I'm looking to do something like:
(
var f1, f2;
(
var harry = 30
f1 = { arg bill;
bill * harry};
)
(
var harry = 40
f2 = { arg bill;
bill * harry};
)
)
,
where each harry is bound to a separate environment enclosing each of the
functions.
If this isn't possible, is there a way to have function variables
have initial values without having to call the function with a special
argument depending upon whether one is initializing or not?
If none of this is clear, I apologize and blame the sake......
thanks,
Michael