Re: Listable vs. Thread
- To: mathgroup <mathgroup at yoda.physics.unc.edu>
- Subject: Re: Listable vs. Thread
- From: HAY at leicester.ac.uk
- Date: Sun, 1 NOV 92 22:28:33 GMT
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