Re: Adding debug traces to expressions

2017-06-03 Thread lvh
And, immediately after I sent this, I remembered clojure.tools.trace; which also looks pretty similar :) On Sat, Jun 3, 2017 at 9:57 AM, lvh <_...@lvh.io> wrote: > Hi, > > > I have a piece of code that takes a limited subset of Clojure as queries, > e.g.: > > (not= (so

Adding debug traces to expressions

2017-06-03 Thread lvh
or am I better off just hacking it together myself? I'm already using specter, so instrumenting forms is not a big deal. It's always nice to get values as data instead of random strings, but the final target is humans, so eventually something is going to get printed. thanks in advance, l

Re: What sorcery is this? (`reduced`, `reduced?`)

2017-04-25 Thread lvh
reduce but different yourself. lvh On Tue, Apr 25, 2017 at 2:34 PM, John Gabriele wrote: > Just recently stumbled upon `reduced` and `reduced?`. It seems rather > magical... how does the outer `reduce` (or `reductions`) know to stop? That > is, how does the function which is bei

Faster diffing for large-ish nested data structures

2017-04-19 Thread lvh
ot of diffs, this might be a speedup. I've found https://groups.google.com/forum/#!topic/clojure/VPpjlRC2INg , but it appears that mostly doesn't go anywhere unless I want to maintain something that knows a lot about internal Clojure data structures :) lvh -- You received this message be

Re: How do I just use AOT compiled class files over clj(c) source with a leiningen uberjar?

2017-04-03 Thread lvh
with it loading e.g. instant18.clj (although it'd certainly be neater if I didn't have to :))) thanks in advance, lvh On Mon, Apr 3, 2017 at 9:24 AM, Alex Miller wrote: > core_instant18.clj is conditionally loaded if you are using >= Java 1.8 to > extend the Inst protocol to java.ti

Re: How do I just use AOT compiled class files over clj(c) source with a leiningen uberjar?

2017-04-01 Thread lvh
Hi Daniel, Thanks, I didn't know about Zach's talk. FWIW: that instant18 clj does not occur in the _uberjar_ (before proguard gets its grubby mitts on it). lvh On Sat, Apr 1, 2017 at 2:24 PM, Daniel Compton < daniel.compton.li...@gmail.com> wrote: > -keep class clojure.c

How do I just use AOT compiled class files over clj(c) source with a leiningen uberjar?

2017-04-01 Thread lvh
lojure/clojure/blob/master/src/clj/clojure/core_instant18.clj ; and the lack of matching class file can be explained because it is in the clojure.core namespace. Do I misunderstand how :aot :all works? Are clj files always going to exist in the resulting uberjar if I want Clojure to work? lvh

Re: How to transform deeply nested map into a series of arrays?

2017-03-08 Thread lvh
Hi! Suggested recursive impl: (defn path-entries ([obj] (path-entries [] obj)) ([prefix obj] (into #{} (mapcat (fn [[k v]] (let [path (conj prefix k)] (if (map? v) (entries path v) [[path v]] obj)

Re: What does "Map literal must contain an even number of forms" mean?

2016-12-04 Thread lvh
se you need a value associated with every key. I don’t know where you got that comment about another way to create a hash map, but it is incorrect. lvh > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To po

Re: comp and partial vs ->>

2016-10-27 Thread lvh
pression. The threading macro does not need a partial, because it operates on the form and injects something in it (in the second position for ->, last position for ->>). The comp version does need a partial, because `(interpose \-)` is not a function — it is just a form. lvh &g

Re: Data Transformation Question

2016-10-12 Thread lvh
> On Oct 12, 2016, at 10:26 AM, tmountain wrote: > > Hi, I'm trying to transform a sequence of data to a map, and I'm using the > following pattern. > > (def data [ {:id 1, :name "foo"}, {:id 2, :name "bar"}]) > > (zipmap (map #(:id %) data) data) > > ; result: {1 {:id 1, :name "foo"}, 2 {:

Re: clojure.spec to match string

2016-09-29 Thread lvh
> On Sep 29, 2016, at 11:42 AM, Sean Corfield wrote: > > The test.chuck library from Gary Fredericks has a generator for regex strings > that works pretty well. Whenever I get some time (not soon, if my inbox is anything to go by), I’ll add the equivalent part to schpec.

Re: [ANN] Clojure 1.9.0-alpha12

2016-09-08 Thread lvh
remove these extensions or switch to using deftype > for these use cases. > > On Wednesday, September 7, 2016 at 8:18:13 PM UTC-5, lvh ‌ wrote: > CLJ-1224 appears to have broken Datascript, which now doesn’t compile: > > Exception in thread "main" java.lang.Asserti

Re: ANN: durable-persistence for Clojure and ClojureScript

2016-09-08 Thread lvh
the GC and adding new backends--it would be > awesome to be able add a CLJS port too :) That’s awesome! What’s datacrypt, and how can I contribute? As a cryptographer who’s been working on CRDTs and does Clojure, this seems right in my wheelhouse :) lvh > Best, > David > > On

Re: [ANN] Clojure 1.9.0-alpha12

2016-09-07 Thread lvh
LJS compat; it looks like it only adds __hash in CLJ: https://github.com/tonsky/datascript/blob/0684c4102706bf4ee8b2496ad35c32ced08640fc/src/datascript/db.cljc Not sure what the ideal way to solve this is… lvh > On Sep 7, 2016, at 4:15 PM, Alex Miller wrote: > > Clojure 1.9.0-alpha

Re: [ANN] Manifail 0.4.0

2016-09-01 Thread lvh
ilure/retry library. It seems to have a similar approach in being more clojure-y, but uses combinators to produce behavior. Here’s the retry logic: https://github.com/RackSec/banach/blob/master/src/banach/retry.clj lvh > Please feel free to check out the readme > <https://github.com/t

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-21 Thread lvh
FYI, while I disagree with your conclusion (I think we should go fix libraries instead), I ran into the same issue just now for roughly the same reason, except the thing that pulled in an old version of core.unify was core.typed, which pulls in 0.5.3 through core.contracts. > On Aug 21, 2016, a

Re: ANN: The REPL, a weekly Clojure/Script newsletter

2016-07-26 Thread lvh
Hi! Thanks for putting this together — although FYI, the site just renders blank for me in Firefox. lvh > On Jul 26, 2016, at 4:20 PM, Daniel Compton > wrote: > > Hi folks > > I’ve started a weekly Clojure and ClojureScript newsletter called The REPL. > It covers wh

Re: Picking a code path if a type is known at compile time (e.g. through hint)

2016-07-01 Thread lvh
does this understand Java’s standard type dispatch? Specifically, I’m thinking of java.nio.ByteBuffer vs java.nio.DirectByteBuffer. Is there something like reflection warnings to tell me automatically when it doesn’t work correctly? lvh -- You received this message because you are subscribed to t

Picking a code path if a type is known at compile time (e.g. through hint)

2016-07-01 Thread lvh
picks the right one at compile time? I wrote some simple test fns, but there doesn’t appear to be a way to access that type hinting information. thanks lvh -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email

Why does a call fail without type hints? (Understanding reflected calls)

2016-06-30 Thread lvh
is, and wasn’t expecting this problem. DirectByteBuffer appears undocumented, but it is a subclass of MappedByteBuffer, implementing ByteBuffer. lvh -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email

Re: clojure.spec

2016-05-25 Thread lvh
excluding/including certain namespaces, but that seems gauche… I know I can just use the spec literally, but having the s/def is convenient. lvh -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email

When/how are top-level side effects in a namespace executed?

2016-05-22 Thread lvh
hold, is there a convenient/canonical way to execute that side-effect synchronously? I’d like to prevent users of my library to have to remember to call an init fn in their main- if I can. thanks lvh -- You received this message because you are subscribed to the Google Groups "Clojure&q

Re: Following type annotations across call sites to eliminate reflection?

2016-05-22 Thread lvh
e some of these call sites are really only useful internally, I’ll deal with the multi-var version, because my library’s the only one to pay that cost. thanks! lvh > I don't have a Clojure instance handy, but this should compile to > 1) load the a argument > 2) check instanceof again

Following type annotations across call sites to eliminate reflection?

2016-05-21 Thread lvh
having two overloads with the same arity doesn’t work, so I’m guessing the answer is “no" there as well :-( Thanks in advance! lvh [1]: https://github.com/lvh/caesium [2]: https://www.lvh.io/posts/nonce-misuse-resistance-101.html -- You received this message because you are subscribed t

Re: Porting Clojure to Native Platforms

2016-04-25 Thread lvh
res you saw out of your efforts in porting Clojure to PyPy? Did you ever get a chance to interact with the PyPy folks when you saw such (IMHO) pathological performance figures? (No blame; a genuine question!) lvh > > On Mon, Apr 25, 2016 at 2:18 PM, Raoul Duke <mailto:rao...@gmail

Re: [ANN] es-boat - an expert system for coastal navigation

2016-04-22 Thread lvh
I couldn’t find a link to your project, but I think this is it: https://github.com/rururu/es-boat Looks awesome!! Thanks for showing :D > On Apr 22, 2016, at 8:50 AM, ru wrote: > > Hi, > > A prototype of an expert system for coastal navigation - test exampl