MathGroup Archive 1997

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

Search the Archive

Re: list manipulation problem

  • To: mathgroup at
  • Subject: [mg9110] Re: [mg9062] list manipulation problem
  • From: seanross at
  • Date: Mon, 13 Oct 1997 23:33:22 -0400
  • Sender: owner-wri-mathgroup at

Teemu Vesanen wrote:
> I have a list like=20
> {{a, b, c}, {d, e, f}, {g, h, i}}
> I need to delete the third term of each sublist.
> In other words how do I make the list look like
> {{a, b}, {d, e}, {g, h}}

How about Map[Take[#,2]&,{{a, b, c}, {d, e, f}, {g, h, i}}]?

The construct Take[#,2]& is called a pure function and is a useful
device in manipulating lists since it allows you to custom makea a
function that can be Mapped Threaded etc. across the elements of a list.

  • Prev by Date: Re: list manipulation problem
  • Next by Date: Re:list manipulation problem
  • Previous by thread: Re: list manipulation problem
  • Next by thread: Re:list manipulation problem