4clojure 题解 Duplicate a Sequence

作者: admin 日期: 2017-12-27 19:08:41 人气: - 评论: 0

输出重复的序列


Write a function which duplicates each element of a sequence.

test not run
(= (__ [1 2 3]) '(1 1 2 2 3 3))
test not run
(= (__ [:a :a :b :b]) '(:a :a :a :a :b :b :b :b))
test not run
(= (__ [[1 2] [3 4]]) '([1 2] [1 2] [3 4] [3 4]))
test not run
(= (__ [[1 2] [3 4]]) '([1 2] [1 2] [3 4] [3 4]))









网上找到了个函数







#(interleave % %)

暂时还不完全理解interleave的用法

相关内容

发表评论
更多 网友评论0 条评论)
暂无评论

Copyright © 2012-2014 我的代码板 Inc. 保留所有权利。

页面耗时0.0270秒, 内存占用1.83 MB, 访问数据库13次

闽ICP备15009223号-1