Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (liste-teilen eingabe) (liste-teilen-iter eingabe 0 '() '()))
- (define (liste-teilen-iter eingabe counter liste1 liste2)
- (cond ((null? eingabe) (list '() '()))
- ((null? (cdr eingabe)) (list (if (odd? counter) liste1 (append liste1 (list (car eingabe))))(if (odd? counter) (append liste2 (list(car eingabe) ) )
- liste2)))
- (else (liste-teilen-iter (cdr eingabe)(+ counter 1)
- (if (even? counter) (append liste1 (list(car eingabe)))
- liste1)
- (if (odd? counter) (append liste2 (list(car eingabe) ) )
- liste2 )))))
- #(liste-teilen '())
- #(liste-teilen'(1 2 3 4 5 6 7 8 9))
- (liste-teilen '(1 2 3 4 5 6 7 8 9 10))
Add Comment
Please, Sign In to add comment