An idle app isn't going to give you any useful benchmarks at all. The JVM
is considerably faster and more scalable than either Ruby or Erlang when
given a real application workload and maybe 2GB of RAM to play with (which
you can certainly afford, if you are doing anything vaguely important on a
Clojurians,
For some reason JAVA_OPTS are not accessible in my Clojure project.
The command line seems to be OK, if I:
$ lein repl
project-ns => (System/getProperty "javax.net.ssl.keyStore")
-> "/../certs/dev.bbc.co.uk.p12"
However, if I load the nRepl in the lein project:
project-ns => (
"Fortunately, it was all closing parentheses."
--
--
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 moderated - please be patient with your
first post
I have +10 years experience of OO programming (C++, C# and a little Java)
and a couple of years of FP programming (mainly F#, some Scala and a little
Haskell).
Are there any resources for learning Clojure that are particular good for
someone with the above background?
--
--
You received this
Cloact is a minimalistic interface between ClojureScript and React.js, that now
has a proper introduction, some documentation and a few examples here:
http://holmsand.github.io/cloact/
Project page and installation instructions are here:
https://github.com/holmsand/cloact
Enjoy,
/dan
--
--
With that background I would go with Joy of Clojure by Michael Fogus and
Chris Houser. http://manning.com/fogus2/
On Friday, January 10, 2014 10:52:53 AM UTC-2, christian jacobsen wrote:
>
> I have +10 years experience of OO programming (C++, C# and a little Java)
> and a couple of years of FP p
For me (a similarly entrenched OO guy) I found it very challenging.
Nothing to do with the syntax, but you are moving from a world of locked up
bits of data behind a (hopefully) impenetrable API to a world full of
lightweight data with a myriad of tiny functions which pretty much all
perform
I have a sequence of file names and I want to make them unique. (uniquify
["a" "b" "c" "a"]) => ["a" "b" "c" "a_1"])
This is what I have come up with, but surely there is a better way?
What would you all do? Feedback welcome (including the word 'muppet' as I
am sure I have missed something si
Hi Colin,
Clojure has a distinct function that does this. I may be missing some
context on what you what out of your new method that 'distinct' does not
provide. The distinct functions source code is a good reference.
Thanks
On Fri, Jan 10, 2014 at 6:59 AM, Colin Yates wrote:
> I have a seque
I would not use an atom. Think about it as doing a reduce while passing
along a set of the names you've seen so far. You might also look at the
implementation of "distinct" in clojure.core which is similar (you want to
detect duplicates in the same way, but emit new names instead of omitting
du
Hi,
Consider the following definition for concat-ing two channels.
(defn my-concat [chan1 chan2 buffer-size]
(let [out (chan buffer-size)]
(go (loop [lst (list chan1 chan2)]
(when (not (empty? lst))
(let [msg (! out msg)
(recur lst))
The missing context is that distinct removes duplicates, I want duplicates to
be made unique by changing them in some way: (uniquify ["a" "b" "c" "a"]) =>
["a" "b" "c" "a_1"]) *not* (uniquify ["a" "b" "c" "a"]) => ["a" "b" "c"])
Not sure what else to put that isn't in the original post to be hone
Good call.
I keep discounting reduce as I am not 'reducing' anything, only
transforming (i.e. map) it - my mistake.
Thanks.
Col
On Friday, 10 January 2014 15:12:27 UTC, Alex Miller wrote:
>
> I would not use an atom. Think about it as doing a reduce while passing
> along a set of the names
On 10 January 2014 14:59, Colin Yates wrote:
> I have a sequence of file names and I want to make them unique. (uniquify
> ["a" "b" "c" "a"]) => ["a" "b" "c" "a_1"])
>
> This is what I have come up with, but surely there is a better way?
>
>
I would do something like:
(defn uniquify
([xs]
Hi,
Use frequencies to get a map of path => nb of occurrences, then for each
entry of the map, create unique names.
Cannot provide an impl on the uPhine, sorry
Le vendredi 10 janvier 2014, Colin Yates a écrit :
> I have a sequence of file names and I want to make them unique. (uniquify
> ["a" "
Love it. Much more readable without any nasty persistent state.
On Friday, 10 January 2014 15:19:03 UTC, Ray Miller wrote:
>
> On 10 January 2014 14:59, Colin Yates >wrote:
>
>> I have a sequence of file names and I want to make them unique.
>> (uniquify ["a" "b" "c" "a"]) => ["a" "b" "c" "a_1"
I did consider that but I want to preserve the order of the incoming
sequence.
On Friday, 10 January 2014 15:22:29 UTC, Laurent PETIT wrote:
>
> Hi,
>
> Use frequencies to get a map of path => nb of occurrences, then for each
> entry of the map, create unique names.
> Cannot provide an impl on t
Ok. My bad. Should not be reading and responding to such posts from the
phone. Somehow, I overlooked that part of the mail. I think as Alex stated,
a simple way of holding on to seen objects in the set and reducing the list
should be good.
On Fri, Jan 10, 2014 at 7:14 AM, Colin Yates wrote:
> T
I quickly put together this which seems to preserver the orderof the
original seq:
(defn uniquify [coll]
(let [post-fn #(group-by first (-> % meta :encountered))]
(loop [unique (with-meta [] {:encountered []})
[f & more] coll]
(if (nil? f) (flatten (concat unique (reduce #(conj % (
Le vendredi 10 janvier 2014, Colin Yates a écrit :
> I did consider that but I want to preserve the order of the incoming
> sequence.
>
>
> On Friday, 10 January 2014 15:22:29 UTC, Laurent PETIT wrote:
>>
>> Hi,
>>
>> Use frequencies to get a map of path => nb of occurrences, then for each
>> entr
actually `post-fn` should be #(group-by identity (-> % meta :encountered))
Jim
On 10/01/14 15:28, Jim - FooBar(); wrote:
I quickly put together this which seems to preserver the orderof the
original seq:
(defn uniquify [coll]
(let [post-fn #(group-by first (-> % meta :encountered))]
(loop
oops! my fn will not keep the original ordering...sorry Colin
Jim
On 10/01/14 15:34, Jim - FooBar(); wrote:
actually `post-fn` should be #(group-by identity (-> % meta :encountered))
Jim
On 10/01/14 15:28, Jim - FooBar(); wrote:
I quickly put together this which seems to preserver the order
Looks very nice :)
On Friday, January 10, 2014, Dan Holmsand wrote:
> Cloact is a minimalistic interface between ClojureScript and React.js,
> that now has a proper introduction, some documentation and a few examples
> here:
>
> http://holmsand.github.io/cloact/
>
> Project page and installation
On Friday, January 10, 2014 5:23:19 PM UTC+1, David Nolen wrote:
> Looks very nice :)
Thanks!
/dan
--
--
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
On 10/01/14, christian jacobsen wrote:
> I have +10 years experience of OO programming (C++, C# and a little Java)
> and a couple of years of FP programming (mainly F#, some Scala and a little
> Haskell).
> Are there any resources for learning Clojure that are particular good for
> someone with
On 10/01/14, Colin Yates wrote:
> I have a sequence of file names and I want to make them unique. (uniquify
> ["a" "b" "c" "a"]) => ["a" "b" "c" "a_1"])
>
> This is what I have come up with, but surely there is a better way?
>
> What would you all do? Feedback welcome (including the word 'mupp
2014/1/10 Stefan Kanev
> On 10/01/14, Colin Yates wrote:
> > I have a sequence of file names and I want to make them unique.
> (uniquify
> > ["a" "b" "c" "a"]) => ["a" "b" "c" "a_1"])
> >
> > This is what I have come up with, but surely there is a better way?
> >
> > What would you all do? Feed
Here's a version using reduce:
(defn uniquify [items]
(first
(reduce (fn [[result count-map] item]
(let [n (inc (count-map item 0))]
[(conj result (str item "_" n))
(assoc count-map item n)]))
[[] {}]
item
Somehow I totally forgot I could use destructuring. Here's a slightly
shorter version:
(defn uniquify [words]
(loop [encountered {}
result []
[word & remaining] words]
(if (seq remaining)
(let [occurences (get encountered word)
no you have a bug in this last version, it now skips the last result
2014/1/10 Stefan Kanev
> Somehow I totally forgot I could use destructuring. Here's a slightly
> shorter version:
>
> (defn uniquify [words]
> (loop [encountered {}
> result []
> [word & re
What about this one?
Inspired by Stefan's, with more destructuring in loop, format-fn as a
function, initial call to (seq) then (next) instead of (rest), placing the
exit argument first so that it's not lost at the end of the function,
renamed word as item since this function does not depend on th
Hi Aidy,
What do mean when you say "load the nRepl in the lein project"?
Juan
On Friday, January 10, 2014 9:42:02 AM UTC-3, Aidy Lewis wrote:
>
> Clojurians,
>
> For some reason JAVA_OPTS are not accessible in my Clojure project.
>
> The command line seems to be OK, if I:
>
> $ lein repl
>
> pro
Hello,
Counterclockwise is an Eclipse Plugin for developing Clojure code.
A few hours after the launch of Counterclockwise 0.21.0, I've had enough
work done to be able to release an interesting upgrade as 0.22.0.
It builds on the foundations introduced by 0.21.0, and adds a more polished
integra
On 10/01/14, Laurent PETIT wrote:
> What about this one?
>
> Inspired by Stefan's, with more destructuring in loop, format-fn as a
> function, initial call to (seq) then (next) instead of (rest), placing the
> exit argument first so that it's not lost at the end of the function,
> renamed word as
If all you need is unqiueness, why not just number *all* the filenames in
sequential order, something like:
(defn uniqueify [filenames]
(map (fn [filename number] (str filename \_ number)) filenames (iterate
inc 1)))
--
--
You received this message because you are subscribed to the Google
Gro
Thank you for putting the time on building and documenting this template!
I'm going to test some ideas with it.
Il giorno venerdì 10 gennaio 2014 06:06:34 UTC+1, Kevin Bell ha scritto:
>
> A Leiningen template featuring all of the most popular Clojure
> technologies that all of the coolest kids
Hi,
When closing a core.async channel, as in
http://clojure.github.io/core.async/
is it possible to attach a status/messaage to the close operation?
Thanks!
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email t
On Jan 10, 2014, at 7:18 AM, Stefan Kanev wrote:
> I strongly suggest you get a copy of the O'Reilly book (Clojure
> Programming)
I'll second that recommendation, and also suggest Brian Marick's "Functional
Programming for the Object-Oriented Programmer":
https://leanpub.com/fp-oo
But, yes, co
I loved the 'Joy of Clojure' as my first clojure book, but it was a little
over my head at the time I started reading it, so it took subjectively
quite a while to internalize everything. Since I didn't need to 'get stuff
done' immediately, I think, in the end, it's great to learn things with
such
java.jdbc does this for column names (in joins):
https://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc.clj#L257
Sean
On Jan 10, 2014, at 6:59 AM, Colin Yates wrote:
> I have a sequence of file names and I want to make them unique. (uniquify
> ["a" "b" "c" "a"])
On Jan 10, 2014, at 11:02 AM, Gary Trakhman wrote:
> I loved the 'Joy of Clojure' as my first clojure book, but it was a little
> over my head at the time I started reading it, so it took subjectively quite
> a while to internalize everything.
JoC was my first Clojure book - but I had plenty of
But, for the given problem this may not be directly helpful. This method
only returns the next unique name for the given list. The logic would have
to traverse the list n times for n elements (and some factor of no of
duplicates) to get the desired result, correct?
Thanks
Guru
On Fri, Jan 10, 20
This and Jonas' are my current favourites, for what that's worth.
Keep the suggestions coming!
On Friday, 10 January 2014 17:29:20 UTC, Laurent PETIT wrote:
>
> What about this one?
>
> Inspired by Stefan's, with more destructuring in loop, format-fn as a
> function, initial call to (seq) then
Actually, you might have meant line 267?
On Fri, Jan 10, 2014 at 11:03 AM, Sean Corfield wrote:
> java.jdbc does this for column names (in joins):
>
>
> https://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc.clj#L257
>
> Sean
>
> On Jan 10, 2014, at 6:59 AM, Colin Y
That's my stack right now, I'll have to check this out and take notes, see
what we're doing differently. This is all pretty uncharted territory it
seems. Thanks for putting this out there.
On Thursday, January 9, 2014 9:06:34 PM UTC-8, Kevin Bell wrote:
>
> A Leiningen template featuring all o
I really think Clojure Programming is the best Clojure book out there. If
you read that thing most (or all) of the way through, you'll have a very
solid understanding of Clojure.
On Friday, January 10, 2014 4:52:53 AM UTC-8, christian jacobsen wrote:
>
> I have +10 years experience of OO prog
I also want to second watching all of Rich Hickey's talks, especially "are
we there yet" and "simple made easy", they really help you get the
philosophies behind the language. For me, I found myself agreeing with all
the principles of simplicity he talks about, and it increased both my
motivat
+1 for Clojure Programming of Oreilly
2014/1/10 Curtis Gagliardi
> I really think Clojure Programming is the best Clojure book out there. If
> you read that thing most (or all) of the way through, you'll have a very
> solid understanding of Clojure.
>
>
> On Friday, January 10, 2014 4:52:53 AM
IMO there are 2 aspects of learning Clojure coming from an imperative
and/or OO background. One s the functional aspect of it and other the
idioms and the language itself. To learn the language a book like 'Clojure
Programming' would be a good start as others have suggested. It will help
you quick
At the risk of self promotion*, have a read
of https://groups.google.com/d/msg/clojure/rt-l_X3gK-I/K80axT77XzwJ - it is
an excellent example of iterative compared to functional. You can see at
least 4 distinct approaches to solving a fairly straight forward problem.
It is a startlingly clear
Technically, all these solutions are flawed.
With the input
["a" "a" "a_1"]
you'll get back
["a" "a_1" "a_1"]
To truly address this, you need to also add the newly formatted filename
into the "seen" map, which none of the suggested solutions do.
--
--
You received this message because you are
On Fri, Jan 10, 2014 at 9:39 PM, Mark Engelberg wrote:
> Technically, all these solutions are flawed.
>
> With the input
> ["a" "a" "a_1"]
> you'll get back
> ["a" "a_1" "a_1"]
>
> To truly address this, you need to also add the newly formatted filename
> into the "seen" map, which none of the sug
Hi Juan,
Maybe I should rephrase my issue.
If I create a new leiningen project
$ lein new foo
And type
$ lein repl
user=> (System/getProperty "javax.net.ssl.keyStore")
> /Users/lewisa29/certs/dev.bbc.co.uk.p12
Now if I enter this into core.clj of the foo project
(ns foo.core)
(System/get
On Fri, Jan 10, 2014 at 11:43 AM, Jonas Enlund wrote:
> That's why I wrote my solution like I did, i.e., concatenate "_1" when a
> new string is found. This would result in the vector ["a_1" "a_2" "a_1_1"]
>
Right, I agree that works, as does my "tack unique numbers onto the end of
everything" so
way to take the wind out of our sails! Well spotted :).
On Friday, 10 January 2014 19:39:45 UTC, puzzler wrote:
>
> Technically, all these solutions are flawed.
>
> With the input
> ["a" "a" "a_1"]
> you'll get back
> ["a" "a_1" "a_1"]
>
> To truly address this, you need to also add the newly fo
On Fri, Jan 10, 2014 at 10:22 AM, Laurent PETIT wrote:
> Hi,
>
> Use frequencies to get a map of path => nb of occurrences, then for each
> entry of the map, create unique names.
> Cannot provide an impl on the uPhine, sorry
>
"uPhine"? :)
--
--
You received this message because you are subscr
On Fri, Jan 10, 2014 at 11:52 AM, Colin Yates wrote:
> way to take the wind out of our sails! Well spotted :).
It's not too hard to fix. Here's an adapted version of Jonas' solution
that should do the trick:
(defn uniqueify [items]
(first
(reduce (fn [[results count-map] item]
Great tips, thank you all! :)
On Friday, January 10, 2014 8:34:47 PM UTC+1, Colin Yates wrote:
>
> At the risk of self promotion*, have a read of
> https://groups.google.com/d/msg/clojure/rt-l_X3gK-I/K80axT77XzwJ - it is
> an excellent example of iterative compared to functional. You can see at
I thought I would have a go myself without copying (although having read
them earlier) the other functions and this is what I came up with:
(first (reduce (fn [[results seen] item]
(let [occurrences ((fnil identity 0) (get seen item))
seen (assoc
Sorry - wrong c/p:
(first (reduce (fn [[results seen] item]
(let [cnt (get seen item 0)
item (if (> cnt 0) (format-fn item cnt) item)]
[(conj results item) (assoc seen item (inc cnt))]))
[[] {}]
On Fri, Jan 10, 2014 at 12:55 PM, Colin Yates wrote:
> Being really anal I could claim the original a_2 should remain a_2 and the
> third instance of a jump to being a_3.
>
Sure, but that would require two passes. Otherwise, there's no way when
you encounter the third "a" to know there's an "a
Gosh - my public humiliation continues. Here is one that actually works:
(first (reduce (fn [[results seen] item]
(let [cnt (get seen item 0)]
[(conj results (if (> cnt 0) (format-fn item cnt)
item))
(assoc seen item (inc cnt
*data.json: JSON parser and writer*
https://github.com/clojure/data.json
Version 0.2.4
Leiningen dependency info:
[org.clojure/data.json "0.2.4"]
Changes in this release:
* Small change in behavior: `clojure.data.json/pprint` now adds a
newline after its output just like `clojure.co
*java.classpath: examine the Java classpath from Clojure*
https://github.com/clojure/java.classpath
Version 0.2.2
Leiningen dependency info:
[org.clojure/java.classpath "0.2.2"]
Changes in this release:
* Enhancement [CLASSPATH-5]: extensible protocol to other classloaders
[CLASSPATH-
okay, new take solving the issue raised by Mark:
(defn uniquify [in format-fn]
(loop [[item :as in] (seq in)
{n item :as item-nbrs} {}
out []]
(if-not in
out
(let [format-fn (if n format-fn (constantly item))
new-item (format-fn item n)]
(rec
Laurent, your approach doesn't quite work:
=> (uniquify ["a_1" "a" "a"] (fn [s n] (str s \_ n)))
["a_1" "a" "a_1"]
On Fri, Jan 10, 2014 at 1:34 PM, Laurent PETIT wrote:
> okay, new take solving the issue raised by Mark:
>
> (defn uniquify [in format-fn]
> (loop [[item :as in] (seq in)
>
Thank you! I think it's useful.
I have done some simple tests. But I think general performance test may be
meaningless regardless of real world requirements.
os : ubuntu 13.10 64bit
memory: 16G
cpu: intel i7 4700MQ (4 cores 2.4GHz)
1. static file test
file: 29.7k (real contents from https://
Indeed, I should definitely recur as you do
Le vendredi 10 janvier 2014, Mark Engelberg a écrit :
> Laurent, your approach doesn't quite work:
> => (uniquify ["a_1" "a" "a"] (fn [s n] (str s \_ n)))
> ["a_1" "a" "a_1"]
>
>
>
> On Fri, Jan 10, 2014 at 1:34 PM, Laurent PETIT wrote:
>
> okay, new ta
Colin Yates writes:
> This and Jonas' are my current favourites, for what that's worth.
>
> Keep the suggestions coming!
here's another one that uses reductions. formatter would need to be
adapted a bit, since it currently also adds "_0" for the first name
seen:
(defn count-name
[name->coun
I meant the code that starts at line 257 (and continues to line 274): two
functions, the second one calls the first one.
Luckily, java.jdbc's code seems to pass all the test cases posted to this
thread so far (arguably more intuitively, the second occurrence gets "_2"
appended, the third "_3" e
On Jan 10, 2014, at 11:26 AM, Guru Devanla wrote:
> Another good book I thought you could get through faster in 'Pragmatic
> Clojure'.I found this book to be the next level to Clojure Programming.
Do you mean "Programming Clojure (2nd Ed)" by Stuart Halloway?
http://pragprog.com/book/shcloj2/pr
On 10 January 2014 21:06, Colin Yates wrote:
> Gosh - my public humiliation continues. Here is one that actually works:
>
> (first (reduce (fn [[results seen] item]
> (let [cnt (get seen item 0)]
> [(conj results (if (> cnt 0) (format-fn item cnt)
> i
On 11 January 2014 01:03, Alan Forrester
wrote:
> On 10 January 2014 21:06, Colin Yates wrote:
>> Gosh - my public humiliation continues. Here is one that actually works:
>>
>> (first (reduce (fn [[results seen] item]
>> (let [cnt (get seen item 0)]
>>
This was great news to hear. Looking forward to it.
Talks will be presented in two tracks
Does this mean there will be two stages/presentations at a time?
On Thursday, January 9, 2014 8:01:13 PM UTC-8, Alex Miller wrote:
>
> At long last, we have finalized the plans for Clojure/West 2014!
>
>
Today I released the first version of the tools.analyzer[1] and
tools.analyzer.jvm[2] contrib libraries, here are the leiningen coordinates:
[org.clojure/tools.analyzer "0.1.0-alpha1"]
[org.clojure/tools.analyzer.jvm "0.1.0-alpha1"]
Right now the only documentation for both those libraries is in
On 11 January 2014 01:14, Alan Forrester
wrote:
> On 11 January 2014 01:03, Alan Forrester
> wrote:
>> On 10 January 2014 21:06, Colin Yates wrote:
>>> Gosh - my public humiliation continues. Here is one that actually works:
>>>
>>> (first (reduce (fn [[results seen] item]
>>>
Hi,
In clojure/cljs, what is the simplest way to check if a given object is a
async/chan ?
Thanks!
--
--
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 a
Consider this snipplet of code:
(. js/console log (type (str "abc")))
(. js/console log (type (atom nil)))
(. js/console log (type (cljs.core/async 100)))
it outputs for me:
function String() { [native code] } app.cljs:13
function (state,meta,validator,watches){ this.state = state; this.m
Another style, using channels for local state, but could been plain old
iterators, slight golf warning:
(require '[clojure.core.async :refer [to-chan ["a" "a_1" "a_2" "a_3" "b" "a_2_1" "a_3_1" "a_3_1_1" "a_3_1_2" "a_4"]
On Friday, 10 January 2014 14:59:10 UTC, Colin Yates wrote:
>
> I have a s
Try println, prn, pr-str. The only sensible thing is to compare
constructors.
On Friday, January 10, 2014, t x wrote:
> Consider this snipplet of code:
>
> (. js/console log (type (str "abc")))
> (. js/console log (type (atom nil)))
> (. js/console log (type (cljs.core/async 100)))
>
>
> it
Eastwood is a Clojure lint tool. It analyzes Clojure source code in
Leiningen projects, reporting things that may be errors.
Installation instructions are in the documentation here:
https://github.com/jonase/eastwood
For example, did you know that if you use clojure.test to write tests, and
81 matches
Mail list logo