Skip to content

Instantly share code, notes, and snippets.

@g000001
Created October 20, 2008 08:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save g000001/18040 to your computer and use it in GitHub Desktop.
Save g000001/18040 to your computer and use it in GitHub Desktop.
;; 未完成
(define mapleave #f)
(define mapret #f)
(define mapstop #f)
(define (mapf finalf loopf . lists)
(let/cc leave
(set! mapleave leave)
(let ((acc () )
(stop? #t)
(res #f)
(it #f))
(set! it
(let/cc stop
(set! mapstop stop)
(let loop ((lists lists))
(if (any null? lists)
(set! stopfl #f)
(begin
(set! acc (cons (let/cc ret
(set! mapret ret)
(map (compose loopf car)
lists))
acc))
(loop (map cdr lists)))))))
(apply finalf (apply append (reverse (if stop?
(cons (list it) acc)
acc)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment