Re: Map, List
- To: mathgroup at smc.vnet.net
- Subject: [mg55103] Re: [mg55066] Map, List
- From: DrBob <drbob at bigfoot.com>
- Date: Sat, 12 Mar 2005 02:36:53 -0500 (EST)
- References: <200503110920.EAA02174@smc.vnet.net>
- Reply-to: drbob at bigfoot.com
- Sender: owner-wri-mathgroup at wolfram.com
>> What general principle applies that makes all such things functions? Two principles: 1) Just about anything can be used as a function. 1[2] is valid syntax, for instance. 2) Nothing is strictly a function. f[x] isn't a function f applied to an argument x; it's an expression which, if it matches a stored pattern for f, is replaced by a new expression. The new expression may do many things, aside from returning a value. Side-effects can keep f from mimicking a function at all, in the usual sense. Mathematica's pattern-matching paradigm is far richer and more varied than a simple function-argument situation. Bobby On Fri, 11 Mar 2005 04:20:42 -0500 (EST), Steve Gray <stevebg at adelphia.net> wrote: > I wanted to convert > > {a,b,c} to > {{a},{b},{c}}, (just an example) > > and it occured to me that since List[xx] = {xx}, I could do > > ml=Map[List,{a,b,c}] and get > ml={{a},{b},{c}}, > > making List in this case the inverse of Flatten. Now,assuming a,b,c have appropriate integer values, > I can do > > Delete[ggon, ml] > > where ggon is a list from which I want to delete an arbitrary set of list members. > > Of course this worked. My only problem is that I might not have thought of this obvious (in > retrospect) operation. Using List as a function is not mentioned in any of my several books. What > general principle applies that makes all such things functions? > > Thank you. > > Steve Gray > > > > -- DrBob at bigfoot.com
- References:
- Map, List
- From: Steve Gray <stevebg@adelphia.net>
- Map, List