Re: Pipes within Mathematica?
- To: mathgroup at smc.vnet.net
- Subject: [mg18162] Re: [mg18123] Pipes within Mathematica?
- From: Jay Gallivan <jay_gallivan at PaineWebber.COM>
- Date: Sat, 19 Jun 1999 23:54:27 -0400
- Organization: PaineWebber
- References: <199906180451.AAA22222@smc.vnet.net.>
- Sender: owner-wri-mathgroup at wolfram.com
If you might look at the following URL you may find that mash will meet your need. http://www.eecs.umich.edu/~dreeves/misc/mash/ simon shannon wrote: > > dear all, > > does anyone know of an easy way of piping > within a Mathematica session? say i have an arbitrary > list of data like this: > > data = {"slap", "boink", 4, 5.3, Pi}; > > and some procedures which each take a list as > input, do something sequentially to the input > > proc1[x_] := Hash /@ x > > proc2[x_] := Split[x, Xor[EvenQ[#1],OddQ[#2]]&] > > proc3[x_] := Scan[Print[Length[#]]&, x] > > note that proc2 doesn't just apply an operation > to each single element---depending on the input > we get an arbitrary partitioning of its input > (depending on the test we give to Split[]). > > so my question is: rather than doing > > proc3[proc2[proc1[data]]] > > which generates the entire result list for proc1 before > handing on to proc2, and similarly for proc3, > is there a way of doing what in unix parlance > might be written > > proc1 < data | proc2 | proc3 > > or, indeed, if data were itself a generating process > an even simpler > > data | proc1 | proc2 | proc3 > > there are languages that allow procedures to voluntarily > relinquish control to other processes using suspend() and > resume() type statements; perhaps something like this > is possible using the Catch[] and Throw[] in Mathematica. > > thanks in advance > > simon shannon -- Jay Gallivan |41st Floor |Voice: (312)683-6386 Technology Manager|181 W. Madison Street|Fax: (312)683-6474 PaineWebber Inc. |Chicago, IL 60602 |mailto:jgalliv at painewebber.com
- References:
- Pipes within Mathematica?
- From: simon shannon <sshannon@taz.dra.hmg.gb>
- Pipes within Mathematica?