define
is def
in clojure, lambda
is fn
, function arguments are written as vectors []
, not lists ()
, null?
is empty
, car
is first
, cdr
is rest
and the default case for cond
is specified with :else
, not #t
.
So for your first example we get:
(def length
(fn [ll]
(cond
(empty? ll) 0
:else (+ 1 (length (rest ll))))))
This can be written a little more succinctly using defn
instead of def
and fn
, but the same is true for the scheme version, so I chose the way that is the closest to the original.
The other examples can be translated the same way.