Skip to content

Instantly share code, notes, and snippets.

Avatar

Avital Oliver avital

View GitHub Profile
View sample-clojure-internal-trace.org

Load this file into Emacs. Use tab to collapse nodes of the trace log.

Function call: (link-elements-in-partition partition el1 el2)

#{#{1 2} #{3 4 5}}

partition

#{#{1 2} #{3 4 5}}

el1

2

el2

4

View gist:257019
* Function call: (link-elements-in-partition partition el1 el2)
#{#{1 2} #{3 4 5}}
** partition
#{#{1 2} #{3 4 5}}
** el1
2
** el2
4
** (let [c1 (containing-class partition el1) c2 (containing-class partition el2)] (cond (and (not c1) (not c2)) (conj partition #{el2 el1}) (and c1 (not c2)) (add-to-class partition c1 el2) (and c2 (not c1)) (add-to-class partition c2 el1) (and (and c1 c2) (not= c2 c2)) (conj (disj partition c1 c2) (union c1 c2)) :else partition))
#{#{1 2} #{3 4 5}}
View robot.clj
; Explain to Ayal:
; 1. interleaved log
; 1.1. (try)
; 2. FP IS SO GOOD WHAT
; 3. never use #() unless its SUPER SHORT REALLY
; 4. Hardly use closures its too hard to follow them use thigns like for
; 5. WE MUST HAVE A "Lisp Editor" (which will also be a JSON editor in effect, etc). THESE PARENTHESIS MATCHING AND
; NEWLINE CALCULATINON ARE TOO HARD
View robot.clj
(ns we
(:require clojure.contrib.json.read)
(:require clojure.contrib.json.write)
(:require clojure.set)
(:use clojure.contrib.json.read)
(:use clojure.contrib.json.write)
(:use clojure.set)
(:use compojure))
(def db (atom {}))
View we-haiku
{
_view: 'collection',
elements: [
{
_view: 'title',
inner: {
_view: 'text',
text: 'Haiku'
}
},
View SSCollectionJSON.js
read
----
{
"action": "read",
"table": "user/shift/trail/comment",
"constraints": {
"user_id": 67 || [option1, option2, option3] || {range: [range-begin, range-end]}
// if range-begin is null, this means all less than range-add.
// if range-add is null, this means all greater than range-begin.
// "NOW()" works for dates.
View SSCollectionJSON.js
read
----
{
"action": "read",
"table": "user/shift/trail/comment",
"constraints": {
"user_id": 67
},
"properties": "*" || ["username", "summary", "modified"],
"orderby": ["<" || ">", "modified"],