Map type extensions (#749)

This commit is contained in:
Wilker Lúcio 2021-03-08 18:58:43 -03:00 committed by GitHub
parent 9e1cb2f9de
commit 2ad4d3342c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 93 additions and 33 deletions

View file

@ -252,6 +252,7 @@
:instance-checks [clojure.lang.Associative
clojure.lang.Atom
clojure.lang.Cons
clojure.lang.Counted
clojure.lang.Cycle
clojure.lang.IObj
clojure.lang.Fn ;; to distinguish fns from maps, etc.
@ -261,14 +262,20 @@
;; clojure.lang.IAtom ;; implemented as protocol in sci
clojure.lang.IEditableCollection
clojure.lang.IMapEntry
clojure.lang.IMeta
clojure.lang.ILookup
clojure.lang.IPersistentCollection
clojure.lang.IPersistentMap
clojure.lang.IPersistentSet
clojure.lang.IPersistentStack
clojure.lang.IPersistentVector
clojure.lang.IRecord
clojure.lang.IReduce
clojure.lang.IReduceInit
clojure.lang.IKVReduce
clojure.lang.IRef
clojure.lang.ISeq
clojure.lang.Indexed
clojure.lang.Iterate
clojure.lang.LazySeq
clojure.lang.Named
@ -284,11 +291,13 @@
clojure.lang.PersistentVector
clojure.lang.Ratio
clojure.lang.Repeat
clojure.lang.Reversible
clojure.lang.Symbol
clojure.lang.Sequential
clojure.lang.Seqable
clojure.lang.Volatile
java.util.List]
java.util.List
java.util.Iterator]
:custom ~custom-map})
(defmacro gen-class-map []

View file

@ -43,11 +43,27 @@
#_:clj-kondo/ignore
(def reify-fn
(gen-reify-combos
{clojure.lang.Associative {containsKey [[this k]]
{java.nio.file.FileVisitor
{preVisitDirectory [[this p attrs]]
postVisitDirectory [[this p attrs]]
visitFile [[this p attrs]]}
java.io.FileFilter
{accept [[this f]]}
java.io.FilenameFilter
{accept [[this f s]]}
clojure.lang.Associative
{containsKey [[this k]]
entryAt [[this k]]
assoc [[this k v]]}
clojure.lang.ILookup {valAt [[this k] [this k default]]}
clojure.lang.IFn {applyTo [[this arglist]]
clojure.lang.ILookup
{valAt [[this k] [this k default]]}
clojure.lang.IFn
{applyTo [[this arglist]]
invoke [[this]
[this a1]
[this a1 a2]
@ -70,8 +86,43 @@
[this a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19]
[this a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20]
[this a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 varargs]]}
java.nio.file.FileVisitor {preVisitDirectory [[this p attrs]]
postVisitDirectory [[this p attrs]]
visitFile [[this p attrs]]}
java.io.FileFilter {accept [[this f]]}
java.io.FilenameFilter {accept [[this f s]]}}))
clojure.lang.IPersistentCollection
{count [[this]]
cons [[this x]]
empty [[this]]
equiv [[this x]]}
clojure.lang.IReduce
{reduce [[this f]]}
clojure.lang.IReduceInit
{reduce [[this f initial]]}
clojure.lang.IKVReduce
{kvreduce [[this f initial]]}
clojure.lang.Indexed
{nth [[this n] [this n not-found]]}
clojure.lang.IPersistentMap
{assocEx [[this k v]]
without [[this k]]}
clojure.lang.IPersistentStack
{peek [[this]]
pop [[this]]}
clojure.lang.Reversible
{rseq [[this]]}
clojure.lang.Seqable
{seq [[this]]}
java.lang.Iterable
{iterator [[this]]
forEach [[this action]]}
java.util.Iterator
{hasNext [[this]]
next [[this]]}}))