(defn mapset [func ele] (loop [elements ele result []] (if (empty? elements) (set result) (let [[first-value & another] elements] (into result (func first-value)) (recur another result))))) (def v [1 2 3 4 5]) (mapset + v) 

Error while trying to run:

 Don't know how to create ISeq from: java.lang.Long 

    1 answer 1

    Read the documentation to into .

    The second argument can be a collection or a transducer , but not a number .

    Since you want to add not a collection of elements, but only one, you do not need into at all. You actually need the conj function .

    You have one more logical error there related to the immunity of vectors. And because of it, your mapset function mapset now equivalent (constantly #{}) . What exactly is the mistake, I suggest to find it yourself.