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 comp | |
"Takes a set of functions and returns a fn that is the composition | |
of those fns. The returned fn takes a variable number of args, | |
applies the rightmost of fns to the args, the next | |
fn (right-to-left) to the result, etc." | |
([] identity) | |
([fun] fun) | |
([& fs] | |
(let [fs (reverse fs)] | |
(fn [& args] |
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
;Grammatik in CNF als Clojure-S-Expression | |
;nur die Produktionen, S ist immer Startsymbol | |
;Vektor von Produktionen der Form [Nichtterminalsymbol Ableitung] | |
;Ableitungen sind * einzelne Zeichen (terminalsymbol) | |
; * Vektoren mit 2 Symbolen (nichtterminale) | |
[[S [A A]] | |
[S [A C]] | |
[A \a] | |
[B \b] | |
[C [B 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
;utilities | |
(defn rec-replace [test fun struct] | |
(let [struct (if (test struct) (fun struct) struct)] | |
(if (seq? struct) (map (partial rec-replace test fun) struct) struct))) | |
(defn value [name map] | |
(let [in-map (map name)] (if in-map (recur in-map map) name))) | |
(def *special-rules* {:number (fn [[num] map] | |
(when (number? (value num map)) [map]))}) |
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 circulate [dir coll] | |
(let [[a b] (split-at (or ({:left 1} dir) (dec (count coll))) coll)] | |
(concat b a))) |
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
(def *rels* | |
'{same [((X X))] | |
dings [(([:bla :bla]))] | |
append [( ([] X X) ) ( ([:cons X Y] Z [:cons X A]) (append Y Z A))] | |
mann [((:klaus)) ((:karl)) ((X) (vater X Y))] | |
vater[((:hans :karl))] | |
number[((:null)) (([:succ N]) (anumber N))] | |
anumber[((N) (number N))] | |
weg [((:wildeck :eisenach)) ((:eisenach :leipzig)) ((:eisenach :erfurt)) | |
((:erfurt :nordhausen)) ((:halle :leipzig)) ((:leipzig :berlin))] |
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
(defmatch s | |
([[+ M N]] ((:number M) (:number N)) {m 'M n 'N} (+ m n)) | |
([[+ 0 N]] () {n 'N} n) | |
([[+ N 0]] () {n 'N} n) | |
([[+ A [+ B C]]] () {a'A,b'B,c'C} ['+ ['+ a b] c]) | |
([[* M N]] ((:number M) (:number N)) {m 'M n 'N} (* m n)) | |
([[* 0 N]] () {n 'N} 0) | |
([[* N 0]] () {n 'N} 0) | |
([[* A [* B C]]] () {a'A,b'B,c'C} ['* ['* a b] c]) | |
([A] () {a 'A} a)) |
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 de.uni-potsdam.hpi.pentago) | |
(def empty-board | |
[[:_____ :_____ :_____ :_____ :_____ :_____] | |
[:_____ :_____ :_____ :_____ :_____ :_____] | |
[:_____ :_____ :_____ :_____ :_____ :_____] | |
[:_____ :_____ :_____ :_____ :_____ :_____] | |
[:_____ :_____ :_____ :_____ :_____ :_____] | |
[:_____ :_____ :_____ :_____ :_____ :_____]]) |
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
(define *gl* (gl:make-opengl)) | |
(gl:open-opengl *gl* '(600 600 640 480)) | |
(define init | |
(lambda () | |
(gl:clear-color *gl* 0.0 0.0 0.0 0.0) | |
(gl:enable *gl* *gl:depth-test*))) |
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
http://yuml.me/diagram/class/[Questionnaire||asEval;asAnswer;asEditor;canEval: aUser;canAnswer:aUser;canSubmit:aUser;canEdit:aUser], [Test|deadline|canAnswer:aUser], [Poll||canEval: aUser;asEval], [Exam|answertime|canSubmit:aUser], [Questionnaire]1->n[Question||statistics: aQuestionnaire], [Questionnaire]^[Test], [Test]^[Exam], [Questionnaire]^[Poll]. |
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
CREATE VIEW actormw AS SELECT DISTINCT * FROM ((SELECT NAME, ‚w’ AS SEX, MOVIE_ID, ROLE FROM „actress“) UNION ALL (SELECT NAME, ‚m’ AS SEX, MOVIE_ID, ROLE FROM actor)); |