fork(4) download
  1. (def atom?
  2. (fn [a]
  3. (not (seq? a))))
  4.  
  5. (def null?
  6. (fn [a]
  7. (or
  8. (nil? a)
  9. (= () a))))
  10.  
  11. (def lat?
  12. (fn [l]
  13. (cond
  14. (null? l) true
  15. (and (seq? l)
  16. (atom? (first l)))
  17. (lat? (rest l))
  18. true false)))
  19.  
  20. (println (lat? '(a b c)))
  21. (println (lat? 'a))
  22.  
  23.  
  24. (def member?
  25. (fn [a lat]
  26. (cond
  27. (null? lat) false
  28. true (or
  29. (= (first lat) a)
  30. (member? a (rest lat)))) ))
  31.  
  32. (println (member? 'a '(a b c)))
  33. (println (member? 'd '(a b c)))
  34.  
  35.  
  36.  
  37.  
Success #stdin #stdout 1.18s 220224KB
stdin
Standard input is empty
stdout
true
false
true
false