Re: #33 Replicate a sequence

24 views
Skip to first unread message

Bill Allen

unread,
Dec 25, 2019, 11:39:03 AM12/25/19
to 4Clojure
4clojure is stuck at clojure 1.4.

On Wed, Dec 25, 2019 at 10:26 AM Matthew Farabaugh <mattfar...@gmail.com> wrote:
Hi all,

I have a solution to this problem which works on my repl but fails on the site: #(apply interleave (repeat %2 %1))

Is there a difference in version? I'm on (clojure-version) => "1.10.0".

Write a function which replicates each element of a sequence a variable number of times.

test not run


#(apply interleave (repeat %2 %1))#(apply interleave (repeat %2 %1))#(apply interleave (repeat %2 %1))#(apply interleave (repeat %2 %1))#(apply interleave (repeat %2 %1))#(apply interleave (repeat %2 %1))#(apply interleave (repeat %2 %1))#(apply interleave (repeat %2 %1))#(apply interleave (repeat %2 %1))
(= (__ [1 2 3] 2) '(1 1 2 2 3 3))
test not run
(= (__ [:a :b] 4) '(:a :a :a :a :b :b :b :b))
test not run
(= (__ [4 5 6] 1) '(4 5 6))
test not run
(= (__ [[1 2] [3 4]] 2) '([1 2] [1 2] [3 4] [3 4]))
test not run
(= (__ [44 33] 2) [44 44 33 33])
clojure.lang.ArityException: Wrong number of args (1) passed to: core$interleave


--
You received this message because you are subscribed to the Google Groups "4Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to 4clojure+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/4clojure/e6e2f944-34bd-4671-b70c-ae9a58f8278c%40googlegroups.com.

Matthew Farabaugh

unread,
Dec 25, 2019, 4:49:13 PM12/25/19
to 4Clojure
Thanks very much. Yes, I saw that another post already answered this issue. I tried deleting my redundant question but it seems you beat me to the punch. Thanks for answering all the same!


On Wednesday, December 25, 2019 at 11:39:03 AM UTC-5, Bill Allen wrote:
4clojure is stuck at clojure 1.4.

On Wed, Dec 25, 2019 at 10:26 AM Matthew Farabaugh <mattfar...@gmail.com> wrote:
Hi all,

I have a solution to this problem which works on my repl but fails on the site: #(apply interleave (repeat %2 %1))

Is there a difference in version? I'm on (clojure-version) => "1.10.0".

Write a function which replicates each element of a sequence a variable number of times.

test not run


#(apply interleave (repeat %2 %1))#(apply interleave (repeat %2 %1))#(apply interleave (repeat %2 %1))#(apply interleave (repeat %2 %1))#(apply interleave (repeat %2 %1))#(apply interleave (repeat %2 %1))#(apply interleave (repeat %2 %1))#(apply interleave (repeat %2 %1))#(apply interleave (repeat %2 %1))
(= (__ [1 2 3] 2) '(1 1 2 2 3 3))
test not run
(= (__ [:a :b] 4) '(:a :a :a :a :b :b :b :b))
test not run
(= (__ [4 5 6] 1) '(4 5 6))
test not run
(= (__ [[1 2] [3 4]] 2) '([1 2] [1 2] [3 4] [3 4]))
test not run
(= (__ [44 33] 2) [44 44 33 33])
clojure.lang.ArityException: Wrong number of args (1) passed to: core$interleave


--
You received this message because you are subscribed to the Google Groups "4Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to 4clo...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages