Re: Anyone want to take a crack at making the fasta shootout program faster?

2011-02-12 Thread Michael Gardner
On Feb 12, 2011, at 3:38 PM, Isaac Gouy wrote: > On Feb 12, 1:28 pm, Michael Gardner wrote: >> That's why this kind of competition is not interesting to me. As it only >> compares the fastest programs, there's every incentive to submit >> horrifically complex, optimized-to-the-hilt solutions th

Re: Type hinting question

2011-02-12 Thread Ken Wesson
On Sat, Feb 12, 2011 at 10:43 PM, Mikhail Kryshen wrote: > Java SDK includes javap bytecode disassembler. And you can compile Java > without creating project structure. Not with an IDE. You have to resort to poking around at a commandline and using a normal editor, and then you lose syntax highli

Re: Type hinting question

2011-02-12 Thread Mikhail Kryshen
Java SDK includes javap bytecode disassembler. And you can compile Java without creating project structure. $ emacs Test.java $ javac Test.java $ javap -c Test Results: public class Test { public static String hello() { final StringBuilder sb = new StringBuilder(); sb.append

Re: Type hinting question

2011-02-12 Thread Ken Wesson
On Sat, Feb 12, 2011 at 9:42 PM, Ken Wesson wrote: > Frak. I tried a cleverish way to maybe answer that question from > within Clojure, basically by seeing if a deliberately bad assignment > threw on the assignment or only when the thing got used. > > Specifically, I used this: > > (let [^String k

Re: Type hinting question

2011-02-12 Thread Ken Wesson
On Sat, Feb 12, 2011 at 9:35 PM, Ken Wesson wrote: > I rarely have more questions than answers here, but this is one of > those times, and it has to do with efficiency. > > Is the bytecode generated from > > (let [^StringBuilder sb (StringBuilder.)] >  (.append sb "Hello, ") >  (.append sb "world"

Type hinting question

2011-02-12 Thread Ken Wesson
I rarely have more questions than answers here, but this is one of those times, and it has to do with efficiency. Is the bytecode generated from (let [^StringBuilder sb (StringBuilder.)] (.append sb "Hello, ") (.append sb "world") (.toString sb)) equivalent to Java final StringBuilder sb

Re: Handling of unsigned bytes

2011-02-12 Thread timc
Thanks for the help. Sorry I got agitated about this - it was just that my code (that was doing lots of byte handling) worked with a previous version of clojure and then stopped working. Thanks Ken, I shall use your little workaround. On Feb 12, 10:04 pm, Ken Wesson wrote: > On Sat, Feb 12, 2011

Re: Installing Clojure-CLR 1.3 alpha on Win XP with .Net 4.0

2011-02-12 Thread dmiller
Done. Thanks for pointing this out. -David On Feb 10, 3:42 pm, Robin Munn wrote: > I just ran into an interesting problem installing the Clojure-CLR 1.3 > alpha > (https://github.com/downloads/richhickey/clojure-clr/clojure-clr-1.3.0...) > on an XP machine with .Net 4.0 installed. Downloading

Re: Boston Clojure Meetup Thursday Jan 13

2011-02-12 Thread David Jacobs
I don't know how I missed this originally. Is there another one planned? -- 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 patient w

Re: Handling of unsigned bytes

2011-02-12 Thread Ken Wesson
On Sat, Feb 12, 2011 at 4:54 PM, Aaron Cohen wrote: > On Sat, Feb 12, 2011 at 4:42 PM, Ken Wesson wrote: >> On Sat, Feb 12, 2011 at 8:28 AM, timc wrote: >>> (def b (byte i)) >>> >>> is doing something equivalent to this internally: >>> >>> byte b = Byte.parseByte(String.format("%d",i)); >> >> Wh

Re: Handling of unsigned bytes

2011-02-12 Thread Aaron Cohen
On Sat, Feb 12, 2011 at 4:42 PM, Ken Wesson wrote: > On Sat, Feb 12, 2011 at 8:28 AM, timc wrote: >> Further investigation reveals that >> >> (def b (byte i)) >> >> is doing something equivalent to this internally: >> >> byte b = Byte.parseByte(String.format("%d",i)); > > What the HELL? > > That'

Re: Handling of unsigned bytes

2011-02-12 Thread Ken Wesson
On Sat, Feb 12, 2011 at 8:28 AM, timc wrote: > Further investigation reveals that > > (def b (byte i)) > > is doing something equivalent to this internally: > > byte b = Byte.parseByte(String.format("%d",i)); What the HELL? That's incredibly icky and inefficient. :) Why not if (i < 128 || i >

Re: Anyone want to take a crack at making the fasta shootout program faster?

2011-02-12 Thread Isaac Gouy
On Feb 12, 1:28 pm, Michael Gardner wrote: > On Feb 12, 2011, at 3:12 PM, Isaac Gouy wrote: > > > Yeah but it's not too hard to see why the Lisp programmer Juho > > Snellman opined on HN "the [sic program] implementations seem to have > > totally dived off the deep end of complexity". > > That's

Re: Anyone want to take a crack at making the fasta shootout program faster?

2011-02-12 Thread Isaac Gouy
On Feb 10, 1:41 pm, Bill James wrote: -snip- > The C++ program was evidently deprecated because it did not go through > the process of generating a random character for each character that > it output. The author realized that the pseudo-random-number-generator > had a cycle-length less than 200

Re: Anyone want to take a crack at making the fasta shootout program faster?

2011-02-12 Thread Michael Gardner
On Feb 12, 2011, at 3:12 PM, Isaac Gouy wrote: > Yeah but it's not too hard to see why the Lisp programmer Juho > Snellman opined on HN "the [sic program] implementations seem to have > totally dived off the deep end of complexity". That's why this kind of competition is not interesting to me. As

Re: better error messages > smaller stack traces

2011-02-12 Thread Ken Wesson
+1 for the assertion macro suggestions (custom messages). On the topic of stack traces: it's high time Clojure stopped generating shit like java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer (NO_SOURCE_

Re: Problems with lazy-xml

2011-02-12 Thread Marko Topolnik
In fact, it is enough to replace (drop-last sibs) with (remove seq? sibs). . On Feb 12, 9:54 pm, Marko Topolnik wrote: > On Feb 12, 7:55 pm, Marko Topolnik wrote: > > > How about replacing > >   (drop-last sibs) > > with > >   (remove vector? sibs) > > ? > > This was slightly naive. We also need

Re: Anyone want to take a crack at making the fasta shootout program faster?

2011-02-12 Thread Isaac Gouy
Yeah but it's not too hard to see why the Lisp programmer Juho Snellman opined on HN "the [sic program] implementations seem to have totally dived off the deep end of complexity". On Feb 11, 2:28 pm, Andy Fingerhut wrote: > fasta.java-3.java calls the method next(), implementing the linear   > co

Re: Problems with lazy-xml

2011-02-12 Thread Marko Topolnik
On Feb 12, 7:55 pm, Marko Topolnik wrote: > How about replacing >   (drop-last sibs) > with >   (remove vector? sibs) > ? This was slightly naive. We also need these changes: In siblings: :end-element [[(rest s)]] In mktree: (cons (struct element (:name elem) (:attrs elem) (remove

Re: clojure xmpp

2011-02-12 Thread Bruce Durling
Mibu, On Sat, Feb 12, 2011 at 17:03, Mibu wrote: > To save you the headache, here are two gotchas I encountered: > When connecting to Google Talk servers .setSASLAuthenticationEnabled > on ConnectionConfiguration to false. > When connecting to Facebook chat servers avoid requiring security > wit

Re: Problems with lazy-xml

2011-02-12 Thread Marko Topolnik
Also, the xpp-based parser is almost an order of magnitude slower than the sax-based one. The only thing it lacks is a couple of type hints: (defn- attrs [^XmlPullParser xpp] (defn- ns-decs [^XmlPullParser xpp] (let [step (fn [^XmlPullParser xpp] These hints increase the performance from 400%

any good reason why defrecord/deftype doesn't support java class inheritence?

2011-02-12 Thread Seth
As the question states - why doesnt defrecord support java class inheritence? Is it just because people think it wouldnt be 'good' or are there true technical issues with doing it? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group,

Re: Problems with lazy-xml

2011-02-12 Thread Marko Topolnik
How about replacing (drop-last sibs) with (remove vector? sibs) ? remove will not access the next seq member in advance and the only vector in sibs is the last element. I tried this change and it works for the test code from the original post. On Feb 12, 4:43 pm, Chouser wrote: > On Sat, Feb

Re: cake bin usage

2011-02-12 Thread Justin Balthrop
Hi Sunil, I just tried your isomorphism project.clj with the following code in src/isomorphism/gogoi.clj: (ns isomorphism.gogoi (:gen-class)) (defn -main [& args] (prn "hello")) Everything worked as expected. I was able to do: fallout:test $ cake bin [compile] Compiling namespace

Re: Handling of unsigned bytes

2011-02-12 Thread Andy Fingerhut
On Feb 12, 2011, at 6:53 AM, Aaron Cohen wrote: On Sat, Feb 12, 2011 at 8:28 AM, timc wrote: Further investigation reveals that (def b (byte i)) is doing something equivalent to this internally: byte b = Byte.parseByte(String.format("%d",i)); which does indeed throw a NumberFormatExceptio

Re: Handling of unsigned bytes

2011-02-12 Thread Brian Hurt
On Fri, Feb 11, 2011 at 12:22 PM, timc wrote: > How on earth is one supposed to do communication programming (not to > mention handling binary files etc) without an unsigned byte type? > > I see that this issue has been talked about vaguely - is there a > solution? > > Thanks > > Java guarantees

Re: clojure xmpp

2011-02-12 Thread Mibu
Smack is the go to library for XMPP client programming on the JVM. It has some quirks and annoying bugs, but it's versatile; it mostly works, and it has excellent (simple!) documentation. Also, there is no worthy free alternative available. Docs: http://www.igniterealtime.org/builds/smack/docs/lat

Re: Problems with lazy-xml

2011-02-12 Thread Chouser
On Sat, Feb 12, 2011 at 4:16 AM, Marko Topolnik wrote: >> > Just guessing, but is it something to do with this (from the docstring >> > of parse-seq)? >> >> > "it will be run in a separate thread and be allowed to get >> >  ahead by queue-size items, which defaults to maxint". > > As I've figured

Re: better error messages > smaller stack traces

2011-02-12 Thread Daniel Werner
On 10 February 2011 21:33, Fogus wrote: > Additionally, I've always hoped for separate > PreConditionAssertionError and PostConditionAssertionError types, but > keep forgetting to discuss it. A while ago Stuart Sierra wrote about using typed assertions in unit testing. One of his points was to gi

Re: Handling of unsigned bytes

2011-02-12 Thread Aaron Cohen
I should also mention that for this sort of stuff, people often get tired of raw bit-twiddling and move to something like a wrapper around protocol buffers (such as https://github.com/ninjudd/clojure-protobuf) or a DSL such as gloss (https://github.com/ztellman/gloss/wiki). --Aaron -- You receiv

Re: Handling of unsigned bytes

2011-02-12 Thread Aaron Cohen
On Sat, Feb 12, 2011 at 8:28 AM, timc wrote: > Further investigation reveals that > > (def b (byte i)) > > is doing something equivalent to this internally: > > byte b = Byte.parseByte(String.format("%d",i)); > > which does indeed throw a NumberFormatException if the decimal integer > representati

Re: Handling of unsigned bytes

2011-02-12 Thread timc
Further investigation reveals that (def b (byte i)) is doing something equivalent to this internally: byte b = Byte.parseByte(String.format("%d",i)); which does indeed throw a NumberFormatException if the decimal integer representation given to it produces an out-of-range value (as it should).

Re: Handling of unsigned bytes

2011-02-12 Thread timc
Sorry I did not make myself clear - I thought it was obvious given the previous postings on this subject. This java program: public class TestByte { public static void main(String[] args) { int i = 0x123456ab; byte[] b = new byte[1];

Re: Problems with lazy-xml

2011-02-12 Thread Marko Topolnik
> > Just guessing, but is it something to do with this (from the docstring > > of parse-seq)? > > > "it will be run in a separate thread and be allowed to get > >  ahead by queue-size items, which defaults to maxint". As I've figured it out, when there's XPP on the classpath, and I'm using it, the