Clojure – launch 'for i in range(0, x)' (begin ques)

all I want to do is increment ‘i’ as list elements go, but it seems that sequence starts from ‘1’ as incrementing go first (?) (fn [lst] (doseq [i (for [i (range (count lst))] (inc i))] (println i) )) All I want to get is ‘0’ for 1-range list, but it returns ‘1’. I tried… Read More Clojure – launch 'for i in range(0, x)' (begin ques)

How to Output a Set as Simple Strings?

I need to give an output like this: /Fotos/Azoren-2018/buffet /Fotos/Azoren-2018/restaurant/dc /Fotos/Azoren-2018/restaurant/dc-41.jpg /Fotos/Azoren-2018/restaurant/dc-42.jpg /Fotos/Azoren-2018/restaurant/dc-43.jpg /Fotos/Mallorca-2017/dc-10.jpg /Fotos/Mallorca-2017/dc-11.jpg /Fotos/Mallorca-2017/dc-19.jpg But I think my output is a set: #{"/Fotos/Mallorca-2017/dc-10.jpg" "/Fotos/Azoren-2018/buffet" "/Fotos/Azoren-2018/restaurant/dc-43.jpg" "/Fotos/Azoren-2018/restaurant/dc-42.jpg" "/Fotos/Mallorca-2017/dc-19.jpg" "/Fotos/Azoren-2018/restaurant/dc-41.jpg" "/Fotos/Mallorca-2017/dc-11.jpg" "/Fotos/Azoren-2018/restaurant/dc"} Here is my code: (ns dirdiff.core (:gen-class)) (require ‘[clojure.set]) (defn no-prefix [prefix] (comp (filter #(clojure.string/starts-with? % prefix)) (map #(subs % (count prefix))))) (defn… Read More How to Output a Set as Simple Strings?

What's wrong with this Clojure function?

I’am new to clojure and i wrote this func: (def fact (fn [n] ( (apply * (drop 1 (range n)))))) When calling it i get the error: ClassCastException class java.lang.Long cannot be cast to class clojure.lang.IFn (java.lang.Long is in module java.base of loader ‘bootstrap’; clojure.lang.IFn is in unnamed module of loader ‘app’) my-stuff.core/fact (form-init3352210926102455316.clj:18) Why?… Read More What's wrong with this Clojure function?