Name: Anonymous 2018-05-11 19:13
I never actually wrote one so here's the result without any external inspiration.
(I don't know any language very well because I'm not a programmer so I used Scheme as lingua franca)
I had to use an anonymous procedure because I can't use "or" which is a special form (?) and it's bloating the whole thing which annoys me.
Variant with my own procedure :
I'm using SRFI-41 for the streams
(I don't know any language very well because I'm not a programmer so I used Scheme as lingua franca)
(define fizzbuzz (stream-map (lambda (x y) (or x y)) (stream-constant #f #f "fizz" #f "buzz" "fizz" #f #f "fizz" "buzz" #f "fizz" #f #f "fizzbuzz" ) nats))
I had to use an anonymous procedure because I can't use "or" which is a special form (?) and it's bloating the whole thing which annoys me.
Variant with my own procedure :
(define (p x y z)
(if (and x y) (string-append x y)
(or (or x y) z)))
(define fizzbuzz2 (stream-map p (stream-constant #f #f "fizz") (stream-constant #f #f #f #f "buzz") nats))
I'm using SRFI-41 for the streams
(require srfi/41)
(define nats (stream-from 1))