> How would you write the following method in Scheme (assuming that
> there is something like a #at:ifAbsent: in Scheme)?
> 
>    Object>>foo
>      bar := zork at: 1 ifAbsent: [ ^ 2 ].
>      self andNowForSomethingCompletelyDifferent: bar.


Either use a continution (call/cc), or check whether 1 is in zork, or check if 
looking for 1 return nil. But basically, it is likely that you will have one 
function for the the lookup, and another that does the 
andNowForSomethingCompletelyDifferent:. 

Alexandre

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






Reply via email to