[ANN] edn-java 0.4.4 released

2014-03-02 Thread Ben Smith-Mannschott
edn-java [1] is a parser and printer for edn [2]. This release: * Provides a pretty printer for edn data [3]. * Recognizes 'foo//' as a symbol [4]. * Provides experimental more readable, but still compact, edn printing [5]. It should be available on Maven Central within a day. [1]

Re: I want to get sha1 of a string

2014-03-02 Thread Ben Smith-Mannschott
(- Hello, World! .getBytes create-hash ...) Will get you the hash of the string encoded to bytes using *some random encoding*. (Whatever the platform you're currently running on defaults to.) You should explicitly choose an encoding and stick to it. I'd suggest UTF-8 since that can encode all

Re: the semantic of if-let macro

2013-01-30 Thread Ben Smith-Mannschott
I find it helpful to view if-let as a minor variation on if, with the only difference being that you choose to bind the results of the test-expression to some name(s). if-let doesn't care about the values bound to the variables named in binding-target (which might be an arbitrarily complex

[ANN] edn-java 0.4.0 a library to read and write edn data

2013-02-23 Thread Ben Smith-Mannschott
I'm happy to report that edn-java is now available on Maven Central. What is edn-java? - Edn-java is a Java library for reading and writing edn data. It has no dependencies other than Java 1.6.x or later. A more detailed description, including usage examples is available here:

Java interop: Can't call public method of non-public class

2013-03-01 Thread Ben Smith-Mannschott
Simplified, from a more complex example: abstract class Bytes { public toHexString() { return ...; } Bytes { } } public class Hash extends Bytes { public Hash() { super(); } } This works in Java: new Hash().toHexString(); This fails in Clojure: (.toHexString (Hash.))

Re: Java interop: Can't call public method of non-public class

2013-03-05 Thread Ben Smith-Mannschott
I found the following work-around since I have access to the java code I am calling: I had the package-visible ABC Bytes implement a (public) interface declaring the toHexString method. This placated the compiler. On Monday, March 4, 2013, Vladimir Tsichevski wrote: I think not. But upgrading

Re: LoL which style for Clojure

2013-03-24 Thread Ben Smith-Mannschott
Way back when I started with Clojure i was doing this: (let [constant-data (something-expensive)] (defn my-fn [x] (do-something-with x constant-data))) But was advised instead to do this: (def my-fn (let [constant-data (something-expensive)] (fn [x] (do-something-with x

[ANN] edn-java 0.4.1 released

2013-06-05 Thread Ben Smith-Mannschott
edn-java [1] is a parser and printer for edn [2]. This release fixes issue31 [3] single quote in a string is incorrectly escaped. It is available on Maven Central [4]. // Ben [1] http://edn-java.bpsm.us [2] https://github.com/edn-format/edn [3] https://github.com/bpsm/edn-java/issues/31 [4]

Re: Immutable Piece-table

2011-07-13 Thread Ben Smith-Mannschott
On Wed, Jul 13, 2011 at 02:33, Ghadi Shayban gshay...@gmail.com wrote: I put up a simple demo that implements a piece table data structure in Clojure (This is totally an excuse to use finger trees, which Chris Houser implemented and excellently presented at the first conj) A piece table is

Re: Change in reduce behavior in 1.3.0?

2011-07-13 Thread Ben Smith-Mannschott
On Wed, Jul 13, 2011 at 08:43, Meikel Brandmeyer m...@kotka.de wrote: Hi, I think the culprit is here: https://github.com/clojure/clojure/blob/5f9d6a02c530a02251197e1b844af37440a6b569/src/clj/clojure/core/protocols.clj#L64 The line (recur cls (next s) f (f val (first s))) must be written as

Re: Anyone on Google+ yet?

2011-07-15 Thread Ben Smith-Mannschott
On Thu, Jul 14, 2011 at 19:12, Claudia Doppioslash claudia.doppiosl...@gmail.com wrote: My Clojure circle is all set up but empty. My g+ is: http://gplus.to/gattoclaudia Please add link to your profile below. https://plus.google.com/117672714007923674182 // Ben -- You received this message

Re: Cyclic load dependency

2011-07-18 Thread Ben Smith-Mannschott
Clojure does not allow cyclic dependencies between namespaces. Java does allow cyclic dependencies between classes. I'm not familiar with appengine-clj. Are you certain that appengine.datastore is Clojure code, not Java code? If it's Java you should be using import. // Ben On Sat, Jul 16, 2011

Re: The Last Programming Language

2011-07-19 Thread Ben Smith-Mannschott
On Tue, Jul 19, 2011 at 16:11, Ken Wesson kwess...@gmail.com wrote: On Tue, Jul 19, 2011 at 10:05 AM, Colin Yates colin.ya...@gmail.com wrote: I find his videos very easy to watch - I think it was around a hour, but the time flies by. An hour of Will Smith blasting aliens flies by. An hour of

Re: Adding Change History To Clojure Modules

2011-08-03 Thread Ben Smith-Mannschott
This. 1000 times this. Don't clutter your source code with this kind of stuff. It'll just cause you pain down the road. (Say, when merging two branches.) // ben On Wed, Aug 3, 2011 at 23:36, Sean Corfield seancorfi...@gmail.com wrote: I think Joop meant to use the change history in your

Re: Sorting gotcha

2011-08-23 Thread Ben Smith-Mannschott
On Tue, Aug 23, 2011 at 09:44, Mark Engelberg mark.engelb...@gmail.com wrote: I had always assumed that vectors were sorted lexicographically.  In other words, you sort on the first element, and then refine by the second element, and so on.  I was surprised tonight to discover that is not the

Re: [ANN] Clojure 1.3 Released

2011-09-24 Thread Ben Smith-Mannschott
See also: http://dev.clojure.org/jira/browse/CLJ-838 I've submitted some patches there to recode changes.txt to Markdown a week or two ago. I updated it last night for f0b092b66 more changes.txt tweaks // Ben On Sat, Sep 24, 2011 at 15:47, Mark Nutter manutte...@gmail.com wrote: Totally

Re: clojure.contrib.base64

2011-10-10 Thread Ben Smith-Mannschott
Cool! I did some quick-and-dirty benchmarking of it this afternoon (GMT+2) and got between 50 and 70 MiB/s on my machine. The Apache implementation used for comparison by the unit tests came in at between 30 and 40 MiB/s. Impressive. I've since seen perf_base64.clj go in, though I'm not clear

Re: clojure.contrib.base64

2011-10-10 Thread Ben Smith-Mannschott
I've already figured out how it works and have found the same 2:1 ratio. (This time on my 1.4GHz MacBook Air; The previous tests were on a 2.4 GHz Core2Duo running Linux.) When I did the quick-and-dirty benchmarking this afternoon I used larger random inputs (1 to 8 MiB) allowing me to calculate

Re: Exception handling changes in Clojure 1.3.0

2011-10-12 Thread Ben Smith-Mannschott
I've attached a RFC patch based on this idea to CLJ-855. http://dev.clojure.org/jira/browse/CLJ-855 // Ben On Wed, Oct 12, 2011 at 22:02, Stefan Kamphausen ska2...@googlemail.com wrote: Just for the record: That's how I understood Ivan's idea, too.  Introduce a special exception type which

Re: About metadat and #^ macro.

2011-10-19 Thread Ben Smith-Mannschott
The current syntax is just ^ (defn filenames-in-jar [^JarFile jar-file] ...) On Thu, Oct 20, 2011 at 07:03, mmwaikar mmwai...@gmail.com wrote: Hi, I read in Clojure in Action book by Amit Rathore, that #^ associates metadata for the next form. He also mentions that it is deprecated. So what

Re: A problem with using enumeration-seq with java.util.jar.JarFile.

2011-10-19 Thread Ben Smith-Mannschott
I've been hacking around with jars in clojure recently. You might find some ideas here: https://gist.github.com/1300472 // Ben On Wed, Oct 19, 2011 at 14:34, mmwaikar mmwai...@gmail.com wrote: But then why does this fail - (slurp (.getInputStream (first (enumeration-seq (.entries f)

Re: Is there a reader setting support BigDecimal by default?

2011-10-20 Thread Ben Smith-Mannschott
On Thu, Oct 20, 2011 at 11:17, Joel Gluth joel.gl...@gmail.com wrote: On Tue, Oct 18, 2011 at 3:47 PM, Tassilo Horn tass...@member.fsf.org wrote: Scott Hickey jscotthic...@gmail.com writes: And usually, you should refrain from using floating points at all, no matter if BigDecimal or Double.

Re: Is there a reader setting support BigDecimal by default?

2011-10-20 Thread Ben Smith-Mannschott
On Thu, Oct 20, 2011 at 22:50, Stuart Halloway stuart.hallo...@gmail.com wrote: It appears that the answer to the original question is no, there is no way to configure the reader to default numbers with a decimal point to be BigDecimal instead of Double. Scott Hickey Reading a double

Re: Is there a reader setting support BigDecimal by default?

2011-10-20 Thread Ben Smith-Mannschott
On Thu, Oct 20, 2011 at 23:16, Stuart Halloway stuart.hallo...@gmail.com wrote: It appears that the answer to the original question is no, there is no way to configure the reader to default numbers with a decimal point to be BigDecimal instead of Double. Scott Hickey Reading a double

Re: Reading special characters with slurp

2011-10-21 Thread Ben Smith-Mannschott
You need to tell slurp how the file is encoded. (slurp path-to-my-file :encoding UTF-8) That means that you'll need to know what encoding your file is using. If you've never dealt with encoding before, I recommend reading this: http://www.joelonsoftware.com/articles/Unicode.html // Ben On Fri,

Re: partial, but instead of args + additional, get additional + args

2011-10-23 Thread Ben Smith-Mannschott
On Sun, Oct 23, 2011 at 21:25, Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 22.10.2011 um 20:49 schrieb Sean Corfield: I'm starting to think there's a nice, idiomatic solution lurking somewhere that wouldn't require an extra function... The idiomatic solution is #(f % a1 a2 a3). I'm

Re: partial, but instead of args + additional, get additional + args

2011-10-23 Thread Ben Smith-Mannschott
On Sun, Oct 23, 2011 at 23:53, Sean Corfield seancorfi...@gmail.com wrote: On Sun, Oct 23, 2011 at 1:04 PM, Ben Smith-Mannschott bsmith.o...@gmail.com wrote: On Sun, Oct 23, 2011 at 21:25, Meikel Brandmeyer m...@kotka.de wrote: The idiomatic solution is #(f % a1 a2 a3). I'm failing to see

Re: Pattern matching for map content

2011-10-25 Thread Ben Smith-Mannschott
On Tue, Oct 25, 2011 at 11:20, Michael Jaaka michael.ja...@googlemail.com wrote: Hi! Pattern matching is fine for sequence or vector destruction. Is is possible to destruct map and make pattern machting? For example I would like to make constraint for to some query service. It would be done

Re: Pattern matching for map content

2011-10-25 Thread Ben Smith-Mannschott
On Tue, Oct 25, 2011 at 15:33, Alex Ott alex...@gmail.com wrote: it's better to use https://github.com/clojure/core.match Thanks, I'd forgotten about core.match. // ben On Tue, Oct 25, 2011 at 11:32 AM, Ben Smith-Mannschott bsmith.o...@gmail.com wrote: On Tue, Oct 25, 2011 at 11:20, Michael

Re: java.lang.ClassFormatError: Invalid method Code length

2011-10-25 Thread Ben Smith-Mannschott
On Tue, Oct 25, 2011 at 22:28, Sergey Didenko sergey.dide...@gmail.com wrote: I get the subject error when trying to deserialize a big map (70kb) using load-file. Is this by design? There was an advice in the old thread to use smaller methods. But while small methods are good, breaking

Re: Is there a String protocol?

2011-10-25 Thread Ben Smith-Mannschott
On Tue, Oct 25, 2011 at 14:45, Sean Devlin francoisdev...@gmail.com wrote: I was wondering if there was a common protocol to get a string representation of an object yet.  Also, are there common protocols for ints, doubles, chars, etc?  Having just spent a lot of time writing Python, having an

Re: (dir *ns*) doesn't work??

2011-10-27 Thread Ben Smith-Mannschott
dir is a macro. It doesn't evaluate its arguments. So when you say (dir *ns*), Clojure sees: show me what's in the namespace named *ns*, and there is no such namespace because *ns* is the name of a variable which contains the name of the current namespace. Dir is this way because for interactive

Re: clojure.core/max and NaN

2011-10-30 Thread Ben Smith-Mannschott
On Sun, Oct 30, 2011 at 10:02, bOR_ boris.sch...@gmail.com wrote: Hi all, Ran into something unexpected with max. user (sd-age-female 13) [10 NaN 0.746555245613119] user (apply max (sd-age-female 13)) 0.746555245613119 TL;DR: Don't expect sensible answers when NaN is involved. The

Re: clojure.core/max and NaN

2011-11-01 Thread Ben Smith-Mannschott
I've opened http://dev.clojure.org/jira/browse/CLJ-868 The min and max functions in clojure.core behave unpredictably when one or more of their arguments is Float/NaN or Double/NaN. This is because the current implementation assumes that provides a total ordering, but this is not the case when

Re: clojure.core/max and NaN

2011-11-01 Thread Ben Smith-Mannschott
On Tue, Nov 1, 2011 at 21:00, Michael michael.campb...@gmail.com wrote: On Nov 1, 12:14 pm, Ben Smith-Mannschott bsmith.o...@gmail.com wrote: 3. Define that min and max will ignore any NaN arguments. What is: (min NaN NaN) in this situation;  ()? The part of the message you didn't

Re: Any reason interleave needs 2 or more collections?

2011-11-03 Thread Ben Smith-Mannschott
On Thu, Nov 3, 2011 at 03:14, Alex Baranosky alexander.barano...@gmail.com wrote: What a coincidence. My instinct would be to make (interleave) return an empty seq, instead of nil. I wonder the trade-offs between the two? There is no such thing as an empty seq. Or put another way, the empty seq

Re: Any reason interleave needs 2 or more collections?

2011-11-03 Thread Ben Smith-Mannschott
On Thu, Nov 3, 2011 at 13:13, Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 03.11.2011 um 12:18 schrieb Ben Smith-Mannschott: There is no such thing as an empty seq. Or put another way, the empty seq *is* nil. You're probably thinking of an empty list. while this is true, the following

Re: Access to unzipped assets within jars

2011-11-05 Thread Ben Smith-Mannschott
On Sat, Nov 5, 2011 at 14:42, Sam Aaron samaa...@gmail.com wrote: Hi there, consider there exists foo.jar on Clojars which contains a bunch of asset files i.e. png images. If I were to declare foo as one of my project's dependencies, is it possible to get access to those asset files? I

Re: Can't dynamically bind non-dynamic var

2011-11-12 Thread Ben Smith-Mannschott
On Sat, Nov 12, 2011 at 18:37, Kevin Albrecht onlya...@gmail.com wrote: I was experimenting with dynamic binding of vars with Clojure 1.3, as described on  http://clojure.org/vars and got this error: user= (def x 1) user= (binding [x 2] x) IllegalStateException Can't dynamically bind

Re: Overused phrases in the Clojure community

2011-11-15 Thread Ben Smith-Mannschott
On Wed, Nov 16, 2011 at 02:16, thenwithexpandedwingshesteershisflight mathn...@gmail.com wrote: Can we please get bored of saying idiomatic and in particular please ? can you think of some more idiomatic way to say idiomatic, in particular? :P // ben -- You received this message because you

Re: Overused phrases in the Clojure community

2011-11-15 Thread Ben Smith-Mannschott
On Wed, Nov 16, 2011 at 02:16, thenwithexpandedwingshesteershisflight mathn...@gmail.com wrote: Can we please get bored of saying idiomatic and in particular please ? It's quite useful to be able to talk about the-way-of-expressing-this-concept-most-in-keeping-with-established-practice

Re: adding metadata to java objects

2011-11-16 Thread Ben Smith-Mannschott
On Wed, Nov 16, 2011 at 17:28, Ben Mabey b...@benmabey.com wrote: Hi, I would like to be able to add metadata to arbitrary java objects that have already been instantiated.  I know that you can use proxy to add metadata to objects that you create but in my case the object already exists (i.e.

Re: adding metadata to java objects

2011-11-16 Thread Ben Smith-Mannschott
On Wed, Nov 16, 2011 at 22:32, Alan Malloy a...@malloys.org wrote: On Nov 16, 11:53 am, Ben Smith-Mannschott bsmith.o...@gmail.com wrote: On Wed, Nov 16, 2011 at 17:28, Ben Mabey b...@benmabey.com wrote: Hi, I would like to be able to add metadata to arbitrary java objects that have

Re: Non Dev Builds

2011-11-16 Thread Ben Smith-Mannschott
== FILE == (def x 1) NEWLINE ; my comment == (str '( (slurp FILE) ) ) produces: == '((def x 1) NEWLINE ; my comment) == oops. On Thu, Nov 17, 2011 at 05:32, Andres Gomez and...@fractalmedia.mx wrote: Thanks for the robustness tip, Meikel. Just a question, i dont understand what you state,

Re: Surprising behavior with clojure.core/int (and probably other primitive integer functions)

2011-12-07 Thread Ben Smith-Mannschott
Would it help to have a naming convention for Clojure to distinguish compile-time flags from normal dynamic vars? // ben On Tue, Dec 6, 2011 at 17:05, David Nolen dnolen.li...@gmail.com wrote: *unchecked-math* is a compiler flag. On Tue, Dec 6, 2011 at 7:00 AM, Cedric Greevey

Re: Much longer build time for Clojure on HDD vs. SSD (4 min vs 30s)

2012-07-16 Thread Ben Smith-Mannschott
On Mon, Jul 16, 2012 at 5:21 PM, Raju Bitter rajubit...@googlemail.com wrote: I've checked out the Clojure source code, and build the JAR using the Ant command. I'm seeing a strange effect, where the compile time on my normal hard disk takes almost 4 min (with most the time being spent in the

Re: Much longer build time for Clojure on HDD vs. SSD (4 min vs 30s)

2012-07-16 Thread Ben Smith-Mannschott
On Mon, Jul 16, 2012 at 9:17 PM, Ben Smith-Mannschott bsmith.o...@gmail.com wrote: On Mon, Jul 16, 2012 at 5:21 PM, Raju Bitter rajubit...@googlemail.com wrote: I've checked out the Clojure source code, and build the JAR using the Ant command. I'm seeing a strange effect, where the compile

seeking namespace-aware xml lib

2012-07-16 Thread Ben Smith-Mannschott
TL;DR: I'm looking for a Clojure library that round trips XML+namespaces through Clojure data structures and back again. I'm hacking on a chewing-gum-and-bailing-wire solution publish my wife's novels as EPUB. I've got most of a prototype of the core functionality working, but an stubbing my

Re: seeking namespace-aware xml lib

2012-07-19 Thread Ben Smith-Mannschott
at 2:53 PM, Ben Smith-Mannschott bsmith.o...@gmail.com wrote: TL;DR: I'm looking for a Clojure library that round trips XML+namespaces through Clojure data structures and back again. I'm hacking on a chewing-gum-and-bailing-wire solution publish my wife's novels as EPUB. I've got most

Re: seeking namespace-aware xml lib

2012-07-24 Thread Ben Smith-Mannschott
On Thu, Jul 19, 2012 at 11:00 PM, Ben Smith-Mannschott bsmith.o...@gmail.com wrote: I am interested and I have a CA with Rich, but I'm currently exploring using XOM from Clojure. My first impression is that the API is very clean (as a Java API) and I appreciate its emphasis on correctness. I

Re: auxiliary methods like :before and :after for multimethods?

2012-07-28 Thread Ben Smith-Mannschott
On Fri, Jul 27, 2012 at 9:06 PM, Vinzent ru.vinz...@gmail.com wrote: robert-hooke actualy doesn't work with multimethods afaik. You can try my new library (https://github.com/dnaumov/hooks), but it's alpha (no docs yet, sorry). (defmulti foo* (fn [args] ...) ...) (defmethod foo* :x [args]...)

Re:

2012-07-30 Thread Ben Smith-Mannschott
On Sun, Jul 29, 2012 at 3:07 PM, John Holland jbholl...@gmail.com wrote: I'm doing some exercises in coding that are meant for Java but I'm doing them in Clojure. I'm stuck on this one. The goal is to return true if an array of ints contains two consecutive 2s. I figured I'd use Stuart

Re: Alternative to (or (:k1 m) (:k2 m))

2012-07-30 Thread Ben Smith-Mannschott
On Tue, Jul 31, 2012 at 1:08 AM, Aaron Cohen aa...@assonance.org wrote: On Mon, Jul 30, 2012 at 6:55 PM, Moritz Ulrich ulrich.mor...@gmail.com wrote: (some identity ((juxt :k1 :k2) m)) is the first thing I can think of. For even more fun, try (some m [:k1 :k2]) :) The flip side of this

Re: Alternative to (or (:k1 m) (:k2 m))

2012-07-30 Thread Ben Smith-Mannschott
On Tue, Jul 31, 2012 at 7:00 AM, Ben Smith-Mannschott bsmith.o...@gmail.com wrote: On Tue, Jul 31, 2012 at 1:08 AM, Aaron Cohen aa...@assonance.org wrote: On Mon, Jul 30, 2012 at 6:55 PM, Moritz Ulrich ulrich.mor...@gmail.com wrote: (some identity ((juxt :k1 :k2) m)) is the first thing I can

Re: use pmap but ensure that original ordering is retained?

2012-08-11 Thread Ben Smith-Mannschott
Yes, pmap behaves as map with respect to the ordering of the elements of the resulting sequence. // ben On Sat, Aug 11, 2012 at 9:29 PM, Jim - FooBar(); jimpil1...@gmail.com wrote: Hi all, I was wondering what assumptions does pmap take with regards to the ordering of the resulting seq? Can

Re: Lazily extract lines from large file

2012-08-17 Thread Ben Smith-Mannschott
On Thu, Aug 16, 2012 at 11:47 PM, David Jacobs da...@wit.io wrote: I'm trying to grab 5 lines by their line numbers from a large ( 1GB) file with Clojure. So far I've got: (defn multi-nth [values indices] (map (partial nth values) indices)) (defn read-lines [file indices] (with-open

Re: Lazily extract lines from large file

2012-08-18 Thread Ben Smith-Mannschott
handles. In any event, that's why I chose to pass the lazy sequence directly to the called function without binding it in a let first. // Ben On Fri, Aug 17, 2012 at 11:09 AM, Ben Smith-Mannschott bsmith.o...@gmail.com wrote: On Thu, Aug 16, 2012 at 11:47 PM, David Jacobs da...@wit.io wrote: I'm

Re: screencast corruption

2012-09-02 Thread Ben Smith-Mannschott
I can't fix the version posted on blip.tv, but I downloaded it over a year ago when it was still working. It's a 107 MB quicktime file encoded using H.264. Running time is 1 hour 14 minutes. I could make it available somewhere, if that would help. // Ben On Sun, Sep 2, 2012 at 12:37 PM, Mayank

Re: screencast corruption

2012-09-02 Thread Ben Smith-Mannschott
You should be able to download it from here for the next few days: https://dl.dropbox.com/u/8238674/clojure-sequences.mov // Ben On Sun, Sep 2, 2012 at 6:56 PM, Andrew Rafas andras.ra...@gmail.com wrote: I would appreciate, Thank you very much, Andrew On Sunday, September 2, 2012 4:19:10

Re: Found bug in contains? used with vectors.

2012-09-04 Thread Ben Smith-Mannschott
The naming of contains? is one of Clojure's small warts. Almost everyone seems to stumble over it when they're starting out. I know I did. Naming it contains-key? would have prevented a great deal of confusion, but I guess that ship has sailed... *shrug* // ben On Tue, Sep 4, 2012 at 1:35 PM,

Re: edn

2012-09-07 Thread Ben Smith-Mannschott
On Fri, Sep 7, 2012 at 3:01 AM, Rich Hickey richhic...@gmail.com wrote: I've started to document a subset of Clojure's data format in an effort to get it more widely used as a data exchange format, e.g. as an alternative to JSON. Please have a look: https://github.com/richhickey/edn

Re: edn

2012-09-08 Thread Ben Smith-Mannschott
On Fri, Sep 7, 2012 at 3:01 AM, Rich Hickey richhic...@gmail.com wrote: I've started to document a subset of Clojure's data format in an effort to get it more widely used as a data exchange format, e.g. as an alternative to JSON. Please have a look: https://github.com/richhickey/edn If

Re: edn

2012-09-09 Thread Ben Smith-Mannschott
On Fri, Sep 7, 2012 at 3:01 AM, Rich Hickey richhic...@gmail.com wrote: I've started to document a subset of Clojure's data format in an effort to get it more widely used as a data exchange format, e.g. as an alternative to JSON. Please have a look: https://github.com/richhickey/edn

Re: edn

2012-09-09 Thread Ben Smith-Mannschott
On Fri, Sep 7, 2012 at 3:01 AM, Rich Hickey richhic...@gmail.com wrote: I've started to document a subset of Clojure's data format in an effort to get it more widely used as a data exchange format, e.g. as an alternative to JSON. Please have a look: https://github.com/richhickey/edn

Re: edn

2012-09-10 Thread Ben Smith-Mannschott
On Mon, Sep 10, 2012 at 2:15 PM, Marko Topolnik marko.topol...@gmail.com wrote: Java has arrays, lists, maps and sets, so does Ruby and Erlang. If they were redundancies in these structures, can't see why these three still maintain this distinction. It's probably a safe bet to say that we

Re: edn

2012-09-10 Thread Ben Smith-Mannschott
On Mon, Sep 10, 2012 at 5:38 PM, Rich Hickey richhic...@gmail.com wrote: Would you mind taking specific requests for clarification to the issues page, so I don't lose track of them? https://github.com/richhickey/edn/issues Thanks, Rich sure thing // Ben -- You received this message

ANN edn-java

2012-09-11 Thread Ben Smith-Mannschott
I've posted a first rough cut of an edn parser written in plain Java here: https://github.com/bpsm/edn-java The parser itself is Wirthian, which is to say it's a hand-written LL(2) scanner coupled with a hand-written LL(1) recursive decent parser. This is easy enough to do for edn's uncomplicated

Re: Map literal with keys generated by function cause Duplicate key exception

2012-09-12 Thread Ben Smith-Mannschott
On Thu, Sep 13, 2012 at 12:02 AM, Matthew O. Smith m0sm...@gmail.com wrote: On Wednesday, September 12, 2012 8:03:58 AM UTC-6, jarppe wrote: I have a function that generatwed unique ID's, something like this: (def k (atom 0)) (defn generate-id [] (swap! k inc)) and I try to use it

Re: Nested functions on #() reader

2012-09-17 Thread Ben Smith-Mannschott
On Sun, Sep 16, 2012 at 6:16 AM, vhsmaia v...@viclib.com wrote: Hello. I'm new here, so, not sure if those were already posted. But why is this not used? An example would be: #(%a %%b %%%c) would be the same as (fn [a] (fn [b] (fn [c] (a b c))) My eyes! The goggles to nothing! -- You

I've had some success using edn

2012-09-19 Thread Ben Smith-Mannschott
I've had some success using edn on one of my little projects. First a little background: We're running a code generator written in Clojure which consumes homogenous collections of Clojure maps and producing a Java enum for each such collection. (The input data is basically 'edn' except that all

Re: ANN edn-java

2012-09-23 Thread Ben Smith-Mannschott
On Sun, Sep 23, 2012 at 3:59 AM, Mikera mike.r.anderson...@gmail.com wrote: Looks cool - going to try it out in a couple of my projects, thanks! Question - assuming this is pretty lightweight and efficient, would it also make sense to use it from Clojure in circumstances where you just want

Re: Map-destructuring a non-associative structure, non documented behavior?

2012-09-24 Thread Ben Smith-Mannschott
On Tue, Sep 25, 2012 at 5:10 AM, Nahuel Greco ngr...@gmail.com wrote: I can't find the documentation for this behaviour: (let [{x :b :as y} '(:a 1 :b 2)] [x y]) ;= [2 {:a 1, :b 2}] It seems as if the list in the init-expr is converted first to an associative structure and then

Re: clojure.lang.Keyword.hashCode is a hotspot in my app

2012-09-25 Thread Ben Smith-Mannschott
On Tue, Sep 25, 2012 at 1:53 AM, James Hess james.hes...@gmail.com wrote: Hi experienced clojure gurus, According to VisualVM 24% of my time is spent in clojure.lang.Keyword.hashCode. I'm sure I am doing something wrong (i.e. I'm not blaming clojure's implementation). Is this an indication

Re: performance in versions = 1.4.0

2012-10-04 Thread Ben Smith-Mannschott
nth only promises O(n) performance for all things sequential. However, the implementation on master in RT.java appears to special case indexed and random-access collections for faster access, so I'm not sure why you're seeing such a difference. You could try using get in place of nth, though from

Re: == is not transitive?

2012-10-05 Thread Ben Smith-Mannschott
On Fri, Oct 5, 2012 at 11:08 AM, Jean Niklas L'orange jeann...@hypirion.com wrote: On Friday, October 5, 2012 2:39:05 AM UTC+2, Ben wrote: user [(== 0 0.0) (== 0.0 0.0M) (== 0.0M 0)] [true true false] When passing two arguments to ==, == will be transitive. user [(== 0 0.0 0.0M) (== 0

Re: basic quoting question

2012-10-08 Thread Ben Smith-Mannschott
On Mon, Oct 8, 2012 at 5:06 PM, Brian Craft craft.br...@gmail.com wrote: Thanks! Is the string vs symbol distinction peculiar to clojure, among lisps? Yes, strings are distinct from symbols in every reputable lisp. That symbol and keyword know how to look themselves up in an associative

Re: Evaluating an anonymous function with closure

2012-10-15 Thread Ben Smith-Mannschott
On Mon, Oct 15, 2012 at 8:11 PM, Lee Spector lspec...@hampshire.edu wrote: On Oct 15, 2012, at 12:51 PM, Alan Malloy wrote: Evaluating function literals is not intended to work; that it works for non-closure functions should be treated as a coincidence. Really? Eval Evaluates the form data

Re: XML parsing with namespace prefixes

2012-10-19 Thread Ben Smith-Mannschott
On Fri, Oct 19, 2012 at 12:03 AM, Maurits maurits.r...@gmail.com wrote: Bit of a late reaction, but there is nothing special about a tag with a namespace prefixed. For example I have been using: (zf/xml- zipper :ListRecords :record :metadata :oai_dc:dc :dc:language zf/text) which works

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

2012-10-25 Thread Ben Smith-Mannschott
Anything that starts with clojure. is part of (some version of) clojure. For Clojure 1.4, that's everything listed in Table of Contents on the right side of the web page you'll find here: http://clojure.github.com/clojure/ clojure.core clojure.data clojure.inspector clojure.java.browse

Re: with-open and line-seq

2012-10-28 Thread Ben Smith-Mannschott
On Sun, Oct 28, 2012 at 9:38 AM, Christian Sperandio christian.speran...@gmail.com wrote: I've got a question about lazy-sequence and file reading. Is line-seq good to process lines from huge file? Let take this case, I want to process each line from a file with one or more functions. All

Re: Clojure videos deleted from blip.tv?

2012-12-12 Thread Ben Smith-Mannschott
I have no idea what is going on. Looks to me like blip decided to redo their web site and in the process throw out old content. or something. I've got local copies of: Alex Miller_ _Tree Editing with Zippers_.m4v Chris Houser_ _Finger Trees_ Custom Persistent Collections_.m4v Christophe Grand_

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-17 Thread Ben Smith-Mannschott
Your macro: *(*~greeter user-name#*)* * * Is producing a list of a function or closure followed by a symbol. The first element of the list your macro builds must instead be an expression that can be evaluated to a function. (For example a symbol naming a function or an (fn [] ...)

Re: Why I get IllegalArgumentException: No matching ctor found

2012-12-17 Thread Ben Smith-Mannschott
On Mon, Dec 17, 2012 at 11:08 AM, Alex Baranosky alexander.barano...@gmail.com wrote: Function values can't be read by the reader. I'm not sure how any versions of this code work. It is true that a function value can not be printed and then read back in, but I don't think that's relevant

Re: seeking namespace-aware xml lib

2013-01-18 Thread Ben Smith-Mannschott
Not currently, alas, having hacked my primary motivating example (publishing my wife's most recent novel for kindle) by hand. I'd like to return to it, but probably not soon. First I want to get 0.4.0 of edn-java released. Ben On Thursday, January 17, 2013, lewen7er9 wrote: Just wondering if

Re: why would this statement java -server ???

2011-12-15 Thread Ben Smith-Mannschott
On Fri, Dec 16, 2011 at 05:48, jayvandal s...@ida.net wrote: I was looking at the installation in Learning clojure and the batch file had this statement:  java -server -cp .;%CLOJURE_JAR% clojure.main     why is  the server in the line and what is it referencing??? Thanks for any help The

Re: Where is ltrim?

2012-01-03 Thread Ben Smith-Mannschott
On Tue, Jan 3, 2012 at 16:09, Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 03.01.2012 um 12:16 schrieb Cedric Greevey: Breaking changes are bad enough without making some of them gratuitous. They could have just renamed the namespace without also renaming some of the individual functions.

Re: Destructuring syntax

2012-01-04 Thread Ben Smith-Mannschott
On Wed, Jan 4, 2012 at 07:36, Johnny Weng Luu johnny.weng@gmail.com wrote: One thing that seems weird is the way Clojure destructures a map I have this map: {:last-name Vinge :first-name Vernor} which is passed to this function: (defn greet-author-2 [{fname :first-name}] ... ) Wouldn't

Re: Help! Migrating to 1.3.0

2012-01-13 Thread Ben Smith-Mannschott
On Fri, Jan 13, 2012 at 17:47, labwor...@gmail.com wrote: I have a few issues. What do the following warnings mean and what should I do about them? Did you read them? *default-encoding* not declared dynamic and thus is not dynamically rebindable ;; wont' work: (binding [*default-encoding*

Re: Help! Migrating to 1.3.0

2012-01-15 Thread Ben Smith-Mannschott
On Sun, Jan 15, 2012 at 01:37, James Reeves jree...@weavejester.com wrote: On 14 January 2012 23:34, myriam abramson labwor...@gmail.com wrote: I couldn't find quite the equivalent to read-lines from duck-streams. I found read-line but it's not the same. Where is the equivalent read-lines

how to get font-lock to work in swank repl buffer

2012-01-19 Thread Ben Smith-Mannschott
I'm trying to get syntax highlighting (font-lock) to work in the repl buffer provided by slime as described here: https://github.com/technomancy/swank-clojure (add-hook 'slime-repl-mode-hook (defun clojure-mode-slime-font-lock () (let (font-lock-mode)

Re: how to get font-lock to work in swank repl buffer

2012-01-20 Thread Ben Smith-Mannschott
On Fri, Jan 20, 2012 at 00:45, Jack Moffitt j...@metajack.im wrote: (add-hook 'slime-repl-mode-hook               (lambda ()                 (clojure-mode-font-lock-setup)                 (font-lock-mode)                 (font-lock-mode))) Excellent! This worked for me. Many thanks for the

Re: Creating map from string

2012-03-19 Thread Ben Smith-Mannschott
On Sun, Mar 18, 2012 at 21:04, Jimmy jimmy.co...@gmail.com wrote: Hi, I would like to generate a hashmap from a string. The key portions of the string  will have some a prefix such as @ to define that they are a key. So the following string @key1  this is a value  @another-key  and another

Re: [beginner] library for java code generation

2012-03-23 Thread Ben Smith-Mannschott
On Fri, Mar 23, 2012 at 14:22, Alex Shabanov avshaba...@gmail.com wrote: Hi all, Is there any easy-to-use library for generating java code? I ended up writing simple function that takes strings and characters and prints them in formatted form (e.g. with tabs and newlines after braces). I

Re: Alternate set literal syntax?

2012-03-25 Thread Ben Smith-Mannschott
On Sat, Mar 24, 2012 at 04:44, Cedric Greevey cgree...@gmail.com wrote: #{foo bar baz} is somewhat ugly. It occurs to me that one could modify the reader to additionally accept {{foo bar baz}} without breaking anything. It's not possible for it to be a valid map literal, because the outer

Re: Converting project.clj to maven's pom.xml

2012-04-20 Thread Ben Smith-Mannschott
lein pom may not do all you need. It depends on what you are trying to accomplish. It will generate a pom.xml which identifies your project (artifactId, groupId, version, packaging) and lists its dependencies. This pom is suitable for publishing your artifacts to some Maven repository for others

Re: Clojurians in Austria

2012-05-29 Thread Ben Smith-Mannschott
I too am in Vienna. I use Clojure at work for a few small internal tools, but not in production. I'd be glad to meet some other Clojurists. // Ben On Tue, May 29, 2012 at 5:05 PM, Nuno Marques nuno.filipe.marq...@gmail.com wrote: I'm in Vienna and I know a couple of more Clojure people here. I

Re: fully type-hinted record still uses reflection!

2012-06-10 Thread Ben Smith-Mannschott
On Sun, Jun 10, 2012 at 7:04 PM, Jim - FooBar(); jimpil1...@gmail.com wrote: Hi again (busy day eh?), well this doesn't make any sense either! Why is a record with  type-hinted arguments still using reflection? I've got the following example record:

Re: defpartial returns object instead of html string

2012-06-22 Thread Ben Smith-Mannschott
str On Fri, Jun 22, 2012 at 11:58 AM, Murtaza Husain murtaza.hus...@sevenolives.com wrote: Hi, I am using Chris Ganger's crate library to generate html on the client side.     (defpartial html [] form)     (def form   [:div.form-horizontal    [:fieldset     [:legend

ANN Big Ivan 0.1.0: BIC/IBAN parser, validator and constructor

2012-07-01 Thread Ben Smith-Mannschott
Big Ivan teaches Clojure how to parse, validate and construct BIC and IBAN strings. (BIC and IBAN are both structured identifiers used in banking.) http://github.com/bpsm/big-ivan http://bpsm.github.com/big-ivan/index.html https://clojars.org/org.clojars.bpsm/big-ivan As libraries

[ANN] edn-java 0.4.2 released

2013-06-13 Thread Ben Smith-Mannschott
edn-java [1] is a parser and printer for edn [2]. This release fixes issue #32 [3] EDN List, Vector types indistinguishable due to common RandomAccess interface. It should be available on Maven Central within a day. // Ben [1] http://edn-java.bpsm.us [2] https://github.com/edn-format/edn [3]

  1   2   >