MathGroup Archive 1992

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

Search the Archive

Listable vs. Thread

  • To: mathgroup at
  • Subject: Listable vs. Thread
  • From: gaylord at
  • Date: Wed, 28 Oct 1992 06:53:31 -0600

i understood Listable to be an attribute which automatically threads a function.

I therefore expect that i could either makea function Listable or I could
'manually' Thread it to its arguments. 

However, as the example below shows, using Thread with the function does
not work the same as  maing the function Listable (in fact using Thread
appears to go to too low a level producing an error message.

could someone please explain exactly what's going on here (i don't
understand why using Thread produced an error) and what functions need to
be 'manually' applied to a function for it to work the same way as it does
when its Listable.


dog = {{1,0,1,1},{1,1,1,0}};

cat = {{1,1,0,1},{1,1,0,0}};

doIt[x_,0] := a
doIt[0,y_] := b
doIt[x_,y_] := c
Attributes[doIt] = Listable


{{c, b, a, c}, {c, c, a, a}}

dontDoIt[x_,0] := a
dontDoIt[0,y_] := b
dontDoIt[x_,y_] := c

   Normal expression expected at position 1 in Thread[c].

richard j. gaylord, university of illinois, gaylord at

"if you're not programming functionally, then you must be programming

  • Prev by Date: Re: Question about changing variables in PDEs
  • Next by Date: Re: Question about changing variables in PDEs
  • Previous by thread: Listable vs. Thread
  • Next by thread: RE: Uses in h.s.APcalculus