This file contains hidden or 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 repl.freestyle) | |
| (set! *print-length* 50) | |
| (let [r (range 100 -101 -1)] | |
| [(first r) (last r)]) | |
| (let [r (range 0 1002 2)] | |
| [(first r) (last r)]) |
This file contains hidden or 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
| ;; ---------- Homoiconicity | |
| (+ 1 2 3) | |
| '(+ 1 2 3) | |
| '(+ 1 x 3) | |
| (map type '(+ 1 x :foo)) | |
| (list + 1 2 3) |
This file contains hidden or 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
| ;; Emacs/Leiningen Integration: Cider | |
| ;; (https://github.com/clojure-emacs/cider) | |
| ;; Mein Emacs Setup: | |
| ;; https://github.com/bendisposto/emacs.d | |
| ;; Andere Editoren sind auch ganz toll! | |
| (use 'clojure.repl) |
This file contains hidden or 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
| (defn normalize-input [s] (clojure.string/join " " (remove empty? (clojure.string/split s #"\s")))) |
This file contains hidden or 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 muster.core | |
| (:use clojure.algo.monads)) | |
| (comment | |
| ;; Aufgabe 1 | |
| ;; a) | |
| (defn punkte [x k] | |
| (let [p (* 2 (- x (/ k 2)))] |
This file contains hidden or 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 repl.datastructures | |
| (:use clojure.repl)) | |
| (defmacro t [& body] | |
| `(let [sw-out# (java.io.StringWriter.)] | |
| (binding [*out* sw-out#] | |
| (let [result# (time (do ~@body))] | |
| {:out (.toString sw-out#) | |
| :result result#})))) |
This file contains hidden or 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 muster.core) | |
| (comment | |
| (defprotocol PKonto | |
| (einzahlen [k b]) | |
| (abheben? [k b]) | |
| (abheben [k b]) | |
| (sperren [k]) | |
| (entsperren [k])) | |
| (defrecord Girokonto [stand limit gesperrt pins] |
This file contains hidden or 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 wdhg.dynamic) | |
| ;; Lexical scoping | |
| (def x 2) | |
| (defn foo [n] (* x n)) | |
| (def a (foo 3)) |
This file contains hidden or 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 vl.core | |
| (:require [clojure.set :refer [union]]) | |
| (:use clojure.algo.monads clojure.walk clojure.repl)) | |
| (comment | |
| ;; Wiederholung | |
| ;; Monaden dienen (unter Anderem) |
This file contains hidden or 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 repl.core | |
| (:require [clojure.tools.reader.edn :as edn]) | |
| (:use clojure.algo.monads clojure.walk)) | |
| (comment | |
| ;; clojure.tools.reader.edn ist nicht in Clojure enthalten | |
| ;; [org.clojure/tools.reader "0.8.3"] | |
| (def serialized (prn-str '(1 2 3))) | |
| (def data (edn/read-string serialized)) |