Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2001

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

Search the Archive

Re: Converting {{a,b},{c,d}} to just {a,b},{c,d} (no enclosing parens) ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28783] Re: [mg28766] Converting {{a,b},{c,d}} to just {a,b},{c,d} (no enclosing parens) ?
  • From: Ken Levasseur <Kenneth_Levasseur at uml.edu>
  • Date: Sat, 12 May 2001 20:18:15 -0400 (EDT)
  • References: <200105120000.UAA21293@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hello:

You can do what you want with Sequence:

In[1]:=
seq1 = {{a, b}, {c, d}}
seq2 = {{e, f}, {g, h}}
Line[{Sequence @@ seq1, Sequence @@ seq2}]

Out[1]=
{{a, b}, {c, d}}

Out[2]=
{{e, f}, {g, h}}

Out[3]=
Line[{{a, b}, {c, d}, {e, f}, {g, h}}]

However, it would seem to be much easer to just join the lists of pairs.

In[4]:=
Line[Join[seq1, seq2]]

Out[4]=
Line[{{a, b}, {c, d}, {e, f}, {g, h}}]

Hope this helps.

Ken Levasseur
Math Sci.
UMass Lowell

aes wrote:

> How can I convert a list of pairs, like
>
>     {{a,b},{c,d},{e,f},. . . }}
>
> into just a sequence of pairs, i.e.
>
>    {a,b}, {c,d}, {e,f}, . . .
>
> with no outer { }'s?
>
> Reason for doing this?  Want to define a Line in the form
>
>    Line[{pt1, pt2, pt3, pt4, pt5, pt6, . . . . . . }]
>
> where some of the points, say pt1 through pt4 are individually defined;
> but then a sequence, say pt5 through pt20, are defined by a Table; then
> pt21, etc are back to individual definitions.
>
> I know -- I could break these into a sequence of Lines -- but it would
> be cleaner if there were a simple way to have one Line[ ]  command with
> all the points inside it.



  • Prev by Date: Det[]
  • Next by Date: Re: How to remove, change the assymptotic lines?
  • Previous by thread: Converting {{a,b},{c,d}} to just {a,b},{c,d} (no enclosing parens) ?
  • Next by thread: Re: Converting {{a,b},{c,d}} to just {a,b},{c,d} (no enclosing parens) ?