|
[Date Index]
[Thread Index]
[Author Index]
functional programming excercise from Mastering Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg55212] functional programming excercise from Mastering Mathematica
- From: Torsten Coym <torsten.coym at eas.iis.fraunhofer.de>
- Date: Thu, 17 Mar 2005 03:28:30 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
I'm quite new to Mathematica and its functional programming capabilities
so I did some reading in John Gray's "Mastering Mathematica". There is
an excercise in chapter 6 as follows
Write your own function composeList that works just like the built-in
operation with the same name, using FoldList. Conversely, write your own
function foldList that works just like the built-in operation with the
same name, using ComposeList.
Unfortunately, there is no solution given at the end of the book (or I
didn't find it). I could figure out a way to do the first task:
composeList[funlist_List, var_] := FoldList[(#2[#1]) &, var, funlist]
but I can't manage the second task...
I know it's rather academic, but ... any help is welcome!
Torsten
Prev by Date:
Re: GridLines
Next by Date:
Re: Sum
Previous by thread:
Re: Add new option to Notebook[]
Next by thread:
Re: functional programming excercise from Mastering Mathematica
|