Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #11448
| From | Ray Koopman <koopman@sfu.ca> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Non-sequential composition of pure functions |
| Date | 2012-08-22 09:20 +0000 |
| Message-ID | <k1289d$10p$1@smc.vnet.net> (permalink) |
| References | <k11u1r$t8m$1@smc.vnet.net> |
| Organization | Time-Warner Telecom |
On Aug 21, 11:26 pm, Earl Mitchell <earl.j.mitch...@gmail.com> wrote:
> Hi All,
>
> I have a list of pure functions (If[Conditional[#[[1]]],Action]&
> statements) and I want to compose them into one large pure function
> If[FirstConditional[#[[1]]]&&SecondConditional[#[[6]]]&&ThirdConditional[#[[foo]]],Action]&.
> They are to be applied to a list of values, and the conditionals checked
> for multiple columns for a given element of a list.
>
> I'm having problems joining these things together - to the point that I've
> considered converting them all to strings and doing the tedious
> (hackie) string manipulations to get the final function in the right form.
> Any recommendations on how to do this? I found Composition[] but it nests
> the functions - and I want to combine them.
>
> Thanks!
>
> Mitch
In[1]:= f1 = If[c1@#, a1]&;
f2 = If[c2@#, a2]&;
f3 = If[c3@#, a3]&;
In[4]:= If[And @@ MapThread[#1@#2&,
{ {f1,f2,f3}[[All,1,1,0]], {x1,x2,x3} }], action]
Out[4]= If[c1[x1] && c2[x2] && c3[x3], action]
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Non-sequential composition of pure functions Earl Mitchell <earl.j.mitchell@gmail.com> - 2012-08-22 06:26 +0000 Re: Non-sequential composition of pure functions Ray Koopman <koopman@sfu.ca> - 2012-08-22 09:20 +0000 Re: Non-sequential composition of pure functions awnl <awnl@gmx-topmail.de> - 2012-08-22 09:21 +0000 Re: Non-sequential composition of pure functions awnl <awnl@gmx-topmail.de> - 2012-08-23 06:51 +0000 Re: Non-sequential composition of pure functions Ralph Dratman <ralph.dratman@gmail.com> - 2012-08-23 06:53 +0000 Re: Non-sequential composition of pure functions Earl Mitchell <earl.j.mitchell@gmail.com> - 2012-08-23 06:54 +0000
csiph-web