doubt on fun

MEENA SELVAM <>
Sun Jun 19 08:41:04 CEST 2005


Can anyone explain what happens when we use something
like this?

function1()->
             my_fun(
                 param1,
                 fun({p1,p2})->
                     p3 = function2(p1,p2)
                 end ).

where p1, and p2 are some variables whose scope
includes within this function.

My doubt is what happens, when we put the fun as a
parameter to a function. Since the fun is in the body,
will the statements within the fun end block be
executed just like any other expression?   

Similarly, what happens when fun... end is used as
part of map as follows?

map(fun(X)->
            {Y,Z}
    end,
    somelist)

In comparison with map(Func, List) applying Func to
each element in the list, what does the above map with
func .... end applies to the list?

I am not clear on this, but I am reading code,  of
these kinds.

meena            

--- "ke.han" <> wrote:

> 
>  >
>  > IMHO the single most important design "boundary"
> is the inter-processor
>  > boundary. Today there are 3 different RPC's:
>  >
>  >     RPC1 - between two processes in the same
> Erlang node
>  >     RPC2 - between two processes in different
> nodes in a single CPU
>  >     RPC3 - between two processes in different
> nodes on different CPU's
>  >
>  > The times for these are *vastly* different RPC1
> is in microseconds, 
> RPC3 is in millisceconds.
>  >
>  > When we have multi-core CPUs well have:
>  >
>  >     RPC4 - between two processes in different
> nodes in different CPUs 
> on the same chip
> 
> 
> So would RPC5 be:
>      RPC5 between two processes in the same node in
> different CPUs on 
> the same chip
> 
> What you describe as RPC4 seems to be a niche
> requirement.  What I'm 
> calling RPC5 seems much more needed.
> 
> 
> thanks, ke han
> 



		
____________________________________________________ 
Yahoo! Sports 
Rekindle the Rivalries. Sign up for Fantasy Football 
http://football.fantasysports.yahoo.com



More information about the erlang-questions mailing list