Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (count lst)
- (cond ((null? lst) 0)
- (else (+ 1 (count (cdr lst))))))
- (define (second my_list)
- (cond ((< ( count my_list) 2) "less than 2")
- (else ( cdr (cdr my_list))
- )
- )
- )
- (define r '() )
- (define (first my_list)
- (cond ((< ( count my_list) 2) '("less than 2" "fff") )
- ((> ( count my_list) 1) (set! r (cons (car (cdr my_list)) r))
- (set! r (cons (car my_list) r))
- r )
- (else '(car my_list)
- )
- )
- )
- (count '(4 5 4 2 5 3 5))
- (define sec (second '(2 3 5 4)))
- (define fir (first '(2 3 5 4)))
- (define re '() )
- (set! re (cons sec '()))
- (set! re (cons fir re))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement