MathGroup Archive 2004

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

Search the Archive

Re: Fold and FoldList Problems

  • To: mathgroup at
  • Subject: [mg45463] Re: Fold and FoldList Problems
  • From: Jens-Peer Kuska <kuska at>
  • Date: Fri, 9 Jan 2004 05:20:30 -0500 (EST)
  • Organization: Universitaet Leipzig
  • References: <bti1ri$a7p$>
  • Reply-to: kuska at
  • Sender: owner-wri-mathgroup at


you are sure that you not mean

g[x_]:=Plus @@ h[x]




GlennRoberts at wrote:
> here is one that might be easy and i am just not getting it - help appriciated - i have written a small function h[x_] say in a .m file that returns a list as its answer - i would like to past this list thou a function in the same .m file that does:
> g[x_]:= Fold[Plus,0,h[x]]
> simple enough i thought but i get a error message returned that tells me the g[x_] function is trying to calcualte on each element of the list h[x] rather than the full list to return the sum - not sure what has gone wrong on this one - thanks - glenn

  • Prev by Date: Re: convert notebook into batch file
  • Next by Date: preserve neighborhood during random reordering
  • Previous by thread: Fold and FoldList Problems
  • Next by thread: Symbolic matrix algebra