MathGroup Archive 1995

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Functions, Part 1


>   (1)	f[x_] := x + 1
>   
>   (2) 	g = Function[x,f[x]]
>   
>   (3)	h = Function[x,Function[y,y+1]]
>   
>   Now  g[2]  and  f[2]  output  3  as expected.  But 
>   h[2] (indeed, h[garbage]) outputs  Function[y,y+1].
>   What`s going on?


You for got the x in the definition of h. You want:

 h = Function[x,Function[y,y+1][x]]

Now h[2]=3.



  • Prev by Date: Re: Functions, Part 1
  • Next by Date: Re: Confused about contexts ...
  • Previous by thread: Re: Functions, Part 1
  • Next by thread: Re: Functions, Part 1