C-c C-s +show source code for function C-c C-d +show documentation for function C-c C-j +show Javadoc for symbol at point
C-c C-k +compile Clojure file C-c M-n +change nrepl namespace to current C-c M-o +clear nrepl C-x C-e +send sexp to nrepl
;; BinOp ::= [Symbol Operand Operand] | |
;; Operand ::= Number | BinaryOperation | |
(defprotocol Numerical | |
"A thing which has a numerical value" | |
(value [this])) | |
(defprotocol PrintableMathExpression | |
"A mathematical expression which can be printed | |
using infix or prefix notation" |
(defn filter-col [a] | |
(filter (juxt #(< 30 %) odd?) a)) | |
(defn report-results [col] | |
(println col) | |
col) | |
(-> (range 100) | |
filter-col | |
report-results) |
#lang racket | |
;; Non-tail | |
(define sum1 | |
(λ (n) | |
(if (= n 0) n | |
(+ n (sum1 (- n 1)))))) | |
(sum1 10) |
/* | |
Hi, I'm Reservation. | |
I dont need an interface because I am a carrier of data. | |
Like a good carrier, I can be instantiated in any layer and used | |
in any other layer. | |
If you need to do stuff with me you should know to instantiate the correct | |
service and pass me to it. | |
Makes sense too since I you might need other classes to instantiate service |
(ns async.core | |
(:require [clojure.core.async :as async :refer :all] | |
[clojure.data.generators :as gen]) | |
(:gen-class)) | |
(defrecord SyncMessage [text wake]) | |
(defmacro forever [& body] | |
`(while true | |
~@body)) |
(ns async.core | |
(:require [clojure.core.async :as async :refer :all] | |
[clojure.core.async.lab :as lab] | |
[clojure.data.generators :as gen]) | |
(:gen-class)) | |
;; A Message carries some text to be communicated | |
;; and a wake channel which notifies the originator | |
;; that it may transmit again. | |
(defrecord Message [text wake]) |
(ns circuito.core | |
(:require [clojure.core.async :as async :refer :all]) | |
(:gen-class)) | |
(def ^:dynamic *timeout* 300) | |
;; Like defn, but executes body in a go block, allowing at most *timeout* milliseconds for completion | |
(defmacro defcommand [name args & body] | |
`(defn ~name ~args | |
(let [t# (timeout *timeout*) |
NameVirtualHost *:80 | |
<Directory "/Users/christian/src/work/ncl/drupal"> | |
AllowOverride all | |
Order allow,deny | |
Allow from all | |
</Directory> | |
<Location /balancer-manager> | |
SetHandler balancer-manager |
(ns async.core | |
(:require [clojure.core.async :as async :refer :all]) | |
(:gen-class)) | |
;; Based on http://talks.golang.org/2012/concurrency.slide#30 | |
;; | |
;; The Go semantics don't quite translate the same way to core.async | |
;; I've swapped the talk and wait channels so that each "boring" | |
;; goroutine creates its own _private_ wait channel / semaphore. | |
;; |