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 indexof.clj
clojure.core.typed=> (cf (let [^clojure.lang.APersistentVector a (ann-form [] (Vec Any))
_ (assert (instance? clojure.lang.APersistentVector a))]
(.indexOf a 0)))
int
View dependent.clj
(cf (fn [arg] (if (true? arg) 1 "foo"))
[Boolean -> (U Number String)
:filters {:then (| (& (is true 0)
(is Number RET))
(& (is false 0)
(is String RET)))}]))
View REPL.clj
user=> (require 'cemerick.austin.repls)
nil
user=> (cemerick.austin.repls/exec)
NullPointerException clojure.core/complement/fn--4048 (core.clj:1357)
View set.clj
(ns timl.set)
;start clojure.core
(defn max-key
([k x] x)
([k x y] (if (> (k x) (k y)) x y))
([k x y & more]
(reduce #(max-key k %1 %2) (max-key k x y) more)))
(defn remove
View disj.clj
(defn disj
([set] set)
([set key]
(when set
(. set (disj key))))
([set key & ks]
(when set
(let [ret (disj set key)]
(if ks
(recur ret (first ks) (next ks))
View juxt.clj
(All [b1 ...]
(All [x r b2 ...]
(Fn [[b1 ... b1 -> b2] ... b2 -> [b1 ... b1 -> '[b2 ... b2]]]
[[b1 ... b1 -> r] * -> [b1 ... b1 -> (Vec r)]]
[[x * -> b2] ... b2 -> [x * -> '[b2 ... b2]]]
[[x * -> r] * -> [x * -> (Vec r)]])))
View apply.clj
(All [b1 ...]
(All [y b2 ...]
(Fn [[b1 ... b1 b2 ... b2 -> y] b1 ... b1 (HSequential [b2 ... b2]) -> y]
[[b1 ... b1 r * -> y] b1 ... b1 (U nil (Seqable r)) -> y])))
View partial.clj
(All [b1 ...]
(All [r b2 ...]
[[b1 ... b1 b2 ... b2 -> r] b1 ... b1 -> [b2 ... b2 -> r]]))
View aliases.clj
(def init-aliases
'[
^{:doc "A type that returns true for clojure.core/integer?"
:forms [AnyInteger]}
clojure.core.typed/AnyInteger (U Integer Long clojure.lang.BigInt BigInteger Short Byte)
^{:doc "A type that returns true for clojure.core/integer?"
:forms [Int]}
clojure.core.typed/Int (U Integer Long clojure.lang.BigInt BigInteger Short Byte)
^{:doc "A type that returns true for clojure.core/number?"
View new_syntax.clj
(defprotocol Foo
(is-foo [this, a :- Number] :- Number)
(is-bar [this, a :- Int] :- Int
[this, b :- Number] :- Number)
(is-baz [this, a :- Int] :- Int
[this, a :- Int, b :- Int] :- Int
[this, a :- Int, b :- Int, c :- Int] :- Int))
You can’t perform that action at this time.