Skip to content

Commit 4b1a822

Browse files
committed
added repeatedly
1 parent 7d2d982 commit 4b1a822

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

docs/talk.org

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,14 @@
3838
*** Written in Clojure and itself
3939
** Clojure on Closure
4040
*** Google's JS toolkit
41-
* Clojure[Script] in Clojure
42-
* Google Closure
41+
** Clojure[Script] in Clojure
42+
** Google Closure
4343
** some subset of my gclosure lightning talk
44-
* Demo
45-
** REPL
46-
** Compilation
47-
** Web app
48-
** CLI app?
4944
* Where we are at
5045
** What's there?
5146
*** Compiler
5247
*** REPL
53-
*** All the primitives
48+
*** All the primitives (that make sense)
5449
*** Arity overloading
5550
*** Macros
5651
*** Seqs, maps, vectors, sets
@@ -121,4 +116,11 @@
121116
*** all with Clojure CAs welcome to participate
122117
** The Friday invite
123118
** The Conj
119+
* Demo
120+
** REPL
121+
** Compilation
122+
** Web app
123+
** CLI app?
124+
* Q & A
125+
124126

src/cljs/cljs/core.cljs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,6 +1558,13 @@ reduces them without incurring seq initialization"
15581558
"Returns a lazy seq of n xs."
15591559
[n x] (take n (repeat x)))
15601560

1561+
(defn repeatedly
1562+
"Takes a function of no args, presumably with side effects, and
1563+
returns an infinite (or length n if supplied) lazy sequence of calls
1564+
to it"
1565+
([f] (lazy-seq (cons (f) (repeatedly f))))
1566+
([n f] (take n (repeatedly f))))
1567+
15611568
(defn iterate
15621569
"Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
15631570
{:added "1.0"}

0 commit comments

Comments
 (0)