William James
10/31/2015 4:33:00 PM
WJ wrote:
> Edi Weitz wrote:
>
> > (defun foo ()
> > (with-open-file (strm "/tmp/test.big")
> > (loop as line = (read-line strm nil nil)
> > while line
> > summing (length line))))
>
> Gauche Scheme:
>
> (define (foo)
> (with-input-from-file "words"
> (cut generator-fold
> (^(line sum) (+ sum (string-length line)))
> 0
> read-line)))
>
> Another way:
>
> (use srfi-42 :only (sum-ec))
>
> (define (foo)
> (with-input-from-file "words"
> (cut sum-ec (:generator line read-line)
> (string-length line))))
MatzLisp (Ruby):
IO.foreach('words').reduce(0){|sum,line| sum + line.strip.size}
==>595785
--
In Sweden, the leadership seems to show Europe's most extensive cultural
self-denial, or rather -- a deeply felt self-loathing, which many feel is the
perfect recipe for driving a peaceful nation to destruction.
fjordman.blogspot.ca/2005/05/is-swedish-democracy-collapsing.html