Re: first vals first vals

2013-11-21 Thread John Szakmeister
On Thu, Nov 21, 2013 at 4:08 AM, Zhemin Lin lin.zhe...@gmail.com wrote: Hi. I'm quite annoyed by the ugly smell of (first (vals (first ... )). Is there any better way to do it? user= (- {:key1 {:cf {:cq 0,1,2,3}}} vals first vals first vals first (clojure.string/split #,)) [0 1 2 3] I

Re: first vals first vals

2013-11-21 Thread John Szakmeister
On Thu, Nov 21, 2013 at 4:32 AM, Zhemin Lin lin.zhe...@gmail.com wrote: Thanks, John Jernau. What if :cf, :cq are not fixed, and I don't really care about the keys, but only the value of the value of the value ...? You might want to consider tree-seq to get at the innermost string: (last

Re: [ANN] optparse-clj: Functional GNU-style command line options parsing

2013-11-22 Thread John Szakmeister
On Wed, Aug 7, 2013 at 11:53 AM, guns s...@sungpae.com wrote: Hello, I'd like to announce optparse-clj, a command line options parser that supports GNU option parsing conventions: https://github.com/guns/optparse-clj [guns.cli/optparse 1.0.0] The interface is modelled after

Re: [ANN] optparse-clj: Functional GNU-style command line options parsing

2013-11-23 Thread John Szakmeister
On Fri, Nov 22, 2013 at 8:30 PM, guns s...@sungpae.com wrote: On Fri 22 Nov 2013 at 07:22:20PM -0500, John Szakmeister wrote: This looks very nice. Have you considered something along the lines of Python's argparse? http://docs.python.org/dev/library/argparse.html Thank you. I am

Re: semantics of ! on closed channels

2014-01-24 Thread John Szakmeister
On Thu, Jan 23, 2014 at 9:17 PM, Cedric Greevey cgree...@gmail.com wrote: [meta, but about something apparently triggered by the message, from this thread, that I'm quoting] Why did reading this post cause gmail to go bonkers? I saw this thread had new articles since earlier today, brought it

Re: What is the status of Clojure on LLVM or C?

2013-03-28 Thread John Szakmeister
On Wed, Mar 27, 2013 at 5:21 PM, Timothy Baldridge tbaldri...@gmail.com wrote: What use-case do you have for such an implementation? Is there something that Clojure on LLVM will give you that Clojure on the JVM or on V8 won't allow you to do? Clojure on C would likely allow me to use Clojure

Re: What is the status of Clojure on LLVM or C?

2013-03-29 Thread John Szakmeister
On Thu, Mar 28, 2013 at 9:26 PM, Mikera mike.r.anderson...@gmail.com wrote: On Friday, 29 March 2013 05:45:53 UTC+8, Laurent PETIT wrote: 2013/3/28 Marko Topolnik marko.t...@gmail.com: Or you may have just a trivial requirement for a program that both starts and executes quickly. To

Re: What is the status of Clojure on LLVM or C?

2013-03-29 Thread John Szakmeister
On Fri, Mar 29, 2013 at 5:28 AM, Marko Topolnik marko.topol...@gmail.com wrote: I certainly don't see that. I've measured this more than a few times, and it's several seconds for a simple Hello World Java application on any machine that I can touch. Additionally, on an embedded system, I'm

Re: What is the status of Clojure on LLVM or C?

2013-03-29 Thread John Szakmeister
On Fri, Mar 29, 2013 at 5:49 AM, Mikera mike.r.anderson...@gmail.com wrote: I decided to benchmark JVM startup again, in case of any doubt, and because I see plenty of FUD on this issue. Sorry, I don't mean to spread any FUD. I'm just being loose with the phrase start-up time. You're right, I

Re: Please try the alphas and betas!

2011-11-02 Thread John Szakmeister
On Mon, Oct 31, 2011 at 4:25 PM, Sean Corfield seancorfi...@gmail.com wrote: On Mon, Oct 31, 2011 at 8:06 AM, Timothy Baldridge tbaldri...@gmail.com wrote: I'd like to second what Bill said...I don't really have the time to setup a clojure build process to test out the 1.4 Alphas/Betas, but

Re: Please try the alphas and betas!

2011-11-04 Thread John Szakmeister
On Wed, Nov 2, 2011 at 10:00 AM, Chas Emerick cemer...@snowtide.com wrote: [snip] Yes; this is called locking snapshots in the Maven world, and there are commands there that can lock any snapshot dependencies to the current snapshot. If you are using Leiningen, there are no corollary

Re: Posted the Bowling Game Kata in Clojure w/ Video. Thoughts welcome. EOM

2010-12-13 Thread John Szakmeister
On Fri, Dec 10, 2010 at 3:30 PM, Tim Visher tim.vis...@gmail.com wrote: Because posting the link would make some modicum of sense… http://blog.twonegatives.com/post/2168030248/kata ^_^ Awesome Tim! Thanks for taking the time to put that together! -John -- You received this message

Quick question about str/join....

2011-01-04 Thread John Szakmeister
I was looking at a commit that updated a docstring for str/join, which enticed me to take a look at the implementation. I was kind of surprised to see that it wasn't: (apply str (interpose sep coll)) I'm just curious about the developer was thinking. Here's a link to the code:

Re: Quick question about str/join....

2011-01-04 Thread John Szakmeister
overhead? -John On Jan 5, 12:18 am, John Szakmeister j...@szakmeister.net wrote: I was looking at a commit that updated a docstring for str/join, which enticed me to take a look at the implementation.  I was kind of surprised to see that it wasn't:   (apply str (interpose sep coll)) I'm just

Re: Quick question about str/join....

2011-01-04 Thread John Szakmeister
On Tue, Jan 4, 2011 at 8:22 PM, Stuart Halloway stuart.hallo...@gmail.com wrote: Several people had hands in that code, and the final result is all about perf. Do not treat string.clj as a reference for idiomatic code. :-) That's what I suspected. :-) Thanks Stuart! -John -- You received

Re: Quick question about str/join....

2011-01-04 Thread John Szakmeister
On Tue, Jan 4, 2011 at 8:29 PM, MiltondSilva shadowtr...@gmail.com wrote: Again from inspection it seems the way it's implemented in contrib, the code makes one pass. With (apply str (interpose sep coll)) you make two, one to interpose the other to convert (seq-str). Well, interpose does

Re: Regarding The Implementation of 'merge-with'

2011-01-20 Thread John Szakmeister
On Thu, Jan 20, 2011 at 3:34 AM, Stefan Rohlfing stefan.rohlf...@gmail.com wrote: Hi John, Thank you very much for your correction of my code! my-merge-with is working perfectly now. There is just one thing: I always want to understand my errors so that I can learn from them. However, I still

Re: just an observation about doseq...

2011-01-20 Thread John Szakmeister
On Thu, Jan 20, 2011 at 5:38 AM, Baishampayan Ghose b.gh...@gmail.com wrote: when we give an empty vector of seq-exprs to doseq it returns the value of the last s-expression.. but returns nil when the vector-of-seq-exprs is not empty.. may be this is the expected behaviour .. but the

Issue with lein-ring...

2011-03-08 Thread John Szakmeister
I've been working on a web app, and it was using leiningen-war. The author of that suggest moving to the lein-ring plugin on his github site... so, I did that. However, when I run lein ring server I get a traceback, which I show below. Two lines stand out to me: at

Re: Issue with lein-ring...

2011-03-09 Thread John Szakmeister
On Tue, Mar 8, 2011 at 4:04 PM, Michael Ossareh ossa...@gmail.com wrote: [snip] 90% of the time I find that: lein clean rm -rf lib lein deps solves this type of issue. Yeah... I've done that a few times. :-) I should say that I'm using the 1.3.0-master-snapshot of Clojure. I did find that

Re: Issue with lein-ring...

2011-03-09 Thread John Szakmeister
On Wed, Mar 9, 2011 at 1:29 PM, John Szakmeister j...@szakmeister.net wrote: On Tue, Mar 8, 2011 at 4:04 PM, Michael Ossareh ossa...@gmail.com wrote: [snip] 90% of the time I find that: lein clean rm -rf lib lein deps solves this type of issue. Yeah... I've done that a few times. :-)  I

Re: Issue with lein-ring...

2011-03-09 Thread John Szakmeister
On Wed, Mar 9, 2011 at 3:29 AM, Saul Hazledine shaz...@gmail.com wrote: On Mar 8, 8:31 pm, John Szakmeister j...@szakmeister.net wrote: I've been working on a web app, and it was using leiningen-war.  The author of that suggest moving to the lein-ring plugin on his github site... so, I did

Re: Clojure shell calls results inconsistent with actual shell calls.

2012-07-12 Thread John Szakmeister
On Wed, Jul 11, 2012 at 7:47 PM, Eric in San Diego eric.sc...@acm.org wrote: It's very application specific, but it's Object 'test' does not have a field named 'test1' c:/path/to/importTest, suggesting that it's not inferring the value of an 'I' parameter which should indicate a directory

Re: is their a Clojure framework for handling form validation?

2012-07-27 Thread John Szakmeister
On Tue, Jul 24, 2012 at 6:05 PM, Trent Ogren m...@trentogren.com wrote: https://github.com/weavejester/valip The approach of that project is interesting. Not only does it decouple validation from any notion of web form (it just works on maps like many of the others in this thread), it

Re: Looking for help with a deadlock issue

2012-07-28 Thread John Szakmeister
On Fri, Jul 27, 2012 at 12:02 PM, Kyle R. Burton kyle.bur...@gmail.com wrote: I encountered a deadlock on one of our production systems (one out of 3) last night. Looking at a thread dump of the JVM, there are several (over 200) threads that are all waiting on a

Re: No show?

2012-02-12 Thread John Szakmeister
On Sat, Feb 11, 2012 at 10:15 PM, Sean Corfield seancorfi...@gmail.com wrote: On Sat, Feb 11, 2012 at 6:30 PM, Michał Marczyk michal.marc...@gmail.com wrote: print-table expects a sequence of maps, e.g. (print-table (:members (reflect Math))) Wow! I had no idea how useful that could be...

lein run takes an excessive amount of time...

2012-02-17 Thread John Szakmeister
It appears that when executing 'lein run' that it's examining dependencies and/or contacting Maven repositories. This overhead is adding a considerable amount of time to lein run. Firing things up from the command line takes *significantly* less time (30s vs 4-5s). Has anyone else seen this

Re: lein run takes an excessive amount of time...

2012-02-18 Thread John Szakmeister
On Fri, Feb 17, 2012 at 5:50 AM, John Szakmeister j...@szakmeister.net wrote: It appears that when executing 'lein run' that it's examining dependencies and/or contacting Maven repositories.  This overhead is adding a considerable amount of time to lein run.  Firing things up from the command

Re: Bret Victor's live editable game in ClojureScript

2012-02-27 Thread John Szakmeister
On Mon, Feb 27, 2012 at 3:14 PM, Chris Granger ibdk...@gmail.com wrote: Hey folks, In reference to the previous thread on Inventing On Principle, I built a ClojureScript example of his live editable game :) http://www.chris-granger.com/2012/02/26/connecting-to-your-creation/ Enjoy! Nice!

Re: New release of Paredit mode for Vim with support for VimClojure repls and Map literals

2012-04-22 Thread John Szakmeister
On Sun, Apr 22, 2012 at 3:28 PM, Evan Mezeske emeze...@gmail.com wrote: Version 0.9.3 does indeed support balanced map literals. I believe that the bitbucket repository is the official home of slimv (from which paredit.vim comes):  https://bitbucket.org/kovisoft/slimv/ . Just an FYI, but

Re: Article on HTTP-based REPL

2012-05-04 Thread John Szakmeister
On Fri, May 4, 2012 at 2:30 PM, Phil Hagelberg p...@hagelb.org wrote: Hello folks. I just posted an article yesterday on using cemerick's drawbridge library for live-debugging a Ring application over HTTP:    https://devcenter.heroku.com/articles/debugging-clojure You may find it

Re: Lexer and parser generator in Clojure

2012-05-19 Thread John Szakmeister
On Fri, May 18, 2012 at 8:46 AM, Alexsandro Soares prof.asoa...@gmail.com wrote: Hi, I'm trying to build a compiler using Clojure. Is there any tools like flex and bison generating Clojure code? I'm interested in a lexer/parser in pure Clojure because I think  in use the same code

Re: Unable to pass unboxed primitive to methods taking multiple numeric primitive types.

2012-05-24 Thread John Szakmeister
On Wed, May 23, 2012 at 7:58 PM, Cedric Greevey cgree...@gmail.com wrote: (defn f [^java.awt.image.BufferedImage bi x]  (.setSample (.getRaster bi) 0 0 0 (double x))) #CompilerException java.lang.IllegalArgumentException: More than one matching method found: setSample,

Re: Parallel doseq?

2012-05-24 Thread John Szakmeister
On Thu, May 24, 2012 at 2:15 AM, Sean Corfield seancorfi...@gmail.com wrote: First off, the code you posted can't actually be right: you have (println n) but the for binding was for i. Second, given your macro, try (range 100) instead of (range 10) and see what you get... Can you explain

Re: Parallel doseq?

2012-05-24 Thread John Szakmeister
On Thu, May 24, 2012 at 7:46 AM, Chris Perkins chrisperkin...@gmail.com wrote: [snip] Also, pmap is not broken; the problem with the code you pasted is simply an errant closing paren. You had (do (doall (pmap ...) nil)), where you meant (do (doall (pmap ...)) nil). Apparently doall has a

Re: Central screwup

2012-06-13 Thread John Szakmeister
On Wed, Jun 13, 2012 at 5:47 AM, Chas Emerick c...@cemerick.com wrote: On Jun 12, 2012, at 7:12 PM, Phil Hagelberg wrote: On Mon, Jun 11, 2012 at 1:48 PM, Phil Hagelberg p...@hagelb.org wrote: On Mon, Jun 11, 2012 at 9:36 AM, Phil Hagelberg p...@hagelb.org wrote: These will be removed once

Access to the issue tracker...

2010-10-27 Thread John Szakmeister
I'm not sure what the protocol is for this, but I'd like to attach a patch to one of the issues in Assembla. Unfortunately, it won't let me. Do I have to get added to the project in some way? Or should I just hang out until Jira comes online? BTW, I did send in my CA. Rich should hopefully

Re: [Bug] StackOverflowError while using map inside a reduce

2010-11-02 Thread John Szakmeister
On Tue, Nov 2, 2010 at 4:49 PM, Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 02.11.2010 um 12:58 schrieb Pepijn de Vos: The one-liner: http://gist.github.com/659491 I would expect this is because you pile lazy seq on lazy seq, which then get realised, unfolding the whole thing resulting

Re: StackOverflowError while using map inside a reduce

2010-11-03 Thread John Szakmeister
On Wed, Nov 3, 2010 at 2:35 AM, Meikel Brandmeyer m...@kotka.de wrote: Hi, On 3 Nov., 00:40, Rasmus Svensson r...@lysator.liu.se wrote: I think the problem is that this reduction will build an expression like this:     (map + ... (map + ... (map + ... (map + ... one million nesting

Re: blog article on RSpec like TDD with a rapid feedback cycle in Clojure

2013-10-21 Thread John Szakmeister
On Sun, Oct 20, 2013 at 4:24 PM, Korny Sietsma ko...@sietsma.com wrote: Note you can do the same thing in midje : https://github.com/marick/Midje/wiki/Auto test - it works quite nicely. Looks like a space made it in between Auto and test. The link should be:

Re: StackOverflowError

2013-11-08 Thread John Szakmeister
On Fri, Nov 8, 2013 at 5:11 AM, ru soro...@oogis.ru wrote: Hi Jim, I forget to say that call to count have been done in not a bare repl, but inside a quite complex program after it did a lot of work on a quite big data. But, after long and profound analysis of source code I did not found any

Re: StackOverflowError

2013-11-08 Thread John Szakmeister
On Fri, Nov 8, 2013 at 8:51 AM, ru soro...@oogis.ru wrote: Solution have found: (remove ...) = (doall (remove ...)) Be careful with this technique. It can easily make your O(n) algorithm O(n^2). It may be better to use data structures that you can use with conj and disj if you need to

IntelliJ / ClojureScript Integration...

2014-08-04 Thread John Szakmeister
Sorry for pestering the list about this, but despite trying to follow several different blog posts about this, I seem unable to get a working ClojureScript REPL that connects to the browser. Ideally, I'd like to start from a clean project using lein new om-start project_name and get the right

Re: IntelliJ / ClojureScript Integration...

2014-08-05 Thread John Szakmeister
On Tue, Aug 5, 2014 at 3:08 AM, Colin Fleming colin.mailingl...@gmail.com wrote: Hi John, [snip] Here's what Wilker Lúcio wrote: This is how I got it done (and I'm using it on node-webkit project): Add this plugin to your project (plugins, not dependencies): [jarohen/simple-brepl 0.1.0]

Avoiding nested ifs...

2016-05-26 Thread John Szakmeister
I'm very much a fan of bailing out early in imperative programming as it helps to avoid a bunch of nested if conditions that are to follow and read. This typically comes up when checking arguments to ensure that they're valid (in range, of acceptable values, etc). One of the major stumbling

Re: Avoiding nested ifs...

2016-05-26 Thread John Szakmeister
On Thu, May 26, 2016 at 10:55 AM, Gary Trakhman wrote: > I think the idiomatic way to handle this in clojure is to do all your > validation upfront on a single descriptive data structure, perhaps in a > single function, then bail early. That has the added advantage of

Re: Avoiding nested ifs...

2016-05-27 Thread John Szakmeister
On Thu, May 26, 2016 at 7:09 PM, Mark Engelberg <mark.engelb...@gmail.com> wrote: > On Thu, May 26, 2016 at 1:29 PM, John Szakmeister <j...@szakmeister.net> > wrote: >> >> >> Yeah, cond is definitely useful here, but not in general. >> > > cond is us

Re: Avoiding nested ifs...

2016-05-27 Thread John Szakmeister
On Thu, May 26, 2016 at 5:41 PM, Erik Assum wrote: > Not being good at reading other peoples mind, I’ll give my guess as to what > Timothy was trying to suggest: > > If you define your input as a map with keys such as: > > {:type :switched ; can be :switched :dual or :something >

Re: Avoiding nested ifs...

2016-05-26 Thread John Szakmeister
(sorry for the repeat Nathan, this was meant to go to the list too) On Thu, May 26, 2016 at 1:43 PM, Nathan Davis wrote: > First off, I should say that you should first consider alternative > approaches before considering the options below. For example, cond

Re: Avoiding nested ifs...

2016-05-26 Thread John Szakmeister
On Thu, May 26, 2016 at 1:47 PM, Sean Corfield wrote: [snip] > A pattern that I’ve also started using is something like this: > > (defn guarded-process [data] > (some-> data > first-guard > second-guard > (another-guard :with “parameters”) >

Re: Avoiding nested ifs...

2016-05-26 Thread John Szakmeister
On Thu, May 26, 2016 at 2:12 PM, Timothy Baldridge wrote: > I would suggest reviewing your data model a bit. One of the problems you > are experiencing is that you are overloading the inputs to your function. > And since they are overloaded you have to create a state

Re: Use latest Clojure with lein repl

2016-07-13 Thread John Szakmeister
On Wed, Jul 13, 2016 at 7:20 AM, Cecil Westerhof wrote: > After a long time I want to start with Clojure again. As I understand it, it > is best to use: > lein repl > > But then I work with 1.5.1. Is there a way to work default with the latest > stable version of

Re: Use latest Clojure with lein repl

2016-07-13 Thread John Szakmeister
On Wed, Jul 13, 2016 at 9:59 AM, Cecil Westerhof wrote: [snip] > I already tried that, but this gives: > WARNING: You're currently running as root; probably by accident. > Press control-C to abort or Enter to continue as root. > Set LEIN_ROOT to disable this warning. > >

Re: (System/console) is nil?

2017-02-01 Thread John Szakmeister
On Wed, Feb 1, 2017 at 5:35 PM, Mark Reed wrote: > Trying to write a CLI that will prompt for a password, and it's failing > because (System/console) always returns nil (whether in a compiled app or > inside the REPL). It works for me in a compiled app (it's non-nil), but

Re: [ANN] Gorilla REPL v0.4.0

2017-01-31 Thread John Szakmeister
It looks like the v0.4.0 and v0.3.6 tags point to the same thing in the gorilla-repl repo, so the v0.4.0 tag isn't picking up the new commits. -John On Mon, Jan 30, 2017 at 1:58 PM, Jony Hudson wrote: > Hi All, > > it's a pleasure to announce a new release of Gorilla

Re: Possible ClojureScript compiler issue...

2016-10-19 Thread John Szakmeister
Fantastic! Thank you! -John On Tue, Oct 18, 2016 at 11:49 PM, David Nolen <dnolen.li...@gmail.com> wrote: > This issue is fixed in master now thanks to Thomas Heller. The performance > hit is negligible. > > Thank you for the report. > > David > > On Tue,

Re: Possible ClojureScript compiler issue...

2016-10-18 Thread John Szakmeister
On Tue, Oct 18, 2016 at 2:59 AM, Thomas Heller wrote: [snip] > While this issue can be very confusing you will hardly ever run into it when > following best practices. As David suggested using a custom js->clj here > would prevent the issue and is probably the best course of

Re: Possible ClojureScript compiler issue...

2016-10-18 Thread John Szakmeister
Yes, you could do that, but it could also do Bad Things. Namely if you have strings that match some of the format, it could be misinterpreted as Transit data rather than JSON, so I don't consider it a particularly useful solution either. It just moves where the problem can happen. :-( If there

Re: Possible ClojureScript compiler issue...

2016-10-18 Thread John Szakmeister
On Tue, Oct 18, 2016 at 5:59 AM, Thomas Heller wrote: > Don't think there is a best practice for your case in particular. Okay. Earlier in the thread you said "while this issue can be very confusing you will hardly ever run into it when following best practices." So it

Re: Deriving a protocol from a protocol...

2016-10-31 Thread John Szakmeister
On Mon, Oct 31, 2016 at 5:57 PM, Alex Miller wrote: > You can create instances that implement multiple Java interfaces using > `reify` or by declaring them inline of a `defrecord` or a `deftype`. (See > http://clojure.org/reference/datatypes for more.) Thank you Alex. I

Deriving a protocol from a protocol...

2016-10-31 Thread John Szakmeister
I'm looking at using Clojure in an application where we make fine-grained use of interfaces that help describe the capabilities of an object. We need to take several interfaces and bring them together, not necessarily in an implementation, but to help define what the overall interface for the

Re: Possible ClojureScript compiler issue...

2016-10-15 Thread John Szakmeister
On Sat, Oct 15, 2016 at 2:49 PM, David Nolen wrote: > This issue is somewhat to be expected if you're going to use `js->clj`. This > issue has nothing to do with ClojureScript compiler versions - you just got > lucky before. Google Closure will collapse properties, but

Possible ClojureScript compiler issue...

2016-10-15 Thread John Szakmeister
I've been using ClojureScript rather successfully for a year now, but ran into an interesting issue recently. I've discovered that js->clj isn't quite working as expected. After quite a bit of tearing things down and apart, I discovered it was one of the keys in some JSON data coming back from