MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Help with concatenating a list with &&

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102153] Help with concatenating a list with &&
  • From: janey <janemkiwi at gmail.com>
  • Date: Fri, 31 Jul 2009 05:52:48 -0400 (EDT)

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.


  • Prev by Date: Re: The audience for Mathematica (Was: Show doesn't
  • Next by Date: Re: bvdae error when using NDSolve for initial value problem
  • Previous by thread: DOCS: debugger + theorem prover
  • Next by thread: Creating a Random Function to Select an Irrational Number