Guest User

Untitled

a guest
May 20th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 0.92 KB | None | 0 0
  1. (define (liste-teilen eingabe) (liste-teilen-iter eingabe 0 '() '()))
  2.  
  3. (define (liste-teilen-iter eingabe counter liste1 liste2)
  4.   (cond ((null? eingabe) (list '() '()))
  5.         ((null? (cdr eingabe)) (list (if (odd? counter) liste1 (append liste1 (list (car eingabe))))(if (odd? counter) (append  liste2 (list(car eingabe) ) )
  6.                                                                              liste2)))
  7.                                      
  8.         (else (liste-teilen-iter (cdr eingabe)(+ counter 1)
  9.                                  (if (even? counter) (append  liste1 (list(car eingabe)))
  10.                                                      liste1)
  11.                                  (if (odd? counter) (append  liste2 (list(car eingabe) ) )
  12.                                      liste2 )))))
  13.                                
  14. #(liste-teilen '())
  15. #(liste-teilen'(1 2 3 4 5 6 7 8 9))
  16. (liste-teilen '(1 2 3 4 5 6 7 8 9 10))
Add Comment
Please, Sign In to add comment