can I select over functions?

Robert Virding robert.virding@REDACTED
Thu Jun 10 23:23:49 CEST 2004


From: "Marc van Woerkom" <Marc.Vanwoerkom@REDACTED>
> The pseudo code in the icfp contest task had some piece
> like
>
>     case instruction of
>       move(Ant, Steps) ->
>          ..
>       turn(LeftRight) ->
>          ..
>       sense(Direction, Time, Moonphase) ->
>          ..
>     end
>
> where the different cases are not simple values like a
> token for the intended instruction, but functions.

What are you actually trying to do here, compare Instruction with the actual
functions (i.e. it is a function) or compare it with the values of the
evaluated functions? The name(...) syntax means a function call. There is no
real way of defining a function object except with fun's and comparing funs
works but is limited.

Robert




More information about the erlang-questions mailing list