Created
December 11, 2010 11:49
-
-
Save tormaroe/737332 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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)])) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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])))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(->> | |
(map #(nth (str %) %2) | |
'(hash dec nil? apply symbol? | |
" , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , " | |
" , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , " | |
remove-watch comporator print-ctor bit-shift-left chunk-append) | |
(range)) | |
(apply str) | |
print) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;==-----\\ | |
; \\\ | |
; \\\\ | |
(ns ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, | |
, hello ,,, | |
, (:use clojure.repl) ,,, | |
, (:require clojure.string)) ,,, | |
, ((defn ,,, | |
, Hello-World! [ by Tormaroe ] ,,, | |
, (println ,,, | |
, (clojure.string/replace ,,, | |
, (first ,,, | |
, (dir-fn 'hello)) ,,, | |
#"-" ", "))) 00 00) ,,,,,,,,,,,,,,,,,,,, | |
; //// | |
; /// | |
;==-----// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(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.