I think this is quite amusing.
I am using contexts, combined with the use of compose first
mentioned by Ladislav.
Of course it is an awful perversion, but it can't be helped:
>> make-adder: func [
x
/reset
][
if reset [exit]
func [y] compose [
make-adder/reset (x)
add x y
]
]
>> add6: make-adder 6
>> add6 1
== 7
>> add5: make-adder 5
>> add5 1
== 6
>> add6 1
== 7
>> source add6
add6: func [y] [
make-adder/reset 6
add x y
]
So, it actually works!
Can you go to jail for this?
Free variables want to be free!
-galt