or even without let:
(condp re-find msg
#^:(.*?)!.*PRIVMSG (.*) :(.*) : (fn [[_ from to message]] (true-form
...)) (false-form...))
On Saturday, June 22, 2013 11:26:35 PM UTC+12, Vincent wrote:
What about using condp?
(condp re-find msg
#^:(.*?)!.*PRIVMSG (.*) :(.*) : #(let [[_ from to
Great question and great answers, thank you.
Regarding (3),
what if want to process various customer order implementations (say, sort
them) in a polymorphic way depending just on their total-price?
Assuming I do not control the implementations..
Is it ok in this case to define *HasTotalPrice*
According, to the library coding standards, the first is better:
(release-sharks 2 :laser-beams true); good
(release-sharks 2 {:laser-beams true}) ; bad
http://dev.clojure.org/display/design/Library+Coding+Standards
On Tuesday, June 18, 2013 5:26:15 PM UTC+12, Omer Iqbal wrote:
Hey
OS X on the working machine, Ubuntu on the servers.
For my project it makes little difference, especially with *brew* on the
mac.
Currently moving from vi to emacs.
On Saturday, June 15, 2013 1:46:37 AM UTC+12, Erlis Vidal wrote:
Hi,
I'm a bit curious to know in what OS do you code. Do you
(merge {:attr something} obj)
--
--
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.
To unsubscribe
Sorry, that's just another suggestion for the first pattern.
For the second, I would use:
(cond- obj (some-test obj) some-transformation)
On Sunday, May 26, 2013 12:05:49 PM UTC+2, dmirylenka wrote:
(merge {:attr something} obj)
--
--
You received this message because you are subscribed
For me - is a bread and butter of working with collections, like here:
(- some-collection
(concat other-collection)
distinct
(filter some-predicate)
(sort-by some-sort-fn)
(take 10))
On Monday, March 11, 2013 11:58:29 AM UTC+1, edw...@kenworthy.info wrote:
So
As for contains? behavior on lists, it is fixed
(CLJ-932https://github.com/clojure/clojure/commit/3acb6ee7ec5c295ae14de861d03a5efd115a5968)
in Clojure 1.5, some 17 days ago:
= (contains? '(1 2 3) 2);
IllegalArgumentException contains? not supported on type:
clojure.lang.PersistentList ...
I
Instead of
(let [predicate #(contains? (set unselect) %1)] ...)
I would write
(let [predicate (set unselect)] ...)
On Tuesday, September 4, 2012 11:10:04 AM UTC+2, Marcus Lindner wrote:
I wanted to use it to select a random element in a collection (set,
vector or list) where I can define
Just 2 cents:
A name you give to the anonymous function also appears in the stack traces
instead of the things like fn_123_4532,
which is very convenient for debugging.
On Friday, August 31, 2012 5:52:55 PM UTC+2, Erlis Vidal wrote:
Hi guys,
I've been reading but I'm still confused about
without having
to create a map out of them:
(assoc m :a 1 :b 2) ; vs.
(conj m {:a 1 :b 2})
On Thursday, August 30, 2012 1:31:41 AM UTC+2, dmirylenka wrote:
I sort of remember Rich Hickey say this, but I am not sure :).
As far as I see it, it is generally better to use more specific functions
I would say, they treat nil as an empty sequence, which makes nil,
effectively, a unit:
(assoc nil :a :b) ; = {:a :b}
(merge nil {:a :b}) ; = {:a :b}
etc.
On Wednesday, August 29, 2012 7:36:26 PM UTC+2, Moritz Ulrich wrote:
This isn't true in Clojure: http://clojure.org/lisps
However, most
Calling flatten on anything that is not 'sequential?' returns an empty
sequence:
(flatten 1); = ()
(flatten Hi); = ()
With sets if feels somewhat strange:
(flatten #{#{:a} #{:b :c}}); = ()
For some reason I expected #{#{:a} #{:b :c}} to equal #{:a :b :c}.
Ok, the docstring says: Takes any
Hm.. There seem to be cases when nil is not equivalent to {} when working
with maps:
(conj {} [:a :b]); = {:a :b}
(conj nil [:a :b]); = ([:a :b])
Although, code working with maps shouldn't use conj anyway.
Any other examples?
On Wednesday, August 29, 2012 9:08:07 PM UTC+2, dmirylenka wrote
the careless programmer. I was all set to submit a patch
condemning the elegant but slow implementation when I noticed that the new
reducers version of flatten in 1.5 alphas is amazingly fast. So that
looks like the way to go.
On Aug 29, 2012, at 3:47 PM, dmirylenka daniilm
understanding ) .
On Thursday, August 30, 2012 12:05:48 AM UTC+2, Meikel Brandmeyer (kotarak)
wrote:
Hi,
Am 29.08.2012 um 23:38 schrieb dmirylenka:
Although, code working with maps shouldn't use conj anyway.
Why?
Kind regards
Meikel
--
You received this message because you are subscribed
:46:05 AM UTC+2, Brian Marick wrote:
On Aug 29, 2012, at 2:08 PM, dmirylenka wrote:
I would say, they treat nil as an empty sequence, which makes nil,
effectively, a unit:
(assoc nil :a :b) ; = {:a :b}
(merge nil {:a :b}) ; = {:a :b}
It's not a unit if you're using `if-let
I've got my stickers!
So happy...
On Friday, July 6, 2012 11:09:29 AM UTC+2, dmirylenka wrote:
+1
On Sunday, June 10, 2012 3:03:46 AM UTC+2, aboy021 wrote:
Is there anywhere that I can get a Clojure sticker?
--
You received this message because you are subscribed to the Google
Groups
, 2012 9:17:26 PM UTC+2, Nikita Beloglazov wrote:
Daniil, yes it is
Do you have some suggestions about tasks or teaching at the BSU in
generally? :)
Nikita
On Mon, Aug 13, 2012 at 9:00 PM, dmirylenka daniilm...@gmail.comwrote:
Wow, too bad I already graduated :)
ФПМИ?
On Thursday
, dmirylenka daniilm...@gmail.comjavascript:
wrote:
Wow, too bad I already graduated :)
ФПМИ?
On Thursday, August 9, 2012 5:28:54 PM UTC+2, Nikita Beloglazov wrote:
Thank you, Jim. This is Belarusian State University.
On Thu, Aug 9, 2012 at 6:23 PM, Jim - FooBar(); jimpi...@gmail.comwrote
Should be (filter (comp not nil?) coll)
On Sunday, August 12, 2012 9:44:11 PM UTC+2, Pierre-Henry Perret wrote:
I prefer (filter (partial not nil?) coll) as a HOF
Le dimanche 12 août 2012 20:46:59 UTC+2, rmarianski a écrit :
On Sun, Aug 12, 2012 at 11:22:55AM -0700, Takahiro Hozumi wrote:
Using threading operators + anonymous functions sometimes yields more
succinct code than using HOF,
especially because 'partial' and 'comp' are such long names:
(comp count (partial filter nil?) (partial map foo))
#(- % (map foo) (filter nil?) count)
On Sunday, August 12, 2012 7:35:16 PM
Wow, too bad I already graduated :)
ФПМИ?
On Thursday, August 9, 2012 5:28:54 PM UTC+2, Nikita Beloglazov wrote:
Thank you, Jim. This is Belarusian State University.
On Thu, Aug 9, 2012 at 6:23 PM, Jim - FooBar();
jimpi...@gmail.comjavascript:
wrote:
On 09/08/12 16:21, Nikita
Not sure about the community, but I personally would be very interested in
having a machine learning library or environment in Clojure.
I'm playing with classification and clustering of academic papers, and use
clojure for the whole research cycle - crawling and parsing the data from
the web,
+1
On Sunday, June 10, 2012 3:03:46 AM UTC+2, aboy021 wrote:
Is there anywhere that I can get a Clojure sticker?
--
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
at 13:33 -0700, dmirylenka wrote:
Could you please explain a bit more?
I don't have any dosync in my code.
Look through your backtrace for a call to
clojure.lang.LockingTransaction.runInTransaction. Its caller is using
dosync.
--
Stephen Compall
^aCollection allSatisfy
Could you please explain a bit more?
I don't have any dosync in my code.
Daniil
On Thursday, June 14, 2012 4:17:46 PM UTC+2, Meikel Brandmeyer (kotarak)
wrote:
Hi,
the exception probably stems from the fact that you do the database
interaction inside a dosync transaction.
Kind regards
27 matches
Mail list logo