This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-23
Channels
- # bangalore-clj (1)
- # beginners (23)
- # boot (90)
- # cljs-dev (133)
- # cljsrn (5)
- # clojure (104)
- # clojure-austin (1)
- # clojure-belgium (2)
- # clojure-dev (12)
- # clojure-gamedev (4)
- # clojure-italy (2)
- # clojure-russia (6)
- # clojure-spec (30)
- # clojure-uk (117)
- # clojurescript (197)
- # core-async (25)
- # cursive (9)
- # datomic (95)
- # devops (1)
- # dirac (49)
- # emacs (1)
- # hoplon (3)
- # immutant (10)
- # lein-figwheel (2)
- # luminus (5)
- # off-topic (43)
- # pedestal (1)
- # protorepl (1)
- # re-frame (13)
- # sql (5)
- # untangled (1)
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
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 (https://github.com/Boteval/compare-classifiers) 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 https://github.com/matanster/split-a-library 🙂 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!
@stardiviner take a loop at https://github.com/clj-time/clj-time
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 foo.bar(String 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?
what a silly bot
=> (munge 'typical-clojure-name!)
typical_clojure_name_BANG_
point being, we have built in stuff for translating things to be sure they are “java safe”
but in the example above the params don’t even have names…
normal as transducer
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.
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