Reduce: what exactly did it do?
Did you do a reduce and get confused about how it got the final answer? Do you just want to see the computer write out it’s work? Check it:
(1,2,3).reduce({ $^a / $^b })
RESULT«0.166666666666667»
(1,2,3).reduce({"($^a / $^b)"})
RESULT«"((1 / 2) / 3)"»
(1,2,3).reduce({ $^b / $^a })
RESULT«1.5»
(1,2,3).reduce({"($^b / $^a)"})
RESULT«"((3 / 2) / 1)"»
How cool is that?
Posted Sat, Mar 7, 2009If you're interested in being notified when new posts are published, you can subscribe here; you'll get an email once a week at the most.