no title added by anonymous on Wed Oct 25 22:21:40 2017
(define (find-particles arr particle-type)
; an iterating search that accumulates its results by recursion (?)
(define (find f #!optional (iter-state '(0 0)) (accumulator '())) ; f: state -> (state result) is the searcher function
(match-let ([(nextstate result) (f iter-state)])
(if (not (null? result))
(find f next-state (cons result acc))
(accumulator)) ))
(define (find-next arr iter-state particle-type)
(define w (dim-size arr 0))
(define h (dim-size arr 1))
(match-let ([(i . j) iter-state])
(do-for i (i w) ; use recursive style loop because this lib doesnt support a break construct
(do-for j (j h)
)) ))
(define searchf
(lambda(iter-state)
(find-next arr iter-state particle-type)))
(find searchf)
)