Skip to content

Instantly share code, notes, and snippets.

@tormaroe
Created December 11, 2010 11:49
Show Gist options
  • Save tormaroe/737332 to your computer and use it in GitHub Desktop.
Save tormaroe/737332 to your computer and use it in GitHub Desktop.
;; a program saying hello to the world
(use '[clojure.string :only (join)])
(def a (partial subs (slurp *file*)))
(def b #(a % (+ % 5)))
(print (join ", " [(b 20) (b 33)]))
;; a program saying hello to the world
(use '[clojure.string :only (join)])
(let [a (partial subs (slurp *file*))]
(print (join ", " (map #(a % (+ % 5)) [20 33]))))
(->>
(map #(nth (str %) %2)
'(hash dec nil? apply symbol?
" , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , "
" , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , "
remove-watch comporator print-ctor bit-shift-left chunk-append)
(range))
(apply str)
print)
;==-----\\
; \\\
; \\\\
(ns ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
, hello ,,,
, (:use clojure.repl) ,,,
, (:require clojure.string)) ,,,
, ((defn ,,,
, Hello-World! [ by Tormaroe ] ,,,
, (println ,,,
, (clojure.string/replace ,,,
, (first ,,,
, (dir-fn 'hello)) ,,,
#"-" ", "))) 00 00) ,,,,,,,,,,,,,,,,,,,,
; ////
; ///
;==-----//
@tormaroe
Copy link
Author

(hello and hello2) Demonstrates loading a single function from a library, partial function application, file reading as well as the special file variable, the dispatch macro used to define an anonymous function literal, and a couple of string manipulation functions.

hello3 is totally different - it demonstrates the use of map on two sequences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment