Skip to content

Instantly share code, notes, and snippets.

import React, { Component } from 'react';
import { Grid, ScrollSync, AutoSizer } from 'react-virtualized';
import 'react-virtualized/styles.css';
class App extends Component {
render() {
return (
<div className="App">
<div className='Table' style={{width: 600, height: 400}}>
<AutoSizer>
(walk-term [1 {1 1} [1 1 1] #{1 2 3} (l/llist 1 1 1)]
(fn [expr]
(if (number? expr)
(inc expr)
expr)))
;; => [3 {3 3} [3 3 3] #{1 2 3} (2 1 . 1)]
user=> (use 'clojure.core.logic.unifier)
user=> (prep '([?x]))
([<lvar:?x>]) ;; ok. ?x turned into an lvar
user=> (prep '([?x] . ?xs))
([?x] . <lvar:?xs>) ;; fail. ?x is not an lvar
;; Given a class name, which methods have changed the most?
(->> (q '[:find ?name (count ?sha)
:in $ ?class-name
:where
[?codeq :java/class-name ?class-name]
[?mcodeq :codeq/parent ?codeq]
[?mcodeq :java/method ?codename]
[?codename :code/name ?name]
[?mcodeq :codeq/code ?code]
[?code :code/sha ?sha]]
@jonase
jonase / codeq-examples.clj
Created November 20, 2012 10:20 — forked from richhickey/codeq-examples.clj
codeq examples used in conj talk
(require '[datomic.api :as d])
(require '[clojure.pprint :refer [pprint]])
(def uri "datomic:free://localhost:4334/git")
(def conn (d/connect uri))
(def db (d/db conn))
;; committers
(d/q '[:find ?email
:where
[_ :commit/committer ?u]
(defmulti foo identity)
(defmethod foo 1 [n]
(recur (dec n)))
(defmethod foo 0 [n]
:ok)
(foo 1) ;; runs forever
(use '[datomic.api :only [db q] :as d])
(def schema
[{:db/doc "A persons name"
:db/id #db/id[:db.part/db]
:db/ident :name
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db}
@jonase
jonase / gist:3175654
Created July 25, 2012 11:33
query performance predictability
(use '[datomic.api :only [db q] :as d])
(def schema
[{:db/id #db/id[:db.part/db]
:db/ident :num
:db/valueType :db.type/long
:db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db}
{:db/id #db/id[:db.part/db]
(use '[datomic.api :only [db q] :as d])
(def schema
[{:db/doc "A persons name"
:db/id #db/id[:db.part/db]
:db/ident :name
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db}
(use '[datomic.api :only [db q] :as d])
(def schema
[{:db/doc "A persons name"
:db/id #db/id[:db.part/db]
:db/ident :name
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db}