Re: Plain clojure 1.9 fails with Could not locate ... clojure/spec/alpha.clj on classpath. in Kubuntu 18.04

2018-05-21 Thread John Mastro
Jesús Gómez wrote: > Simply: 1.7 works but 1.9 not. > Test: > $ # Download Clojure 1.7, 1.8 and 1.9 jars > $ seq 7 9 | xargs -L1 -I% wget http://repo1.maven.org/maven2/org/clojure/clojure/1.%.0/clojure-1.%.0.jar > $ seq 7 9 | xargs -L1 -I% java -jar clojure-1.%.0.jar -e '"1.%.0 is Working"' > "1

Re: class and case

2017-05-12 Thread John Mastro
Kevin Kleinfelter wrote: > Can someone help me get un-stuck with a problem of using class in a case? > > This returns true, as I expect: > (= (type "x") java.lang.String) > > This returns an error, and I'd hoped it would print STRING: > (case (type "x") > class java.lang.String (println "STRING")

Re: Keywords with colon on the backside?

2016-09-23 Thread John Mastro
Timothy Baldridge wrote: > The syntax (I think) comes from Ruby although they call keywords "symbols". The reader syntax for Common Lisp's keywords has the leading colon too. John -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to t

Re: Quil and Core.async - Problems blocking thread with

2016-08-02 Thread John Mastro
JvJ wrote: > (try (do > (q/text "Putting beacon..."0 40) > (put! beacon true) > (let [ns ((q/fill 255) >(q/text (str "State: " ns) 0 60))) >(catch Exception e > (q/fill 255 0 0) > (q/text (str "Error: " e 0 60 > >

Re: Land of lisp to Clojure

2014-07-09 Thread John Mastro
Cecil Westerhof wrote: > I read a little about it. And no, I do not use dynamic binding. So I > probably should use atoms. Is there a convention how to name atoms? Nope, none that I've come across anyway. Dynamic variables can have very surprising effects if you're not aware you're dealing with t

Re: Land of lisp to Clojure

2014-07-08 Thread John Mastro
Hi Cecil, Cecil Westerhof wrote: > - The book displays all the lines of a look on separate lines. In my > case it is just one long line. Am I doing something wrong? No, you're not doing anything wrong. There's nothing in that data structure which would inherently cause it to print on multiple li

Re: Instaparse - thank you!

2014-06-14 Thread John Mastro
Agreed - thanks Mark! If anyone is able to share the query languages you're using (the language's grammar more than the implementation), I'd be very interested (and grateful). I'm always struggling to create reports for our non-technical staff which are flexible enough to be useful but don't rely

Re: Reduce vs. Comp

2014-05-07 Thread John Mastro
Hi, Mike Fikes wrote: > In fact, section 5 of that document defines comp as a reduce > involving the identify function in some way. (Now, I want to re-read > this paper, but translated into Clojure.) Here's one definition of comp in terms of reduce: (defn comp [& fs] (reduce (fn [result f]

Re: The Cons in iterate's return value

2014-04-16 Thread John Mastro
mment on whether there's a reason to prefer one over the other? -- John Mastro -- 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 members are moderate

Re: How to work with variables that need to change

2014-04-12 Thread John Mastro
On Sat, Apr 12, 2014 at 5:13 AM, Cecil Westerhof wrote: > But it looks a ‘little’ cumbersome. Is there a better way to do this? Here's another way. Not the best way, but I offer it to introduce you to atoms [1] if you're not familiar yet. [1] http://clojure.org/atoms (def numbers '(4 6 8 10))

Re: apply to quoted form

2014-03-21 Thread John Mastro
On Fri, Mar 21, 2014 at 4:44 PM, John Mastro wrote: > > That's interesting. It seems it's the last form in the list that's being > returned, and it doesn't matter what function you apply > Sigh, clearly sometimes I type faster than I think. That should be "it

Re: apply to quoted form

2014-03-21 Thread John Mastro
On Fri, Mar 21, 2014 at 4:44 PM, John Mastro wrote: > > (let [f '(+ 1 1)] > (apply (resolve (first f) (rest f > ;=> 2 > Sorry, I have a typo in there. It should be: (let [f '(+ 1 1)] (apply (resolve (first f)) (rest f))) -- John Mastro -- You received

Re: apply to quoted form

2014-03-21 Thread John Mastro
but eval is bad (apparently)... You could use clojure.core/resolve instead, I think that should be safe. (let [f '(+ 1 1)] (apply (resolve (first f) (rest f ;=> 2 -- John Mastro -- You received this message because you are subscribed to the Google Groups "Clojure"

Re: STM and persistent data structures performance on mutli-core archs

2014-03-19 Thread John Mastro
> Due to the path-copy semantics, the contention gets driven to the root of the > tree. Out of curiosity, would reference counting (rather than or in addition to "normal" GC) help with this? Or is reference counting problematic in a highly concurrent environment? It seems like reference cycles

Re: shenandoah

2014-03-14 Thread John Mastro
objects immediately after they become unreachable. The "normal" GC would then have a lot less to do, helping achieve shorter pauses. (AFAIK no such thing actually exists for the JVM, this is just an idle thought.) -- John Mastro -- You received this message because you are subscribed

Re: query on clojure maps / vectors

2014-02-14 Thread John Mastro
t x wrote: > @David: > * set operations is not what I'm looking for Just in case you didn't notice it (it's not called out very prominently), when the `clojure.set` documentation [1] mentions a "rel" it's referring to a set of maps - a "table" similar to what you mentioned. [1] http://clojure.

Re: map semantics

2014-02-08 Thread John Mastro
esn't /a priori/ mean they're wrong. - John John Mastro wrote: > Hi Andy, > > Andy C wrote: >> >> >>> user> (= s1 s2) >>> true >>> user> (= (seq s1) (seq s2)) >>> false >> >> >> Thx. If a=b then f(a) must

Re: map semantics

2014-02-08 Thread John Mastro
Hi Andy, Andy C wrote: > > >> user> (= s1 s2) >> true >> user> (= (seq s1) (seq s2)) >> false > > > Thx. If a=b then f(a) must = f(b). Something is broken here. If a seq is a sequential view of a thing, and a set is an unordered thing, then it does not seem shocking to me that multiple sequenti

Re: Help about using clojure in org mode in Emacs with CIDER

2014-01-28 Thread John Mastro
Stuart Sierra wrote: > Don't know if it's relevant or helpful here, but here's my Emacs org / babel > / Clojure setup: Thanks Stuart, very useful indeed (for me anyway). - John -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this gr

Re: let bindings

2014-01-20 Thread John Mastro
> If there's another reason then I'm hoping someone will correct me, but I > can't think of any other reasons at the moment. Since Clojure doesn't do tail call elimination implementing let atop fn would also use up stack. I believe many or all Schemes (which are required by the spec to eliminat

Re: bug in clojure.zip when calling next on empty list node?

2013-12-31 Thread John Mastro
Hi Lee, > Can anyone tell if I'm right that this is a bug in clojure.zip? If so, then > is the right thing to do to post an issue on JIRA? I don't have any insight regarding whether this is a bug (haven't yet had an opportunity to dig into clojure.zip or zippers in general). However, I think y

Re: is there a tutorial about working at the REPL?

2013-12-30 Thread John Mastro
On Sun, Dec 29, 2013 at 1:30 PM, larry google groups wrote: > Thanks for that. But the app has no problem reading the schema.edn file when > I start the app with: > > java -jar admin-1-standalone.jar > > So why would it have trouble reading the file when I'm in the repl? Can you post the project

Re: is there a tutorial about working at the REPL?

2013-12-28 Thread John Mastro
Hi Larry, > 4.) load whatever file holds the (main-) function that starts the app. So for > me, for instance, it might be: (load-file "src/admin/core.clj") I don't think the `load-file` should be necessary. Do things not work if you omit it? The code on disk when you jacked in will already have

Re: Is The Joy if Clojure up to date?

2013-11-30 Thread John Mastro
Manning (the publisher) has an interesting early-access program called MEAP. I used it to buy [1] electronic access to both the first edition and the second edition (the in-progress version immediately, plus the final version when it's released). I've been very happy with the arrangement. [1]

Re: parse a text file that has some binary characters

2013-11-19 Thread John Mastro
On Tue, Nov 19, 2013 at 6:24 AM, smk wrote: > Hi > I am trying to parse a text file that has some binary characters(such as > 0x001 or 0x002) and replace them with text characters. > How to do it in clojure? > Would something like this work? (require '[clojure.java.io :as io]) (def replace-cha

Re: Padding missing elements in a sequence of identical K/V maps

2013-11-19 Thread John Mastro
This was my first thought (quite close to Jim's): (def the-maps [{:key 3 :value 30} {:key 4 :value 40}]) (def mandatory-keys [1 2 3 4 5]) (defn find-missing-keys [maps keys] (let [found (into #{} (map :key maps))] (remove #(contains? found %) keys))) (defn ensure-mandatory-keys [maps] (

What's the -dup in print-dup?

2013-11-02 Thread John Mastro
This isn't a very deep question, but I wonder every time I come across it: to what does "-dup" in `print-dup` and `*print-dup*` refer? Thanks - John -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@goo

Re: Newbie question: How to add external clojure jars properly in Eclipse.

2013-10-19 Thread John Mastro
> John, thanks. Not a stupid question at all. When learning a new language, a > new environment, and using an unfamiliar OS, there are so many moving parts > that it is sometimes hard to know where to begin when tracking stuff down. My > old and favorite line here is that "signposts are generall

Re: Newbie question: How to add external clojure jars properly in Eclipse.

2013-10-18 Thread John Mastro
> So, clearly I need to get the libs onto the classpath. The questions are > what libs, where and how? Forgive me if this is a stupid question, but have you already listed the dependency coordinates under the :dependencies key of your project.clj? Leiningen has a sample project.clj here: http

Re: Question on mapcat and its variable arity

2013-08-25 Thread John Mastro
On Aug 25, 2013, at 2:43 PM, ngieschen wrote: > I'm somewhat new to clojure and trying to understand mapcat, so apologies in > advance if this is an embarrassingly elementary question. > > mapcat's signature is (f & colls) which indicates to me I should be able to > so something like (mapcat #(