fun send(rcv, msg, args) {
cls = rcv.isa
if (cls.isa == STD_CLS)
method = builtin_lookup(rcv, msg)
else
method = send(cls, "lookup", msg)
method(rcv, args)
}
| (ns party.units | |
| (:refer-clojure :exclude [+ - * /]) | |
| (:require [clojure.algo.generic.arithmetic :as ari :use [+ - * /]])) | |
| (defrecord Measurement [factor units] | |
| clojure.lang.IFn | |
| (invoke [a b] (* a b))) | |
| (defn ^:private short-name [sym] | |
| (if (= (namespace sym) (namespace `foo)) |
| (ns support.service | |
| (:require [io.pedestal.http :as http] | |
| [io.pedestal.http.route :as route])) | |
| (defn about-page | |
| [request] | |
| {:status 200 :body (format "Clojure %s - served from %s" | |
| (clojure-version) | |
| (route/url-for ::about-page))}) |
A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats. The link points back at them.
If you are talking about the aspect of pattern matching that acts as a conditional based upon structure, I'm not a big fan. I feel about them the way I do about switch statements - they're brittle and
| typedef char C; | |
| typedef long I; | |
| typedef struct a { | |
| I t, r, d[3], p[2]; | |
| } *A; | |
| #define P printf | |
| #define R return | |
| #define V1(f) A f(w)A w; |
Here are all of the resources mentioned by Deconstruct 2017 speakers, along with who recommended what. Please post a comment if I missed something or have an error!
- Seeing Like a State by James Scott
- Public Opinion by Walter Lippmann (Evan Czaplicki)
- A Pattern Language by Christopher Alexander (Brian Marick)
- Domain Driven Design by Eric Evans (Brian Marick)
| (ns unrepl.evented-reader) | |
| (defprotocol Closeable | |
| (close [_])) | |
| (defprotocol Stream | |
| (read! [stream]) | |
| (unread! [stream]) | |
| (on-more [stream f] | |
| "f is a function of two arguments: stream and an array where to push values. |
| ;; the SET game in clojure.spec | |
| ;; inspired by https://github.com/jgrodziski/set-game | |
| (require '[clojure.spec :as s]) | |
| (s/def ::shape #{:oval :diamond :squiggle}) | |
| (s/def ::color #{:red :purple :green}) | |
| (s/def ::value #{1 2 3}) | |
| (s/def ::shading #{:solid :striped :outline}) | |
| (s/def ::card (s/keys :req [::shape ::color ::value ::shading])) |
| module Unify where | |
| -- Translated from http://strictlypositive.org/unify.ps.gz | |
| open import Data.Empty | |
| import Data.Maybe as Maybe | |
| open Maybe hiding (map) | |
| open import Data.Nat | |
| open import Data.Fin | |
| open import Data.Product hiding (map) |
| \ This is an implementation of quotations and some combinators | |
| \ for use with Forth. The combinators should work with most | |
| \ Forth systems; the quotation implementation here is gForth | |
| \ specific. | |
| \ ************************************************************ | |
| \ dip | |
| \ Stack: value quote -- value | |
| \ Executes a quotation with a value being temporarily removed |