Your line "g = zz(2,3)" should have failed.  I suspect you defined a zz
function earlier in your session and it's dispatching on that.  Restart
your julia session to get clean results.

I think you probably wanted to do:

z(x,y) = x+y
zz(f::Function, x, y) = f(x,y)
zzz(f::Function, x, y) = zz(f, x, y)
z(2,3)   # 5
zz(z,2,3)  # 5
zzz(z,2,3) #5

On Mon, Jul 27, 2015 at 9:18 AM, Joe Tusek <[email protected]> wrote:

> I was exploring passing functions to functions and wrote the following
>
> function z(x,y)
>    x+y
> end
>
> function zz(z)
> end
>
> g = zz(2,3)    # gives a result g = 5
>
> function zzz(zz)
> end
>
> c = zzz(1,7)   #no result, claims that zzz has no methods for two int64
> arguments.
>
> Why is that? I would expect when g was evaluated it used function z for
> the evaluation of zz and hence, when calling zzz it would be reaching all
> the way back to  z?
>
>
>

Reply via email to