Skip to content

Instantly share code, notes, and snippets.

@mfikes
Created January 1, 2016 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfikes/ef1b535ab41d1e706a5c to your computer and use it in GitHub Desktop.
Save mfikes/ef1b535ab41d1e706a5c to your computer and use it in GitHub Desktop.
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