This file contains 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
use_module(library(lists)). | |
/* Bind updates a state given a list of binding names and a list of | |
corresponding values. The special binding form &(args) binds `args` to all | |
remaining arguments. Used to update contexts for e.g. function evaluation. */ | |
bind(S, S, [], []). | |
/* Varargs */ | |
bind(S1, S2, [&(Var)], Vals) :- | |
S2 = S1.put(Var, Vals). | |
bind(S1, S3, [Var | Vars], [Val | Vals]) :- |
This file contains 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
Thank you for extending an invitation to speak at HighLoad++. I | |
sincerely appreciate your consideration. | |
I am an outspoken advocate for LGBTQ equality; this position is deeply | |
woven into my work. Clojure From The Ground Up is adamantly | |
LGBT-inclusive. Jepsen is named after a gay pop anthem and includes | |
dozens of references to same-sex relationships and trans identities. My | |
talk slides are populated with bearded nuns, genderqueer punks, and | |
trans hackers. My twitter feed is about as gay as it is possible to get. |
This file contains 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
Dear Mr. Bezos, | |
My sincerest apologies for cluttering your inbox, but my best friend is | |
an Amazon employee, and he swears that making an earnest case to you is | |
the surest way to shift things for the better at Amazon. Here goes. | |
It's Saturday evening and I feel like watching Arrow with my best | |
friend. Hey, it's on Amazon! How's this work? Well it says I can buy a | |
TV Pass for the season. What's a TV Pass? | |
http://www.amazon.com/gp/help/customer/display.html?nodeId=200182030 says: |
This file contains 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
java.lang.IllegalArgumentException: No matching clause: | |
at clj_ssh.ssh$scp_sink.invokeStatic(ssh.clj:981) ~[classes/:na] | |
at clj_ssh.ssh$scp_sink.invoke(ssh.clj:977) ~[classes/:na] | |
at clj_ssh.ssh$scp_from.invokeStatic(ssh.clj:1094) ~[classes/:na] | |
at clj_ssh.ssh$scp_from.doInvoke(ssh.clj:1044) ~[classes/:na] |
This file contains 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 converger | |
"Generates a convergence context for n threads, where values are converged | |
when (converged? values) returns true." | |
[n converged?] | |
(atom {; The convergence function | |
:converged? converged? | |
; What threads are involved? | |
:threads [] | |
; And what values did they most recently come to? | |
:values (vec (repeat n ::init))})) |
This file contains 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
; We use EDN as a serialization format in Clojure | |
user=> (require '[clojure.string :as str] '[clojure.edn :as edn]) | |
nil | |
; Defrecords are a common way to represent data | |
user=> (defrecord Star [hair body face]) | |
#<Class@28e8ba16 user.Star> | |
; Serializing a defrecord to EDN is easy | |
user=> (def s (pr-str (Star. "ga" "ga" "ooh la la"))) |
This file contains 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
#!/usr/bin/env ruby | |
# Synchronizes ZFS filesystems. | |
# | |
# Takes three args: source pool, destination pool, and filesystem name. | |
# | |
# Syncs most recent snapshot of filesystem from source to destination pool, | |
# using incremental transfer if possible. | |
# Take a snapshot line from zfs list -t snapshot and emit a struct |
This file contains 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
#!/usr/bin/ruby | |
# This script tells you which of your friends (people you follow) are | |
# auto-completable in public twitter user searches, e.g. by typing | |
# @username" into the search box. It takes four arguments for twitter | |
# API credentials: consumer_key, consumer_secret, access_token, and | |
# access_token_secret. You can create an twitter API app at | |
# https://developer.twitter.com/. | |
# Output is a tab-separated list of accounts, one per line, where the |
This file contains 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 messagepassing.core) | |
(import [java.util.concurrent LinkedTransferQueue]) | |
(def m 10000000) | |
(defn queue-test [] | |
(defn bounce [in out m] | |
(let [value (.take in)] | |
(if (< value m) | |
(do |
This file contains 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
Let: | |
T1 = {:type :ok, :f :txn, :value [[:r 132 [1 2]] [:append 134 2] [:r 127 [1 2 3 6]]], :process 13, :time 174587090574, :index 2314} | |
T2 = {:type :ok, :f :txn, :value [[:append 132 3] [:r 133 [1]] [:append 134 1] [:r 132 [1 2 3]]], :process 14, :time 174415701895, :index 2300} | |
T3 = {:type :ok, :f :txn, :value [[:append 134 4] [:r 127 [1 2 3 6]]], :process 14, :time 174480602924, :index 2308} | |
Then: | |
- T1 < T2, because T1 did not observe T2's append of 3 to 132. | |
- T2 < T3, because T3 appended 4 after T2 appended 1 to 134. | |
- However, T3 < T1, because T1 appended 2 after T3 appended 4 to 134: a contradiction! |