This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)))}])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user=> (require 'cemerick.austin.repls) | |
nil | |
user=> (cemerick.austin.repls/exec) | |
NullPointerException clojure.core/complement/fn--4048 (core.clj:1357) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)]]))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(All [b1 ...] | |
(All [r b2 ...] | |
[[b1 ... b1 b2 ... b2 -> r] b1 ... b1 -> [b2 ... b2 -> r]])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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]))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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?" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns clojure.core.typed.test.interop | |
(:import (java.io File)) | |
(:require [clojure.core.typed :as t :refer [ann non-nil-return check-ns cf]])) | |
(ann f File) | |
(def f (File. "a")) | |
(ann prt (U nil String)) | |
(def prt (.getParent ^File f)) |