can I select over functions?

Marc van Woerkom Marc.Vanwoerkom@REDACTED
Fri Jun 11 10:19:26 CEST 2004

Am Thu, 10 Jun 2004 23:23:49 +0200 hat
"Robert Virding" <robert.virding@REDACTED> geschrieben:
>From: "Marc van Woerkom" 
>> 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?

Intendend is comparison of functions,

      case instruction of
        move/2 ->
        turn/1 ->
        sense/3 ->

would be closer to the Erlang spirit.

> 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.

May you tell me how that comparison of functions (or is 
'fun' limited to anonymous functions) looks like?
I did not spot it when I looked for it.


More information about the erlang-questions mailing list