-
Fetch the latest:
wget http://www.pauldee.org/uberclj/uberclj-1.4.0-latest.jar; mv uberclj-1.4.0-latest.jar ~/.lein
-
Update your
lein
bash script from:CLOJURE_JAR="$HOME/.m2/repository/org/clojure/clojure/1.2.1/clojure-1.2.1.jar"
To
(ns barker.client.main | |
(:require [shoreleave.client.worker :as swk])) | |
; Take any function in your source... | |
(defn echo-workerfn [data] data) | |
; Drop it into a worker... | |
(def nw (swk/worker echo-workerfn)) | |
; The worker implements IWatchable |
(comment | |
Given some rules like: | |
{(if ?x ?y nil) (when ?x ?y) | |
(when true . ?x) (do . ?x)} | |
And the `unify` and `check-form` functions below, | |
I would like to apply `unify` until I `unify` returns nil. |
<?php namespace cacher; | |
class CacheMixin | |
{ | |
public static $default_cache_settings = array(); | |
public static function __callStatic($name, $args) | |
{ | |
echo "\nHello, $name\n"; | |
$cache_settings = static::$default_cache_settings; |
;; This is O(n*m) for all cases, where n is the length of a, and m is the length of b | |
user=> a | |
"8th grade biology" | |
user=> b | |
["chemistry" "biology" "algebra"] | |
user=> (def s (cstr/split a #" ")) | |
#'user/s | |
user=> s | |
["8th" "grade" "biology"] | |
user=> (for [w b |
(ns clopi.core | |
(:import (java.util.zip GZIPInputStream) | |
(java.io StringReader))) | |
(def *feed-archive-url* "http://clojars.org/repo/feed.clj.gz") | |
(defn gunzip | |
"Unzip a gzip archive into an input stream" | |
[archive] | |
(GZIPInputStream. (clojure.java.io/input-stream archive))) |
user=> (future (+ 1 2 3)) | |
#<core$future_call$reify__5403@d2d58b: 6> | |
user=> (def f *1) | |
#'user/f | |
user=> @f | |
6 | |
user=> (map #(future (apply * %)) (partition-all (+ 2 num-of-cores) (range 25))) | |
(#<core$future_call$reify__5403@3d3c33b7: 0> #<core$future_call$reify__5403@3b6752c9: 840> #<core$future_call$reify__5403@7c6c2896: 7920> #<core$future_call$reify__5403@20dccfab: 32760> #<core$future_call$reify__5403@c5f468: 93024> #<core$future_call$reify__5403@4430d83d: 212520> #<core$future_call$reify__5403@62c4afc4: 24>) | |
user=> (def my-futures *1) | |
#'user/my-futures |
(defn step-seq [result n] | |
(if (= n 1) | |
result | |
(recur (conj result (step n)) | |
(step n)))) | |
(defn step-seq! [n] | |
(loop [result (transient []) | |
cnt n] | |
(if (= cnt 1) |
args_that_need_validation = ["one", "two", "three"] | |
def newStudy(**kwargs): | |
for key in kwargs: | |
if (key in args_that_need_validation) and not kwargs[key]: | |
raise Exception("You don't have %s" % str(key)) |