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 not at the REPL (probabl

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 REPL :-) For those > that h

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 should have been more cle

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 obje

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 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, Oct 18, 2016 at 3:45 PM, John Szakme

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 seemed to me that perhaps

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 w

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 action > regardless.

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 some of these > collapsed pr

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 th

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. > > Downloading Leiningen to >

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 Clojure? I think you probably

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 > :pos 54} > > Yo

Re: Avoiding nested ifs...

2016-05-27 Thread John Szakmeister
On Thu, May 26, 2016 at 7:09 PM, Mark Engelberg wrote: > On Thu, May 26, 2016 at 1:29 PM, John Szakmeister > wrote: >> >> >> Yeah, cond is definitely useful here, but not in general. >> > > cond is useful in general, just not the cond that is built-in to Cl

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 seems > well-suited for this particul

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 machine of sorts to > parse o

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”) > (process-the-d

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 being > able to report multi

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 block

Re: IntelliJ / ClojureScript Integration...

2014-08-05 Thread John Szakmeister
On Tue, Aug 5, 2014 at 3:08 AM, Colin Fleming 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"] >> >> On your

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 bi

Re: semantics of >! on closed channels

2014-01-24 Thread John Szakmeister
On Thu, Jan 23, 2014 at 9:17 PM, Cedric Greevey 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 up, and read

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 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/ar

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 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 clojure.to

Re: first vals first vals

2013-11-21 Thread John Szakmeister
On Thu, Nov 21, 2013 at 4:32 AM, Zhemin Lin 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 (tree-seq map? v

Re: first vals first vals

2013-11-21 Thread John Szakmeister
On Thu, Nov 21, 2013 at 4:08 AM, Zhemin Lin 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 thi

Re: StackOverflowError

2013-11-08 Thread John Szakmeister
On Fri, Nov 8, 2013 at 8:51 AM, 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 maintain performanc

Re: StackOverflowError

2013-11-08 Thread John Szakmeister
On Fri, Nov 8, 2013 at 5:11 AM, 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 places wit

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 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: 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 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 should be more precise i

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 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 not going to h

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 wrote: > On Friday, 29 March 2013 05:45:53 UTC+8, Laurent PETIT wrote: >> >> 2013/3/28 Marko Topolnik : >> > Or you may have just a trivial requirement for a program that both >> > starts >> > and executes quickly. >> >> To what extent would an LLVM / C vers

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 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 in a deeply embedde

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 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 > java.util.concurrent.locks.ReentrantLock from Ke

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 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 decouple the error mes

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 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 > within which t

Re: [ANN] ClojureC - A Clojure to C compiler - Work in Progress

2012-07-11 Thread John Szakmeister
On Mon, Jul 9, 2012 at 7:03 AM, Mark Probst wrote: > Dear Clojurians, > > I'm excited to announce ClojureC, an effort to produce a Clojure > implementation that targets C: > > https://github.com/schani/clojurec > > My personal goals with this are to be able to write self-contained > (command-lin

Re: Central screwup

2012-06-13 Thread John Szakmeister
On Wed, Jun 13, 2012 at 5:47 AM, Chas Emerick wrote: > On Jun 12, 2012, at 7:12 PM, Phil Hagelberg wrote: > >> On Mon, Jun 11, 2012 at 1:48 PM, Phil Hagelberg wrote: >>> On Mon, Jun 11, 2012 at 9:36 AM, Phil Hagelberg wrote: These will be removed once Central gets back to working order, but

Re: Parallel doseq?

2012-05-24 Thread John Szakmeister
On Thu, May 24, 2012 at 7:46 AM, Chris Perkins 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 two-arg version, which > is

Re: Parallel doseq?

2012-05-24 Thread John Szakmeister
On Thu, May 24, 2012 at 2:15 AM, Sean Corfield 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 that a little more Se

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 wrote: > (defn f [^java.awt.image.BufferedImage bi x] >  (.setSample (.getRaster bi) 0 0 0 (double x))) > # matching method found: setSample, compiling:(NO_SOURCE_PATH:1)> > > The only way I was able to find to fix this is > > (defn f [^java.awt.imag

Re: Lexer and parser generator in Clojure

2012-05-19 Thread John Szakmeister
On Fri, May 18, 2012 at 8:46 AM, Alexsandro Soares 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 with Javascript (

Re: Article on HTTP-based REPL

2012-05-04 Thread John Szakmeister
On Fri, May 4, 2012 at 2:30 PM, Phil Hagelberg 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 interesting if yo

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 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 there seems to be v

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 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! You roc

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 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 >

"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 beh

Re: No show?

2012-02-12 Thread John Szakmeister
On Sat, Feb 11, 2012 at 10:15 PM, Sean Corfield wrote: > On Sat, Feb 11, 2012 at 6:30 PM, Michał Marczyk > 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... Learn something new > every day! (and,

Re: Please try the alphas and betas!

2011-11-04 Thread John Szakmeister
On Wed, Nov 2, 2011 at 10:00 AM, Chas Emerick 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 commands, but you can

Re: Please try the alphas and betas!

2011-11-02 Thread John Szakmeister
On Mon, Oct 31, 2011 at 4:25 PM, Sean Corfield wrote: > On Mon, Oct 31, 2011 at 8:06 AM, Timothy Baldridge > 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 if >> there was a way for me to get to

Re: Issue with lein-ring...

2011-03-09 Thread John Szakmeister
On Wed, Mar 9, 2011 at 3:29 AM, Saul Hazledine wrote: > On Mar 8, 8:31 pm, John Szakmeister 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: Issue with lein-ring...

2011-03-09 Thread John Szakmeister
On Wed, Mar 9, 2011 at 1:29 PM, John Szakmeister wrote: > On Tue, Mar 8, 2011 at 4:04 PM, Michael Ossareh wrote: > [snip] >> >> 90% of the time I find that: >> lein clean && rm -rf lib && lein deps >> solves this type of issue. > > Yeah... I&

Re: Issue with lein-ring...

2011-03-09 Thread John Szakmeister
On Tue, Mar 8, 2011 at 4:04 PM, Michael Ossareh 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 ring.util

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 ring.util.tracker$e

Re: just an observation about doseq...

2011-01-20 Thread John Szakmeister
On Thu, Jan 20, 2011 at 5:38 AM, Baishampayan Ghose 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 documentation s

Re: Regarding The Implementation of 'merge-with'

2011-01-20 Thread John Szakmeister
On Thu, Jan 20, 2011 at 3:34 AM, Stefan Rohlfing 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 don't understand why

Re: just an observation about doseq...

2011-01-20 Thread John Szakmeister
On Thu, Jan 20, 2011 at 1:02 AM, Sunil S Nandihalli wrote: > Hello everybody, > 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 docu

Re: Regarding The Implementation of 'merge-with'

2011-01-20 Thread John Szakmeister
On Wed, Jan 19, 2011 at 11:23 PM, Stefan Rohlfing wrote: > Hi all, > > I tried another implementation of 'merge-with' using nested calls to > 'reduce'. However, > I just cannot get it to work correctly: > > (defn my-merge-with [f & maps] >  (when (some identity > maps) >    (reduce >     (fn [acc

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

2011-01-04 Thread John Szakmeister
On Tue, Jan 4, 2011 at 8:29 PM, MiltondSilva 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 return a lazy sequence,

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

2011-01-04 Thread John Szakmeister
On Tue, Jan 4, 2011 at 8:22 PM, Stuart Halloway 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 this message because you

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

2011-01-04 Thread John Szakmeister
John > On Jan 5, 12:18 am, John Szakmeister 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))

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: 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 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 because you are subscr

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 wrote: > Hi, > > On 3 Nov., 00:40, Rasmus Svensson wrote: > >> I think the problem is that this reduction will build an expression like >> this: >> >>     (map + ... (map + ... (map + ... (map + ... > levels> >> >> When clojure tries to reali

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 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 in

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 hav