I hereby claim:
- I am pnf on github.
- I am pnf (https://keybase.io/pnf) on keybase.
- I have a public key whose fingerprint is 1919 04F5 FA4D EF6A 64B3 AEDD 3F99 0C80 DAAD DC69
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| ;;; clj-fly.el --- Flycheck: Clojure support -*- lexical-binding: t; -*- | |
| ;;; Commentary: | |
| ;;; So far, this only invokes eastwood. It works best if flycheck-pos-tip is used, so as not to clash with Cider doc messages. | |
| ;;; Code: | |
| (require 'cider-client) | |
| (require 'flycheck) | |
| (defun parse-eastwood (s) |
| user> (clojure.pprint/pprint (macroexpand-all | |
| '(defn consume [c] (a/go (let [n (a/<! c)] | |
| (when (zero? (mod n 10000)) (println n))) | |
| (consume c))))) | |
| (def | |
| consume | |
| (fn* | |
| ([c] | |
| (let* | |
| [c__8709__auto__ |
| import qualified Data.Map as Map -- refer to function foo as Map.foo | |
| gs = ["g1","g2"] | |
| g2m = Map.fromList [("g1",["m1","m2"]),("g2",["m2"])] | |
| m2w = Map.fromList [("m1",["w1","w2"]),("m2",["w2","w3"])] | |
| nest xs = map (\x -> [x]) xs | |
| -- lookup in dictionary by first element of key list, then prepend to key list |
| from itertools import chain,imap | |
| manufacturing_groups = { 'multiglobal manufacturing group', | |
| 'intergalactic joint ventures', | |
| 'transdimensional megacorp', } | |
| manufacturers = { 'multiglobal manufacturing group': { 'red heron manufacturers', | |
| 'blue bass super-corp', | |
| 'yellow dog llc', | |
| 'orange penguin family manufacturers', | |
| 'green hornet industries', }, |
| die "Note that there are two different algorithms here. Don't expect it to run as is." | |
| #!/usr/bin/perl | |
| # ~0.15s on i7 1.7GHz | |
| my @all; | |
| my $m=0; | |
| while(<>) { | |
| $l = length($_); | |
| $m = $l if $l>$m; |
| (defn maintain-non-primes [non-primes] | |
| "Remove first non-prime entry, and create new entries based on it" | |
| (let [[n ps] (first non-primes) | |
| xs (dissoc non-primes n) | |
| new-non-primes (map (fn [p] [(+ n p) (cons p (xs (+ n p))) ]) ps)] | |
| (into xs new-non-primes))) | |
| (defn seive | |
| ([] (seive (sorted-map) 2)) | |
| ([n] (take n (seive (sorted-map) 2))) | |
| ([non-primes n] |
| ; list of winning positions | |
| (def wp | |
| [2r111000000 2r000111000 2r000000111 2r100100100 2r010010010 2r001001001 2r100010001 2r001010100]) | |
| ;; Is a particular bitmask winning? | |
| (defn winner? [p] | |
| (some (fn [c] (= (bit-and c p) c)) wp)) | |
| ;; list of possible moves, filtering out ones already made | |
| (defn moves [p] | |
| (filter pos? (map #(bit-and (bit-not p) (bit-shift-left 1%)) (range 9)))) | |
| ;; A board position comprises a bitarray for each player and an indicaiton of whose turn it is. |
| #!/usr/bin/env python | |
| from math import * | |
| import sys | |
| # draw line from x,y of length s at angle theta, spawn growth of length s*r, theta+/-q unless n==0 | |
| def grow(x, y, theta, s, q, r, n): | |
| ret = [(x,y,theta,s)] | |
| n = n-1 | |
| if n>0: | |
| x2 = x + s*cos(theta) |
| Welcome to Scala version 2.10.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_21). | |
| Type in expressions to have them evaluated. | |
| Type :help for more information. | |
| scala> implicit def strToInt(x:String) = x.toInt | |
| warning: there were 1 feature warning(s); re-run with -feature for details | |
| strToInt: (x: String)Int | |
| scala> class C[A](v:A){def a(implicit ev:A=>Int)=123+ev(v)} | |
| defined class C |