Skip to content

Instantly share code, notes, and snippets.

View lfranchi's full-sized avatar

Leo Franchi lfranchi

View GitHub Profile
(ns fj
(:import [java.util.concurrent RecursiveTask
ForkJoinPool]))
(set! *warn-on-reflection* true)
;; -----------------------------------------------
;; Helpers to provide an idiomatic interface to FJ
(defprotocol IFJTask
# A list is either () or (head, list).
# list = () | (head, list)
def make_list(xs): return (xs[0], make_list(xs[1:])) if xs else ()
L = make_list('abcd')
## L
#. ('a', ('b', ('c', ('d', ()))))