From: Stefan S. <s...@xs...> - 2009-06-29 18:40:47
|
On Mon, 29 Jun 2009 11:23:28 -0600 Harold Hausman <hha...@gm...> wrote: > Hi. > > Regarding this produce word: > http://docs.factorcode.org/content/word-produce,sequences.html > > I'm confused that the two quotations it uses have stack effects with > nothing on the left side of the --. > > Certainly at least the predicate needs some parameters? I think it's just a problem of what to write that's the least wrong .-) USING: kernel math prettyprint sequences ; 1337 [ dup 0 > ] [ 2/ dup ] produce nip . { 668 334 167 83 41 20 10 5 2 1 0 } produce ( pred quot -- seq ) Both pred and quot are required to be a quotation which add one element to the stack but there is no requirement as to what they might do to the elements found on the stack. The intention is probably that pred leaves the elements untouched, only adding a flag on top of them, while quot may modify the elements as is necessary to fulfil its purpose. That's quite difficult to express in a stack comment. s. |