Re: Help with concatenating a list with &&
- To: mathgroup at smc.vnet.net
- Subject: [mg102188] Re: [mg102153] Help with concatenating a list with &&
- From: Patrick Scheibe <pscheibe at trm.uni-leipzig.de>
- Date: Sat, 1 Aug 2009 03:57:02 -0400 (EDT)
- References: <200907310952.FAA19208@smc.vnet.net>
Hi,
quite close but && is the infix notation.
You want
And @@ {ex1, ex2, ex3, ex4}
Cheers
Patrick
Am Jul 31, 2009 um 11:52 AM schrieb janey:
> Can anyone help me make better use of mathematica's built in commands?
>
> My problem is to take the list of expressions ls:
>
> ls={ex1, ex2, ex3, ex4}
>
> and connect them to obtain
>
> ex1 && ex2 && ex3 && ex4
>
>
> I thought I should be able to use
>
> && @@ ls
>
> or equivalently Apply[&&, ls]
>
> However this fails. I ended up using the very awkward
>
> conditions = ls[[1]] && ls[[2]]
> Do[conds = conds && ls[[i]], {i, 3, Length[ls]}]
>
> which works but feels like just bludgeoning the problem
>
> Does anyone know of a more elegant way to work this?
>
> Thanks,
> Jane.
>