Re: [midje] ANN: Midje 1.3.0

2011-12-13 Thread Denis Labaye
Midje is getting better and better. Congrats! On Mon, Dec 12, 2011 at 5:41 PM, Brian Marick wrote: > Midje 1.3's most important feature is compatibility with Clojure 1.3. > https://github.com/marick/Midje > > Midje is a test framework for Clojure that supports top-down as well as > bottom-up te

Re: Lazy-seq of a binary file

2011-12-13 Thread Simone Mosciatti
Thank you so much, just one last thing, why you use a char-array ? If I want use a byte-array, and no map all the whole sequence ? On Dec 13, 10:39 pm, Cedric Greevey wrote: > On Tue, Dec 13, 2011 at 11:33 PM, Simone Mosciatti wrote: > > Where by now: > > (defn lazy-reader [fl] > >     (assert .

Re: Lazy-seq of a binary file

2011-12-13 Thread Cedric Greevey
On Tue, Dec 13, 2011 at 11:33 PM, Simone Mosciatti wrote: > Where by now: > (defn lazy-reader [fl] >     (assert ...) >     (lazy-seq >         (cons (.read fl) (lazy-reader fl > > The first one ? Er, buffering of the I/O is probably preferable, but that would probably work OK in many cases.

Re: Opposite function to cons, but in terms of construction, not destruction.

2011-12-13 Thread Cedric Greevey
On Tue, Dec 13, 2011 at 11:25 PM, Alan Malloy wrote: > On Dec 13, 7:56 pm, Stephen Compall wrote: >> On Tue, 2011-12-13 at 16:28 -0800, Alan Malloy wrote: >> > As you can see, only as many elements are realized as are needed to >> > satisfy the user's request. >> >> Yes, in the expression (conr (

Re: Lazy-seq of a binary file

2011-12-13 Thread Simone Mosciatti
Where by now: (defn lazy-reader [fl] (assert ...) (lazy-seq (cons (.read fl) (lazy-reader fl The first one ? This means that I haven't understand nothing, right? (I'm so sorry for this stupid question... :embarassed: ) On Dec 13, 10:23 pm, Cedric Greevey wrote: > On Tue,

Re: Opposite function to cons, but in terms of construction, not destruction.

2011-12-13 Thread Alan Malloy
On Dec 13, 7:56 pm, Stephen Compall wrote: > On Tue, 2011-12-13 at 16:28 -0800, Alan Malloy wrote: > > As you can see, only as many elements are realized as are needed to > > satisfy the user's request. > > Yes, in the expression (conr (conr (conr '( 1 2 3) 4) 6) 7), all the > lazy-seqs implied by

Re: topoged-hibernate: a clojure hibernate library

2011-12-13 Thread Matthew O. Smith
I am working on making library useful to the public: https://github.com/m0smith/topoged-hibernate One question I would like a comment on: I have been using entity-maps rather than POJOs because it makes for a cleaner interop with Clojure. The amount of code needed goes way down while the standa

Re: Lazy-seq of a binary file

2011-12-13 Thread Cedric Greevey
On Tue, Dec 13, 2011 at 11:12 PM, Simone Mosciatti wrote: > Ok, now by now i think to have understand... > > To do right, I should build a macro similar to let where I pass the > filename and after execute the body close the stream, right ? Easier to just use the pre-existing one: with-open. Som

topoged-hibernate: a clojure hibernate library

2011-12-13 Thread Matthew O. Smith
As part of a larger project, Topoged, I am developing a Hibernate library that makes working with Hibernate from within Clojure much easier IMHO. It uses the standard Hibernate configuration and provides wrappers and whatnot to simplify the interaction. For example, to write a record to the data

Re: Lazy-seq of a binary file

2011-12-13 Thread Simone Mosciatti
Ok, now by now i think to have understand... To do right, I should build a macro similar to let where I pass the filename and after execute the body close the stream, right ? On Dec 13, 9:42 pm, Cedric Greevey wrote: > On Tue, Dec 13, 2011 at 10:14 PM, Simone Mosciatti wrote: > > No, I'm sure t

Re: Opposite function to cons, but in terms of construction, not destruction.

2011-12-13 Thread Stephen Compall
On Tue, 2011-12-13 at 16:28 -0800, Alan Malloy wrote: > As you can see, only as many elements are realized as are needed to > satisfy the user's request. Yes, in the expression (conr (conr (conr '( 1 2 3) 4) 6) 7), all the lazy-seqs implied by the conr calls must be forced immediately to yield (1

Re: Lazy-seq of a binary file

2011-12-13 Thread Cedric Greevey
On Tue, Dec 13, 2011 at 10:14 PM, Simone Mosciatti wrote: > No, I'm sure to not use all the sequence, so I will follow your second > advice, but... > > Cause of my non-perfect english I've not really understand the last > part. >  Who is the caller ? >  You suggest something like this: > > (let [f

Re: Lazy-seq of a binary file

2011-12-13 Thread Simone Mosciatti
No, I'm sure to not use all the sequence, so I will follow your second advice, but... Cause of my non-perfect english I've not really understand the last part. Who is the caller ? You suggest something like this: (let [fl (clojure.java.io/reader "path/filename") rd (lazy-reader fl)] (do-m

Re: How to refer to nodejs Buffer in clojurescript ?

2011-12-13 Thread sunng
Thank you. It works now. However, I think this is an issue of compiling clojurescript to nodejs. *Buffer* is a nodejs specific function like *require* (a nodejs function). So maybe we'd better use it like the way we use require: (cljs.nodejs/require). When compiled to nodejs, require is added to t

Re: Opposite function to cons, but in terms of construction, not destruction.

2011-12-13 Thread Alan Malloy
On Dec 13, 3:05 pm, Stephen Compall wrote: > On Mon, 2011-12-12 at 10:53 -0800, Michael Jaaka wrote: > > (defn conr[ col item ] > >    (lazy-seq > >            (if (seq col) > >                    (cons (first col) (conr (rest col) item)) > >                    (list item > > > And now stick w

Re: bug in clojure.walk in 1.3

2011-12-13 Thread Cedric Greevey
On Tue, Dec 13, 2011 at 2:51 PM, Alan Malloy wrote: > On Dec 13, 11:36 am, Stuart Sierra > wrote: >> It's not clojure.walk, it's bean: >> >> user=> (empty (bean "hi")) >> AbstractMethodError >> clojure.lang.APersistentMap.empty()Lclojure/lang/IPersistentCollection; >> clojure.core.proxy$clojure.l

Re: Opposite function to cons, but in terms of construction, not destruction.

2011-12-13 Thread Stephen Compall
On Mon, 2011-12-12 at 10:53 -0800, Michael Jaaka wrote: > (defn conr[ col item ] > (lazy-seq > (if (seq col) > (cons (first col) (conr (rest col) item)) > (list item > > And now stick with it. > All works as desired: > > (conr (c

Re: multiple return values

2011-12-13 Thread Stephen Compall
On Tue, 2011-12-13 at 10:52 -0800, Razvan Rotaru wrote: > Thanks. I don't know how this hashmap works, but at the first glance > there seems to be one problem: the two values don't get garbage > collected at the same time. There are problems with weak hashmaps, but I wouldn't count that among them

namespace what?

2011-12-13 Thread jayvandal
I think I understand namespace and then I don't! I try to run this example (ns examples.core (use [clarity.component :as c])) (make :button "The Button") I have programs stored in c:\projects\klarity.clj I have clojure stored in c:\clojure-1.2.1\clojure-1.21. I am running c:\cljr\clj-installer

Re: bug in clojure.walk in 1.3

2011-12-13 Thread Alan Malloy
On Dec 13, 11:36 am, Stuart Sierra wrote: > It's not clojure.walk, it's bean: > > user=> (empty (bean "hi")) > AbstractMethodError > clojure.lang.APersistentMap.empty()Lclojure/lang/IPersistentCollection; > clojure.core.proxy$clojure.lang.APersistentMap$0.empty (:-1) > > The generated class doesn'

Re: bug in clojure.walk in 1.3

2011-12-13 Thread Phil Hagelberg
On Tue, Dec 13, 2011 at 11:38 AM, Alan Malloy wrote: > Issue is in bean, not walk. walk calls (empty foo) on its collection, > in order to make sure you get back a collection of the same type. bean > maps are, I guess, some special type rather than an ordinary > c.l.PersistentHashMap; and that typ

Re: bug in clojure.walk in 1.3

2011-12-13 Thread Alan Malloy
Issue is in bean, not walk. walk calls (empty foo) on its collection, in order to make sure you get back a collection of the same type. bean maps are, I guess, some special type rather than an ordinary c.l.PersistentHashMap; and that type doesn't implement the full IPersistentCollection contract (i

Re: bug in clojure.walk in 1.3

2011-12-13 Thread Stuart Sierra
It's not clojure.walk, it's bean: user=> (empty (bean "hi")) AbstractMethodError clojure.lang.APersistentMap.empty()Lclojure/lang/IPersistentCollection; clojure.core.proxy$clojure.lang.APersistentMap$0.empty (:-1) The generated class doesn't implement the 'empty' method. Please file a JIRA ti

Re: multiple return values

2011-12-13 Thread Razvan Rotaru
Thanks. I don't know how this hashmap works, but at the first glance there seems to be one problem: the two values don't get garbage collected at the same time. I'll look more into it, thanks. On Dec 13, 3:10 am, Stephen Compall wrote: > On Mon, 2011-12-12 at 10:54 -0800, Razvan Rotaru wrote: > >

Re: multiple return values

2011-12-13 Thread Razvan Rotaru
I don't want to change the interface i'm exposing to the outer world. May be that I'm thinking too javaish, but what I miss here is a possibility to extend the base class. :) On Dec 12, 9:31 pm, James Reeves wrote: > On 12 December 2011 18:54, Razvan Rotaru wrote: > > > - function returns a valu

Re: multiple return values

2011-12-13 Thread Razvan Rotaru
Thanks Tom. Using proxy like this could work. But i'm worried about one thing.What happens if I have many instances? With proxy there's a new class with each instance. Could I run out of permgen space? On Dec 13, 9:38 am, Tom Faulhaber wrote: > Razvan, > > I think that you can implement your idea

A ClojureScript Debugger

2011-12-13 Thread David Nolen
I've started working on a debugging infrastructure for ClojureScript based on the WebKit Remote Debugging Protocol (WRDP). There's not much to see here yet, but I've been surprised how much we get for free from the WRDP. Most of the challenges will be around providing a good sexpr level debugging e

bug in clojure.walk in 1.3

2011-12-13 Thread Jay Fields
I think I found a bug user=> (bean "hi") {:empty false, :class java.lang.String, :bytes #} user=> (clojure.walk/stringify-keys (bean "hi")) AbstractMethodError clojure.lang.APersistentMap.empty()Lclojure/lang/IPersistentCollection; clojure.core.proxy$clojure.lang.APersistentMap$0.empty (:-1) Che

Re: xml-zip

2011-12-13 Thread Tom Faulhaber
Great. Happy to help! On Dec 13, 7:39 am, Linus Ericsson wrote: > Thank you Tom! > > Exactly was I was looking for! > > I will TRY to add some documentation to clojuredocs.org just so people > won't be that afraid, this xml-functionality is a very sane way of doing > it, it's just takes a while t

ANNOUNCEMENT: core.cache version 0.5.0

2011-12-13 Thread Fogus
core.cache v0.5.0 Release Notes === core.cache is a new Clojure contrib library providing the following features: * An underlying `CacheProtocol` used as the base abstraction for implementing new synchronous caches * A `defcache` macro for hooking your `CacheProtocol`

Re: xml-zip

2011-12-13 Thread Linus Ericsson
Thank you Tom! Exactly was I was looking for! I will TRY to add some documentation to clojuredocs.org just so people won't be that afraid, this xml-functionality is a very sane way of doing it, it's just takes a while to get used to it (I'll check that it's refered to the correct namespace as wel

Re: How to refer to nodejs Buffer in clojurescript ?

2011-12-13 Thread Stuart Sierra
I don't know if this works for this case, but the special namespace "js" allows access to raw JavaScript objects. Try js/Buffer -S -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note th

Re: Lazy-seq of a binary file

2011-12-13 Thread Stuart Sierra
Here's a version I hacked up a while ago: https://gist.github.com/1472163 -S -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be pat

Couch Error

2011-12-13 Thread Rups
Hello friends, I am new in clojure, i want to create document in couch db using clojure. i got some error please help me. my code is (ns web-app.views.welcome (:require [clj-file-utils.core :as f-util] [noir.content.getting-started] [noir.response :as resp]) (:use [noir.core :o

How to refer to nodejs Buffer in clojurescript ?

2011-12-13 Thread Sun Ning
Hi, all I'm trying to use clojurescript compiled to nodejs. I ran into a problem with nodejs Buffer class, which doesn't have a namespace. I tried different ways to refer Buffer: (def b (Buffer. 1)) compiled to: b = new mynamespace.Buffer(1) this leads to an undefined error on runtime If I u