[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] h

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

[ANN] edn-java 0.4.3 released

2013-06-18 Thread Ben Smith-Mannschott
edn-java [1] is a parser and printer for edn [2]. This release fixes issue #35 [3] "Allow Symbols to contain $ % & =". 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] https://github.com/bpsm/edn-java/issues/35 -

Re: [ANN] byte-streams: a rosetta stone for all the byte representations the jvm has to offer

2013-07-02 Thread Ben Smith-Mannschott
Ropes? http://en.m.wikipedia.org/wiki/Rope_(data_structure) Ben -- This message was sent via electromagnetism. On 02.07.2013, at 12:19, Mikera wrote: > This is cool, thanks Zach! > > Another set of mostly-isomporphic types that this could be applied to is > different matrix/array types in co

Re: edn-format parsers (eg, Common Lisp)?

2013-07-09 Thread Ben Smith-Mannschott
Perhaps you've not seen this: https://github.com/edn-format/edn/wiki/Implementations (But there's no CL implementation listed there.) //Ben On Tuesday, July 9, 2013, Rich Morin wrote: > I'm intrigued by edn (extensible data notation), as described here: > > https://github.com/edn-format/edn

Proposed formal syntax for edn

2013-07-18 Thread Ben Smith-Mannschott
I think it would aid compatibility between edn implementations if we had an agreed upon formal syntax. To that end, I've tried my hand at specifying one. I've posted it as issue 56 on edn-format/edn: https://github.com/edn-format/edn/issues/56 I'll incorporate fixes for any problems that are iden

Re: Proposed formal syntax for edn

2013-07-18 Thread Ben Smith-Mannschott
On Thu, Jul 18, 2013 at 7:46 PM, kovas boguta wrote: > I agree that would be a Good Thing. This looks like an excellent start. > > Is this specification executable in Instaparse? > > IMO specs that are immediately computable are more useful and more likely > to be correct. > No, not as it stands

[ANN] edn-java 0.4.5 released

2015-01-28 Thread Ben Smith-Mannschott
edn-java [1] is a parser and printer for edn [2]. This release: * Incorporates a patch from 'redahe' to fix issue 40 where < and > were not recognized as symbols. [3] It is available on Maven central as I write this. [1] http://edn-java.bpsm.us [2] https://github.com/edn-format/edn [3]

core.async: "Deprecated - this function will be removed. Use transducer instead"

2015-02-18 Thread Ben Smith-Mannschott
I'm probably just especially dense today, but perhaps someone can give me a poke in the right direction. I'm trying to wrap my head around transducers. (1) For debugging purposes I'd like to be able to consume the values on a channel and put them in a collection to be printed. I'm doing this at

Re: core.async: "Deprecated - this function will be removed. Use transducer instead"

2015-02-18 Thread Ben Smith-Mannschott
Thanks Malcolm, you're blog post was a great help to me. On Thu, Feb 19, 2015 at 3:06 AM, Malcolm Sparks wrote: > I have recently written a blog article which explains how to use > transducers with core.async. > > You can find it here: http://malcolmsparks.com/posts/transducers.html > > > On Wed

Re: core.async: "Deprecated - this function will be removed. Use transducer instead"

2015-02-19 Thread Ben Smith-Mannschott
I'm unclear on one thing: what's the purpose of core.async/pipe? In your blog article, you write: (-> source (pipe (chan)) payload-decoder payload-json-decoder) (pipe source destination) just copies elements from source to destination. How is that any different than just using source here directl

Re: Is there a cheet sheet for some of the pure symbolic functions like #'

2015-06-05 Thread Ben Smith-Mannschott
try googling for "clojure reader macros". Dru Sellers June 5, 2015 at 22:05via Postbox Trying to google what #' means is tricky to say the least. Is there a good name for these t

[ANN] edn-java 0.5.0 released

2016-12-11 Thread Ben Smith-Mannschott
edn-java [1] is a parser and printer for edn [2]. This release: * Can read namespaced maps as per CLJ-1910 [47] * Throws an exception when asked to read a map or set with duplicates [49] It should be appearing on Maven Central shortly. // Ben [1] http://edn-java.bpsm.us [2] https://github.com

[ANN] edn-java 0.4.6 released

2015-10-25 Thread Ben Smith-Mannschott
edn-java [1] is a parser and printer for edn [2]. This release: * Teaches the default parser to produce values that can participate in Java serialization. [3] It should be appearing on Maven Central shortly. // Ben [1] http://edn-java.bpsm.us [2] https://github.com/edn-format/edn [3] https:/

[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] http://edn-ja

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

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 destruct

[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: ht

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.)) Il

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 constan

Re: Immutable Piece-table

2011-07-12 Thread Ben Smith-Mannschott
On Wed, Jul 13, 2011 at 02:33, Ghadi Shayban 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 good for b

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

Re: Anyone on Google+ yet?

2011-07-15 Thread Ben Smith-Mannschott
On Thu, Jul 14, 2011 at 19:12, Claudia Doppioslash 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 because you are subscribe

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

Re: The Last Programming Language

2011-07-19 Thread Ben Smith-Mannschott
On Tue, Jul 19, 2011 at 16:11, Ken Wesson wrote: > On Tue, Jul 19, 2011 at 10:05 AM, Colin Yates 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 a talking > head is better pre

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 wrote: > I think Joop meant to use the change history in your version control system > dir

Re: Creating map from string

2012-03-19 Thread Ben Smith-Mannschott
On Sun, Mar 18, 2012 at 21:04, Jimmy 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 value @test1 a

Re: [beginner] library for java code generation

2012-03-23 Thread Ben Smith-Mannschott
On Fri, Mar 23, 2012 at 14:22, Alex Shabanov 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 really like comp

Re: Alternate set literal syntax?

2012-03-25 Thread Ben Smith-Mannschott
On Sat, Mar 24, 2012 at 04:44, Cedric Greevey 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 {...} pair ha

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: Pulling constants out of interfaces

2012-04-30 Thread Ben Smith-Mannschott
On Mon, Apr 30, 2012 at 18:22, Jay Fields wrote: > Foo$Bar is the name of the class, and $ is a valid character in a Java class > name. Foo$Bar is not a clojure symbol. Sure it is. The reader has to read it somehow. Otherwise the compiler will have nothing to work with. Also: user=> (symbol? (re

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 wrote: > I'm in Vienna and I know a couple of more Clojure people here. > I would be happy to help star

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(); 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 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 "Student Registeration"]

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 g

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 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 "compile-clojure" task

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 wrote: > On Mon, Jul 16, 2012 at 5:21 PM, Raju Bitter > 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

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 toe

Re: seeking namespace-aware xml lib

2012-07-19 Thread Ben Smith-Mannschott
gt; > -Ryan > > On Mon, Jul 16, 2012 at 2:53 PM, Ben Smith-Mannschott > 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 chewi

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

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 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]...) (defmethod foo* :y

Re:

2012-07-30 Thread Ben Smith-Mannschott
On Sun, Jul 29, 2012 at 3:07 PM, John Holland 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 Halloway's by-pairs fun

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 wrote: > On Mon, Jul 30, 2012 at 6:55 PM, Moritz Ulrich > 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 proposal is: ((some-fn :k1 :k2) m) Whic

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 wrote: > On Tue, Jul 31, 2012 at 1:08 AM, Aaron Cohen wrote: >> On Mon, Jul 30, 2012 at 6:55 PM, Moritz Ulrich >> wrote: >>> (some identity ((juxt :k1 :k2) m)) is the first thing I can think of. >> >> For

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(); wrote: > Hi all, > > I was wondering what assumptions does pmap take with regards to the ordering > of the resulting seq? Can I assume it retai

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

Re: Lazily extract lines from large file

2012-08-17 Thread Ben Smith-Mannschott
ot;locals clearing" 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 > wrote: >> On Thu, Aug 16, 2012 at 11:47 PM, David Jacobs

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 wrote: > I would appreciate, > Thank you very much, > Andrew > > > On Sunday, September 2, 2012 4:19:10 PM UTC+1, bsmith.

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

Re: edn

2012-09-07 Thread Ben Smith-Mannschott
On Fri, Sep 7, 2012 at 3:01 AM, Rich Hickey 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 > > Rich A few que

Re: edn

2012-09-08 Thread Ben Smith-Mannschott
On Fri, Sep 7, 2012 at 3:01 AM, Rich Hickey 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 - or . are t

Re: edn

2012-09-09 Thread Ben Smith-Mannschott
On Fri, Sep 7, 2012 at 3:01 AM, Rich Hickey 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 > > Rich The propo

Re: edn

2012-09-09 Thread Ben Smith-Mannschott
On Fri, Sep 7, 2012 at 3:01 AM, Rich Hickey 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 > > Rich I assume

Re: edn

2012-09-10 Thread Ben Smith-Mannschott
On Mon, Sep 10, 2012 at 2:15 PM, Marko Topolnik 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 need to >> convey

Re: edn

2012-09-10 Thread Ben Smith-Mannschott
On Mon, Sep 10, 2012 at 5:38 PM, Rich Hickey 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 because you are

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

Re: Nested functions on #() reader

2012-09-17 Thread Ben Smith-Mannschott
On Sun, Sep 16, 2012 at 6:16 AM, vhsmaia 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 received this messag

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 v

Re: ANN edn-java

2012-09-22 Thread Ben Smith-Mannschott
On Sun, Sep 23, 2012 at 3:59 AM, Mikera 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 edn > and don't need the fu

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 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 destructured. > But

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 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 that I'm using > keyw

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 r

Re: == is not transitive?

2012-10-05 Thread Ben Smith-Mannschott
On Fri, Oct 5, 2012 at 11:08 AM, Jean Niklas L'orange 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 0.0

Re: basic quoting question

2012-10-08 Thread Ben Smith-Mannschott
On Mon, Oct 8, 2012 at 5:06 PM, Brian Craft 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 collection is, as far

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 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 structure (not

Re: XML parsing with namespace prefixes

2012-10-18 Thread Ben Smith-Mannschott
On Fri, Oct 19, 2012 at 12:03 AM, Maurits 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 perfectly well. Ye

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 cloju

Re: with-open and line-seq

2012-10-28 Thread Ben Smith-Mannschott
On Sun, Oct 28, 2012 at 9:38 AM, Christian Sperandio 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 lines must be processed. Lin

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 [] ...) expre

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 releva

Re: Sorting gotcha

2011-08-23 Thread Ben Smith-Mannschott
On Tue, Aug 23, 2011 at 09:44, Mark Engelberg 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 case. > >> (compare "

Clojure 1.3: "defs can now have docstrings"; how so?

2011-09-06 Thread Ben Smith-Mannschott
http://dev.clojure.org/display/doc/1.3 def's can already have doc strings, though it's not very convenient: (def ^{:doc "documentation"} x 1) Can someone give me a simple example? // Ben -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to t

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 wrote: > Totally awesome, thanks to ever

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 on

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 a

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 wrote: > Just for the record: That's how I understood Ivan's idea, too.  Introduce a > special exception type which is used nowhere else a

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 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 > is the curr

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 wrote: > But then why does this fail - > > (slurp (.getInputStream (first (enumeration-seq (.entries f) > > with - No matchin

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 wrote: > On Tue, Oct 18, 2011 at 3:47 PM, Tassilo Horn wrote: >> Scott Hickey writes: >> And usually, you should refrain from using floating points at all, no >> matter if BigDecimal or Double. > > I thought BigDecimal with was not a floating point in th

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 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 implies that som

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

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

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 wrote: > On Sun, Oct 23, 2011 at 1:04 PM, Ben Smith-Mannschott > wrote: >> On Sun, Oct 23, 2011 at 21:25, Meikel Brandmeyer wrote: >>> The idiomatic solution is #(f % a1 a2 a3). I'm failing to see the issue >>> wit

Re: Pattern matching for map content

2011-10-25 Thread Ben Smith-Mannschott
On Tue, Oct 25, 2011 at 11:20, Michael Jaaka 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 as map for example:  { :n

Re: Pattern matching for map content

2011-10-25 Thread Ben Smith-Mannschott
On Tue, Oct 25, 2011 at 15:33, Alex Ott 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 > wrote: >> On Tue, Oct 25, 2011 at 11:20, Michae

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 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 continuous data into

Re: Is there a String protocol?

2011-10-25 Thread Ben Smith-Mannschott
On Tue, Oct 25, 2011 at 14:45, Sean Devlin 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 int function that wo

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

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 wrote: > > > On Nov 1, 12:14 pm, Ben Smith-Mannschott > 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

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 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 *is* nil. You're probably t

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

Re: Access to unzipped assets within jars

2011-11-05 Thread Ben Smith-Mannschott
On Sat, Nov 5, 2011 at 14:42, Sam Aaron 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 > essentially wan

  1   2   >