Guest User

Untitled

a guest
Aug 17th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. Detecting the caller of a function in Scheme or Racket
  2. (define atom? (lambda (x) (and (not (pair? x)) (not (empty? x)))))
  3.  
  4. (define lat? (lambda (l)
  5. (define latt?
  6. (lambda (l)
  7. (cond
  8. ((null? l) #t)
  9. ((atom? (car l)) (latt? (cdr l)))
  10. (else #f))))
  11. (if (null? l) #f (latt? l))))
  12.  
  13. (define lat?
  14. (lambda (l)
  15. (cond
  16. ((and (null? l) (called-by "lat?")) #t)
  17. ((atom? (car l)) (lat? (cdr l)))
  18. (else #f))))
Add Comment
Please, Sign In to add comment