MathGroup Archive 2004

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

Search the Archive

Re: Fold and FoldList Problems

  • To: mathgroup at smc.vnet.net
  • Subject: [mg45463] Re: Fold and FoldList Problems
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Fri, 9 Jan 2004 05:20:30 -0500 (EST)
  • Organization: Universitaet Leipzig
  • References: <bti1ri$a7p$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

you are sure that you not mean

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

??

Regards

  Jens

GlennRoberts at hbosts.com 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