Re: Assertions in Mathematica?
- To: mathgroup at smc.vnet.net
- Subject: [mg113530] Re: Assertions in Mathematica?
- From: "Nasser M. Abbasi" <nma at 12000.org>
- Date: Mon, 1 Nov 2010 05:01:28 -0500 (EST)
- References: <iaj4ob$n70$1@smc.vnet.net> <iajgs3$qt7$1@smc.vnet.net>
- Reply-to: nma at 12000.org
On 10/31/2010 3:36 AM, Nasser M. Abbasi wrote: > > Because if the programmer writes the documentation of the software they > know, they think something is 'obvious', and so they will short change > the documentation. Just as an example of Mathematica documentation being written not for mere mortal among us, I was looking at Append, then it said: "In iteratively building a list, it is usually more efficient to use Sow and Reap than to use Append[list, new] at each step." I said, great, let me look at Sow and Reap (which I never to this day figured how to use these 2 guys). The first thing I see about Sow[e] is: "Sow[e] specifies that e should be collected by the nearest enclosing Reap. " What does that mean? collected by the 'nearest' enclosing Reap? Reading more...I look at the first example, "Evaluate a sequence of expressions, sowing some to be collected by Reap" Sowing "some"? How this "some" come about? to be collected by Reap? in what sense? What does Sowing actually mean? as in sewing cloth? as in joining parts? Ok, trying to understand what the command does from looking at the output, since the description above made no sense to me. After looking at some examples, and still not clear how it works exactly, I looked at Reap, and the first thing it said is: "Reap[expr] gives the value of expr together with all expressions to which Sow has been applied during its evaluation. Expressions sown using Sow[e] or Sow[e, tagi] with different tags are given in different lists. " humm, looking at the next part, it says "Make a separate sublist for each tag being reaped" Ok, I give up. Sow seems to be described in terms of Reap, and Reap seems to be described in terms of Sow. Like a cycle. I do wish these 2 command could have been presented in a simpler way. It would have been nice for example to show how to use Sow and Reap in place of Append. May be it is hidden there somewhere. But I will keep reading, I am sure I will figure these 2 commands out one day :) --Nasser