Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1995
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1995

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

Search the Archive

Re: Functions, Part 1

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg573] Re: [mg564] Functions, Part 1
  • From: Arthur Wasserman <Arthur.Wasserman at math.lsa.umich.edu>
  • Date: Sun, 19 Mar 95 11:27:08 -0500

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