4 ms·
and streams are.. (define-syntax scons (syntax-rules () ((_ x expr) (cons x (delay expr))))) (define scar car) (define (scdr xs) (force (c
by dschiptsov 12y ago
and streams are..
(define-syntax scons
(syntax-rules ()
((_ x expr) (cons x (delay expr)))))
(define scar car)
(define (scdr xs) (force (cdr xs)))
(define snull? null?)
and filter for streams is, OMG..
(define (sfilter f xs)
(cond ((snull? xs) '())
((f (scar xs)) (scons (scar xs)
(sfilter f (scdr xs))))
(else (sfilter f (scdr xs)))))
and of course..
(define (smap f xs)
(if (snull? xs)
'()
(scons (f (scar xs))
(smap f (scdr xs)))))
I am doing reactive programming? Am I?
- reikonomusha 12y agoThat has no notion of time or distance between "events".
- dschiptsov 12y agoSo they have "ticks" in a stream? OK, one more cond clause.)
- zerr 12y agoTo follow that line, all of the users of electronic spreadsheets were/are doing RP :) (not completely a joke actually)
- wyager 12y ago> all of the users of electronic spreadsheets were/are doing RP I think you are absolutely right. One of the popular examples of where RP is useful is in implementing a spreadsheet program.