Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
realized? for lazy seq in ClojureScript
From 705930227b34365b95480941ee085f2e5a4e2a63 Mon Sep 17 00:00:00 2001
From: Mike Fikes <mike@fikesfarm.com>
Date: Fri, 1 Jan 2016 01:24:34 -0500
Subject: [PATCH] Experiment: realized? for lazy seq
---
src/main/cljs/cljs/core.cljs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/main/cljs/cljs/core.cljs b/src/main/cljs/cljs/core.cljs
index c6ca522..f6db702 100644
--- a/src/main/cljs/cljs/core.cljs
+++ b/src/main/cljs/cljs/core.cljs
@@ -3014,6 +3014,10 @@ reduces them without incurring seq initialization"
(set! fn nil)
s)))
+ IPending
+ (-realized? [d]
+ (nil? fn))
+
IWithMeta
(-with-meta [coll meta] (LazySeq. meta fn s __hash))
--
2.5.4 (Apple Git-61)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment