Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (make-source s . end)
- (if (string? s)
- (if (null? end)
- (let ((static (reverse (cons #f (reverse (string->list s))))))
- (lambda (x)
- (if (= (length static) 1)
- (car static)
- (if (equal? x 'peek)
- (car static)
- (if (equal? x 'next)
- (begin
- (let ((cur (car static)))
- (begin
- (set! static (cdr static))
- cur)))
- static)))))
- (let ((static (reverse (cons (car end) (reverse (string->list s))))))
- (lambda (x)
- (if (= (length static) 1)
- (car static)
- (if (equal? x 'peek)
- (car static)
- (if (equal? x 'next)
- (begin
- (let ((cur (car static)))
- (begin
- (set! static (cdr static))
- cur)))
- static))))))
- (if (vector? s)
- (if (null? end)
- (let ((static (reverse (cons #f (reverse (vector->list s))))))
- (lambda (x)
- (if (= (length static) 1)
- (car static)
- (if (equal? x 'peek)
- (car static)
- (if (equal? x 'next)
- (begin
- (let ((cur (car static)))
- (begin
- (set! static (cdr static))
- cur)))
- static)))))
- (let ((static (reverse (cons (car end) (reverse (vector->list s))))))
- (lambda (x)
- (if (= (length static) 1)
- (car static)
- (if (equal? x 'peek)
- (car static)
- (if (equal? x 'next)
- (begin
- (let ((cur (car static)))
- (begin
- (set! static (cdr static))
- cur)))
- static))))))
- (if (null? end)
- (let ((static (reverse (cons #f (reverse s)))))
- (lambda (x)
- (if (= (length static) 1)
- (car static)
- (if (equal? x 'peek)
- (car static)
- (if (equal? x 'next)
- (begin
- (let ((cur (car static)))
- (begin
- (set! static (cdr static))
- cur)))
- static)))))
- (let ((static (reverse (cons (car end) (reverse s)))))
- (lambda (x)
- (if (= (length static) 1)
- (car static)
- (if (equal? x 'peek)
- (car static)
- (if (equal? x 'next)
- (begin
- (let ((cur (car static)))
- (begin
- (set! static (cdr static))
- cur)))
- static)))))))))
- (define (peek x)
- (x 'peek))
- (define (next x)
- (x 'next))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement