POV-Ray : Newsgroups : povray.off-topic : how to scheme a cat up? : Re: how to scheme a cat up? Server Time
5 Sep 2024 09:25:41 EDT (-0400)
  Re: how to scheme a cat up?  
From: Daniel Bastos
Date: 18 Aug 2009 14:42:44
Message: <4a8af624$1@news.povray.org>
In article <4a8acf7f$1@news.povray.org>,
Daniel Bastos wrote:

>> In Haskell, we just say
>>
>>    main = interact id
>>
>> ;-)
>
> That's right! I should copy that! ;)

#!/usr/bin/env mzscheme
(module cat scheme/base

(define (interact f)
  (let ([ln (read-line)])
     (if (not (eq? ln eof))
         (and (display (f ln)) (newline) (interact f))
         (exit))))

(define (id x) x)

(define (cat)
  (interact id))

;main
(cat)

)

%printf 'my\nbeloved\ncat\n' | ./cat
my
beloved
cat
%


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.