Fork me on GitHub

how can I stop strings from converting to raw characters when I operate on them with nth, reverse, drop and other sequence functions?


you can’t, because strings are a subclass of CharSequence, but if needed you can call str on each char, or apply str to a sequence of chars


as in (apply str (map f some-string)) if f takes a char and returns a char or string


alright, thank you!


How to calculate time between two timestamps in video? I want to calculate the time between two timestamps like 00:23:45:00 ~ 00:29:56:34 .


Hi, I've lately written a small project for large repeat numeric computations over data. Shortly after writing it for an immediate project's cause, did I turn to making it a library. The library itself ( I might publish to clojars after some more love, even if not more than a handful would ever use it, hopefully not much of an eco footprint... But I've summarized my experience in turning a codebase into a library here, in case anyone has comments to it ― might be cool 🙂 Being kind of new to clojure, I figured #beginners might be fine.


Moreso, if you have any reference for, or your own related best practices for authoring a clojure library, I'd be very interested in learning!


Hi, I use :gen-class so that I can use clojure from java. The problem is that all methods parameters as well as constructors parameters look like s1, s2, s3 in java, i.e. parameters names are changed from meaningful to generic ones. So :constructors {[String] []} looks like Foo(String s1) :methods [[bar [String Long] void ]] looks like s1, Long l1) The situation is the same if I extends some java class or implement an interface. public interface Foo { void bar(String meaningfulParameterName); } in clojure: :implements "a.b.c.Foo" the method when clojure jar imported in java will still have corrupted parameter name. So the question is: is it possible to save parameters names?


not sure as clojure allows identifiers which are not valid in java


what a silly bot

=> (munge 'typical-clojure-name!)


point being, we have built in stuff for translating things to be sure they are “java safe”


hm, why then it's not munged while generating java code


as it seems easier than generating s1, s2 etc


but in the example above the params don’t even have names…


@nmax more detailed example please?


Is there anything like “Units of Measure” in F# for Clojure?


normal as transducer


Is there a function for this pattern? (if (fn? valfn) (valfn value) value)


nbardy: FWIW, oftentimes you will see cond-> used when you want to conditionally do something to a value. So (cond-> value (fn? valfn) valfn) is an equivalent way to write that, and fairly idiomatic.


cond-> for the above, is often actually written without newlines


Can't think of one, it looks a bit dodgy to me. (probably should know whether valfn is fn or not). Another way of looking at it would be replacing valfn with identity, like (let [fun (if (fn? valfn) valfn identity)] (fun value)) That way you'd get the same call structure surrounding value