On 1/10/07, Daniel Ehrenberg <[EMAIL PROTECTED]> wrote:
> Is this supposed to be useful or just an excercise? I don't see why
> we'd need this.
I've come across situations that it would be useful a few times. In
those cases I explicity use set-global to set the variable in the
global namespace- where I really could get by with it being stored in
a more local something.
For example, storing data in an httpd responder. A counter of hits
could be incremented on each request but using 'set' would store it in
the local scope:
[
0 counter set
...do stuff...
[
counter get 1+ counter set
] with-stream
] with-scope
In this case the original counter value is not changed as it was set
inside a 'with-stream' which creates a new scope. So you have to be
aware of which combinators create new scopes, etc for variable setting
to work. I believe Eduardo's solution provides a solution for this.
Previously I'd use 1 element vectors or tuples and set the value
inside the vector/tuple, or use set/get-global.
Chris.
--
http://www.bluishcoder.co.nz
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk