【发布时间】:2020-03-07 22:12:32
【问题描述】:
(defn recursive_function
[total] ;let's say total is: (why you(piece of(poop)))
(cond ;if there is only one parenthesis set left
(;if only (why you) is left) (System/exit 0)
)
(map (fn [i]
(cond
(seq? i) (recursive_function total)
;otherwise do things to make total shorter (I did not add this code as it
;would make this stack overflow question rather long. But essentially this map
;will eventually recursively reduce (why you(piece of(poop))) to -> (why you)
)
idealreturn)
)
一旦“total”被简化为单个序列或括号,例如 (why you),我如何编写 Cond 来检查它是否只有一个括号集?
【问题讨论】: