Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Pad a sign - and + to a list of lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49771] Re: Pad a sign - and + to a list of lists
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Fri, 30 Jul 2004 06:02:23 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 7/29/04 at 7:45 AM, sean_incali at yahoo.com (sean kim) wrote:

>consider a list of lists
>
>{ {{1, 1}}, {{1, 2}}, {{1, 3}}, {{2, 1}}, {{2, 2}}, {{2, 3}}, {{3,
>1}}, {{3, 2}}, {{3, 3}}
>}

>Now pad a string or letter to the end of the each list within the
>list so u get...

>{{1, 1},string}, {{1, 2}, string}, {{1, 3}, string}

>or sign

>{{1, 1},-}, {{1, 2},-}, {{1, 3},-}

For a string or any legal Mathematica expression you can do

({#1, string} & ) /@ 
  {{{1, 1}}, {{1, 2}}, 
   {{1, 3}}, {{2, 1}}, 
   {{2, 2}}, {{2, 3}}, 
   {{3, 1}}, {{3, 2}}, 
   {{3, 3}}}

to get

{{{{1, 1}}, string}, 
  {{{1, 2}}, string}, 
  {{{1, 3}}, string}, 
  {{{2, 1}}, string}, 
  {{{2, 2}}, string}, 
  {{{2, 3}}, string}, 
  {{{3, 1}}, string}, 
  {{{3, 2}}, string}, 
  {{{3, 3}}, string}}
  
But since the sign operator by itself is not a legal Mathematica expression, I don't think there is a way to do the second. I can of course, pad with the single character "-".
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Wolfram Technology Conference 2004: Call for Submissions
  • Next by Date: Re: How to code Conjugate Gradient Method
  • Previous by thread: Re: Pad a sign - and + to a list of lists
  • Next by thread: how to know where the error is from