4clojure 题解 Reverse a Sequence

作者: admin 日期: 2017-12-27 16:27:42 人气: - 评论: 0

不使用reverse操作翻转一个序列

Write a function which reverses a sequence.

test not run
(= (__ [1 2 3 4 5]) [5 4 3 2 1])
test not run
(= (__ (sorted-set 5 7 2 7)) '(7 5 2))
test not run
(= (__ [[1 2][3 4][5 6]]) [[5 6][3 4][1 2]])








一个巧妙的答案:

#(reduce conj () %)


相关内容

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

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

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

闽ICP备15009223号-1