Skip to content

Instantly share code, notes, and snippets.

View alexpw's full-sized avatar

Alex Walker alexpw

View GitHub Profile
@tbremer
tbremer / Front-End-Methodologies.md
Last active February 16, 2021 16:13
Front End Methodologies
(defrecord Fragment [t p1 p2])
(defprotocol FragmentProtocol
(t [fragment] "Return the type.")
(switch-type [fragment] "Switch type."))
(deftype TypeFragment [f-type p1 p2]
FragmentProtocol
(t [this] f-type)
(switch-type [this] (TypeFragment. (if (= f-type :type-a) :type-a :type-b) p1 p2)))
@nathanmarz
nathanmarz / gist:1350522
Created November 9, 2011 05:38
Optimized variance in Cascalog
(defn one [] 1)
(defn div [v1 v2]
(float (/ v1 v2)))
(defparallelagg count
:init-var #'one
:combine-var #'+)
(defparallelagg sum-parallel
(ns fj
(:import [java.util.concurrent RecursiveTask
ForkJoinPool]))
(set! *warn-on-reflection* true)
;; -----------------------------------------------
;; Helpers to provide an idiomatic interface to FJ
(defprotocol IFJTask