Skip to content

Instantly share code, notes, and snippets.

Ambrose Bonnaire-Sergeant frenchy64

  • Bloomington, Indiana
Block or report user

Report or block frenchy64

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 0_before.clj
(ns clojure.core.typed.test.rt-infer.loop
{:lang :core.typed
:core.typed {:features #{:runtime-infer}}}
(:require [clojure.core.typed :as t]))
(defn b [coll]
(loop [c coll
out []]
(if (seq c)
(recur (next c) (conj out (inc (first c))))
frenchy64 / automatic.clj
Created Feb 16, 2017
Automatic annotations for `for`
View automatic.clj
(defn- multi-perm
"Handles the case when you want the permutations of a list with duplicate items."
(let [f (frequencies l),
v (vec (distinct l)),
indices (apply concat
(for ^{::t/ann (t/Coll Long)} [^{::t/ann Long} i (range (count v))]
(repeat (f (v i)) i)))]
(map (partial map v) (lex-permutations indices))))
frenchy64 / 0_before.clj
Last active Feb 13, 2017
Runtime type inference
View 0_before.clj
(ns clojure.core.typed.test.rt-infer.anon-lambda
{:lang :core.typed
:core.typed {:features #{:runtime-infer}}}
(:require [clojure.core.typed :as t]))
(defn b [coll]
(->> coll
(map (fn [n]
(inc n)))
View even.clj
(ann even (All [a]
(IFn [Int -> Boolean]
[(I a (Not Int)) -> (I a (Not Int))])))
(defn even [a]
(integer? a) (even? a)
:else a))
; (even 1) ; can't type check this yet... WIP
View instructions.txt
1. Clone this repository
2. Checkout the `tools.analyzer.ast` branch.
3. `lein install` that branch.
4. Now you should have `[org.clojure/clojurescript "0.0-SNAPSHOT"]` in your maven repo
5. You now have push rights to ``.
6. I'll soon have a CLJS branch we can all work on.
Relevant files:
- the clojurescript type checker
frenchy64 / bit.clj
Created Nov 3, 2016
Bit manipulation in Cloure
View bit.clj
(require '[clojure.pprint :refer [pprint]])
(defn binary-str [bitmap]
(let [s (Integer/toBinaryString bitmap)]
(if (= 32 (count s))
(str (apply str (repeat (- 32 (count s)) \0))
;; get a feel for 2's complement
View spec.clj
(ns runtime-infer-demo.server-port
{:lang :core.typed
:core.typed {:features #{:runtime-infer}}}
(:require [clojure.core.typed :as t]
[clojure.spec :as s]))
(deftest configure-server-port-test
(= (->
View wrap_prim.clj
(ns prim-wrap
(:require [clojure.math.combinatorics :as comb]))
(declare wrap-prim)
(defn instrument-var [vr]
(wrap-prim vr @vr))
(def prim-invoke-interfaces
(into #{}
View gist:8853fa71673b7b79bc5a035b89fe601c
#lang racket
(define (emit s) s)
(define (process-file in out)
(with-input-from-file in
(lambda ()
(with-output-to-file out
#:exists 'replace
(lambda ()
View ann.clj
{:lang :core.typed
:core.typed {:features #{:runtime-infer}}
(:require [clojure.test :refer [deftest is]]
[clojure.core.typed :as t]
[clojure.pprint :refer [pprint]]))
;; Start: Generated by clojure.core.typed - DO NOT EDIT
You can’t perform that action at this time.