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 / 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 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 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 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
View gist:0fdce1b9455fb9e26919
Types in Clojure
What is Typed Clojure?
- optional type system Clojure
- based on Typed Racket "Gradual typing"
- dynamic checking
- static checking <---
Why is it built that way?
You can’t perform that action at this time.