Skip to content

Instantly share code, notes, and snippets.

;; pure fn implem
(defn set-empty []
nil)
(defn set-contains? [{:keys [inner element]:as s} e]
(and s
@denlab
denlab / s.clj
Last active December 14, 2015 09:19
(clojure.string/split (slurp "my.file") #"\e")
(-> "my.file"
slurp
(clojure.string/split #"\e"))
(-> "my.file"
slurp
(clojure.string/split #"\e")
(ns euler-denlab.doing.p26-reciprocal-cycles
(:refer-clojure :exclude [inc reify ==])
(:use
[clojure.core.logic]
[clojure
[pprint :only [pprint pp print-table ]]
[repl :only [doc find-doc apropos ]]
[inspector :only [inspect-tree inspect inspect-table ]]]
[clojure.java.javadoc :only [javadoc ]]
[clojure.tools.trace :only [trace deftrace trace-forms trace-ns
cs2013.enonce3> (defn f [x] (* 2 x))
#'cs2013.enonce3/f
cs2013.enonce3> (defn g [x] (* 3 x))
#'cs2013.enonce3/g
cs2013.enonce3> (defn h [x] (* 4 x))
#'cs2013.enonce3/h
cs2013.enonce3> (defn i [x] (* 5 x))
#'cs2013.enonce3/i
cs2013.enonce3> (defn j [x] (* 6 x))
#'cs2013.enonce3/j
@denlab
denlab / gist:4469890
Created January 6, 2013 20:16
Devoxx 2011 - Code Story - Selection - 1st exercice: FooBarQix
(ns cljsta.misc.code-story-2012
(:use [midje.sweet]
[clojure.pprint :only [pprint print-table]]
[clojure.string :only [split join]]
[clojure.repl :only [doc]]
[table.core :only [table]])
(:require [clojure
[string :as str]
[set :as set]
[walk :as w]
;;Hack to get a black background in terminal mode in emacs-live
;; most of it shamelessly stolen from: http://stackoverflow.com/questions/5795451/how-to-detect-that-emacs-is-in-terminal-mode
(add-hook 'after-make-frame-functions
(lambda ()
(if (not window-system)
(set-face-background 'default "color-16"))))
(defun quirk-black-background ()
(interactive)
(set-face-background 'default "color-16"))
(ns foo.bar
(:use [midje.sweet]
[clojure
[pprint :only [pprint pp]]
[repl :only [doc find-doc apropos]]]
[clojure.java.javadoc :only [javadoc]]
[clojure.tools.trace :only [trace deftrace trace-forms trace-ns untrace-ns trace-vars]])
(:require [clojure
[set :as set]
[string :as str]
(defn create-attr-map
[attr-code attr-type src-code]
{"attribute"
{"name" attr-code
"attributeType" {"href" (format "/foundation/v2/attributeTypes/%s" attr-type)}
"source" {"href" (format "/foundation/v2/%s" src-code)}}})
(comment
(def att0 (create-attr-map "new-attr-code" "String" "System"))
(json-encode att0))
;; quel sont les parents de Bart?
;;
(run* [q]
(parent 'Bart q))
;; => (Homer Marge)
(set (run* [q]
(fresh [c]
(parent c q) )))