MathGroup Archive 1992

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

Search the Archive

Re: Listable vs. Thread


Richard:

(1)
The error message in

Thread[voteTwice[cat,dog]]
Thread::normal: Normal expression expected at position 1 in Thread[c].

is because Thread evaluates its elements in the usual way so gets  c  from

voteTwice[cat,dog], and then tries to evaluate Thread[c].


(2)
Here's some prettier code to do the same as

Map[(Thread[#])&,Thread[vote[cat,dog]]]


MapThread[vote,{cat,dog}, 2]
{{c, b, c}, {b, a, c}}

Allan

Allan Hayes
hay at leicester.ac.uk





  • Prev by Date: Re: Treating units as positive constants?
  • Next by Date: How to calculate Fisher Information?
  • Previous by thread: Re: Treating units as positive constants?
  • Next by thread: How to calculate Fisher Information?