Re: record serialization

2010-11-23 Thread Shantanu Kumar
Shantanu Kumar wrote: > Islon Scherer wrote: > > Yes, java serialization is what I want but I don't know how to do a > > record implement the Serializable interface. > > The following two steps may help: > > (defrecord Foo [a b]) > (extend java.io.Serializable Foo) Oops! that was a bit too fast.

Re: record serialization

2010-11-23 Thread Shantanu Kumar
Islon Scherer wrote: > Yes, java serialization is what I want but I don't know how to do a > record implement the Serializable interface. The following two steps may help: (defrecord Foo [a b]) (extend java.io.Serializable Foo) Regards, Shantanu -- You received this message because you are su

Re: priority queue for scheduling events in the future

2010-11-23 Thread Ken Wesson
On Wed, Nov 24, 2010 at 12:39 AM, Ken Wesson wrote: > On Tue, Nov 23, 2010 at 11:45 PM, HiHeelHottie wrote: >> >> Does anybody know of an implementation for a priority queue that can >> be used for scheduling events in the future?  I would like to put a >> map associated with a timestamp into the

Re: priority queue for scheduling events in the future

2010-11-23 Thread Mark Engelberg
In 1.3, you can use clojure.contrib.priority-map. Documentation found in comment at top of source: https://github.com/clojure/clojure-contrib/blob/master/modules/priority-map/src/main/clojure/clojure/contrib/priority_map.clj -- You received this message because you are subscribed to the Google Gr

Re: priority queue for scheduling events in the future

2010-11-23 Thread Ken Wesson
On Tue, Nov 23, 2010 at 11:45 PM, HiHeelHottie wrote: > > Does anybody know of an implementation for a priority queue that can > be used for scheduling events in the future?  I would like to put a > map associated with a timestamp into the queue and be able to pull out > all maps at or before a gi

Re: priority queue for scheduling events in the future

2010-11-23 Thread HiHeelHottie
Ulises, thanks for the response. The insertions will be sprinkled out over time and would want insertions/removals to be reasonably efficient. On Nov 23, 11:58 pm, Ulises wrote: > > Does anybody know of an implementation for a priority queue that can > > be used for scheduling events in the fut

Re: priority queue for scheduling events in the future

2010-11-23 Thread Ulises
> Does anybody know of an implementation for a priority queue that can > be used for scheduling events in the future?  I would like to put a > map associated with a timestamp into the queue and be able to pull out > all maps at or before a given time in order. You can do so with a combination of t

priority queue for scheduling events in the future

2010-11-23 Thread HiHeelHottie
Does anybody know of an implementation for a priority queue that can be used for scheduling events in the future? I would like to put a map associated with a timestamp into the queue and be able to pull out all maps at or before a given time in order. -- You received this message because you ar

Re: hashCode?

2010-11-23 Thread Sunil S Nandihalli
thanks Miki .. I guess using hash is even better .. I overlooked it the first time I read your reply .. Sunil On Tue, Nov 23, 2010 at 10:48 PM, David Powell wrote: > > > On Tue 23/11/10 09:41 , Sunil S Nandihalli sunil.nandiha...@gmail.comsent: > > Hello everybody, It is really nice that all the

Re: hashCode?

2010-11-23 Thread Sunil S Nandihalli
thanks David and Miki So it comes from Java.. :) I didn't know that .. Sunil. On Tue, Nov 23, 2010 at 10:48 PM, David Powell wrote: > > > On Tue 23/11/10 09:41 , Sunil S Nandihalli sunil.nandiha...@gmail.comsent: > > Hello everybody, It is really nice that all the > > clojure-datastructures have

Re: record serialization

2010-11-23 Thread ka
Hi Islon, Records already implement java.io.Serializable. So this is working: (ns record-serialization) (defrecord R [x y]) (defn test-serialization [] (with-open [oos (java.io.ObjectOutputStream. (java.io.FileOutputStream. "tmp"))] (.writeObject oos (R. 12 42))) (with-open [ois (java

Re: ANN: Gloss, a byte-format DSL

2010-11-23 Thread Zach Tellman
There are a couple of different things being discussed here. I don't think there's any harm in allowing maps as frames, as long as people understand that they're arbitrarily ordered (alphabetically by key, but that's an implementation detail) and that keys specified aren't optional - if they're no

Re: Clojure Out of memory exception

2010-11-23 Thread Ken Wesson
On Tue, Nov 23, 2010 at 9:08 PM, Rick Moynihan wrote: > On 23 November 2010 19:01, Ken Wesson wrote: >> On Tue, Nov 23, 2010 at 7:49 AM, Laurent PETIT >> wrote: >>> try >>> (def x #(iterate inc 1)) >>> (take 1 (drop 10 (x)) >>> >>> if you do not want to blow up the memory. >> >> I wonde

Re: Clojure Out of memory exception

2010-11-23 Thread Rick Moynihan
On 23 November 2010 19:01, Ken Wesson wrote: > On Tue, Nov 23, 2010 at 7:49 AM, Laurent PETIT > wrote: >> try >> (def x #(iterate inc 1)) >> (take 1 (drop 10 (x)) >> >> if you do not want to blow up the memory. > > I wonder if an uncached lazy seq variant that cannot hold onto its > head

Re: record serialization

2010-11-23 Thread Islon Scherer
Yes, java serialization is what I want but I don't know how to do a record implement the Serializable interface. On Nov 23, 2:46 pm, Shantanu Kumar wrote: > Not sure about your exact requirement, but can Java serialization > help? You may need to extend the Serializable interface to the > records

Re: Clojure vs F# performance

2010-11-23 Thread Ralph
Maybe Microsoft has tuned the CLR for those particular benchmarks (think "IE9" - not that anyone is accusing them of anything :-)). On Nov 22, 6:01 pm, Isaac Gouy wrote: > On Nov 22, 12:54 pm, Ralph wrote: > > > That is almost certainly true, since the Microsoft have probably done > > extensive

Re: ANN: ClojureQL 1.0.0 finally released as public beta

2010-11-23 Thread Luke VanderHart
Lau, This is really impressive, and I can't wait to experiment with it. That said, I'm curious as to what good use cases for this would be, and what it's motivation is. SQL is already a highly specialized DSL for slinging around relational data that most developers are already pretty good with. I

Re: Clojure Out of memory exception

2010-11-23 Thread Eric Lavigne
>> try >> (def x #(iterate inc 1)) >> (take 1 (drop 10 (x)) >> >> if you do not want to blow up the memory. > > I wonder if an uncached lazy seq variant that cannot hold onto its > head would be useful to have in core? I would argue that such a feature wouldn't be very useful. Let's consid

Re: ANN: Gloss, a byte-format DSL

2010-11-23 Thread Chris Perkins
On Nov 23, 3:24 pm, Zach Tellman wrote: > On Nov 23, 12:12 pm, Chris Perkins wrote: > > I have only taken a quick look, so maybe I'm misunderstanding the > > intent, but it's not clear to me how you would use this for sending > > and receiving structured data from, say, a C program. > > > Taking

Re: logging recommendation

2010-11-23 Thread lprefontaine
We use a combination of apache common logging and log4j. In dev we can remove log4j and still have some decent console logging. Luc P. Dave Newton wrote .. > On Tue, Nov 23, 2010 at 5:46 PM, Stuart Sierra > wrote: > > > On Nov 20, 5:56 pm, HiHeelHottie wrote: > > > What do you recommend for lo

Re: logging recommendation

2010-11-23 Thread Dave Newton
On Tue, Nov 23, 2010 at 5:46 PM, Stuart Sierra wrote: > On Nov 20, 5:56 pm, HiHeelHottie wrote: > > What do you recommend for logging, especially to a set of rolling > > files? Simply use log4j? > > I manage with Log4j. The .properties configuration file is annoying > sometimes, but it works. >

Re: logging recommendation

2010-11-23 Thread Stuart Sierra
On Nov 20, 5:56 pm, HiHeelHottie wrote: > What do you recommend for logging, especially to a set of rolling > files?  Simply use log4j? I manage with Log4j. The .properties configuration file is annoying sometimes, but it works. -S -- You received this message because you are subscribed to the

Re: ANN: Gloss, a byte-format DSL

2010-11-23 Thread Daniel Kersten
Looks really good. Thanks for another great library! On 23 November 2010 21:12, Moritz Ulrich wrote: > I would go for the vector. It's easier than writing (ordered-map ...) all > the time. If you want to generate structs dynamically, you would even simply > create a vector of alternating pairs an

Re: ANN: ClojureQL 1.0.0 finally released as public beta

2010-11-23 Thread LauJensen
@Wilson, Normally I release the jar to clojars when I implement some major change of interest to the public, but the compiler above didn't not get released due to forgetfulness on my part! I was reworking the predicate compiler into a very fancy record which does automated parameterization of all

Re: ANN: Gloss, a byte-format DSL

2010-11-23 Thread Moritz Ulrich
I would go for the vector. It's easier than writing (ordered-map ...) all the time. If you want to generate structs dynamically, you would even simply create a vector of alternating pairs and do (apply ordered-map my-vec). Btw: Great library! I think I will rewrite my binary-parser from a project

Re: sort-by reverse order?

2010-11-23 Thread Tyler Perkins
Nice! And with just a bit more, we have a clean, sorting DSL: (def asc compare) (def desc #(compare %2 %1)) ;; compare-by generates a Comparator: (defn compare-by [& key-cmp-pairs] (fn [x y] (loop [[k cmp & more] key-cmp-pairs] (let [result (cmp (k x) (k y))] (if (a

Re: Porting libraries to ClojureCLR

2010-11-23 Thread Tatiana Racheva
Not sure what "structuring imports" would entail. Do we need to use something like http://www.ikvm.net/devguide/net2java.html? On Tue, Nov 23, 2010 at 10:26 AM, Tatiana Racheva wrote: > Yeah, I was thinking the other day about the divergence of the CLR and the > JVM Clojures in general. > Let's

Re: Porting libraries to ClojureCLR

2010-11-23 Thread Tatiana Racheva
Yeah, I was thinking the other day about the divergence of the CLR and the JVM Clojures in general. Let's keep as many things as possible in common. On Tue, Nov 23, 2010 at 1:44 AM, David Jagoe wrote: > G'day all, > > I am using ClojureCLR (thanks everyone involved, clojure makes me > happy!) t

Re: ANN: Gloss, a byte-format DSL

2010-11-23 Thread Zach Tellman
Good question. The solution didn't make the cut for my initial release, but will be added soon. My plan is to have an (ordered- map ...) frame which encodes and decodes the keys in the given order. So for C interop, the frame would be (ordered-map :a :int16, :b :float32) An alternative would be

Re: ANN: Gloss, a byte-format DSL

2010-11-23 Thread Chris Perkins
On Nov 23, 12:03 pm, Zach Tellman wrote: > When writing Calx [1], I discovered it was a huge pain to deal with > mixed C datatypes in Java.  When writing Aleph [2], I discovered the > problem increases by a factor of ten when dealing with streams of > bytes.  In an attempt to alleviate my own pain

Re: Clojure Out of memory exception

2010-11-23 Thread Ken Wesson
On Tue, Nov 23, 2010 at 7:49 AM, Laurent PETIT wrote: > try > (def x #(iterate inc 1)) > (take 1 (drop 10 (x)) > > if you do not want to blow up the memory. I wonder if an uncached lazy seq variant that cannot hold onto its head would be useful to have in core? -- You received this mess

Re: ANN: Gloss, a byte-format DSL

2010-11-23 Thread Chris Riddoch
On Tue, Nov 23, 2010 at 10:03 AM, Zach Tellman wrote: > When writing Calx [1], I discovered it was a huge pain to deal with > mixed C datatypes in Java.  When writing Aleph [2], I discovered the > problem increases by a factor of ten when dealing with streams of > bytes. You're not the only one.

Re: ANN: Gloss, a byte-format DSL

2010-11-23 Thread Zach Tellman
Yes. There are Eclipse license headers on all the files, I'll just update the README to reflect that. On Nov 23, 9:51 am, Stuart Halloway wrote: > Neat. License same as Clojure's? > > Stu > > > > > > > > > When writing Calx [1], I discovered it was a huge pain to deal with > > mixed C datatypes

Re: ANN: Gloss, a byte-format DSL

2010-11-23 Thread Dave Newton
This looks a *lot* like something I did a long time ago ("Data File Disassembler") when I spent a lot of time reverse-engineering things. I had a view/edit layer on top (On Mac, back when a Mac II was extreme hardware :) and man, was it useful... had "pluggable" modules for microcontroller disassem

Re: ANN: Gloss, a byte-format DSL

2010-11-23 Thread Stuart Halloway
Neat. License same as Clojure's? Stu > When writing Calx [1], I discovered it was a huge pain to deal with > mixed C datatypes in Java. When writing Aleph [2], I discovered the > problem increases by a factor of ten when dealing with streams of > bytes. In an attempt to alleviate my own pain, a

Re: hashCode?

2010-11-23 Thread David Powell
On Tue 23/11/10 09:41 , Sunil S Nandihalli sunil.nandiha...@gmail.com sent: > Hello everybody, It is really nice that all the > clojure-datastructures have a function called hashCode.. I saw it gave > the same answer for the same native map/vector/set/list give the same > number ... is it meant t

ANN: Gloss, a byte-format DSL

2010-11-23 Thread Zach Tellman
When writing Calx [1], I discovered it was a huge pain to deal with mixed C datatypes in Java. When writing Aleph [2], I discovered the problem increases by a factor of ten when dealing with streams of bytes. In an attempt to alleviate my own pain, and hopefully help a few other people out, I've

[ANN] appengine-magic 0.3.0: Clojure on Google App Engine

2010-11-23 Thread Constantine Vetoshev
I would like to announce the release of appengine-magic version 0.3.0, a library designed to make it easier to write Clojure applications for Google App Engine. appengine-magic abstracts away nearly all the boilerplate necessary to deploy an App Engine application. It also enables interactive deve

Re: record serialization

2010-11-23 Thread Shantanu Kumar
Not sure about your exact requirement, but can Java serialization help? You may need to extend the Serializable interface to the records. http://java.sun.com/developer/technicalArticles/Programming/serialization/ Regards, Shantanu On Nov 23, 5:50 pm, Islon Scherer wrote: > Hi people, I want to s

Re: ANN: ClojureQL 1.0.0 finally released as public beta

2010-11-23 Thread Wilson MacGyver
On Tue, Nov 23, 2010 at 5:34 AM, LauJensen wrote: > And finally, I've just refurbished the compiler so that its not a > 25 line beast of a recursive machine that automatically spawns > subselects for aggregates, limit/offset and predicates: > > cql.core> (to-sql (-> (table {} :users) >            

Re: hashCode?

2010-11-23 Thread Miki
Hello Sunil, >  It is really nice that all the clojure-datastructures have a function > called hashCode.. IIRC this comes from Java where every object has a hashCode method. > is it meant to be used by the end-user of clojure This is mostly used by Java (and in turn by Clojure) for equality testi

record serialization

2010-11-23 Thread Islon Scherer
Hi people, I want to serialize records to further deserializing, is there a way to do that? (pr-str myrecord) doesn't seen to work. I was thinking about something like (to-map record) and (from-map RecordClass record) to serialize and deserialize. Any sugestions? Islon -- You received this messa

Re: Clojure Out of memory exception

2010-11-23 Thread Laurent PETIT
2010/11/23 DarkMagus > > % (def x (iterate inc 1)) > % (take 1 (drop 1 x)) > > Can someone, please, explain to me why the above code crashes with an > out of memory exception? it works fine when the drop number is small. > But as I increase the drop number clojure starts getting slower an

Clojure Out of memory exception

2010-11-23 Thread DarkMagus
% (def x (iterate inc 1)) % (take 1 (drop 1 x)) Can someone, please, explain to me why the above code crashes with an out of memory exception? it works fine when the drop number is small. But as I increase the drop number clojure starts getting slower and slower until the point where I re

Re: ANN: ClojureQL 1.0.0 finally released as public beta

2010-11-23 Thread LauJensen
@Mark: Thanks! :) @Jeff: Thanks a lot. Link is fixed now. @Sam: Thanks! @James: Wow - I should put that in my resume, thanks a lot ! @Mark E: Half right. ClojureQL has a major focus on queries as they are the largest part of our interaction with databases. However it piggy-backs on contrib.sql

Porting libraries to ClojureCLR

2010-11-23 Thread David Jagoe
G'day all, I am using ClojureCLR (thanks everyone involved, clojure makes me happy!) to develop a Windows application. I need a json library (and don't really want to directly use the native C# one) so it seems like the best option will be to port an existing Clojure library to the CLR. Basically

hashCode?

2010-11-23 Thread Sunil S Nandihalli
Hello everybody, It is really nice that all the clojure-datastructures have a function called hashCode.. I saw it gave the same answer for the same native map/vector/set/list give the same number ... is it meant to be used by the end-user of clojure if so what things can we assume about them? This

Re: Problem adjusting the implementation of 'partition'

2010-11-23 Thread Benny Tsai
Glad I was able to help :) On Nov 23, 12:53 am, Stefan Rohlfing wrote: > Fantastic! Thanks again! > > On Nov 23, 3:50 pm, Benny Tsai wrote: > > > > > > > > > Indeed there is :) > > >http://clojuredocs.org/clojure_core/clojure.core/cycle > > > On Nov 23, 12:37 am, Stefan Rohlfing > > wrote: > >