Re: UTF16 Surrogate Pairs in Fressian not encoded to utf8 correctly

2019-11-07 Thread Francis Avila
Perhaps this is so invalid character streams (e.g. mismatched or orphaned surrogate pairs) can survive encoding and decoding (I haven't tested)? Strictly speaking not every CharacterSequence is validly encode-able to utf-8. Java just kind of hides this. For example, this is a reversed

Re: [Q] Deploying two artefacts/jars with same group/artefactid via Leiningen

2019-03-28 Thread Francis Avila
I haven't used lein-package but I am surprised it doesn't handle this case. This issue I think describes a similar use case, perhaps it helps you? https://github.com/pliant/lein-package/issues/9 `lein deploy` has a long form which accepts arbitrary filenames: $ lein help deploy Deploy

Re: global-hierarchy.. private?

2018-04-11 Thread Francis Avila
I'm not certain I know what use case you're getting at. It sounds like you want to take the current state of the global hierarchy and "fork" it into a private hierarchy? Even though the var is private you can still access its value: @#'clojure.core/global-hierarchy (same as (deref (var

Re: How to Programmatically Create Unqualified Keywords?

2018-03-22 Thread Francis Avila
keyword has two arities: (keyword x) will attempt to parse "x" into a keyword with name and namespace parts. (keyword namespace-part name-part) will make a keyword with name and namespace set explicitly. So to create a keyword dynamically (i.e. not using literal syntax) and be *absolutely

Re: Transducers eduction vs sequence

2017-12-22 Thread Francis Avila
Even though evaluation and realization of sequences is lazy, they cache their result after evaluation. If you consume an object from the `sequence` function more than once, the work is only done once. Sequences are iterable and reducible, but not as efficiently because of the caching and

Re: Defrecord Conflict

2017-03-17 Thread Francis Avila
Import does not demand name mapping. You can import a full path without aliasing. This will work fine: (ns multi.core (:require [multi.ns1] [multi.ns2]) (:import [multi.ns1.Animal] [multi.ns2.Animal])) (multi.ns1.Animal. "hi") (But remember to use the keyword

What is the correct way to increment a value in an atom from multiple workers?

2017-02-10 Thread Francis Avila
Not all intermediates appear because in between your completed swap! and your log (really the deref of the atom) the value in the atom changed. You are using atoms correctly. Your swap! function would me more idiomatic if it used the threading macro (->) but otherwise is fine. If you really

Re: Pattern matching Vs destructuring?

2017-01-27 Thread Francis Avila
There are two different concerns in what people refer to as "pattern matching": binding and flow-control. Destructuring only addresses binding. Pattern matching emphasizes flow control, and some binding features typically come along for free with whatever syntax it uses. (But you could in

Re: Simple clojure example improvements sought

2017-01-10 Thread Francis Avila
On Tuesday, January 10, 2017 at 9:27:24 AM UTC-6, hiskennyness wrote: > > Whenever I code something like this I get the feeling a clojure guru could > do it more simply, and I love learning new tricks. > > Here is my simple (real-world, btw) problem and solution. Is there a > better way? > >

Re: associative destructuring on a list? (using :keys)

2017-01-06 Thread Francis Avila
A list/seq (not a vector) which is destructured as a map will be first read into a map as by (apply hash-map the-seq) This curiosity exists so the "keyword argument" idiom works: (defn my-options [_ & {:keys [a b] :as options}] options) => #'user/my-options (my-options nil :a 1 :b 2 :c 3) =>

Re: Why does "clojure.core/run!" end in an exclamation mark?

2017-01-06 Thread Francis Avila
doseq is a macro that accepts comprehension clauses like "for", so doseq is a straight translation of for that is eager (but still uses seqs internally) and swallows its body's results. run! is like more like (doall (map f xs)), except it swallows results and uses "reduce" for speed and

recursive bindings not available in let form?

2016-12-02 Thread Francis Avila
Let bindings are immutable bindings, not refs. They must act as if their value could be substituted at the moment they are referenced. Def (i.e. a ref) is a mutable container whose contents is examined when it is used (not when referenced), which is why your second example works. Why doesn't

Re: Validate different maps that have the same keys in the same namespace

2016-11-17 Thread Francis Avila
Your spec names need different namespaces, but your functions do not: (s/def :catalog-a/type #{"a" "b" "c"}) (s/def :catalog-a/ref string?) (s/def :catalog-b/type #{:x :y :z}) (s/def :catalog-b/ref number?) Then you need to say that the keys are unqualified when they appear in the map for

Re: Liberator with ring-cors

2016-10-14 Thread Francis Avila
You could try https://github.com/jumblerg/ring.middleware.cors as your cors lib instead. This would at least help you isolate if it is a liberator issue or not. On Friday, October 14, 2016 at 7:22:29 AM UTC-5, Kenny Liu wrote: > > Anyone know if this all works out of the box? Preflight OPTIONS

Re: parallel sequence side-effect processor

2016-09-24 Thread Francis Avila
BTW I noticed that sequence got hotter and eventually became the fastest, but it took many more runs: (time (dorun (sequence (map side-effect) col1 col2))) "Elapsed time: 31.321698 msecs" => nil (time (dorun (sequence (map side-effect) col1 col2))) "Elapsed time: 15.492247 msecs" => nil (time

Re: parallel sequence side-effect processor

2016-09-24 Thread Francis Avila
Well, you pay a cost whenever you use seqs instead of reduce, so it/s strange to think of doseq as "as fast as possible". If it/s argument is a true collection, its IReduce is usually faster than its seq. If it is a sequence already, its IReduce is usually just using seqs anyway. Let's get

Re: parallel sequence side-effect processor

2016-09-23 Thread Francis Avila
> Francis, thanks for separating out the different types of intermediate > collections. I'm not entirely clear on type 1. It sounds like those are > just collections that are already there before processing them. Or are you > saying that Clojure has to convert them to a seq as such? Why

Re: parallel sequence side-effect processor

2016-09-23 Thread Francis Avila
arguments! So it really is > not better than clojure.core/map as far as allocation is concerned. > > Timothy > > On Fri, Sep 23, 2016 at 5:15 PM, Francis Avila <fav...@breezeehr.com > > wrote: > >> There are a few intermediate collections here: >> >&

Re: parallel sequence side-effect processor

2016-09-23 Thread Francis Avila
There are a few intermediate collections here: 1. The source coll may produce a seq object. How costly this is depends on the type of coll and the quality of its iterator/ireduce/seq implementations. 2. You may need to collect multiple source colls into a tuple-like thing to

Re: Adding JDBC drivers to Clojars

2016-09-23 Thread Francis Avila
Leinigen uses maven repos to satisfy project clj dependencies, but there is nothing stopping you from putting your jar directly on the classpath. The idiom for local jars is to put them in "libs/". In this case you do *not* mention this dependency in your project.clj, but the jar will be on

parallel sequence side-effect processor

2016-09-23 Thread Francis Avila
It's not crystal clear to me what you are after, either from this post or the one you link to. I think you want a map that does not produce intermediate collections and accepts multiple colls as input at a time? Do you have some pseudocode example so we can be precise? What about (run!

Re: Efficient comparison of persistent structures

2016-09-09 Thread Francis Avila
The only way to have diff consider internal structures is to have a diff protocol (with access to internals) to speed up comparison between items of the exact same Java class. However, much of the slowdown you see is from intermediate vectors created during the reductions in diff-associative

Re: [ANN] data.avl 0.0.14 – BUGFIX to splits, faster map/set reductions

2016-08-23 Thread Francis Avila
I wasn't aware Clojure had an IReduce protocol! I thought CollReduce was just what IReduce is called in Clojure. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new

Re: Having trouble doing what I want using macros, is there a better way?

2016-06-11 Thread Francis Avila
oesn't require the accumulator to function > properly, then there is no reason why `(map my-fn)` won't work. > >> On Sat, Jun 11, 2016 at 12:13 AM, Travis Daudelin >> <travis.daude...@gmail.com> wrote: >>> On Friday, June 10, 2016 at 3:03:38 PM UTC-7, F

Re: Having trouble doing what I want using macros, is there a better way?

2016-06-10 Thread Francis Avila
A higher-order function can do what this macro does: https://gist.github.com/favila/ecdd031e22426b93a78f On Friday, June 10, 2016 at 1:07:58 PM UTC-5, Travis Daudelin wrote: > > Hi all! > > I'm current working on a project where I am ingesting events off a stream > and processing them. There

Re: sorted-map vs hash-map issue

2016-04-28 Thread Francis Avila
Sorted maps sort their keys, but keywords and strings are not comparable: (sorted-map "a" 1 :b 2) ClassCastException java.lang.String cannot be cast to clojure.lang.Keyword clojure.lang.Keyword.compareTo (Keyword.java:114) On Thursday, April 28, 2016 at 3:54:33 PM UTC-5, JPatrick Davenport

Re: Compile ClojureScript in Java application

2016-04-26 Thread Francis Avila
On Tuesday, April 26, 2016 at 4:38:02 PM UTC-5, Martin Grześlowski wrote: > > I'm trying to compile String that contains Clojure Script code in > Java/Groovy. > > I'm not really happy with using *"java -jar ...".execute()*. > > > Is there any way to invoke clojurescript library (version 1.8.51)

Re: Benchmarking in Clojurescript -- Necessary or not?

2016-04-25 Thread Francis Avila
On Monday, April 25, 2016 at 6:45:13 PM UTC-5, JvJ wrote: > > What I want to know is this: Will the JVM benchmarking numbers reflect > how the JS implementation performs? > No -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Unexpected nullpointer while processing a transient vector

2016-04-24 Thread Francis Avila
Your reduction function uses when, which returns nil for the false case. You need to use if instead and return %1 unchanged in the else case so the reduction can continue. There may still be other problems, but that is the cause of your NPE -- You received this message because you are

Re: [ANN] components.md

2016-04-19 Thread Francis Avila
I believe by "several different mem-dbs" he means different instances, not implementations, i.e. they differ by name and (maybe) config, but share an implementation. There are two ways this can happen: two system graphs in the same clojure runtime, or one system graph that uses the same

Re: Encapsulating Local Mutable State

2016-04-15 Thread Francis Avila
If you can model the authentication process as a state machine, have a pure function which accepts auth-state and data and returns either a new state or an operation to get new data to determine the next state. E.g. (next-auth-state {:stage :not-authed :login "login" :password "pass"} nil) =>

Re: Core.async performance with many channels

2016-04-06 Thread Francis Avila
On Monday, April 4, 2016 at 6:30:07 PM UTC-5, Howard M. Lewis Ship wrote: > > David Nolen had an early ClojureScript core.async demo with thousands of > channels, controlling individual pixels. > This is the demo you are referring to: http://swannodette.github.io/2013/08/02/10-processes/

Re: Macro for quickly switching libraries

2016-04-06 Thread Francis Avila
The backtick namespace-qualifies symbols automatically: (macroexpand-1 '(switch-foo-library! x)) ;=> (clojure.core/defn user/foo [y__3652__auto__] ((clojure.core/resolve (clojure.core/symbol (clojure.core/str x "/foo"))) y__3652__auto__)) The error is about the "user/foo" name of the defn.

Re: Trouble using r/fold to optimise a reduce

2016-04-03 Thread Francis Avila
I had some fun with playing around with faster solutions. https://gist.github.com/favila/0573e3f644dea252bdaaed5be9d1519f The biggest speedup comes from avoiding set creation in expanded-range (i.e., the function that produces the collection of affected coordinates) and ensuring that the ops

Re: Trouble using r/fold to optimise a reduce

2016-04-02 Thread Francis Avila
Even stranger - the parallel version seems to at least produce an output > (not sure how correct) if run for the first 50 commands instead of 300. > I forgot to mention: the reason why r/fold sometimes seems to still work is because there is only one chunk (i.e., no parallelism), so the

Re: Trouble using r/fold to optimise a reduce

2016-04-02 Thread Francis Avila
kash wrote: > > Just verified - it works and gives the correct answer for shorter > collections. > No performance boost though. And fails (?) on larger collections. > Not sure what's happening. The foldvec implementation is also pretty hard > to understand. > > On Sunday, April 3, 2016

Re: Trouble using r/fold to optimise a reduce

2016-04-02 Thread Francis Avila
Your input collection to r/fold is provided by cmds-from-input which returns a lazy-seq (from map) which is not a parallel-foldable type. You can try mapv instead: vectors are parallel-foldable. (Note only PersistentVector and PersistentHashMap have useful coll-fold implementations: all other

Re: Stable clojure.xml/parse

2016-04-01 Thread Francis Avila
Are you sure that it changes the child element order? It hasn't in my experience. Example: (clojure.xml/parse (io/input-stream (.getBytes "" "UTF-8"))) => {:tag :a, :attrs nil, :content [{:tag :b1, :attrs nil, :content nil} {:tag :a1, :attrs nil, :content nil} {:tag :a2,

Re: Reworking :pre condition to add an error message

2016-03-29 Thread Francis Avila
A wonderful hack I read about somewhere is to just use the clojure.test/is macro, which I now do all the time: (require '[clojure.test :refer [is]]) => nil (defn get-key [m k] {:pre [(is (map? m) "m is not a map!")]} (m k)) => #'user/get-key (get-key [] 0) FAIL in

Re: Trouble replacing deprecated map< function

2016-02-15 Thread Francis Avila
I think the difficulty here is that Chord has a bidirectional channel, where putting and taking operate on different "streams" inside the channel. (Internally, Chord is actually using a different channel for reads and writes. It constructs the "joined" channel using chord.channels/bidi-ch) I

[Clojurescript] .getElementById returns NULL

2016-01-03 Thread Francis Avila
Your problem is unrelated to clojurescript. Your script runs before the body is loaded, so the test-content element doesn't exist yet. Either load your script at the end of the body, or wrap your code in a document.onload event handler. -- You received this message because you are subscribed

Re: Would a custom constructor for records be a silly idea?

2015-12-27 Thread Francis Avila
In clojurescript you can just "override" the necessary protocols inline in the defrecord. You will get a warning, but everything will work. You can silence the warning by using extend-type instead of an inline implementation. In clojure, doing this will give you a compile-time error, meaning

Re: ANN: ClojureScript 1.7.170, Enhanced Build Pipeline

2015-11-07 Thread Francis Avila
e shows cljs 1.7.170 is used. So, On Saturday, November 7, 2015 at 3:30:05 AM UTC-6, Maria Geller wrote: > Try using 0.5.0-SNAPSHOT for figwheel ;) > > On Saturday, November 7, 2015 at 9:59:24 PM UTC+13, Francis Avila wrote:I'm > getting the following exception w

Re: ANN: ClojureScript 1.7.170, Enhanced Build Pipeline

2015-11-07 Thread Francis Avila
I'm getting the following exception with figwheel builds (using 0.4.1): java.lang.AbstractMethodError: Method clojurescript_build/core/CompilableSourcePaths._find_sources(Ljava/lang/Object;)Ljava/lang/Object; is abstract at clojurescript_build.core.CompilableSourcePaths._find_sources

Re: "get" returns nil even when "not-found" is supplied?

2015-10-16 Thread Francis Avila
Not-found is not the same is not-nil. Is it possible that this-users-converstation *does* have an :incoming-message key with a nil value? See the difference between these two cases: (get {} :a :not-found) => :not-found (get {:a nil} :a :not-found) => nil Notice also that records always

Re: How do you process this over multiple values?

2015-10-16 Thread Francis Avila
There are only two steps: filter to select maps to use (e.g. :name = "abc"), map to transform them (e.g. extract :value). Here are some examples: (def xs [{:src "a.png", :name "abc", :value "a"} {:name "def", :src "b.gif", :value "b"}]) => #'user/xs (->> xs (filter (comp #{"abc" "def"}

what is the shortest series of casts needed to get

2015-10-04 Thread Francis Avila
Does he actually need a real arraylist, or will something fulfilling a collection interface (Collection, Iterable, or List for example) be ok? Many clojure types do not require any casting at all as long as the java code writes to a collection interface and doesn't expect to be able to mutate

Re: Type hint using protocol

2015-09-08 Thread Francis Avila
I don't quite understand why you are not calling the Protocol method as a function, i.e. (new-node this t-2 lev l r c) (no leading dot on new-node). I also don't see anything which actually *implements* INode. Note that the meaning of "method" in "Protocol method" is not the same as in "Java

Re: (fail promise exception)

2015-08-07 Thread Francis Avila
Futures automatically capture exceptions raised in their bodies and reraise them when the future is derefed. Promises also throw exceptions when derefed. Unlike promises, futures are created with the code that delivers their value, so calling fail and deliver explicitly on a future makes no

Re: (fail promise exception)

2015-08-07 Thread Francis Avila
with a promise? It seems that there is no fail method. On Friday, August 7, 2015 at 4:52:47 PM UTC-4, Francis Avila wrote: Futures automatically capture exceptions raised in their bodies and reraise them when the future is derefed. Promises also throw exceptions when derefed. Unlike promises

Re: no set-car! in clojure

2015-08-06 Thread Francis Avila
There is no equivalent to set-car!, because conses are not mutable. Only vars, refs, atoms, and agents are mutable, and they are simply containers for immutable values. You could put a cons inside an atom and put a new transformed list into the atom. (Note even among schemes set-car! is highly

Re: Should the Cheat Sheet mention assoc-in for vectors?

2015-08-06 Thread Francis Avila
assoc-in works for vectors in the sense that both vectors and maps implement ILookup (get) and IAssoc (assoc). assoc-in can navigate any collection that understands get (including sets!), and add to any collection that understands assoc. However, assoc-in will *always* create *maps* when it

Re: Beginner question

2015-07-29 Thread Francis Avila
Note: my knowledge of soap is not very deep, but I have done the following in a production system. If you have a WSDL available, a good approach is to generate the (Java) client code and then use it via Java interop. You can smooth out the rough edges and shed the extra java types by using

Re: ring.middleware.reload and figwheel

2015-07-28 Thread Francis Avila
I've never used ring.middleware.reload, but I do run client figwheel and server in the same jvm. In your project.clj, make figwheel listen on an nrepl port: :figwheel {:nrepl-port 7888 :server-port 3000 ; http :repl false ; Optional: keep this off and bootstrap to

Re: How can I write a string into Redis such that a Java app might see its contents as a primitive string?

2015-07-15 Thread Francis Avila
do not appear to be escaped. I amazed by this: user= (count *1) 3 Perhaps the error is something entirely different from what I was assuming. On Thursday, July 9, 2015 at 7:52:54 PM UTC-4, Francis Avila wrote: This is what I am doing with Carmine and it seems to work properly

Re: How can I write a string into Redis such that a Java app might see its contents as a primitive string?

2015-07-15 Thread Francis Avila
-4, Francis Avila wrote: This is what I am doing with Carmine and it seems to work properly. First some setup in the repl: user=(require '[taoensso.carmine :as car]) nil user= (def conn {:pool {} :spec {}}) #'user/conn user= (defn raw-str-set [k ^String v] (car/set k (car/raw (.getBytes v

reducers question

2015-07-14 Thread Francis Avila
Reducers can perform fewer allocations than lazy seqs, but that does not automatically translate into a big speed difference, especially with your trivial example. Try comparing chained lazy seq ops (map, mapcat, filter, take, drop, etc) to an equivalent chain of reducer calls: you may see a

Re: How can I write a string into Redis such that a Java app might see its contents as a primitive string?

2015-07-09 Thread Francis Avila
to and from JSON. Any suggestions are welcome. On Wednesday, July 8, 2015 at 8:58:53 PM UTC-4, Francis Avila wrote: Who is saving these strings, and who is reading them? Do you have complete control over both apps, or does one of them need to be aligned with the other? If the Java app

Re: How can I write a string into Redis such that a Java app might see its contents as a primitive string?

2015-07-09 Thread Francis Avila
are sometimes escaped, but most of the time they are not. I need to avoid having those quote marks escaped. I am not clear what is causing the escaping. On Thursday, July 9, 2015 at 12:01:51 PM UTC-4, Francis Avila wrote: your document-as-byte-array is wrong--it only handles ascii

Re: How can I write a string into Redis such that a Java app might see its contents as a primitive string?

2015-07-08 Thread Francis Avila
You are running into Carmine's automatic nippy serialization. https://github.com/ptaoussanis/carmine#serialization Redis only stores byte arrays (what it calls strings). Carmine uses the nippy library (the meaning of NPY in your byte stream) to represent rich types compactly as bytes.

Re: How can I write a string into Redis such that a Java app might see its contents as a primitive string?

2015-07-08 Thread Francis Avila
is that happening? On Wednesday, July 8, 2015 at 5:38:20 PM UTC-4, gingers...@gmail.com wrote: Francis Avila, Thank you for your response. The Java app is using Jedis and the Clojure app is using Carmine. I'm wondering if you can suggest what you think would be the easiest way to allow these 2

Re: Datomic query question

2015-06-04 Thread Francis Avila
(This question is more appropriate to the datomic group: https://groups.google.com/forum/#!forum/datomic) Datomic/datalog queries always perform aggregation as a last step so the results of aggregation are unavailable to the :where clause. In other words, what you want is impossible with a

Re: multi-arity functions with macros

2015-06-04 Thread Francis Avila
This is exactly the approach to take: a macro which expands to a defn with all your arities filled out. Here's a simple approach which might be enough for your problem: it will splice in argument names whenever some marker symbol is encountered, and repeat for the range of arities you want.

Re: Lein :provided profile and uberjar not working

2015-06-03 Thread Francis Avila
Possibly you are also including the dependencies in the non-profile part of the project.clj? You shouldn't: the :provided profile is normally included, but excluded when running the uberjar task. More concrete example: (defproject myproj 0.1.0 :dependencies [[org.clojure/clojure 1.6.0]] ;;

Re: How can I remove this nil? check from my code?

2015-05-26 Thread Francis Avila
Your two functions can be written more succinctly (and with fewer explicit conditionals) like these, but they will be harder for a beginner to understand. (The nested update-in with fnil in particular may cause confusion.) (defn add-placeholder-to-history [users] (reduce-kv (fn [users uk

Re: Core async pipeline should return to channel.

2015-04-17 Thread Francis Avila
Core.async issues are reported on Clojure's JIRA: http://dev.clojure.org/jira/browse/ASYNC pipeline does not have an incidental return value: it returns a channel which closes when there are no more transformation results, i.e. when the pipelining process is finished. There is no other way to

Re: Use reduce or something appropriate instead of loop / recur

2015-03-24 Thread Francis Avila
Separate out traversal from selection to make this clearer. We make a generic traversal function get-in-via. It accepts a via function which takes the current result and some value which determines the next result, and returns the next result. (defn get-in-via [m via ks] (reduce (fn [m' k]

Re: Use reduce or something appropriate instead of loop / recur

2015-03-24 Thread Francis Avila
. On Tuesday, March 24, 2015 at 4:55:23 PM UTC-5, Francis Avila wrote: Separate out traversal from selection to make this clearer. We make a generic traversal function get-in-via. It accepts a via function which takes the current result and some value which determines the next result, and returns

Re: map-in

2015-03-24 Thread Francis Avila
The reduce in your mapped function is already implemented by get-in. Other possible implementations using get-in: (defn map-in [coll ks f args] (- coll (map #(get-in % ks)) (map #(apply f % args Or: (defn map-in [coll ks f args] (map #(apply f (get-in % ks) args) coll))

Re: Sum up second elemsts of pairs in a sequence by grouping by the first item in pair

2015-03-20 Thread Francis Avila
Yet another way: (vec (reduce (fn [m [k v]] (assoc m k (+ (m k 0) v))) {} [[1 0.5] [1 0.7] [2 1.0] [3 0.1] [3 0.1]])) = [[3 0.2] [2 1.0] [1 1.2]] On Friday, March 20, 2015 at 8:45:10 AM UTC-5, Emrehan Tüzün wrote: Yet another way to solve it: *user=

Re: [GSoC] Source meta information model proposal

2015-03-16 Thread Francis Avila
Wishlist: for macros, metadata about the vars a macro will define. (E.g., (defmacro defrecord [...]) will define (-NAME arg...), (map-NAME m) when executed.) This would allow a lot more source analysis for the common case of def* macros which are just fancy ways of def-ing vars, but without

Re: defmulti: dispatch function is not called

2015-02-23 Thread Francis Avila
You can work around this by using a symbol for the dispatch function instead of inlining the function: (defn create-fact-dispatch [item-vector] (do (print item-vector) (first item-vector))) (defmulti create-fact create-fact-dispatch) When you reload in the REPL the defmulti will

Re: Performant flattening of nested data structures

2015-02-17 Thread Francis Avila
This is probably easier if you do it in two passes: one to assemble the get-in path down to a value, and another to stringify that path. (def input {:name {:first Rich :last Hickey} :number [1 415 123 4567]}) ;= #'user/input (def expected {$.number[0] 1, $.number[1] 415, $.number[2] 123,

Re: [ANN] clj-uuid: thread-safe, performant unique identifiers

2015-02-16 Thread Francis Avila
This is nice to have, thank you! uuid v5 generation seems to be something I reimplement over and over, but which is never big enough for a library. I would like to stop doing that and just include your library in the future. However, I think your v3/v5 implementations need much more control

Re: calling functions that accepts keyword arguments with a map

2015-02-13 Thread Francis Avila
Not fundamentally different from your approach: (apply set-style (apply concat {:color red :cursor pointer})) On Friday, February 13, 2015 at 11:30:44 AM UTC-6, Wilker wrote: Hi guys, I'm trying to find the best way to call a function that accepts keyword arguments (in my case it's the

Re: Question about ClojureScript Testing

2015-02-12 Thread Francis Avila
There is also a jar of v8 (https://github.com/circleci/clj-v8 https://clojars.org/clj-v8) which can run js scripts in a v8 subprocess. With some plumbing code in Clojure you could run your tests in v8 as a jar, but again you won't be able to test anything that requires a browser stack. If you

Re: var args with recur

2015-01-20 Thread Francis Avila
The difference is how rest args are handled. From the recur documentation: In particular, if the recursion point was the top of a variadic fn method, there is no gathering of rest args - a single seq (or null) should be passed. So your two calls are not the same. f1 calls (recur x some-seq)

Re: CLJS-in-CLJS; building ClojureScript from source; and stuff

2015-01-19 Thread Francis Avila
You will probably have more luck getting help in the Clojurescript group. The clojurescript-in-clojurescript project you found is defunct. In the meantime normal Clojurescript has gotten much closer to being self-hosted and work towards that end is probably best done on Clojurescript itself

Re: core async and transducers in Clojure 1.6.0

2014-12-29 Thread Francis Avila
It will be inconvenient to use transducer functions without the transducer support added in 1.7.0, but there's nothing magical about transducers that requires Clojure 1.7. Core.async 0.1.346.0-17112a-alpha does not depend on clojure 1.7 (it only depends on Clojure 1.6) and you don't need

Re: parsing and chunking large xyz files

2014-12-26 Thread Francis Avila
If you need parallelism, you need to do an indexing pass first to determine the group boundaries. Then you can process them in parallel because you know the units-of-work. Iota is an ok fit for this, so I suggest trying it first. (You may have to dial down the parallelism of r/fold to avoid

Re: Clojure and IBM JVM

2014-12-18 Thread Francis Avila
For completeness and internet posterity, this issue produced the following ticket and resolution: http://dev.clojure.org/jira/browse/CLJ-1620 On Thursday, December 18, 2014 9:16:06 AM UTC-6, Alex Miller wrote: The problem is in the static initializer (which is gigantic), not the particular

Re: Is there a tool to display all the references to a symbol in a project?

2014-12-03 Thread Francis Avila
Cursive Clojure can do this: alt-f7 the symbol. (But it's not a lightweight tool if that's what you mean by not emacs.) On Wednesday, December 3, 2014 9:16:52 AM UTC-6, Yehonathan Sharvit wrote: Is there a tool to display all the references to a symbol in a project? Preferably without using

Re: Core.async unordered pipeline-blocking ?

2014-11-28 Thread Francis Avila
I had a need for this too some time ago. It's not very hard to write yourself. Whatever trickiness there is in these functions is in handling exceptions and orchestrating shutdown. I put my version up in a gist with some other async utility functions I wrote:

Re: Preventing url-encoding of POST body in http-kit.client

2014-11-14 Thread Francis Avila
What you are describing is not url-encoding but xml-entity-quoting. The problem is not with the http-kit client but somewhere else in your stack. On my system (http-kit 2.1.16) I get the expected result: In a terminal: $ nc -l localhost -p In a repl: @(org.httpkit.client/post

Re: loop problems

2014-11-12 Thread Francis Avila
Your loop pattern should work. (I've used this pattern before.) Just a sanity check: you *are* running this function in a different thread, right? Because whatever thread calls this function *will* block forever, whether the queue is empty or not. And unless you provide some side-effecting

Re: Clojure In HTML

2014-10-28 Thread Francis Avila
There is nothing *exactly* like this for clojurescript. The problem is clojurescript compiler is implemented in Clojure and thus requires a JVM to compile the code. Brython's compiler is implemented in js so it can run in the browser. There was a cljs-in-cljs (self-hosted clojurescript)

Re: How can I add meta to an object that doesn't implement IObj?

2014-08-30 Thread Francis Avila
It would probably help if you said more about the source of this atom-holding object. Is it a plain Java class? A deftype/defrecord? Is it final? If you can control the construction of this object and its class is not final, you can subclass it and add an IObj implementation. (Note that most,

Re: ANN: ClojureScript 0.0-2277

2014-07-30 Thread Francis Avila
FYI, using the :psuedo-names compiler option is very handy for debugging advanced-compile munging issues, e.g.: :compiler {:optimizations :advanced :pseudo-names true ...} On Wednesday, July 30, 2014 10:11:17 AM UTC-5, Thomas Heller wrote: Geez, 2277