Re: Copying (immigrating) macros from namespace to namespace

2013-01-06 Thread Sean Corfield
Here's what I use to pull symbols from Enlive into FW/1: (def ^:private enlive-symbols ['append 'at 'clone-for 'content 'do- 'html-content 'prepend 'remove-class 'set-attr 'substitute]) (defmacro enlive-alias ^:private [sym] `(let [enlive-sym# (resolve (symbol (str html/ ~sym)))]

Re: Suggestion: add `into` on clojure.org/data_structures page

2013-01-06 Thread Sean Corfield
And there's also the excellent http://clojureatlas.com for exploring concepts and their implementations within the Clojure ecosystem. On Sun, Jan 6, 2013 at 3:08 PM, Andy Fingerhut andy.finger...@gmail.com wrote: For most of the documentation on clojure.org, only a few people have authorization

Re: Copying (immigrating) macros from namespace to namespace

2013-01-06 Thread Sean Corfield
On Sun, Jan 6, 2013 at 6:17 PM, Stuart Sierra the.stuart.sie...@gmail.com wrote: 1. `refer`. Define a public function that `refer`s all the symbols you want. It's an extra step for the user, but that's good because it makes it evident that extra symbols are being added. Forcing all users of a

Re: MultiMethod Interoperability with Java

2013-01-05 Thread Sean Corfield
My first thought it that this is because (class nil) = nil so even tho' the 'correct' Java signature is matched and called, the multi-method dispatch is still invoked under the hood. So (String) null selects the [String] String signature, (class valueHolder) = nil so the :default implementation

ANN CongoMongo 0.4.0 released

2013-01-05 Thread Sean Corfield
CongoMongo - a Clojure-friendly API for MongoDB https://github.com/aboekhoff/congomongo Version 0.4.0 - January 4th, 2012 BREAKING CHANGES IN THIS RELEASE! 10gen have updated all their drivers to be more consistent in naming. They have also changed the default write concern (from :none to

Re: how to get the 'else' from if-not?

2013-01-04 Thread Sean Corfield
map-of-profile))] user-nice-name)) #'user/make-user-nice-name user (make-user-nice-name {:username seanc}) seanc user (make-user-nice-name {:username seanc :first_name Sean}) seanc user (make-user-nice-name {:username seanc :first_name Sean :last_name Corfield}) Sean Corfield user (make-user

Re: Clojure Conj Videos

2013-01-02 Thread Sean Corfield
On Wed, Jan 2, 2013 at 3:42 PM, Mark Derricutt m...@talios.com wrote: +1 - I'm sure I've even seen any BLOGS on this years Conj let alone videos. http://corfield.org/blog/post.cfm/clojure-conj-2012 -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles,

Re: Use repeat with a function argument

2012-12-24 Thread Sean Corfield
He's repeating a function argument, not a function. Meikel is correct that the second expression causes (some #{0} ...) to return nil when number is not a multiple of 3 or 5, and then zero? fails. As he suggests... (reduce + (filter (fn [number] (some zero? (map mod (take 2 (repeat number)) [3

Re: Clojure 1.5.0 RC 1

2012-12-23 Thread Sean Corfield
On Sun, Dec 23, 2012 at 8:50 AM, Peter Taoussanis ptaoussa...@gmail.comwrote: Specifically, seem to be having trouble with `ring.middleware.reload/wrap-reload`: Exception in thread main java.lang.IllegalArgumentException: contains? not supported on type: clojure.lang.LazySeq,

Re: Clojure videos deleted from blip.tv?

2012-12-13 Thread Sean Corfield
When I tried to go to the Clojure videos link inside iTunes (from the set of videos that I already have downloaded), it went to an unknown podcast with no image and no episodes - and I can't find the actual list of blip.tvepisodes in iTunes... On Thu, Dec 13, 2012 at 3:59 PM, Leonardo Borges

Re: Slime and heroku setup question

2012-12-12 Thread Sean Corfield
You should be able to run your app locally and do all your testing and development locally. Heroku is just a remote server for deployment. I'd suggest ignoring Heroku at first and focusing on getting your Clojure app running locally. Presumably you are building a Ring / Jetty app? On Wed, Dec

Re: Java, Lein, and Windows x64

2012-12-08 Thread Sean Corfield
Is this for Leiningen 2? I've been running it on Windows 8 64-bit without needing to update lein.bat. Which version of Windows are you on? On Sat, Dec 8, 2012 at 10:15 AM, Kruno Saho kruno.s...@gmail.com wrote: There seems to be an issue, which I have spent several days combating. The issue

Re: in keyword withing where claus java-jdbc

2012-12-05 Thread Sean Corfield
to raw update statement with in within Where clause... On Wednesday, December 5, 2012 4:53:39 AM UTC+1, Sean Corfield wrote: ... in ? is not supported in c.j.jdbc On Tue, Dec 4, 2012 at 6:16 AM, Amir Wasim amir@gmail.com wrote: I am trying to use the following (defn commit-acknowledged

Re: ANN: Clojure/West 2013 registration, CFP, sponsorships, training

2012-12-05 Thread Sean Corfield
How long did it actually take to sell all 50 early bird tickets? On Wed, Dec 5, 2012 at 1:34 PM, Alex Miller a...@puredanger.com wrote: Based on a very quick response, the early bird is now sold out! Plenty of tickets left at the regular rate though of $350 though. On Tuesday, December 4,

Re: in keyword withing where claus java-jdbc

2012-12-04 Thread Sean Corfield
... in ? is not supported in c.j.jdbc On Tue, Dec 4, 2012 at 6:16 AM, Amir Wasim amir.wa...@gmail.com wrote: I am trying to use the following (defn commit-acknowledged [acks] (sql/with-connection (db-connection) (sql/transaction (sql/update-values MSGIDS [msg_id in ? acks]

Re: understanding 'binding' use in clojure.java.jdbc

2012-12-03 Thread Sean Corfield
On 10 October 2012 15:03, Stuart Sierra the.stuart.sie...@gmail.comwrote: On Tuesday, October 9, 2012 10:25:05 PM UTC-4, Sean Corfield wrote: This is why c.j.jdbc is getting an API overall that will expose functions that accept the connection or the db-spec directly (and the old API

Re: confused about the scope of variables, or is it something else? ClojureScript

2012-12-02 Thread Sean Corfield
Part of it is laziness: map is lazy so it doesn't do anything unless you use the result. In the REPL, you print the result so map runs across the whole sequence. In the function, only the last expression (draggables) is returned so it is the only thing fully evaluated. Your code is very

Re: Proposed change to let- syntax

2012-12-01 Thread Sean Corfield
On Sat, Dec 1, 2012 at 6:33 AM, Rich Hickey richhic...@gmail.com wrote: Given that some- threads while non-nil but the fn some stops with the first logical true value, this seems counter-intuitive to me. when- seems better here, or while- perhaps? What other names were considered? when and

Re: JavaFX2, problem with overriden constructor

2012-12-01 Thread Sean Corfield
On Sat, Dec 1, 2012 at 11:58 AM, Christian Sperandio christian.speran...@gmail.com wrote: When I try to use the following constructor *Scenehttp://docs.oracle.com/javafx/2/api/javafx/scene/Scene.html#Scene(javafx.scene.Parent,%20double,%20double,%20javafx.scene.paint.Paint) *(Parent

Re: Proposed change to let- syntax

2012-11-30 Thread Sean Corfield
On Fri, Nov 30, 2012 at 7:37 AM, Rich Hickey richhic...@gmail.com wrote: A) let- becomes as- Fine with that. B) test- becomes cond- Fine with that (because I can't think of anything better). C) when- becomes some- and in doing so, tests for non-nil rather than truth. Given that

Re: seq? vs sequential? vs coll?

2012-11-26 Thread Sean Corfield
A colleague showed me this page recently which seems like a nice quick reference: http://www.brainonfire.net/files/seqs-and-colls/main.html On Mon, Nov 26, 2012 at 6:01 AM, Mark Engelberg mark.engelb...@gmail.comwrote: I understand that these functions test for different interfaces, but I

Re: seq? vs sequential? vs coll?

2012-11-26 Thread Sean Corfield
clojure.core.incubator: https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/incubator.clj#L77 On Mon, Nov 26, 2012 at 1:51 PM, Frank Siebenlist frank.siebenl...@gmail.com wrote: Guess we need a test for seq'able ;-) -FS. On Nov 26, 2012, at 1:47 PM, Herwig

Re: ease of use

2012-11-22 Thread Sean Corfield
On Thu, Nov 22, 2012 at 5:39 PM, atucker agjf.tuc...@gmail.com wrote: Thanks all! Sounds like I need to install some more stuff. I'll +1 what some of the others have said: I too started with Aquamacs and was told don't do that and later learned they were right! Emacs 24.x from the

Re: Fail to run `lein bootstrap` in ClojureScript One

2012-11-21 Thread Sean Corfield
ClojureScript One still requires Leiningen 1.x - it hasn't been updated to Leiningen 2.x yet. On Wed, Nov 21, 2012 at 10:06 PM, Satoru Logic satorulo...@gmail.comwrote: HI, all. I'm following the instructions on http://clojurescriptone.com/getting-started.html, and run `lein bootstrap` in

Re: need to build clojure myself again?

2012-11-19 Thread Sean Corfield
Try -beta1 - I recall a patch recently that was supposed to fix this. On Mon, Nov 19, 2012 at 11:47 AM, Jim - FooBar(); jimpil1...@gmail.comwrote: Moving from clojure-1.5-alpha1 to -alpha4 i get this again: NoClassDefFoundError jsr166y/ForkJoinTask clojure.core.reducers/fjinvoke

Re: [ANN] Clojars Releases repository

2012-11-19 Thread Sean Corfield
On Mon, Nov 19, 2012 at 9:51 AM, Phil Hagelberg p...@hagelb.org wrote: Perhaps it would be helpful if you could explain in more detail what it is about the provided explanation that you found confusing? In the first step you use an actual example, then switch to $KEY_ID without explanation,

Re: [ANN] Clojars Releases repository

2012-11-19 Thread Sean Corfield
On Mon, Nov 19, 2012 at 2:28 PM, Phil Hagelberg p...@hagelb.org wrote: Yeah, we intended to use that originally, but Bouncy Castle's PGP support is awful beyond words. It's effectively undocumented, and the classes it exposes really only make sense if you have the OpenPGP RFC memorized.

Re: [ANN] Clojars Releases repository

2012-11-19 Thread Sean Corfield
FWIW, after setting up a public key etc and using lein deploy clojars to push congomongo 0.3.3 (successfully with one key), I am also getting the error about transferring the POM: Sending congomongo/congomongo/0.3.3/congomongo-0.3.3.pom.asc (1k) to https://clojars.org/repo/ Sending

Re: [ANN] Clojars Releases repository

2012-11-19 Thread Sean Corfield
On Mon, Nov 19, 2012 at 10:32 PM, Phil Hagelberg p...@hagelb.org wrote: Someone who writes software for a living without understanding how to securely share secrets over email *and is perfectly happy with that fact* is doing something wrong. Thanx for that clarification :) That's actually

Re: [ANN] new book: ClojureScript: Up and Running

2012-11-19 Thread Sean Corfield
I wonder if it's some aspect of lein trampoline on Windows. As I understand it, trampoline generates a file that is used to fire up the next process and it may well have some *nix-ism that isn't compatible with Windows? On Mon, Nov 19, 2012 at 11:18 PM, Mark Engelberg

Re: [ANN] new book: ClojureScript: Up and Running

2012-11-19 Thread Sean Corfield
Looks like George nailed it with his note about issue 674 which came in while I was writing my (accurate but not particularly helpful) response... On Mon, Nov 19, 2012 at 11:45 PM, Sean Corfield seancorfi...@gmail.comwrote: I wonder if it's some aspect of lein trampoline on Windows. As I

Re: [ANN] Clojars Releases repository

2012-11-19 Thread Sean Corfield
I removed congomongo completely from my local repo and lein repl seemed to pull it back down with no problems. Tested it on two machines. So it seems the repo on Clojars is OK for me - except that I can't redeploy the POM? On Tue, Nov 20, 2012 at 12:22 AM, Peter Taoussanis

Re: [ANN] Clojars Releases repository

2012-11-18 Thread Sean Corfield
On Sun, Nov 18, 2012 at 5:56 AM, Phil Hagelberg p...@hagelb.org wrote: If you don't have a key yet, generate one with `gpg --gen-key`. The default settings are pretty good, though I'd recommend making it expire in a year or two. Next find your key ID. It's the 8-character part after the slash

Re: lein 2.x not working on Mac OS X 10.7.5 -- Exception in thread main java.lang.ClassNotFoundException:

2012-11-13 Thread Sean Corfield
On Tue, Nov 13, 2012 at 4:11 PM, Alec Ramsay a...@frontseat.org wrote: But while lein new still works, lein run does not. I get the following exception: How did you create that project? lein new http_hello3 - or - lein new http-hello3? -- Sean A Corfield -- (904) 302-SEAN An Architect's View

Re: run-jetty doesn't shut down the server after ctrl+c?

2012-11-13 Thread Sean Corfield
On Tue, Nov 13, 2012 at 8:33 PM, Satoru Logic satorulo...@gmail.com wrote: BindException Address already in use sun.nio.ch.Net.bind (Net.java:-2) user= 2012-11-14 11:44:21.370:WARN:oejuc.AbstractLifeCycle:FAILED SelectChannelConnector@0.0.0.0:3000: java.net.BindException: Address already in

Re: Coding Standard - ns usage

2012-11-12 Thread Sean Corfield
On Sun, Nov 11, 2012 at 10:31 PM, Denis Labaye denis.lab...@gmail.com wrote: Most of my Clojure usage is as a scripting language (where other would use Python or Ruby). I usually don't plan in advance how my program will be splitted in namespaces : I start from one namespace that does

Re: Coding Standard - ns usage

2012-11-11 Thread Sean Corfield
On Sun, Nov 11, 2012 at 2:26 PM, Mark Engelberg mark.engelb...@gmail.com wrote: I can relate to Denis' issue. I find it pretty common to have a common set of dependencies across every file in a project. Well, I have to say I was puzzled by Denis' post because I definitely don't have common

Re: Coding Standard - ns usage

2012-11-11 Thread Sean Corfield
On Sun, Nov 11, 2012 at 6:40 PM, Mark Engelberg mark.engelb...@gmail.com wrote: set, string, numeric-tower, combinatorics all provide fundamental operations I need throughout my code. Ah, very different fields of work. Makes sense. My work doesn't usually involve creating a standalone

Re: [ANN] ClojureScript release 0.0-1535 with G.Closure 0.0-2029

2012-11-11 Thread Sean Corfield
On Sun, Nov 11, 2012 at 8:49 PM, Evan Mezeske emeze...@gmail.com wrote: Oops, I've been out of town and did not see this release! I'll cut a new lein-cljsbuild tomorrow night. Wasn't trying to make you feel guilty! Just wondered if there was a policy of tracking builds. Welcome back - and

Re: clojure.java.jdbc says data too long for 1 character of data

2012-11-10 Thread Sean Corfield
On Sat, Nov 10, 2012 at 9:20 AM, larry google groups lawrencecloj...@gmail.com wrote: In MySql I have a table with a field called is_top_winner and this is defined as char(1). In Clojure I have this function: (defn downgrade-everyone [db] 2012-11-10 - Let's start by saying no one is a top

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-10 Thread Sean Corfield
On Sat, Nov 10, 2012 at 9:21 AM, larry google groups lawrencecloj...@gmail.com wrote: Thank you much. You suggest a good approach: I'll just get it working and then I'll worry about performance later. And as I said, happy to help you off-list since a) I maintain java.jdbc and b) I've been using

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-10 Thread Sean Corfield
On Sat, Nov 10, 2012 at 12:27 PM, larry google groups lawrencecloj...@gmail.com wrote: Thank you very much for all of your help. I am curious, is there anyway to print out the sql that is actually run against the database? I looked here but didn't see anything obvious:

Re: Coding Standard - ns usage

2012-11-09 Thread Sean Corfield
On Thu, Nov 8, 2012 at 3:19 PM, Softaddicts lprefonta...@softaddicts.ca wrote: Oh, I must say that I rarely use the Eclipse debugger. Tracing does most of the job. Removing use would force us to redefine it somehow. (:use clojure.tools.trace) = (:require [clojure.tools.trace :refer :all) --

Re: Coding Standard - ns usage

2012-11-09 Thread Sean Corfield
On Fri, Nov 9, 2012 at 8:28 AM, Sean Corfield seancorfi...@gmail.com wrote: On Thu, Nov 8, 2012 at 3:19 PM, Softaddicts lprefonta...@softaddicts.ca wrote: Removing use would force us to redefine it somehow. (:use clojure.tools.trace) = (:require [clojure.tools.trace :refer :all) *sigh

Re: [ANN] ClojureScript release 0.0-1535 with G.Closure 0.0-2029

2012-11-09 Thread Sean Corfield
Nice! I wonder how quickly lein-cljsbuild will get updated for this new release? (Evan?) Nice to see Leiningen and lein-cljsbuild introduced up front in your book as the quickest way to get up and running, Stuart! Sean On Fri, Nov 9, 2012 at 6:17 AM, Stuart Sierra the.stuart.sie...@gmail.com

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread Sean Corfield
On Fri, Nov 9, 2012 at 9:42 AM, larry google groups lawrencecloj...@gmail.com wrote: Can I assume that sql/with-connection does some magic in the background to manage the connection? I would not want the connection to get shut down, and then restarted, everytime I run a query. Use a connection

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread Sean Corfield
I'm not sure why you'd need to use those low-level APIs for normal queries etc? Perhaps you can explain a bit more about what you're trying to do. Have you looked at this page: http://clojure.github.com/java.jdbc/doc/clojure/java/jdbc/UsingSQL.html Sean On Fri, Nov 9, 2012 at 10:13 AM, larry

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread Sean Corfield
On Fri, Nov 9, 2012 at 10:19 AM, larry google groups lawrencecloj...@gmail.com wrote: Usage: (do-commands commands) This seems flexible, but how does it know what the open database connection is? I have to switch between 2 databases. do-commands is intended for DDL. All of these API methods

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread Sean Corfield
On Fri, Nov 9, 2012 at 3:17 PM, larry google groups lawrencecloj...@gmail.com wrote: http://clojure.github.com/java.jdbc/doc/clojure/java/jdbc/UsingSQL.html I will read over that page. I have no experience with Java, which would probably help as there seem to be an abundance of Java examples

Re: EOFException when using clojuredocs under repl

2012-11-09 Thread Sean Corfield
On Fri, Nov 9, 2012 at 8:50 PM, Satoru Logic satorulo...@gmail.com wrote: But when I try, it failed with an `EOFException`: user= (clojuredocs pprint) EOFException Unexpected end of ZLIB input stream java.util.zip.InflaterInputStream.fill (InflaterInputStream.java:223) Is this a bug?

Re: [ANN] new book: ClojureScript: Up and Running

2012-11-08 Thread Sean Corfield
On Wed, Nov 7, 2012 at 4:23 PM, Stuart Sierra the.stuart.sie...@gmail.com wrote: Not to toot our own horn, but people have been asking about getting started with ClojureScript, so here's our contribution, just released in book form: ... http://shop.oreilly.com/product/0636920025139.do Nice.

Re: [ANN] new book: ClojureScript: Up and Running

2012-11-08 Thread Sean Corfield
On Thu, Nov 8, 2012 at 2:39 PM, Mayank Jain firesof...@gmail.com wrote: Try this code : MBBGS It should give you 50% off on the book. Hopefully. :) Thanx but too late. One of my colleagues also bought it 50% off with a different code. I'm happy with $15 :) -- Sean A Corfield -- (904) 302-SEAN

Re: with-open and line-seq

2012-11-07 Thread Sean Corfield
On Wed, Nov 7, 2012 at 11:09 AM, Dave Ray dave...@gmail.com wrote: (defn get-records [file-name] (with-open [r (reader file-name)] (line-seq r))) I suspect it's considered more idiomatic to do: (defn process-records [process file-name] (with-open [r (reader file-name)] (doseq

Re: Cdr car

2012-11-06 Thread Sean Corfield
On Tue, Nov 6, 2012 at 9:34 AM, JvJ kfjwhee...@gmail.com wrote: There's quite a number of functions like caar, cadr, cadadr, etc. It's lengthy to do that in clojure with just first and rest. Clojure does have ffirst, fnext, nfirst, nnext tho' - and I'd question why you'd need to string several

Re: Problem installing Noir with Lein

2012-11-02 Thread Sean Corfield
On Fri, Nov 2, 2012 at 8:15 PM, Satoru Logic satorulo...@gmail.com wrote: So I add a line of requirement into `~/.lein/profiles.clj`: [lein-noir 1.2.1] You should not need that. I just tried on my system, which has no ~/.lein/profiles.clj file. I did: lein new noir my-website (note

Re: Using clj-soap

2012-10-30 Thread Sean Corfield
AM, diepeglo diepe...@gmail.com wrote: Is someone using clj-soap? I tried and it fails with the same error. On Friday, July 13, 2012 4:35:39 AM UTC+2, Sean Corfield wrote: On Thu, Jul 12, 2012 at 7:34 PM, Sean Corfield seanco...@gmail.com wrote: When I looked at (soap/client-proxy http

Re: Fail to run dynamic binding code with Clojure1.4

2012-10-30 Thread Sean Corfield
Yes, it's very unfortunate that Manning released Clojure in Action without a final pass to make it Clojure 1.3 compatible. I talked to them about it when they still had time to make changes but they decided to go ahead and publish a book that is tightly wedded to Clojure 1.2 after Clojure 1.3 had

Re: Fail to run dynamic binding code with Clojure1.4

2012-10-30 Thread Sean Corfield
On Tue, Oct 30, 2012 at 8:38 PM, Satoru Logic satorulo...@gmail.com wrote: Could you please recommend a book that's more up-to-date? Clojure Programming http://www.clojurebook.com/ would be my first choice. Programming Clojure 2nd Edition http://pragprog.com/book/shcloj2/programming-clojure

Re: conversion problems using (count @someatom)

2012-10-29 Thread Sean Corfield
Your last argument is not a sequence - remove the apply. (and you probably want to remove the conj [] on the free memory call?) On Mon, Oct 29, 2012 at 9:21 AM, larry google groups lawrencecloj...@gmail.com wrote: Now Ihave this and I get errors: (defn

Re: ANN: data.json 0.2.0

2012-10-25 Thread Sean Corfield
On Thu, Oct 25, 2012 at 8:08 AM, Stuart Sierra the.stuart.sie...@gmail.com wrote: I certainly did not anticipate this release causing significant problems for application or library developers, and if it did then I apologize. The biggest problem is transitive dependency conflicts (as I had with

Re: thinking in data, polymorphism, etc.

2012-10-25 Thread Sean Corfield
On Thu, Oct 25, 2012 at 8:59 AM, Brian Craft craft.br...@gmail.com wrote: I have a fairly common scenario where I have a set of operations that need to work on two types of data (not data types in the clojure sense) that have different internal structure (i.e. maps with different keys). I could

Re: compile fails but stack trace does not mention a line of code in my app

2012-10-25 Thread Sean Corfield
On Thu, Oct 25, 2012 at 11:36 AM, larry google groups lawrencecloj...@gmail.com wrote: I am finding the following stack trace unusually devoid of information. My app is Clojure 1.3. I run lein compile and I get the following stack trace. Am I blind, or does this stack trace fail to tell me what

Re: what is the modern equivalent of clojure.contrib.java-utils/file?

2012-10-25 Thread Sean Corfield
On Thu, Oct 25, 2012 at 11:39 AM, larry google groups lawrencecloj...@gmail.com wrote: How do you know this? Where is this documented? I find myself baffled as to what is a dependency and what is not. http://clojure.github.com If it's listed separated there, it's a contrib you need to pull in

Re: ANN: data.json 0.2.0

2012-10-25 Thread Sean Corfield
Thanx Stuart! That looks great, at a glance. On Thu, Oct 25, 2012 at 1:25 PM, Stuart Sierra the.stuart.sie...@gmail.com wrote: I'm sorry for causing people extra work. How's this for a solution: https://github.com/clojure/data.json/commit/6ee71009946731d89ef8f98e7b659fa82443b6a2 This allows

Re: what is the modern equivalent of clojure.contrib.java-utils/file?

2012-10-25 Thread Sean Corfield
(and need a project.clj dependency), some are built-in. Per my original email: On Thursday, October 25, 2012 2:57:26 PM UTC-4, Sean Corfield wrote: http://clojure.github.com If it's listed separated there, it's a contrib you need to pull in explicitly. Otherwise it's part of Clojure itself

Re: (if (io/file path-to-session-file) -- returns false though file exists

2012-10-25 Thread Sean Corfield
On Thu, Oct 25, 2012 at 3:21 PM, larry google groups lawrencecloj...@gmail.com wrote: I look here and see that the old monolithic Clojure contrib had an exists function: http://clojuredocs.org/clojure_contrib/clojure.contrib.java-utils/file I see this example: (.

Re: when to be lazy

2012-10-23 Thread Sean Corfield
On Tue, Oct 23, 2012 at 11:38 AM, Brian Craft craft.br...@gmail.com wrote: Is a lazy seq mostly about algorithmic clarity, and avoiding unnecessary computation? So far I haven't run into any cases where I wouldn't realize the entire sequence, and it's always faster to do it up-front. Here's a

[ANN] congomongo 0.2.2 and 0.3.1 released

2012-10-23 Thread Sean Corfield
Today has been a busy day in the world of CongoMongo with four(!) releases... The 0.2.x branch is now in maintenance, supporting Clojure 1.2.x. Release 0.3.0 onward only support Clojure 1.3.0 and later. Only 0.2.1 and 0.3.0 were planned. MongoDB then announced a critical bug fix in the Java

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Sean Corfield
On Mon, Oct 22, 2012 at 12:05 PM, Michael Fogus mefo...@gmail.com wrote: First, thanks for trying c.c.cache! The answer to your question is that the TTL cache implementation is non-destructive. The `evict` call returns the cache without the element, but does not remove it from the original

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Sean Corfield
, and a value, update the cache and return... [a k v] (if (cache/has? @a k) (cache/hit @a k) (cache/miss @a k v))) ... (swap! c3 hit-or-miss :c 42) ... On Monday, October 22, 2012 11:15:06 PM UTC+3, Sean Corfield wrote: In other words you need something like this: (def c3 (atom (cache/ttl

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Sean Corfield
Fogus can help me out there?). Sean On Mon, Oct 22, 2012 at 2:31 PM, Sean Corfield seancorfi...@gmail.com wrote: On Mon, Oct 22, 2012 at 1:50 PM, Hussein B. hubaghd...@gmail.com wrote: c3 holds a map containing {:a 1} that will lives for two minutes. In the code I provided, c3 is an atom

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Sean Corfield
On Mon, Oct 22, 2012 at 3:08 PM, Hussein B. hubaghd...@gmail.com wrote: I tried this: (defn hit-or-miss [a k v] (if (c/has? @a k) (c/hit @a k) (c/miss @a k v))) My bad... got a bit carried away with the derefs based on code I was playing around with in the REPL. Try this:

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Sean Corfield
On Mon, Oct 22, 2012 at 3:30 PM, Hussein B. hubaghd...@gmail.com wrote: So we need to call evict explicitly if we want to remove an entry? no automatic deletion after expiring? The cache is immutable. When you call hit / miss, you get a new instance of the cache with the expired entries

Re: Coming from Common Lisp to Clojure

2012-10-19 Thread Sean Corfield
On Thu, Oct 18, 2012 at 4:28 PM, Brian Craft craft.br...@gmail.com wrote: C is a C-language, and it seems a lot simpler than clojure to me. KR is about 200 pages. I expect you mean C++, Java, etc. No, I think Clojure is a lot simpler than C. As for C++, I was on the standards committee for

Re: ANN: cljs-info 1.0.0 Help and reflection facilities for ClojureScript

2012-10-19 Thread Sean Corfield
Frank demo'd a lot of this to the Bay Area Clojure Meetup tonight and it is very cool stuff that makes development with ClojureScript a lot more interactive and natural. Great work! On Thu, Oct 18, 2012 at 12:28 AM, Frank Siebenlist frank.siebenl...@gmail.com wrote: cljs-info is a collection

Re: I can get this if() clause to ever be true

2012-10-19 Thread Sean Corfield
On Fri, Oct 19, 2012 at 12:10 AM, larry google groups lawrencecloj...@gmail.com wrote: (defn add-to-logged-in-registry [this-users-params] (let [right-now (. (Date.) getTime) new-user-entry (conj this-users-params { updated right-now })] (if (:username new-user-entry)

Re: I can get this if() clause to ever be true

2012-10-19 Thread Sean Corfield
On Fri, Oct 19, 2012 at 12:53 AM, Kevin Downey redc...@gmail.com wrote: conj can surely produce maps, and does so happily in the following cases: Doh! Of course. Thank you for the correction. I assumed that was his problem without actually trying it - my bad :( -- Sean A Corfield -- (904)

Re: ANN: data.json 0.2.0

2012-10-19 Thread Sean Corfield
Removing the old API causes problems for projects that have transitive dependencies on multiple versions of c.d.json. For example, congomongo depends on c.d.json 0.1.3, specifically on json-str. At World Singles we depend on c.d.json directly and we depend on congomongo. We can't move to c.d.json

Re: code design in clojure

2012-10-18 Thread Sean Corfield
Which books on Clojure have you read so far? On Wed, Oct 17, 2012 at 8:51 PM, Brian Craft craft.br...@gmail.com wrote: I'm finding the books on clojure to be very focused on low-level language features. Are there any good references for how to design code in clojure (or perhaps in functional

Re: why is get not giving me a default value?

2012-10-18 Thread Sean Corfield
I tried your code and got the expected result: user (def registry (atom {})) #'user/registry user (import 'java.util.Date) java.util.Date user (defn add-to-logged-in-registry [this-users-params] (let [right-now (. (Date.) getTime) new-user-entry (conj this-users-params { updated

Re: why is get not giving me a default value?

2012-10-18 Thread Sean Corfield
On Thu, Oct 18, 2012 at 8:26 AM, larry google groups lawrencecloj...@gmail.com wrote: Interesting. I am using Clojure 1.3. And I'm using clojure-jack-in inside of emacs. What are you using? I was using Clojure 1.4 via jack-in from emacs. I just tried it again with lein repl in a clean

Re: code design in clojure

2012-10-18 Thread Sean Corfield
On Thu, Oct 18, 2012 at 8:58 AM, Brian Craft craft.br...@gmail.com wrote: Clojure Programming, and The Joy of ... Hmm, I was going to suggest Joy of but if you don't think that helps with some of those design issues, I'm not sure what to suggest. Others suggested Clojure Programming but,

Re: Coming from Common Lisp to Clojure

2012-10-18 Thread Sean Corfield
On Thu, Oct 18, 2012 at 9:37 AM, Brian Craft craft.br...@gmail.com wrote: I suspect that if you come from java or C++ it seems like a simple language, but it feels pretty cluttered compared to other languages. Interesting observation and probably true. Although I did Lisp back at university

ANN CongoMongo 0.2.0

2012-10-14 Thread Sean Corfield
I meant to post this a few days ago... CongoMongo, a Clojure wrapper for MongoDB, just released version 0.2.0 to Clojars: Version 0.2.0 - October 10th, 2012: - Added URL / license / mailing list information to project.clj so it will show up in Clojars and provide a better user experience

Re: trying to read table write file

2012-10-11 Thread Sean Corfield
On Wed, Oct 10, 2012 at 9:43 PM, Brian Craft craft.br...@gmail.com wrote: and I get Insufficient bytes to decode frame from gloss. I didn't expect an error reading the table. What am I doing wrong? Source for read-table? -- Sean A Corfield -- (904) 302-SEAN An Architect's View --

Re: trying to read table write file

2012-10-11 Thread Sean Corfield
On Thu, Oct 11, 2012 at 10:38 AM, Brian Craft craft.br...@gmail.com wrote: Never mind, I found it. ;) Been up too long, apparently. Please share - I'm curious now! -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/

Re: trying to read table write file

2012-10-11 Thread Sean Corfield
On Thu, Oct 11, 2012 at 5:57 PM, Brian Craft craft.br...@gmail.com wrote: Geez, you want me to share my brain failures? ;-p In my defense, I was up half the night taking care of sick progeny. I just wondered if whether it was the sort of problem that others might run into and sharing it might

Re: pattern for coalescing similar adjacent items in list

2012-10-10 Thread Sean Corfield
partition-by will probably get you started - turning (a1 a2 a3 b1 b2 c1 c2 c3 c4) into ((a1 a2 a3) (b1 b2) (c1 c2 c3 c4)) - then map some function over that? On Wed, Oct 10, 2012 at 5:22 PM, Brian Craft craft.br...@gmail.com wrote: I have a long list (or seq? result of calling map) something

Re: understanding 'binding' use in clojure.java.jdbc

2012-10-09 Thread Sean Corfield
No, the inner with-connection binds *db* to db1 so db2 is no longer accessible. This is why c.j.jdbc is getting an API overall that will expose functions that accept the connection or the db-spec directly (and the old API will be rewritten in terms of the new one for compatibility). Sean On

Re: understanding 'binding' use in clojure.java.jdbc

2012-10-09 Thread Sean Corfield
On Tue, Oct 9, 2012 at 12:53 PM, Brian Craft craft.br...@gmail.com wrote: On Tuesday, October 9, 2012 12:11:28 PM UTC-7, Tassilo Horn wrote: Yes, that's true. Maybe Korma [1] is better suited for this kind of operation. Thanks for the link to korma. Korma is built on c.j.jdbc and may

Re: math

2012-10-09 Thread Sean Corfield
On Tue, Oct 9, 2012 at 7:38 PM, Brian Craft craft.br...@gmail.com wrote: I need some basic math functions, e.g. floor. I see there are some in contrib, but I'm unable to figure out the status of contrib. Seems like it's deprecated, or in transition, or something? Back with Clojure 1.3, the

Re: math

2012-10-09 Thread Sean Corfield
On Tue, Oct 9, 2012 at 9:03 PM, kovas boguta kovas.bog...@gmail.com wrote: Most of the time you are using the contrib for some convenience function. Its way easier to just copy that function into your own project, than to worry about tracking down the new library, and then checking that the

Re: math

2012-10-09 Thread Sean Corfield
On Tue, Oct 9, 2012 at 9:22 PM, Brian Craft craft.br...@gmail.com wrote: Top hits on google. clojure math floor, top three hits are contrib docs. Thanx. I Googled that phrased and the first result was the old richhickey repo. We should be able to get that fixed - or at least a notice added

Re: math

2012-10-09 Thread Sean Corfield
On Tue, Oct 9, 2012 at 9:23 PM, kovas boguta kovas.bog...@gmail.com wrote: The one that bit me specifically was clojure.contrib.string = clojure.string . Not criticising the new design, its just a fact that its not backwards compatible. I believe that happened in Clojure 1.2, even before

Re: math

2012-10-09 Thread Sean Corfield
On Tue, Oct 9, 2012 at 9:43 PM, kovas boguta kovas.bog...@gmail.com wrote: Actually all the examples I had in mind where from 1.2 (I migrated from 1.1 so it all seemed part of a piece to me) I think the migration from 1.2 to 1.3 is better documented than the migration from 1.1 to 1.2... So

Re: Clojure web framework

2012-09-29 Thread Sean Corfield
sites and projecst and Rails is like a pro maybe there should be something like a pro at Clojure. пятница, 28 сентября 2012 г., 19:37:05 UTC+4 пользователь Sean Corfield написал: The lein-noir plugin works with lein2 so you can just say: lein new noir my-app cd my-app lein run

Re: Clojure web framework

2012-09-28 Thread Sean Corfield
The lein-noir plugin works with lein2 so you can just say: lein new noir my-app cd my-app lein run The webnoir.org website seems to provide reasonable documentation on getting started. If you have suggestions to improve the documentation, I'm sure Chris would be happy to receive them (I suspect

Re: instantiating a clojure record from Java

2012-09-18 Thread Sean Corfield
On Tue, Sep 18, 2012 at 11:04 AM, Jim - FooBar(); jimpil1...@gmail.comwrote: However i get again: ClassNotFoundException Clondie24.games.chess.Player That suggests the Clojure code isn't AOT compiled and/or isn't on your class path? -- Sean A Corfield -- (904) 302-SEAN An Architect's View --

Re: idiomatic use of iterate + cycle ?

2012-09-16 Thread Sean Corfield
On Sun, Sep 16, 2012 at 5:15 AM, Jim - FooBar(); jimpil1...@gmail.comwrote: It turns out that reduce is exactly what I need...I didn't know this but there is a handy 'reduced' fn that makes it easy to terminate from within a reduce at any given time. At least this is what i understand from the

Re: Clojure lazy-seq over Java iterative code

2012-09-14 Thread Sean Corfield
On Fri, Sep 14, 2012 at 8:37 AM, Dave Kincaid kincaid.d...@gmail.com wrote: I also posted this to StackOverflow, so sorry if you saw it there too. If you want some rep points over there you can answer there too

<    6   7   8   9   10   11   12   13   14   15   >