Xiufen Xu
Xiufen Xu

Reputation: 531

How to get a sublist in a list in clojure

I am wondering get a sublist in a list,like:

user=> (findsublst '(hello world (10 clock)))
(10 clock)

what function can I use or how to define the functioin findsublst. Thank you so much!

Upvotes: 0

Views: 1833

Answers (1)

Frank C.
Frank C.

Reputation: 8088

With very little to go on, the following will return all first level list/sequences contained by the primary:

(filter seq? '(1 2 3 (4 5 6)))
=> ((4 5 6))

Upvotes: 4

Related Questions