Skip to content

Commit 4243395

Browse files
David NolenDavid Nolen
authored andcommitted
* devnotes/corelib.org: add IReversible, rseq, & reversible?
1 parent a5923ac commit 4243395

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

devnotes/corelib.org

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,8 @@ ticket #8
460460
* restart-agent
461461
* resultset-seq
462462
* DONE reverse
463-
* TODO reversible?
464-
* TODO rseq
463+
* DONE reversible?
464+
* DONE rseq
465465
* TODO rsubseq
466466
* DONE satisfies?
467467
as macro

src/cljs/cljs/core.cljs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@
193193
(defprotocol IRecord
194194
"Marker interface indicating a record object")
195195

196+
(defprotocol IReversible
197+
(-rseq [coll]))
198+
196199
(defprotocol IPrintable
197200
(-pr-seq [o opts]))
198201

@@ -1216,6 +1219,12 @@ reduces them without incurring seq initialization"
12161219

12171220
(set! cljs.core.List/EMPTY (EmptyList. nil))
12181221

1222+
(defn reversible? [coll]
1223+
(satisfies? IReversible coll))
1224+
1225+
(defn rseq [coll]
1226+
(-rseq coll))
1227+
12191228
(defn reverse
12201229
"Returns a seq of the items in coll in reverse order. Not lazy."
12211230
[coll]

0 commit comments

Comments
 (0)