I yearn (want), occasionally, a kind of any/switch-like
flow-control function. What I came up with (works ok) is
similar in function to what I want:

        do select reduce [
                condition-1 [...]
                condition-2 [...]
                true [...]   ; default code
        ] true

It's kind of like ANY, in that it does the code associated
with the first condition that returns true.

I used it in a feel/detect function like so..

        do select reduce [
                event/shift [...]
                event/control [...]
                true [...] ; default
        ] true

to handle shift-clicks, control-clicks and plain mouse clicks.

But I would like it to be more like ANY.
In ANY, the first evaluated value that is not none is
considered "true" and returned.
In the desired function, the first evaluated condition that
is not none should have its associated code executed.
(That's different to the above - conditions have to evaluate
to true.)

I should use such a function like this:

        any-switch [
                condition-1 [...]
                condition-2 [...]
                true []
        ]

Hmm, maybe it should be a refinement:-  switch/any  ?

On another note, today I had the occasion to write:

        face/parent-face/parent-face/parent-face/parent-face/parent-face

Don't ask me the object hierarchy that leads to that expression. :)

Anton.
-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to