Hi all,

I failed miserably trying to join the #concatenative IRC channel (I
could join and read, but couldn't post, "Cannot send to channel"... I
can post to other channels alright).

I fiddled a bit with both Forth and Factor, and now I'm making my way
through the excellent DLS2010 paper which I find quite instructive. I
would like to post a few questions concerning this:

* The first code example, Figure 1, says

  "data.txt" utf8 file-lines 10 head

  Is there a way, or a "word", like file-lines that is lazy, like a
lazy iterator/generator in other languages? I was thinking of a file
with hundreds of thousands of lines, where I'm only interested in the
first 10, and which would potentially overload the stack if all lines
would be placed on it before '10 head' could run.

* In the tail-recursive factorial example, Figure 3, shouldn't the
second word read

  : factorial ( n -- n! )
      1 swap (tail-factorial)  ;

rather than '1 swap (factorial)'?! And why is the factorial word in parens?

* In the same code example, the recursive invocation in the
tail-factorial word definition reads

  [ [ * ] [ 1 - ] bi tail-factorial ]

I get that bi is actually '{ [ * ] [ 1 - ] } cleave'. But '*' is
dyadic, so consumes 2 elements from the stack, where cleave is said to
operate only on a single value (apart from the array of quotations)!?

Thanks,
Thomas

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to