MathGroup Archive 1998

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

Search the Archive

RE: [Q] How to get rid of {} in lists?


  • To: mathgroup@smc.vnet.net
  • Subject: [mg10729] RE: [mg10710] [Q] How to get rid of {} in lists?
  • From: Jean-Marie THOMAS <jmthomas@cybercable.tm.fr>
  • Date: Mon, 2 Feb 1998 00:44:23 -0500
  • Return-Receipt-To: Jean-Marie THOMAS <jmthomas@cybercable.tm.fr>

In this kind of situation, I use one of the following methods:

- use Apply:
Apply[And,{True,False,True}] will return False This works when the
function is "flat"

- use List->Sequence:
f[{a,b,c}/.List->Sequence] will be evaluated as f[a,b,c] Mind the fact
that f[{{a,b},{c,d}}/.List->Sequence] will evaluate as f[a,b,c,d]

- in other cases, you will have to sparse your arguments: if for
instance your variable is v={a,{a,b}} and your function something like
f[x,y], use f[First@v,Last@v]

Hope this helps,

-----------------------------------------------

Jean-Marie THOMAS
Conseil et Audit en Ingenierie de Calcul jmthomas@cybercable.tm.fr
+33 (0)3 88 32 93 64
www.cybercable.tm.fr/~jmthomas
=======================


-----Message d'origine-----
De:	Alessandro Rossi [SMTP:rossiale@cisco-ags.unive.it] Date:	vendredi
30 janvier 1998 10:25 A:	mathgroup@smc.vnet.net
Objet:	[mg10710] [Q] How to get rid of {} in lists?

Hi all: that's my problem...it seems to me very easy but I caan get out
of it with a solution:

I'd like to put the ordered elements of a list as parameters in a
function...

e.g.

list={True, False};
And[list] is not And[True, False]... how can I get rid of {} in order to
perform the calculation???

thanks in advance

Alessandro




  • Prev by Date: Re: Need help plotting multiple NDSolve solutions
  • Next by Date: Re: Bug? Can suddenly not edit with LINUX Frontend
  • Prev by thread: Re: Need help plotting multiple NDSolve solutions
  • Next by thread: Re: [Q] How to get rid of {} in lists?