Re: Overflow by (inc) and (dec) at integer boundaries?

2009-08-20 Thread Lauri Pesonen
Hi Rich, 2009/8/19 Rich Hickey : > > On Fri, Aug 14, 2009 at 6:28 AM, David Powell wrote: >> >> >>> user=> (.getClass (+ 1 Integer/MAX_VALUE)) >>> java.lang.Long >> >> Also, >> >> user=> (def i (Integer/MAX_VALUE)) >> >> user=> (class (+ 1 i)) >> java.lang.Long >> >> user=> (class (inc i)) >> jav

Re: New string utilities library ready

2009-08-20 Thread Chas Emerick
On Aug 20, 2009, at 2:29 AM, Meikel Brandmeyer wrote: > Hi, > > Disclaimer: personal opinion following... I think that's all we have when it comes to matters of style :-) > I'm sorry. I don't get the elegance of point-free style. > > In mathematics f denotes the function, while f(x) denotes the

replace-subtree for zippers?

2009-08-20 Thread Jan Rychter
Has anyone written a replace-subtree for zippers? I need to replace an entire subtree with another one (from another zipped structure) and found out that zip/replace won't help me there. Writing my own has proven remarkably difficult, or perhaps I'm missing something obvious. Any help appreciate

Re: replace-subtree for zippers?

2009-08-20 Thread Meikel Brandmeyer
Hi, A transcript: ; Create trees... user=> (def t1 [1 [[2 3] 4]]) #'user/t1 user=> (def t2 [[[:a :b] :c] :d]) #'user/t2 ; Create zippers and navigate to subtrees... user=> (def zt1 (-> (zip/vector-zip t1) zip/down zip/right)) #'user/zt1 user=> (zip/node zt1) [[2 3] 4] user=> (def zt2 (-> (zip/v

Re: New string utilities library ready

2009-08-20 Thread Michel Salim
On Wed, 2009-08-19 at 23:29 -0700, Meikel Brandmeyer wrote: > Hi, > > Disclaimer: personal opinion following... > > I'm sorry. I don't get the elegance of point-free style. > > In mathematics f denotes the function, while f(x) denotes the value f > takes over x. This is actually a nice and easy

Invalid method Code length 65567 in class file user$eval__630

2009-08-20 Thread Paul GT
Dear list, I am writing some functions to serialize and deserialize clojure data structures, but somehow they do not work and I am stuck. The functions are as follows: (use 'clojure.contrib.duck-streams) (defn ser "Returns the string serialization of object o." [o] (binding [*print-dup*

Re: Overflow by (inc) and (dec) at integer boundaries?

2009-08-20 Thread Rich Hickey
On Thu, Aug 20, 2009 at 5:52 AM, Lauri Pesonen wrote: > > Hi Rich, > > 2009/8/19 Rich Hickey : >> >> On Fri, Aug 14, 2009 at 6:28 AM, David Powell wrote: >>> >>> user=> (.getClass (+ 1 Integer/MAX_VALUE)) java.lang.Long >>> >>> Also, >>> >>> user=> (def i (Integer/MAX_VALUE)) >>> >>> use

Re: Invalid method Code length 65567 in class file user$eval__630

2009-08-20 Thread Chas Emerick
load-string evaluates the contents of the string, which brings in all of the compilation machinery, which produces bytecode, classes, etc. Classfiles have a 64K size limit in typical JVM implementations. You want to use the read fn (which requires a PushbackReader), as all you're intereste

Re: Infinite Sequence of Coin Flips

2009-08-20 Thread tmountain
Thanks for all the helpful suggestions guys. I put together a little article on determining coin flipping probability with Clojure. I'm still a newb, but this Google Group is helping me progress with the language. http://travis-whitton.blogspot.com/2009/08/flipping-coins-with-clojure.html Travis

Re: Request for Discussion: user created reader macros

2009-08-20 Thread Meikel Brandmeyer
Hi, On Aug 20, 4:59 pm, Brian Hurt wrote: > This I like better, and I may take a crack at doing this over the next > weekend.  Have some sort of parser object that starts life parsing the same > s-expression syntax as the standard Clojure reader but allows for > extensions.  This would sidestep

Re: New string utilities library ready

2009-08-20 Thread Stuart Sierra
Seems like opinion is pretty evenly divided here. I'll leave the library as-is for now, give it some time to see how things play out. In the mean time, as a compromise, I've added str-utils2/partial, which is like clojure.core/partial for functions that take their primary argument first. (str2/

Re: New string utilities library ready

2009-08-20 Thread Bradbev
On Aug 20, 8:26 am, Stuart Sierra wrote: > Seems like opinion is pretty evenly divided here.  I'll leave the > library as-is for now, give it some time to see how things play out. > > In the mean time, as a compromise, I've added str-utils2/partial, > which is like clojure.core/partial for functi

Re: Request for Discussion: user created reader macros

2009-08-20 Thread Brian Hurt
On Fri, Aug 14, 2009 at 7:00 PM, Jonathan Smith wrote: > > It would be nice if someone wrote a separate extension to clojure that > (reads in a text file and) that does tokenization and manipulation of > said tokens (I'm thinking YACC, flex/bison sort of thing). > > (Then you could substitute in c

Re: Proposal: Promote clojure.contrib.def to a "core" lib

2009-08-20 Thread Phlex
On 14/08/2009 19:53, Jarkko Oranen wrote: > > I'm not sure whether defonce is useful enough that it should be moved > to core, so I'll abstain. > > I use defonce and defonce- quite a lot. I'm all for inclusion of c.c.def in core. Sacha --~--~-~--~~~---~--~---

Re: lazy-seq problems

2009-08-20 Thread Rich Hickey
On Aug 19, 10:01 pm, jon wrote: > Hi, > Two problems I'd like to ask about.. (using clojure 1.0) > > (1) The following code seems to work correctly > ( generates Hamming numbers -- > seehttp://en.wikipedia.org/wiki/Haskell_(programming_language)#More_comp... > ) > but... > ;---

Emacs cheat sheet - help needed

2009-08-20 Thread Ricardo Bánffy
Hi folks. I am starting to make what will eventually, with some luck, become a freely available, nice, pretty and easy-to-use GNU/Emacs cheat sheet. Right now, it lives in a mind-map, has some commands I use frequently and needs input badly from more experienced Emacs users. I would appreciate a

Re: New string utilities library ready

2009-08-20 Thread Brian Carper
On Aug 19, 2:16 pm, Sean Devlin wrote: > First, I would change the names of functions functions that collide > with core to str-take, str-drop, etc.  It's just as much to type, and > it is safe to use these names.  Also, it would make it easier for Rich > to promote the library to the standard li

Danish Clojure meetups + JAOO 2009 Clojure workshop

2009-08-20 Thread Krukow
Dates are now final for the Copenhagen and Aarhus Clojure meetings. Trifork and Azul Systems are sponsoring the events: Trifork provides a room, some drinks and sandwiches, and Azul is letting us run Clojure on one of their large boxes (864 cores, loads of RAM ;-). I will be trying to reproduce th

Re: Proposal: Promote clojure.contrib.def to a "core" lib

2009-08-20 Thread Timothy Pratley
If defvar was [doc-string? name init?] It would obviate defunbound (defvar "A set of current TCP connections" connections #{}) And the backward compatible form could still be supported if necessary [name init? doc-string?] Regards, Tim. --~--~-~--~~~---~--~~ You

Eval not working on unexpanded macro quote

2009-08-20 Thread gutzofter
In common lisp I can do this: src-> (defmacro macro-hello () `"hello") (eval '(macro-hello)) no problem. In clojure: (defmacro macro-hello [] `"hello") (eval '(macro-hello)) gives me an error. Have I done something wrong? After further investigation I found that a pre-defined macro/function

Re: Eval not working on unexpanded macro quote

2009-08-20 Thread Chouser
On Thu, Aug 20, 2009 at 6:58 PM, gutzofter wrote: > > In common lisp I can do this: > > src-> (defmacro macro-hello () `"hello") > > (eval '(macro-hello)) > > no problem. > > In clojure: > > (defmacro macro-hello [] `"hello") > > (eval '(macro-hello)) > > gives me an error. Works for me: Clojure

Re: Transcript of Rich's "Clojure for Lispers" talk uploaded

2009-08-20 Thread Rich Hickey
On Aug 13, 4:40 pm, Andy Fingerhut wrote: > This is the same Clojure for Lispers talk with audio, and video of > slides, available on clojure.blip.tv, among others, from the September > 2008BostonLisp meeting. > > It has been uploaded to the files section of the group with this name: > > clojur

Re: Eval not working on unexpanded macro quote

2009-08-20 Thread gutzofter
thanks for the version number: Clojure 1.1.0-alpha-SNAPSHOT is this from the github? On Aug 20, 4:41 pm, Chouser wrote: > On Thu, Aug 20, 2009 at 6:58 PM, gutzofter wrote: > > > In common lisp I can do this: > > > src-> (defmacro macro-hello () `"hello") > > > (eval '(macro-hello)) > > > no pr

Re: Eval not working on unexpanded macro quote

2009-08-20 Thread gutzofter
here is my code: (comment Sample clojure source file ) (ns com.yourcompany.defpackage (:gen-class)) (defmacro macro-hello [] `"hello") (defn -main [] (println (eval '(= 0 0))) ;works (println (eval '(com.yourcompany.defpackage/macro-hello))) ;works (println (eval `(macro-hello))) ;w