Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

Re: Lists to mask other lists

  • To: mathgroup at
  • Subject: [mg19112] Re: [mg19022] Lists to mask other lists
  • From: "David Park" <djmp at>
  • Date: Thu, 5 Aug 1999 01:35:29 -0400
  • Sender: owner-wri-mathgroup at

>I am trying to use one list to control the content of a second list.
>(It's not really masking, but...)
>Here's what I mean. Let's say
>(* could be filled with anything; same # elements as maskList }
>If a 1 appears at position n of maskList, then I leave the corresponding
>element of realDealList alone. But if a 0 appears, then I want to change
>the corresponding element of realDealList in some prescribed way. Let's
>say I change those elements to my first name (aram). Then realDealList
>would become
>I can do this in a loop, which is a really clunky solution, but isn't
>there a way I can Map across my list somehow?
>Aram Schiffman

Try this Aram,

MapThread[If[#1 == 1, #2, aram] &, {maskList, realDealList}]

{aaa, aram, aram, ddd, eee}

David Park
djmp at

  • Prev by Date: Re: equaltity of lists
  • Next by Date: Automatic grouping of animation cells
  • Previous by thread: Re: Lists to mask other lists
  • Next by thread: RE: Lists to mask other lists