Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;***KOLEJKA************************************************************
- ;;Implementacja Kolejki
- (define-unit bag-fifo@
- (import)
- (export bag^)
- (define (bag? x)
- (and (list? x)
- (eq? (length x) 2)
- (eq? (car x) 'bag-fifo)))
- (define (bag-empty? x)
- (eq? (bag-fifo x) '()))
- (define (bag-fifo x) (cadr x))
- (define (bag-cons l) (list 'bag-fifo l))
- (define empty-bag (bag-cons '()))
- (define (bag-peek x) (car (reverse (bag-fifo x))))
- (define (bag-remove x)
- (bag-cons (reverse (cdr (reverse (bag-fifo x))))))
- (define (bag-insert x v)
- (bag-cons (cons v (bag-fifo x)))))
- ;;Otwarcie implamentacji Kolejki
- (define-values/invoke-unit/infer bag-fifo@)
- (define my-fifo empty-bag)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement