Skip to content

Instantly share code, notes, and snippets.

@manudatta
Last active December 11, 2015 18:48
Show Gist options
  • Save manudatta/4644088 to your computer and use it in GitHub Desktop.
Save manudatta/4644088 to your computer and use it in GitHub Desktop.
;pg 102. Ex 3.22.c
(defn myfun [x y] (list (list x) y))
(myfun 'alpha 'beta)
;.d
(defn firstp? [ e collection] (= e (first collection)))--clojure uses ? instead of p for predicate (lisp convention)
(firstp? 'foo '(foo bar baz))
(firstp? 'boing '(foo bar baz)) -- clojure has false instead of nil
;.e
(defn mid-add1 [sentence] (list (first sentence) (+ 1 (second sentence)) (last sentence)))
(mid-add1 '(take 2 cookies))
;.f
(defn f-to-c [F] (/ (* 100 (- F 32)) 180.0))--180.0 otherwise you can get ratio instead of number
(f-to-c 132)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment