bookmate game
Daniel Higginbotham

Clojure for the Brave and True

Notify me when the book’s added
To read this book, upload an EPUB or FB2 file to Bookmate. How do I upload a book?
  • Nikita Naumenkohas quoted5 years ago
    It is better to have 100 functions operate on one data structure than 10 functions on 10 data structures.
    —Alan Perlis
  • Стас Поздняковhas quoted5 years ago
    let creates a new scope in which the name x is bound to the value 1. I think of scope as
  • Стас Поздняковhas quoted5 years ago
    You can also pass a rest parameter with %&:

    (#(identity %&) 1 "blarg" :yip); => (1 "blarg" :yip)
  • Стас Поздняковhas quoted5 years ago
    strange-looking style of writing anonymous functions is made possible by a feature called reader macros.
  • Стас Поздняковhas quoted5 years ago
    Clojure also offers another, more compact way to create anonymous functions. Here’s what an anonymous function looks like:

    #(* % 3)
    Whoa, that looks weird. Go ahead and apply that weird-looking function:

    (#(* % 3) 8); => 24
  • Стас Поздняковhas quoted5 years ago
    Clojure also offers another, more compact way to create anonymous functions. Here’s what an anonymous function looks like:

    #(* % 3)
  • Стас Поздняковhas quoted5 years ago
    fact, you’ll use anonymous functions all the time. How mysterious! You create anonymous functions in two ways. The first is to use the fn form:

    (fn [param-list] function body)
  • Стас Поздняковhas quoted5 years ago
    Clojure automatically returns the last form evaluated.
  • Стас Поздняковhas quoted5 years ago
    Clojure on how to associate names with values in a list, map, set, or vector
  • Стас Поздняковhas quoted5 years ago
    (defn announce-treasure-location [{:keys [lat lng]}] (println (str "Treasure lat: " lat)) (println (str "Treasure lng: " lng)))
fb2epub
Drag & drop your files (not more than 5 at once)