Re: Risks of (over-)using destructuring?

2009-07-24 Thread jan
font-lock-function-name-face nil t)) + ;; Private keywords :foo- + ("\\<:\\sw+-\\>" 0 font-lock-constant-face) ;; Constant values. ("\\<:\\sw+\\>" 0 font-lock-builtin-face) ;; Meta type annotation #^Type -- jan --~--~-~--~~-

Re: Idiom for array slicing

2009-08-17 Thread jan
d do it: (defn extract [coll & keys] (map #(get coll %) keys)) or (defn slice [coll & keys] (remove nil? (map #(get coll %) keys))) -- jan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clo

Re: Printing to *out* in another thread

2009-10-17 Thread jan
edirect output to the repl with M-x slime-redirect-inferior-output or place this line in your .emacs file (add-hook 'slime-connected-hook 'slime-redirect-inferior-output) -- jan --~--~-~--~~~---~--~~ You received this message because you are subscribed t

Re: Baffled by NPE

2009-11-03 Thread jan
] (when-not (empty? items) (f (first items)) (recur f (rest items -- jan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegrou

Re: Code formatter

2009-11-05 Thread jan
;    aligned with the first by inserting additional spaces before the >    ;, the comments are aligned in this manner; exception to item 2. it doesn't handle these comments gracefully (format-code " header comment (defn test-comments []

Re: newbie question

2009-11-11 Thread jan
(fn [x] (every? (dual x) preds))) > > (filter > (conjunction even? (partial >= 16) (partial <= 9)) > (range 1 20)) for cases like this you can also leverage reader macros (filter #(and (even? %) (>= 16 %) (<= 9 %)) (range 1 20)) -- jan -- You received this message

Re: Topological sort

2009-11-11 Thread jan
te output of the sorting. I was wondering if anyone has > already done something similar? clojure.contrib.graph/dependency-list might be close enough for you (use 'clojure.contrib.graph) (dependency-list {:nodes [:a :b :c] :neighbors {:a [:b :c]

Re: Code improvement: incrementing a meta val

2009-11-18 Thread jan
"Increments the :index val in the givens state's metadata." [state] (vary-meta state update-in [:index] inc)) -- jan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googl

Re: variation of time macro

2009-12-14 Thread jan
average time in the report? > > Usage: > user> (time 10 (* 21 2)) > "Elapsed time: 0.201 msecs, Average: 0.0201 msecs" > 42 > user>  I think this is a bad idea, read this article for reasons why http://www.ibm.com/developerworks/java/library/j-benchmark1.html --

Re: Clojure in production

2013-06-13 Thread jan
Hi Plínio, at gateprotect, we use clojure in our firewall product for model representation and doing all the hard/logic work. Some stats: ~ 370 namespaces ~ 25000 sloc A great part of that is written in our model DSL. Cheers, Jan http://www.gateprotect.com We are hiring! http

Re: Indexing a nested sequence

2011-08-12 Thread Jan
mensional input string: (zipmap (map vector (for [y (range height) x (range width)] y) (cycle (range width))) "#I##O#") => {[1 2] \#, [1 1] \O, [1 0] \#, [0 2] \#, [0 1] \I, [0 0] \#} HTH, Jan -- You received this message because you are subsc

Re: Monads in Clojure

2008-11-21 Thread jan
Stuart Sierra writes: > Rich gives out commit permission on clojure-contrib to people who are > interested, but he doesn't dictate what goes in. You have to sign the > Clojure Contributor agreement, which basically says that if the > Clojure license changes at some point, you allow your contribut

Re: delimited continuations for web development

2008-12-02 Thread Jan Rychter
Rich Hickey <[EMAIL PROTECTED]> writes: > On Jun 20, 11:58 am, Jaime Barciela <[EMAIL PROTECTED]> wrote: >> Hello Phil, >> >> My understanding is that Common Lisp doesn't have support for >> continuations either and that's why Weblocks uses cl-cont (http:// >> common-lisp.net/project/cl-cont/, a l

Re: Superficial barriers to entry

2008-12-18 Thread Jan Rychter
Mibu writes: > I recommended clojure to a dozen friends or so and after a while none > of them stuck with it. I know clojure being a lisp and being at the > current development stage is not for everyone, but after I probed why > people gave up with it I saw the barriers to entry were largely > su

Support for disabling forms (reader macro similar to CL's #-(and))

2009-01-25 Thread Jan Rychter
I couldn't find anything in Clojure that would correspond to Common Lisp's reader conditionals, in particular the extremely useful #-(and) idiom. I would like to suggest the inclusion of a reader macro: #* or something of the kind, that would simply ignore the form right after it. That would allo

zipper: missing root-loc

2009-01-25 Thread Jan Rychter
I tried using the zipper data structure and immediately noticed, that there is a function I need, which isn't there. I would like to have something like root-loc (with a better name), that would do exactly what root does, except it would return a tree location, not just the root node. Or perhaps

Re: Support for disabling forms (reader macro similar to CL's #-(and))

2009-01-25 Thread Jan Rychter
Meikel Brandmeyer writes: > Am 25.01.2009 um 17:11 schrieb Zak Wilson: > >> Clojure has that in the comment form: (comment (do (not (eval this > > No. That's not equivalent. comment leaves a nil behind, while #* > would not. > > [:a (comment :b) :c] => [:a nil :c] > [:a #* :b :c] => [:a :c]

zip/down bug?

2009-01-25 Thread Jan Rychter
I think zip/down has a bug. It effectively does (when (children loc) ...), and since in Clojure empty list isn't false, it ends up adding nodes in my tree. Shouldn't it check for (when-not (empty? (children loc)) ...) ? --J. --~--~-~--~~~---~--~~ You received thi

Re: Support for disabling forms (reader macro similar to CL's #-(and))

2009-01-25 Thread Jan Rychter
Mark Volkmann writes: > On Sun, Jan 25, 2009 at 1:43 PM, Rich Hickey wrote: >> On Jan 25, 1:43 pm, Jan Rychter wrote: >>> Meikel Brandmeyer writes: >>> > Am 25.01.2009 um 17:11 schrieb Zak Wilson: >>> >>> >> Clojure has that in the comme

Re: Support for disabling forms (reader macro similar to CL's #-(and))

2009-01-25 Thread Jan Rychter
Mark Volkmann writes: > On Sun, Jan 25, 2009 at 1:43 PM, Rich Hickey wrote: >> On Jan 25, 1:43 pm, Jan Rychter wrote: >>> Meikel Brandmeyer writes: >>> > Am 25.01.2009 um 17:11 schrieb Zak Wilson: >>> >>> >> Clojure has that in the comme

Re: zip/down bug?

2009-01-26 Thread Jan Rychter
Christophe Grand writes: > Jan Rychter a écrit : >> I think zip/down has a bug. It effectively does (when (children loc) >> ...), and since in Clojure empty list isn't false, it ends up adding >> nodes in my tree. >> >> Shouldn't it check for (when-not

Re: zipper: missing root-loc

2009-01-26 Thread Jan Rychter
Chouser writes: > On Sun, Jan 25, 2009 at 9:46 AM, Jan Rychter wrote: >> From what I understand, currently the only way is to get the root >> node and then recreate the entire zipper structure. This seems >> unnecessary. > > I think what you're asking for sounds

Re: Support for disabling forms (reader macro similar to CL's #-(and))

2009-01-26 Thread Jan Rychter
Rich Hickey writes: > On Jan 26, 11:15 am, Cosmin Stejerean wrote: >> On Mon, Jan 26, 2009 at 6:34 AM, Rich Hickey wrote: >> >> > On Jan 25, 4:10 pm, Laurent PETIT wrote: >> > > #- makes sense (CL didn't always make things the wrong way :-) >&g

Re: Got a Clojure library?

2009-01-30 Thread Jan Rychter
ess not) Is unification planned? --J. > On Jan 29, 2009, at 10:04 AM, Rich Hickey wrote: > >> >> People regularly post here about Clojure libraries they are working >> on, and it is great to see the explosion of new libs for Clojure! >> >> I'd like t

Object system for Clojure?

2009-01-30 Thread Jan Rychter
There is something I don't understand about Clojure. There are multimethods (great), but I can't seem to find objects they can operate on. I come to Clojure from a Common Lisp background, having done a fair bit of CLOS programming. Mind you, I am not necessarily a fan of overly complex object hier

Re: Object system for Clojure?

2009-01-31 Thread Jan Rychter
Stuart Sierra writes: > On Jan 30, 1:09 pm, Jan Rychter wrote: >> From what I read, the reasoning is that Clojure provides extremely >> general multimethods where you have to define a dispatch function. On >> the object side, there is metadata and you can do with it what

Re: Object system for Clojure?

2009-01-31 Thread Jan Rychter
David Nolen writes: > At this point you have to roll your own, I have an experimental thing I plan > on fleshing out temporarily called CLJOS. I've implemented field > inheritance, type inheritance, basic multiple inheritance, basic > introspection. Search the mailing list for CLJOS and you'll s

loop bug?

2009-02-01 Thread Jan Rychter
"loop is exactly like let, except that it establishes a recursion point at the top of the loop, with arity equal to the number of bindings. See recur." (let [[a b] [1 2]] [a b]) => [1 2] (as expected) However: (loop [[a b] [1 2]] (if (= a 2) true (recur [(+ a 1) (+

Re: loop bug?

2009-02-01 Thread Jan Rychter
Meikel Brandmeyer writes: > Am 01.02.2009 um 14:27 schrieb Jan Rychter: > >> (loop [[a b] [1 2]] >>(if (= a 2) >> true >> (recur [(+ a 1) (+ b 1)]))) > > 1:1 user=> (loop [[a b] [1 2]] > (if (= a 2) >

Parenscript in clojure?

2009-02-18 Thread Jan Rychter
Is anyone working on a Parenscript (http://common-lisp.net/project/parenscript/) for Clojure? If not, perhaps someone would like to start? :-) Parenscript is an incredibly useful Javascript generator which makes writing web applications in Common Lisp much more pleasant. In particular, it gives

Re: Support for disabling forms (reader macro similar to CL's #-(and))

2009-02-22 Thread Jan Rychter
Following up on my own post: Jan Rychter writes: > Rich Hickey writes: >> On Jan 26, 11:15 am, Cosmin Stejerean wrote: >>> On Mon, Jan 26, 2009 at 6:34 AM, Rich Hickey wrote: >>> >>> > On Jan 25, 4:10 pm, Laurent PETIT wrote: >>> > >

SLIME and clojure problem

2009-02-22 Thread Jan Rychter
I have a problem that I am unable to solve by myself. I've been trying to use parts of the weld framework by Mark McGranaghan. However, clojure fails to compile it with an error I don't understand: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Symbol [Thrown class

Re: Parenscript in clojure?

2009-02-22 Thread Jan Rychter
Konrad Hinsen writes: > On Feb 18, 2009, at 9:39, Jan Rychter wrote: > >> Is anyone working on a Parenscript >> (http://common-lisp.net/project/parenscript/) for Clojure? > > There's Chouser's ClojureScript in clojure.contrib. I don't know if > it is

Re: Support for disabling forms (reader macro similar to CL's #-(and))

2009-02-22 Thread Jan Rychter
Rich Hickey writes: [...] How about #_ ? >>> >>> I would prefer #-, but if you think you might want to have a reader >>> conditional system similar to CL in the future, #_ is fine as well. >>> >>> Actually, any character is better than plucking out multi-line >>> forms and >>> commenting t

Re: Parenscript in clojure?

2009-02-22 Thread Jan Rychter
>> I'm curious about what you need that's different from what >> ClojureScript provides: a mechanism for compiling a subset of Clojure >> to JavaScript code that behaves like you'd expect the Clojure code to >> behave. Dan writes: > ParenScript is a subset of common lisp and a javascript generato

Re: SLIME and clojure problem

2009-02-22 Thread Jan Rychter
Hah! Thanks! I didn't spot that! That indeed seems to be the cause. > In the mean time, a check for this was added in the latest swank- > clojure (but that needs lazier seqs, so you may want to hold off on > that). I am holding off on Clojure and swank-clojure upgrades until dust se

Clojure vectors

2009-07-13 Thread Jan Rychter
I've been trying to implement stacks using vectors in Clojure. In case you wonder why, it's because I need stacks with a fast item count operation. While experimenting I discovered some vector properties which were unexpected. conj adds at the end of the vector as expected: user> (conj [1 2 3] 4

Re: Clojure vectors

2009-07-15 Thread Jan Rychter
Thanks to everyone who replied in this thread. I am impressed by the signal-to-noise ration on this list and by the quality of replies. I will try to reply to everyone in a single post, trying to summarize. > On Jul 13, 11:15 am, Jan Rychter wrote: >> I've been trying to implemen

turn a seq into a list

2009-07-15 Thread Jan Rychter
I've been looking for a function that would take a seq and create a list (a real clojure.lang.PersistentList), but haven't found one. The closest I got was: (apply list my-seq) Essentially, I'm looking for something similar to (vec) that returns lists. --J. --~--~-~--~~

Re: turn a seq into a list

2009-07-16 Thread Jan Rychter
Jarkko Oranen writes: > On Jul 15, 1:54 pm, Jan Rychter wrote: >> I've been looking for a function that would take a seq and create a list >> (a real clojure.lang.PersistentList), but haven't found one. The closest >> I got was: >> >> (apply list

sizeof in Clojure

2009-07-21 Thread Jan Rychter
Is there a way to get the size of a data structure in Clojure? I've been wondering how much more space-efficient vectors are than lists, but I don't know how to measure it. --J. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goo

Re: sizeof in Clojure

2009-07-24 Thread Jan Rychter
> On Jul 21, 5:51 am, Jan Rychter wrote: >> Is there a way to get the size of a data structure in Clojure? >> >> I've been wondering how much more space-efficient vectors are than >> lists, but I don't know how to measure it. Stuart Sierra writes: > Shor

Re: ANN: Clojuratica -- A seamless interface to Mathematica for fast numerics and more

2009-07-27 Thread Jan Rychter
Garth Sheldon-Coulson writes: > I would like to announce *Clojuratica ,* a > high-performance, seamless Clojure interface to Wolfram > Mathematica. Wow! This is exactly what I needed. I've been looking for interfaces to

Re: Idiom for array slicing

2009-08-17 Thread Jan Marecek
> (defn slice [coll & keys] >  (remove nil? (map #(get coll %) keys))) this doesn't handle nils, here is a better definition (defn slice [coll & keys] (let [not-found (Object.)] (remove #(identical? % not-found) (map #(get coll % not-foun

replace-subtree for zippers?

2009-08-20 Thread Jan Rychter
Has anyone written a replace-subtree for zippers? I need to replace an entire subtree with another one (from another zipped structure) and found out that zip/replace won't help me there. Writing my own has proven remarkably difficult, or perhaps I'm missing something obvious. Any help appreciate

Re: clojure success story ... hopefully :-)

2009-08-21 Thread Jan Rychter
bradford cross writes: > Hi Chad, yep, that was me. We do hope to open source some stuff soon. > > First will probably be our wrappers for cascading/hadoop and s3. Those would be of great interest to many of us. Please do. --J. --~--~-~--~~~---~--~~ You receive

Re: replace-subtree for zippers?

2009-08-21 Thread Jan Rychter
Meikel Brandmeyer writes: > A transcript: > > ; Create trees... > user=> (def t1 [1 [[2 3] 4]]) > #'user/t1 > user=> (def t2 [[[:a :b] :c] :d]) > #'user/t2 > > ; Create zippers and navigate to subtrees... > user=> (def zt1 (-> (zip/vector-zip t1) zip/down zip/right)) > #'user/zt1 > user=> (zip/no

Re: replace-subtree for zippers?

2009-08-22 Thread Jan Rychter
Meikel Brandmeyer writes: > Hi, > > On Aug 21, 12:05 pm, Jan Rychter wrote: > >> It isn't what I want. But that's because I misspecified what I actually >> wanted. I didn't think about the problem enough. I need something more >> akin to a spl

Re: replace-subtree for zippers?

2009-08-22 Thread Jan Rychter
Stefan van der Meer writes: > On Aug 21, 12:05 pm, Jan Rychter wrote: >> think crossover in genetic programming (this is actually what I need >> this for). > I've written a genetic programming framework in Clojure, it might > be of interest if you're looki

Re: Clojure/EPL and the GPL

2009-08-30 Thread Jan Rychter
Tassilo Horn writes: [...] > BTW: What's the reason that Clojure is licensed under the EPL and the > contrib stuff under CPL? Since clojure is not really eclipse-related, I > don't see a good rationale. IMHO, the Lesser GPL would be a much better > fit. Then you can use clojure also in commerc

Leiningen, Clojure and libraries: what am I missing?

2010-03-04 Thread Jan Rychter
I haven't hacked on new Clojure stuff for the past two months or so. Now, having updated my repositories, I find that everybody just dropped ant and moved to leiningen. I tried to make sense of things, but can't. I must be missing something big here. It seems that leiningen assumes that you are b

Re: group tag for clojure newsgroup

2010-03-04 Thread Jan Rychter
Rich Hickey writes: > On Mar 4, 2:56 am, TimDaly wrote: >> For the other groups that I subscribe to, the email subjects are >> always prefixed with the group name, e.g. >> >> Re: [sage-devel] This is the mail subject >> >> This makes it possible to reliably group the emails into folders. >> Is i

Re: When to use metadata

2015-01-29 Thread Jan Herich
Solussd is absolutely correct, but maybe even more simplistic (or easier to grasp) explanation would be to use metadata if you don't want the additional (meta)data to change the equality semantics of the map, for example: (def test-desc1 {:number-of-threads 10}) (def test-desc2 ^{:integration t

Clojure Jobs Available

2015-03-30 Thread Jan Drake
cureOne™ is the best place to be. We care about solid engineering, reliable and resilient systems, low latency distributed processing, streaming analytics, high scalability, and extreme performance… and we're doing all of them. If you're interested, please deliver a resume to jobs

Re: Is Clojure a language for growth?

2014-08-21 Thread Jan Ziniewicz
> > > If a company wants to be able to hire staff and get them up to speed, as > well as have options for bringing in contractors and outsourcing some work, > is Clojure a good choice? > My friend works in a project which is being rewritten from Rails to Clojure (due to usual scaling problems

Seeking Large Companies That Employ Clojure

2014-10-09 Thread Jan Drake
le, in production, etc. If you are one, please contact me directly; if you know of one, please make me an introduction. Onward in the great Clojure Adventure! Regards, Jan -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this g

Re: Question about test.check, and knossos

2014-10-23 Thread Jan Stępień
]. I find it very interesting but I haven't yet had time to try it out. It'd be great to have it integrated, though. I demonstrated the tentative API in [gist], where some simple properties of HashSet and Clojure vector are checked. The gist also shows how an exemplary failure looks, includ

Re: Question about test.check, and knossos

2014-10-26 Thread Jan Stępień
On Thursday, October 23, 2014 10:04:52 AM UTC-4, Jan Stępień wrote: I've begun to work on such a tool not long ago. Thomas Arts, who gave a talk at our local FP user group meetup [mλ], inspired me to try out the approach you're describing in Clojure.

Re: [ANN] stateful-check 0.1.0 - test stateful systems with test.check

2014-11-28 Thread Jan Stępień
Hi Carlo, Thanks for sharing! I see that generative testing of statful computations is a popular topic in the Clojure world these days; I think we've started working on our libraries nearly the same day :) https://github.com/jstepien/states All the best, Jan -- You received this me

Re: [ANN] stateful-check 0.1.0 - test stateful systems with test.check

2014-12-08 Thread Jan Stępień
tive was to expose an interface closely resembling original QuviQ eqc API. How natural this feels in Clojure is a subject open for discussion. I haven't felt constrained by this API. Still, to be honest, I haven't used it to test more than some simple experiments yet. Best, Jan --

Parsing and querying binary .fit files in Clojure

2017-04-05 Thread Jan Herich
ranges and also virtual elevation profile for accurate Cda estimations by Robert Chung's method <http://anonymous.coward.free.fr/wattage/cda/indirect-cda.pdf>. If you have any suggestions or ideas for improvement, just write me here, or open a PR. Cheers Jan -- You received this me

An Annotation within an Annotation

2017-11-01 Thread Jan Stavel
welcome. Have a good day, Jan Stavel -- 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 u

Re: An Annotation within an Annotation

2017-11-01 Thread Jan Stavel
n only be applied to IMetas, compiling:(rhsm/cockpit/tests/register_tests.clj:88:35) Have a good day, Jan Stavel -- 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

s/valid? does not tell me if the data is valid as supplied

2018-02-20 Thread Jan Rychter
I've been using spec for a while now, in a reasonably large code base (>30k lines of Clojure and ClojureScript) and there is an issue that bit me several times. I use conformers for coercing data that is *almost* what I need, usually when reading from JSON (RethinkDB). Common conformers are key

Re: s/valid? does not tell me if the data is valid as supplied

2018-02-21 Thread Jan Rychter
On Tuesday, February 20, 2018 at 4:53:33 PM UTC+1, Alex Miller wrote: > > This is exactly why we recommend that you not use conformers for coercion. > Conformers were added primarily as a tool for building custom composite > spec types (for example, we used it to build keys* from keys). > I am a

Re: s/valid? does not tell me if the data is valid as supplied

2018-02-22 Thread Jan Rychter
de don’t even mention s/conformer, I’m > not sure where that recommendation should live. Alex, any thoughts on this, > since you seem to be the one most often making the recommendation? > As a spec user, I would expect to learn about this from the spec guide. Also, I still believe t

Handy clojure function to transform prepared statement queries

2014-02-09 Thread Jan Herich
["id = ? AND user_id IN (?,?,?) AND msg_id = ?" 1 2 3 4 5]) Now my question is, do you think that something in this flavor would be good addition to clojure/java.jdbc or yesql libraries (the latter one is probably more appropriate for inclusion) ? If so, i will try to refine and

Re: Handy clojure function to transform prepared statement queries

2014-02-10 Thread Jan Herich
discuss this topic. Dňa pondelok, 10. februára 2014 0:16:01 UTC+1 Sean Corfield napísal(-a): > > As maintainer of java.jdbc I'd say this is a more appropriate feature > for a DSL library like SQLingvo or HoneySQL (which may already support > something like this - I haven&#x

Re: Handy clojure function to transform prepared statement queries

2014-02-10 Thread Jan Herich
6>. > > And until I do, I'm not going to document it, or make it official. But it's > there in v0.3.0, so if you want to field-test it, do let me know your > experiences. :-) > > (And, FWIW, I completely agree with Sean. This kind of thing definitely > be

Re: Example in Joy of Clojure, 2nd edition (MEAP)

2014-02-15 Thread Jan Herich
Hello Eric, You can rewrite this functionality with key# and r# instead of ~'key and ~'r and it would work just as well, it's only not necessary to use unique symbols here, because you are not using them in the function body anyway, so there is no danger of accidental var capture. To be hones

Re: (series of swap! on atom) ==> single swap!

2014-02-16 Thread Jan Herich
I'm afraid your understanding of atom swap! operations is not quite correct -> update function must (or should) be pure as well. See the documentationfor swap!, update function could be potentially called multiple times if there are more t

Re: (series of swap! on atom) ==> single swap!

2014-02-16 Thread Jan Herich
ranteed to run only once. Dňa pondelok, 17. februára 2014 2:36:59 UTC+1 t x napísal(-a): > > Hi Jan, > > You're right. I'm wrong. > > I'm grateful you pointed this out -- this would have otherwise been > impossible to debug. > >

Shutting down core.async executors threadpool

2014-02-24 Thread Jan Herich
/shutdown.sh), it won't quit. I can see with VisualVM that it is because of the core.async executors threadpool used to dispatch go blocks which is not properly teared down. Any ideas how to solve this ? Cheers Jan -- You received this message because you are subscribed to the Google G

Re: Shutting down core.async executors threadpool

2014-02-24 Thread Jan Herich
ybe it is a tomcat issue. > > > On Mon, Feb 24, 2014 at 7:06 PM, Jan Herich > > wrote: > >> Hi Folks, >> >> I developed an pedestal application which uses core.async for real-time >> server push. >> Everything works fine, except little problem w

Re: Latest web framework for clojure

2014-02-25 Thread Jan Herich
It depends also on your requirements. For example if you want your app to work in many deployment scenarios (standalone Jetty or Tomcat, J2EE web containers...) and you may have to use servlet 3.0 API asynchronous features, nothing beats pedestal currently. The concept of interceptors is lit

Re: Comparing Regular Expression pattens for equality?

2014-02-26 Thread Jan Herich
Clojure re-uses java.util.regex.Pattern objects. This object doesn't override equals method, so object references are always compared. But you can easily get pattern string from compiled pattern and then compare just them: user=> (= (.pattern #"test") (.pattern #"test")) true Dňa streda, 26.

Re: Comparing classes in case statement

2014-02-27 Thread Jan Herich
>From official clojure documentation: "The test-constants are not evaluated. They must be compile-time literals" Dňa štvrtok, 27. februára 2014 14:03:04 UTC+1 Markus Bader napísal(-a): > > Hello, > > if I am not too dumb, it seems that comparing for classes does not work in > case statements, li

Re: Idiomatic clojure on building a sequence

2014-05-21 Thread Jan Herich
Hi Colin, Have a look at the 'as->' macro, its very helpful in some cases, as: (-> [] (conj some-element) (as-> some-seq (if some-condition? (conj some-seq some-element) some-seq) (if some-other-condition? (conj some-seq some-other-element) some-seq)) (t

[ANN] Service-hub - Library for building service-oriented applications

2013-11-11 Thread Jan Herich
with complicated transaction strategies, or to implement asynchronous communication in the effective fashion out of the box, libraries like pedestal-service are much better at those kind of tasks. I still think it could be useful to people, so i decided to announce it. Feedback welcomed, Jan

Re: [ANN] Component: dependency injection and state management

2013-11-21 Thread Jan Herich
This is simple brilliant... The approach proposed and the component "framework" implementing it finally solves the issue with the "necessary evil" (start/stop interactions with statefull components in any bigger Clojure app) by cleverly taking only the best ideas (like using inferred dependency

Re: Akka-like framework in Clojure ?

2013-12-27 Thread Jan Herich
Hi Eric, Maybe pulsar is what you are looking for, but i recommend you to also discover the other way of doing concurrency in clojure instead of the actor model -> have a look at CSP and its

Re: Parallel http requests

2013-12-31 Thread Jan Herich
Maybe it's not exactly what you need, but i did similar thing once - i needed to scrape many linked html resources to extract tree data structure, each request/parse operation took considerable time - around 2 seconds - i was using clj-http/enlive combo (which is actualy Apache HttpClient/ TagS

Re: Sorting Nested Vectors and filter out some

2014-01-04 Thread Jan Herich
Hello Jeff, This should do the trick, at least it worked with data set you provided :) Dňa sobota, 4. januára 2014 11:31:07 UTC+1 Jeff Angle napísal(-a): > > Hi...I get my nested vector from a database, then map a function that > fo

Re: HttpKit, Enlive (html retrieval and parsing)

2014-01-11 Thread Jan Herich
I don't recommend using java's built in HTTP retrieval (by passing java.net.URL object to enlive html-resource function). Not only is it significantly slower then using clj-http (which uses apache-http client under the hood), but it's also unreliable when issuing more parallel requests. Current

Re: Adding query customization to Ring-based REST APIs

2014-01-12 Thread Jan Herich
Hello Alexander, I did some work in this area some time ago, and the result was service-hub library - created to simplify basic CRUD services. It's designed to allow more then one type of data-store, currently it supports SQL databases (i use my own fork

Re: A question about lazy seq with io

2014-01-13 Thread Jan Herich
As Mauricio already mentioned, map is not meant to be used for side-effects, if you want to need to evaluate a sequence for side-effects, use doseq instead. Regarding your first question about explicit loop-recur, i think it's reasonable w

Re: [ANN] incise 0.1.0 - An extensible static site generator

2014-01-14 Thread Jan Herich
Hello Ryan, Thank you for the project, i was always missing a good static site generator written in clojure ! You took some interesting design decisions with extensibility. I'm currently working on the similar project , even if my design is very differe

Re: Grouping and nested keys in a hash

2014-01-16 Thread Jan Herich
Another way of doing that: (def data {:b--name "B", :a--id 1, :b--id 2, :a--name "A"}) (defn transform [data delimiter] (reduce (fn [acc [k v]] (let [[f-k s-k] (-> k (name) (str/split delimiter))] (assoc-in acc [(keyword f-k) (keyword s-k)] v))) {} s)) (transform data #"--") ;; {:a

Re: Grouping and nested keys in a hash

2014-01-16 Thread Jan Herich
My solution would work only for fixed 2 level deep maps, but it would be not so hard to modify it that it will be much more generic :) Dňa štvrtok, 16. januára 2014 14:46:46 UTC+1 James napísal(-a): > > Hello all, > > I've found myself stuck trying to move matching keys in a hash into a > nested

Re: Grouping and nested keys in a hash

2014-01-16 Thread Jan Herich
Here we go, more generic solution: (defn transform [data delimiter] (reduce (fn [acc [k v]] (let [key-strs (-> k (name) (str/split delimiter))] (assoc-in acc (mapv keyword key-strs) v))) {} s)) Dňa štvrtok, 16. januára 2014 14:46:46 UTC+1 James napísal(-a): > > Hello all, > > I've fo

Re: Grouping and nested keys in a hash

2014-01-16 Thread Jan Herich
Oh, yes, my mistake, it should be data instead of s Dňa štvrtok, 16. januára 2014 15:56:18 UTC+1 James napísal(-a): > > Thank you for sharing. > > I think the final `s` needs to be `data`, right? > > On 16 Jan 2014, at 14:53, Jan Herich > > wrote: > > Here we go, mo

Re: Grouping and nested keys in a hash

2014-01-16 Thread Jan Herich
and only later i collected my courage and approached Clojure again. Determination and patience is very important. Dňa štvrtok, 16. januára 2014 15:54:47 UTC+1 James napísal(-a): > > Wow, I feel like a clumsy fool bashing parens together. > > Have you been using Clojure for a long tim

Servlet adapter for ring handlers with support for asynchronous processing

2014-01-18 Thread Jan Herich
n... If you assembled something similar yourself, or you now about such project (even in development, immature, alpha), please let me know, thank you very much. Jan -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group

Re: Servlet adapter for ring handlers with support for asynchronous processing

2014-01-18 Thread Jan Herich
t;, looks very interesting. Jan Dňa sobota, 18. januára 2014 20:32:19 UTC+1 Shantanu Kumar napísal(-a): > > Hi Jan, > > This not directly related, but i thought it might be useful in some way. > In case you do the java interop stuff on your own to implement the servlet > 3

Re: core.async count in a channel

2014-01-21 Thread Jan Herich
ur description of the problem, but for me, it seems like a perfect fit. Jan Dňa utorok, 21. januára 2014 17:56:56 UTC+1 Paul Viola napísal(-a): > > I think this is all well and good for a particular use of channel. > > So perhaps I am misusing channels?? > > To repeat: in one case I

Re: Read file contents as map

2014-01-26 Thread Jan Herich
And if you are not sure about that, just use edn-only reader: (require '[clojure.tools.reader.edn :as edn]) (edn/read-string (slurp "file")) Dňa nedeľa, 26. januára 2014 17:12:32 UTC+1 mynomoto napísal(-a): > > If you are sure that the file doesn't contain malicious code you can use: > > (read-s

Re: side-effect only function with map-like syntax (again)

2014-01-27 Thread Jan Herich
How about doseq ? Dňa utorok, 28. januára 2014 5:28:04 UTC+1 Mars0i napísal(-a): > > Back in 2007 ( > https://groups.google.com/forum/#!searchin/clojure/mapc/clojure/x0PDu_D6mP0/3A7CZe-ZDWAJ), > > Henk Boom raised the possibility of inclu

Idiomatic way to construct potentially time bound target channel in core.async

2014-01-31 Thread Jan Herich
Hello Folks, I need to construct core.async channel with following semantics: 1. When the channel is created, timeout is attached to channel 2. After timeout passes out, channel is closed 3. It's possible to detach timeout from the channel before it passes out Now i implemented it with something

Re: Idiomatic way to construct potentially time bound target channel in core.async

2014-02-02 Thread Jan Herich
If anyone is interested, that's roughly what i'm currently thinking about... (ns async-util.input-pipe (:require [clojure.core.async.impl.protocols :as impl] [clojure.core.async :refer [ > Hello Folks, > > I need to construct core.async channel with following semantics: > > 1. When t

Re: Idiomatic way to construct potentially time bound target channel in core.async

2014-02-03 Thread Jan Herich
Ok, so i'm thinking about such one-shot detachable input pipe channels... (ns async-util.input-pipe (:require [clojure.core.async.impl.protocols :as impl] [clojure.core.async :refer [ > Hello Folks, > > I need to construct core.async channel with following semantics: > > 1. When the

  1   2   >