Re: What's the point of - ?

2013-03-14 Thread dmirylenka
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

Re: Any alternatives for these two ugly patterns?

2013-05-26 Thread dmirylenka
(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

Re: Any alternatives for these two ugly patterns?

2013-05-26 Thread dmirylenka
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

Re: community interest in machine learning (?)

2012-07-16 Thread dmirylenka
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,

Re: Pattern of Succinctness

2012-08-13 Thread dmirylenka
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:

Re: Pattern of Succinctness

2012-08-13 Thread dmirylenka
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

Re: Ideas for interactive tasks

2012-08-13 Thread dmirylenka
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

Re: Ideas for interactive tasks

2012-08-14 Thread dmirylenka
, 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

Re: Ideas for interactive tasks

2012-08-16 Thread dmirylenka
, 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

Re: Clojure Sticker

2012-08-28 Thread dmirylenka
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

Re: (merge) = nil

2012-08-29 Thread dmirylenka
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

another why: (flatten #{:a :b}) = () ???

2012-08-29 Thread dmirylenka
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

Re: (merge) = nil

2012-08-29 Thread dmirylenka
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

Re: another why: (flatten #{:a :b}) = () ???

2012-08-29 Thread dmirylenka
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

Re: (merge) = nil

2012-08-29 Thread dmirylenka
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

Re: (merge) = nil

2012-08-29 Thread dmirylenka
: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

Re: (merge) = nil

2012-08-30 Thread dmirylenka
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

Re: anonymous functions with names

2012-09-03 Thread dmirylenka
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

Re: Found bug in contains? used with vectors.

2012-09-04 Thread dmirylenka
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

Re: Found bug in contains? used with vectors.

2012-09-04 Thread dmirylenka
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

Re: IllegalStateException I/O in transaction in REPL

2012-06-14 Thread dmirylenka
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

Re: IllegalStateException I/O in transaction in REPL

2012-06-22 Thread dmirylenka
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

Re: Clojure Sticker

2012-07-06 Thread dmirylenka
+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

Re: Multiple args: opts map vs inline arguments

2013-06-17 Thread dmirylenka
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

Re: In what OS do you code?

2013-06-17 Thread dmirylenka
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

Re: Data vs API

2013-06-19 Thread dmirylenka
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*

Re: matching, assigning and branching in one form

2013-06-23 Thread dmirylenka
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