Skip to content

Instantly share code, notes, and snippets.

//////////////////////////////////////////////////////////////////////
// Original version in Processing:
//
// http://www.openprocessing.org/visuals/?visualID=323
using system , math , ffi , GL , GLU , GLUT , glamour , vector_math ;
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
using math ;
//////////////////////////////////////////////////////////////////////
sump x = case x of (a+b) = 1 ; a = 0 ; end ;
//////////////////////////////////////////////////////////////////////
using math ;
//////////////////////////////////////////////////////////////////////
sump (x+y) = 1 ; sump x = 0 ;
//////////////////////////////////////////////////////////////////////
base (x^y) = x ;
(import (rnrs)
(gl)
(glut)
(agave glu)
(agave glamour window)
(agave glamour misc))
(initialize-glut)

(dharmalab misc collection list)

(list-fold-left  <list> <value> <procedure>)
(list-fold-right <list> <value> <procedure>)

(list-reverse <list>)

(list-for-each            <list> <procedure>)
(list-for-each-with-index <list> <procedure>)
(library (abc)
(export abc)
(import (rnrs))
(define abc 10))
(import (rnrs)
(only (srfi :1) iota)
(dharmalab misc time entry))
(define (list-enumerate ls val proc)
(let loop ((ls ls) (return? #f) (val val))
(if (or (null? ls)
return?)
val
(call-with-values (lambda () (proc val (car ls)))
~ $ scheme --program ~/scratch/_fib-binrec-a.sps
(time (fib 34))
no collections
303 ms elapsed cpu time
307 ms elapsed real time
0 bytes allocated
~ $ scheme --program ~/scratch/_fib-binrec-a.sps
(time (fib 34))
no collections

(rnrs lists)

(find proc list)

(for-all proc list1 list2 ... listn)
(exists  proc list1 list2 ... listn)

(filter    proc list)
(partition proc list)
(library (binrec)
(export binrec)
(import (rnrs))
(define (binrec f g h i j)
(define (fun x)
(if (f x)