- remove
-snapshot
from version number in bothpackage.json
andproject.clj
- probably run the tests one more time to make sure all is well
- add and commit changes with git
- create a git tag for to-be-released version
- push the commits and tag out to github
- run
npm publish .
(may need to re/register with npmjs.org) - deploy to clojars (maybe?)
- assuming all goes well, bump the version number and append
-snapshot
in bothpackage.json
andproject.clj
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
;; list comprehensions are often used as a poor man's Prolog | |
;; consider the following, it has only one solution | |
;; [1 1 1 1 1 1 1 1 1 1] yet we actually consider 10^10 possibilities | |
(for [a (range 1 11) | |
b (range 1 11) | |
c (range 1 11) | |
d (range 1 11) | |
e (range 1 11) | |
f (range 1 11) |
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
(unifier/unify | |
{:as '{?x (?y ?z)} | |
:constraints {'?z (fnc [n] (number? n))} | |
'(?x ?a) '(["foo" 9] [1 2 3])) | |
;; previously you couldn't name '(?y ?z) | |
(unifier/unify | |
{:constraints {'?z (fnc [n] (number? n)}} | |
'((?y ?z) ?a) '(["foo" 9] [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
(ns net.cgrand.decay | |
"Exponentially decaying lists. See http://awelonblue.wordpress.com/2013/01/24/exponential-decay-of-history-improved/ | |
for background and http://clj-me.cgrand.net/2013/02/12/decaying-lists-log-scale-for-lists/ for documentation") | |
;; PRNG, formulas straight from java.util.Random javadoc | |
(defn- seed ^long [^long n] | |
(bit-and (unchecked-multiply n 0x5DEECE66D) | |
(unchecked-dec (bit-shift-left 1 48)))) | |
(defn- next-seed ^long [^long seed] |
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 logic-play.puzzle | |
(:refer-clojure :exclude [==]) | |
(:use [clojure.core.logic]) | |
(:require [clojure.tools.macro :as mu] | |
[clojure.set :as set] | |
[clojure.core.logic.fd :as fd])) | |
;; ----- | |
;; CLP(Set) Boilerplate | |
(defn index [xs] (->> xs (map-indexed (fn [i x] [x (inc i)])) (into {}))) |
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 puzzle | |
(:refer-clojure :exclude [==]) | |
(:use [clojure.core.logic]) | |
(:require [clojure.core.logic.set :as set])) | |
(defn existso [q ps] (fresh [x] (featurec x ps) (membero x q))) | |
(defn ruleo [q p v tp tv] (existso q {p v tp tv})) | |
(defn neg-ruleo [q p v tp tv] (fresh [x] (!= x tv)) (existso q {p v tp x})) | |
(defn earliero [q p v op ov] |
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 hacklheber.core) | |
(defn flip | |
"A function which returns true or false randomly. Can optionally be | |
supplied a number for a bias." | |
([] (> 0.5 (rand))) | |
([p] (> p (rand)))) | |
(defn- memo-bangs | |
"If a variable is bound with a bang, then it will be memoized." |
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 pettomato.findall | |
(:refer-clojure :exclude [==]) | |
(:use | |
[clojure.core.logic.protocols]) | |
(:require | |
[clojure.core.logic :refer :all])) | |
(defn findall | |
"A goal that unifies l with a lazy sequence containing all possible | |
instantiations of v that could be generated by applying the goal g |
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 sublisto | |
"The sequence x appears in y." | |
[x y] | |
(fresh [a b c] | |
(appendo a x b) | |
(appendo b c y))) | |
(->> (run* [q] | |
(sublisto [:b :r :r :c] q) | |
(sublisto [:r :c :c :b] q) |
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
// Possibly wacky and useless protocol experiment | |
var mapObj = function(obj, fn) { | |
var ret = {} | |
for (var k in obj) { | |
var temp = fn(k, obj[k]) | |
ret[temp[0]] = temp[1] | |
} | |
return ret | |
} |