Skip to content

Instantly share code, notes, and snippets.

View frenchy64's full-sized avatar

Ambrose Bonnaire-Sergeant frenchy64

  • Madison, Wisconsin
View GitHub Profile
#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 ()
(ns clojure.core.typed.test.mini-occ
{: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
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?
@frenchy64
frenchy64 / core-typed-pluggable.clj
Created December 2, 2015 22:43
Pluggable type system idea
(add-core-async-handler! :print-stuff [Any -> nil])
(register-core-typed-emission async/handler (fn [[v kw & args]] `(~v ~kw ~@(map #(add-handler cast % kw) args)))
(register-core-typed-emission async/emit! (fn [[v kw & args]] `(~v ~kw ~@(map #(add-handler cast % kw) args)))
(handle :print-stuff prn)
;=> (handle :print-stuff (cast [Any -> nil] prn))
(emit! :print-stuff "a")
;=> (emit! :printf-stuff (cast String "a"))
@frenchy64
frenchy64 / tab.txt
Created November 29, 2015 08:13
What if Coldplay tabs.txt
References: http://www.azlyrics.com/lyrics/coldplay/whatif.html
https://tabs.ultimate-guitar.com/c/coldplay/what_if_crd.htm
F#m 24422x
A x0222x
Bm7 x2423x
E7 02213x
Bm7(3) x2023x
D xx0232
Bm7(5) x24232
@frenchy64
frenchy64 / infer.md
Created November 17, 2015 20:29
Infer with Unchecked type

How to infer u as '{:a Num} in

(inc (:a u))

Step 1: Import u as type Unchecked(u)

Step 2:

user=> (-> (ana/analyze '['a]) :val)
[(quote a)]
@frenchy64
frenchy64 / cut out.txt
Last active November 2, 2015 01:48
Cut out tabs
There's a few clues in the recording that suggest this is the original tuning. One, it simply sounds better
since it's easier to fret the main chords. Two, the E2 chord seems to mute the G string, I'd bet that idea
from the G string actually being an A string.
However, standard tuning still works. The final chord sounds better in standard tuning, plus it's easier
to play E major chords. If you can somehow play B minor 9 the way John does live (I can't) then try it!
Enjoy!
Tuning: EADABE <tune G string up to A from standard tuning>
@frenchy64
frenchy64 / kw.clj
Created June 26, 2015 03:48
All the types of `clojure.core/keyword`
(is-tc-e (fn [k]
(let [i (keyword k)]
i))
(IFn ['a -> ':a]
['a/b -> ':a/b]
['"a" -> ':a]
['"a/b" -> ':a/b]
[':a -> ':a]
[':a/b -> ':a/b]
[Sym -> Kw]
Type Error (rdp_214/bar.clj:37:9) Polymorphic function (new clojure.lang.LazySeq (fn* ([] (do :clojure.core.typed.special-form/special-form :clojure.core.typed/loop {:ann (quote {:params [{:type (clojure.core.typed/Option #)}]})} (loop* [s__29299 s__29299] (let* [temp__4423__auto__ (clojure.core/seq s__29299)] (if temp__4423__auto__ (do (let* [s__29299 temp__4423__auto__] (if # # #)))))))))) could not be applied to arguments:
Polymorphic Variables:
x
Domains:
[-> (t/Option (Seqable x))]
Arguments:
[-> (t/U (t/I (java.util.Collection (t/U (t/I (java.util.Collection (t/HVec [Long Long])) (ISeq (t/HVec [Long Long])) (java.util.List (t/HVec [Long Long])) (Iterable (t/HVec [Long Long])) IObj Sequential) (t/HVec [Long Long]))) (ISeq (t/U (t/I (java.util.Collection (t/HVec [Long Long])) (ISeq (t/HVec [Long Long])) (java.util.List (t/HVec [Long Long])) (Iterable (t/HVec [Long Long])) IObj Sequential) (t/HVec [Long Long]))) (java.util.List (t/U (t/I (java.util.Collection (t/HVec [Long Long])) (ISeq (t/HVec [Long