Re: laziness performance question

2009-05-21 Thread Daniel Lyons


On May 21, 2009, at 1:32 AM, Konrad Hinsen wrote:
> I can't say if there is an important difference between Haskell and  
> Clojure
> implementation-wise.


I would be surprised if the basic idea (passing thunks instead of  
values) were different or could be much different. On the other hand,  
there are fewer ways to force a thunk evaluation in Haskell, usually  
through I/O, the ironically-named `seq` operator, or a strictness  
annotation. That might have ramifications for the implementation.

At the same time, Haskell is always compiled and GHC goes to  
incredible lengths to optimize code; as a statically-typed, pure FP  
language there may be more optimizations available for it than for  
Clojure (but also more boilerplate and a distinction between code and  
data). GHC-compiled Haskell code probably outperforms Clojure code by  
quite a bit right now, but you're losing a fair amount of flexibility  
for it. And I doubt that the performance difference has much to do  
with laziness or how laziness is implemented in it.

—
Daniel Lyons
http://www.storytotell.org -- Tell It!


--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: laziness performance question

2009-05-21 Thread Daniel Lyons


On May 20, 2009, at 5:42 PM, Raoul Duke wrote:

>
> hi,
>
> Seems like Haskell's laziness has an aura of "it will bite you
> performance-wise sooner or later." What is different (I'm asking
> didactically, not snarkily) about Clojure's laziness? Does it manage
> to avoid some aspects of the "uh ohs" in Haskell?


Yes, it does avoid most of them. Instead of having to grok monads and  
strictness annotations, you have doall and dorun which are just  
functions, and only sequences are lazy. Clojure's lazy sequences  
strike me as a balance between explicit iterators and a completely  
lazy language. Memoize and delay/force give you most of the other  
laziness or pure functional benefits you get in Haskell. (By the way,  
strictness annotations do wonders for making sense of Haskell.) Try it  
out. I bet you'll find it lots easier.

—
Daniel Lyons
http://www.storytotell.org -- Tell It!


--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Bit-Shift without Sign-Extend?

2009-05-21 Thread Daniel Lyons


On May 21, 2009, at 7:39 PM, CuppoJava wrote:

>
> Hi everyone,
> I'm just wondering where the equivalent of the ">>>" operator is for
> Clojure. I need it to do a divide-by-power-of-2 on unsigned bytes.

I could use this too.

—
Daniel Lyons
http://www.storytotell.org -- Tell It!


--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Call for Help!: Clojure Code for JavaOne Talk

2009-05-21 Thread Timothy Pratley

Here is a more direct translation with type hints:

(with-open [r (new java.io.BufferedReader (new java.io.FileReader
"words.txt"))]
  (sort-by #(.toLowerCase #^String %)
   (mapcat #(.split #^String % " ") (line-seq r

With the obvious advantage of not reading the file as a string.

Regards,
Tim.

On May 22, 2:48 am, Timothy Pratley  wrote:
> >http://fupeg.blogspot.com/2009/05/javaone-talk-word-sort.htmlhttp://f...
> (sort-by #(.toLowerCase %) (.split (slurp "words.txt") " ")


--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure at JavaOne

2009-05-21 Thread Adrian Cuthbertson

>... impact part can be merged with the "business application" mindset by
>generating a report that includes the data visualization (I think PDF
>generation is built into processing).

I've been doing some work with enlive and XHtmlRenderer - it's a
pretty awesome way of generating (business, media, etc)  PDF docs from
html templates, css style sheets and clojure generated data. I could
post some examples if there's any interest.

Rgds, Adrian.

On Thu, May 21, 2009 at 4:38 PM, Chas Emerick  wrote:
>
> I'm guessing glitz and visual impact is what's going to wow the crowd,
> especially in that environment, where it's likely that most people are
> steeped in "business applications".
>
> Perhaps using one of the clojure-processing wrappers to do some
> outrageously-slick data visualization, and then showing how little
> code is required to do it and how much leverage the language provides
> when addressing changes in requirements?  Maybe the slick visual
> impact part can be merged with the "business application" mindset by
> generating a report that includes the data visualization (I think PDF
> generation is built into processing).
>
> - Chas
>
> On May 18, 7:36 am, Rich Hickey  wrote:
>
>> The audience is Java developers, many of whom will have never seen
>> Clojure or any Lisp.
>>
>> I'd appreciate some suggestions *and help* preparing demos for the
>> Script Bowl. What (that could be demonstrated in 4 minutes) would make
>> you think - 'Clojure looks cool, I need to look into it'? What
>> community contribution(s) should we showcase?
>
>
> >
>

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure for high-end game development

2009-05-21 Thread Adrian Cuthbertson

> Game developement?

Some work has been done on using clojure with jogl (the java opengl
library) Search this forum with "jogl" for details.

> with the Android platform

I'm pretty sure there is also an android implementation of clojure.
Again, search this forum for "android".

Rgds, Adrian.

On Fri, May 22, 2009 at 4:29 AM, Mark Fayngersh  wrote:
> Game developement?
> Definitely possible. I was even thinking of finding a way to bridge Clojure
> with the Android platform
>
> Electronic Arts?
> Most likely not.
>
> On Thu, May 21, 2009 at 2:35 PM, tcg  wrote:
>>
>> You would think with Clojure's ability to make use of mutli cpu
>> hardware it would be a good choice for high-end game development.
>>
>> Does anyone know if big game studios like Electronic Arts are using or
>> looking into Clojure for this purpose?
>>
>>
>
>
>
> --
> ~phunny.pha...@gmail.com
> ~mar...@archlinux.us
>
> >
>

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure at JavaOne

2009-05-21 Thread e
Quite an old example which I think demonstrates this well:
> http://clojure.googlegroups.com/web/2c-calculator.clj
>
>
the fourth line can be combined with the third line for even more
conciseness, no?

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure as a Java lib documentation / examples?

2009-05-21 Thread Adrian Cuthbertson

Check out clojure.org - focus on java interop, compilation and class
generation. Mark Volkmann's
http://java.ociweb.com/mark/clojure/article.html has a good general
clojure overview and nice examples. Gen-class and proxy are the main
tools you'll need for exposing your clojure libraries as java api's.

Rgds, Adrian.

On Fri, May 22, 2009 at 2:23 AM, Brett Morgan  wrote:
>
> Hi guys,
>
> I have some evil thoughts of using Clojure as a java library so that i
> can use both the STM and the persistent data structures in projects
> that my team of java developers can work with.
>
> As much as I'd like to get the team coding in Clojure properly, I have
> enough trouble selling the idea of using immutable data structures. If
> I hide the clojure magic behind interfaces, I can have the team coding
> in plain java, and wrap what they do in clojure transactions and what
> not. I'd like to do this in a way that the clojure repl can still be
> used to interact with the running server.
>
> So where do I start reading? =)
>
> --
>
> Brett Morgan http://brett.morgan.googlepages.com/
>
> >
>

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure at JavaOne

2009-05-21 Thread e
>
> Show how you can run a demo with a bug in it, trigger the bug, to
> cause a break, fix the bug while in the break, and resume the demo
> with the corrected code.
>
>
You can do that?  What do "Fix the bug while in the break" mean?  I know you
could do that in Common Lisp.  I'd love to know how that works in clojure.
What environment do I need?  In my environment, all I see is
"NullPointerException" wiith no hint as to where it might have occurred.

- Eli

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure for high-end game development

2009-05-21 Thread Mark Fayngersh
Game developement?
Definitely possible. I was even thinking of finding a way to bridge Clojure
with the Android platform

Electronic Arts?
Most likely not.

On Thu, May 21, 2009 at 2:35 PM, tcg  wrote:

>
> You would think with Clojure's ability to make use of mutli cpu
> hardware it would be a good choice for high-end game development.
>
> Does anyone know if big game studios like Electronic Arts are using or
> looking into Clojure for this purpose?
>
> >
>


-- 
~phunny.pha...@gmail.com
~mar...@archlinux.us

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: off topic - sending and receiving raw Ethernet frames from clojure/java

2009-05-21 Thread Mark Addleman

Can't be done using the standard Java library.  You'll have to write
some JNI code or find a JNI library.

On May 20, 4:32 am, prhlava  wrote:
> Hello,
>
> Apologies for off topic post.
>
> I would like to send and receive raw ethernet frames from Clojure.
>
> So far, I found:
>
> http://netresearch.ics.uci.edu/kfujii/jpcap/doc/
>
> but is sending and receiving raw ethernet packets possible with the
> latest JDK using standard networking stack of JVM?
>
> Info I found is contradictory and most of it is old.
>
> The target platform this should work on are Linux, MacOS, and Windows.
> My development platform is Linux.
>
> Kind regards,
>
> Vlad
>
> PS: I am not after UDP or any TCP/IP related stuff but trying to send/
> receive ethernet stuff directly.
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Bit-Shift without Sign-Extend?

2009-05-21 Thread CuppoJava

Hi everyone,
I'm just wondering where the equivalent of the ">>>" operator is for
Clojure. I need it to do a divide-by-power-of-2 on unsigned bytes.
  -Patrick
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Clojure for high-end game development

2009-05-21 Thread tcg

You would think with Clojure's ability to make use of mutli cpu
hardware it would be a good choice for high-end game development.

Does anyone know if big game studios like Electronic Arts are using or
looking into Clojure for this purpose?

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure at JavaOne

2009-05-21 Thread John Newman
Speaking of "walking/filtering code," what about walking _actual_ code?

The only thing off the top of my mind would be an example of, say, a "Hello
World" function, but with the code represented as a JTree.  Say, in the
function (pr (.toLowerCase "Hello World")), you'd see .toLowerCase as a
node.  You'd click on the node to edit it and enter .toUpperCase.

After showing people the "HELLO WORLD," you could show them how the JTree
used a zipper (or some similar walking tool) to edit the datastructure.
This shows how a textual .clj file is only one of the possible
representations of the datastructure, code is data, data is code, etc. etc.

Even better, the JTree could be editing a live program... Or the program
running the JTree itself! :)

This doesn't have to be the actually example used.  Someone else might be
able to come up with something more practical, ideally implementing some of
the xml stuff you were talking about.

However, I can tell you that from my perspective, this whole "code is data"
thing was a bit of an epiphany for me when I realized it allowed for things
like in the example above.  (And it's thanks to Clojure that I took the dive
into lisp.)  I think something like this might have some jazz to it.  Not
sure the other languages can play the same tune.  (correct me if I'm wrong)

Regards,

On Thu, May 21, 2009 at 11:43 AM, Rich Hickey  wrote:

>
>
>
> On May 21, 10:38 am, Chas Emerick  wrote:
> > I'm guessing glitz and visual impact is what's going to wow the crowd,
> > especially in that environment, where it's likely that most people are
> > steeped in "business applications".
> >
> > Perhaps using one of the clojure-processing wrappers to do some
> > outrageously-slick data visualization, and then showing how little
> > code is required to do it and how much leverage the language provides
> > when addressing changes in requirements?  Maybe the slick visual
> > impact part can be merged with the "business application" mindset by
> > generating a report that includes the data visualization (I think PDF
> > generation is built into processing).
> >
>
> Last year the JRuby demo was a fancy graphics thing that utilized the
> motion sensor in the laptop + OpenGL or something. It really said
> little about JRuby (IMO), other than that being on the JVM lets you
> reach these libs, and perf was good enough.
>
> I'd like to do something modest but distinguishing. I have a vague
> notion of showing some Clojure data originating in some XML off the
> web, being passed to some filtering/walking code, getting displayed,
> stored in a DB, all without specific DOM/model/recordset APIs, a
> couple of lines for each task. This demonstrating the difference of
> not being OO - using generic abstract data types like maps everywhere.
>
> Help wanted in implementing some demo code.
>
> Rich
>
> >
>


-- 
John

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure at JavaOne

2009-05-21 Thread mikel



On May 21, 6:42 am, Rich Hickey  wrote:
> On May 21, 3:39 am, mikel  wrote:
>
>
>
>
>
> > On May 18, 7:36 am, Rich Hickey  wrote:
>
> > > I'll be doing two sessions involving Clojure at JavaOne this June. One
> > > is a traditional talk (TS-4164), the other is as a participant in the
> > > Script Bowl 2009: A Scripting Languages Shootout (PAN-5348).
>
> > > The 'script' bowl is a friendly competition, basically a place to show
> > > off your language and seek audience acclaim.
>
> > > "Scripting language gurus returning from 2008 are Groovy, JRuby,
> > > Jython, and Scala. This year there is also a new kid on the block:
> > > Clojure."
>
> > > There are two very brief rounds, 4 minutes per language each round .
>
> > > round 1: Core language and libraries round (show something really cool
> > > with the core language and libraries)
>
> > > round 2: Community round (show some significant community
> > > contributions)
>
> > > Note there is no comparative aspect, each language presenter talks up
> > > their own language and the audience decides, so it's not an
> > > opportunity to draw contrasts explicitly. It's about being pro-
> > > Clojure, not anti- anything else.
>
> > > The audience is Java developers, many of whom will have never seen
> > > Clojure or any Lisp.
>
> > > I'd appreciate some suggestions *and help* preparing demos for the
> > > Script Bowl. What (that could be demonstrated in 4 minutes) would make
> > > you think - 'Clojure looks cool, I need to look into it'? What
> > > community contribution(s) should we showcase?
>
> > Show something that does a lot of visible work quickly with very
> > little code, where the code is still very readable and easy to
> > understand.
>
> > Show how to do something that Java programmers have to do pretty
> > often, and that requires many lines of code, but which requires very
> > few lines of code in Clojure, yet the code is still very
> > understandable.
>
> > Show how someone can look at a running demo and ask for a different
> > feature, and you can implement the feature and have it show up in the
> > running demo without needing to stop and restart it.
>
> > Show how you can run a demo with a bug in it, trigger the bug, to
> > cause a break, fix the bug while in the break, and resume the demo
> > with the corrected code.
>
> > Show how you can do all of this from a nice interactive session, but
> > also quickly and easily package the demo app as a jarfile that you can
> > deploy like any other jarfile.
>
> > Show how easy it is to look at the guts of any Java instance or class,
> > and how easy it is to instantiate and use classes and interfaces.
>
> > Take a concurrent Java example that exhibits hard-to-debug threading
> > issues (this should address pain that any server-side Java programmer
> > has felt), and show how they go away in the presence of Clojure's
> > safety guarantees.
>
> > Finally, show them that they don't lose performance by gaining these
> > features.
>
> And in the second 4 minutes? :)
>

:-)

Certainly you're under no obligation to do all (or any) of those. But
I'll bet that any of them you can do will work.
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Greater-Than not overloaded for bytes?

2009-05-21 Thread CuppoJava

Hi,
I noticed that one part of my code was being obscenely slow, so I set
*warn-on-reflection* to true.

(let [b (byte 30)]
  (> b 30))

gives Reflection warning, NO_SOURCE_PATH:498 - call to gt can't be
resolved.

But:
(let [b (int 30)]
  (> b 30))

Is there a reason for having a byte-overloaded version of ">"?
Currently I'm reading bytes from a byte-array and then upcasting it to
integers to avoid reflection.

Thanks
  -Patrick
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure as a Java lib documentation / examples?

2009-05-21 Thread Nathan Hawkins

Try here:

http://code.google.com/p/clojure/source/browse/


Brett Morgan wrote:
> Hi guys,
>
> I have some evil thoughts of using Clojure as a java library so that i
> can use both the STM and the persistent data structures in projects
> that my team of java developers can work with.
>
> As much as I'd like to get the team coding in Clojure properly, I have
> enough trouble selling the idea of using immutable data structures. If
> I hide the clojure magic behind interfaces, I can have the team coding
> in plain java, and wrap what they do in clojure transactions and what
> not. I'd like to do this in a way that the clojure repl can still be
> used to interact with the running server.
>
> So where do I start reading? =)
>
>   


--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Clojure as a Java lib documentation / examples?

2009-05-21 Thread Brett Morgan

Hi guys,

I have some evil thoughts of using Clojure as a java library so that i
can use both the STM and the persistent data structures in projects
that my team of java developers can work with.

As much as I'd like to get the team coding in Clojure properly, I have
enough trouble selling the idea of using immutable data structures. If
I hide the clojure magic behind interfaces, I can have the team coding
in plain java, and wrap what they do in clojure transactions and what
not. I'd like to do this in a way that the clojure repl can still be
used to interact with the running server.

So where do I start reading? =)

-- 

Brett Morgan http://brett.morgan.googlepages.com/

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: clojure-mode install on Windows XP does not work, for me

2009-05-21 Thread Phil Hagelberg

klang  writes:

> This only works (for now) when using an alternative fork of clojure-
> mode
>
> git clone git://github.com/technomancy/clojure-mode.git
>
> .. that's why I got the same error messages consistently on both XP,
> OSX and Ubuntu ..

I was able to contact jochu (the original maintainer of clojure-mode),
and he's merged my changes upstream.

I plan on helping to fix swank-clojure to work with trunk, but for now
at least the obvious method will work.

-Phil

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: clojure-mode install on Windows XP does not work, for me

2009-05-21 Thread klang

This only works (for now) when using an alternative fork of clojure-
mode

git clone git://github.com/technomancy/clojure-mode.git

.. that's why I got the same error messages consistently on both XP,
OSX and Ubuntu ..

/klang

On May 18, 8:40 pm, klang  wrote:
> Using my existing definitions
>
> (setq clojure-src-root "~/lisp/clj")
>
> (setq swank-clojure-extra-classpaths
>       (cons (concat clojure-src-root "/swank-clojure")
>         (when (file-directory-p "~/.clojure")
>           (directory-files "~/.clojure" t ".jar$"
>
> This does not work, with "origin/master", rolling back to "origin/1.0"
> works though. (with or without setting swank-clojure-extra-classpaths)
>
> Paul, you must have done something else to swank-clojure to make thing
> work on origin/master?
>
> /klang
>
> On May 18, 7:14 pm, Paul Stadig  wrote:
>
> > I just happened to be setting up emacs an a new Ubuntu install today. I
> > think it might have something to do with 'add-classpath. The
> > swank-clojure-init function is trying to add the swank-clojure directory to
> > the classpath, but the 'require still fails when starting up the clojure
> > REPL.
>
> > I added the following to my .emacs to get it to work:
>
> > (setq swank-clojure-extra-classpaths
> >       (cons "~/src/swank-clojure"
> >         (when (file-directory-p "~/.clojure")
> >           (directory-files "~/.clojure" t ".jar$"
>
> > Paul
>
> > On Mon, May 18, 2009 at 1:02 PM, Phil Hagelberg  wrote:
>
> > > klang  writes:
>
> > > > First things first:
>
> > > > swank doesn't load and slime can't connect to the *inferior-lisp*
> > > > running clojure
>
> > > > I am missing something obvious, please advice.
>
> > > It's not your fault; it looks like the latest Clojure 1.1 snapshot is
> > > not compatible with swank-clojure. I haven't been following it closely,
> > > but somewhere between 1.0 and the present it's broken. It looks like
> > > swank-clojure will need to be updated to work with the latest.
>
> > > In the meantime, cd to your checkout of clojure and perform:
>
> > >  $ git checkout origin/1.0
> > >  $ ant
>
> > > Then launch a new Emacs instance and M-x slime should work. This did the
> > > trick for me at least. I'll update clojure-mode to work with 1.0 by
> > > default so you don't need to do anything by hand.
>
> > > -Phil
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Saving the Clojure.org webiste

2009-05-21 Thread Tom Faulhaber

Here's the magic incantation for using wget to pull a useful copy (no
postprocessing required!):

wget -krmnp -E -X/page,/message --no-check-certificate -P 
https://clojure.org

replace target with the directory where you want the output and you're
off to the races.

Thanks to Kresimir Sojat for working this out.

On May 19, 12:49 pm, Kei Suzuki  wrote:
> I wanted to save the Clojure.org website so that I can read it when
> I'm off-line. The problem is that none of the website downloader tools
> I found is satisfactory; the pages don't look right and links are
> broken (I think I know now why they don't work by looking into the
> html and css files of the website). So I wrote a downloader in
> Clojure. It's a bit slow and inefficient (but I don't care). Besides
> it depends on the way the website is written and organized. But it
> does what I want, so I'm happy...until the website changes radically.
>
> I'll upload the code to the Clojure Google Groups file area. The file
> name is save_clojure.org.tar.bz2. Hope you find it useful too.
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure at JavaOne

2009-05-21 Thread Ian Phillips

> I'd like to do something modest but distinguishing. I have a vague
> notion of showing some Clojure data originating in some XML off the
> web, being passed to some filtering/walking code, getting displayed,
> stored in a DB, all without specific DOM/model/recordset APIs, a
> couple of lines for each task. This demonstrating the difference of
> not being OO - using generic abstract data types like maps everywhere.


I agree that the uniform data structures are one of the really cool
things about Clojure, but it seems like a fairly subtle point to try
to get across in such a short amount of time; also, showing people a
language with loads of parentheses *and* saying it's not OO may just
scare people off ;-)  Although to be fair, I haven't been to J1 so I'm
not sure what the audience is going to be like.

For me, 2 of the biggest things are:

* using macros to add new control structures and eliminating
   boilerplate; and

* changing code at runtime.

However, given the time constraint I think that changing code at runtime
will have more of a 'wow' factor to it, and will also be easier to
demonstrate as you can, for example, have a app set up and running with
a known defect, that you could fix as a demo. For enterprise users who
value uptime this is going to be pretty cool (it's not that big a deal
for the folks who run web sites as you can basically roll out changes
across a server cluster by bouncing nodes already

One other tip: if you're going to show source code then set the editor
to highlight brackets in a very light colour so they don't stand out as
much, I've often been surprised at how big a deal people make about them
when coming from Algol family languages.

Cheers,
Ian.

#ifndef __COMMON_SENSE__  | Ian Phillips
#include  | i...@ianp.org
#endif| http://ianp.org/


--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Call for Help!: Clojure Code for JavaOne Talk

2009-05-21 Thread Timothy Pratley

> http://fupeg.blogspot.com/2009/05/javaone-talk-word-sort.htmlhttp://fupeg.blogspot.com/2009/05/javaone-talk-ruby-word-sort.html

(sort-by #(.toLowerCase %) (.split (slurp "words.txt") " ")


> implementations:http://fupeg.blogspot.com/2009/05/javaone-talk-prime-sieve.html

CG had a very nice solution:
http://clj-me.blogspot.com/2008/06/primes.html


Apologies in advance if these deviate too far to be useful.
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Feedback on new persistentmatrix datatype

2009-05-21 Thread Konrad Hinsen

On 21.05.2009, at 15:38, aperotte wrote:

> Though I can't say I've thoroughly tested this, the intended
> functionality is that you provide a nested structure and you specify
> the shape of the units with the first argument.

Ah, I see. I didn't try that at all.

>> 2) Shapes and indices are all int, rather than long. This excludes
>> really big arrays. Is there a reason for this choice other than
>> saving space?
>
> I used ints because I don't think java arrays can be indexed with
> longs.  I could theoretically back the data structures with more than
> one array, but the maximum index is defined by the int, I think.

After a quick look at the Java docs, it seems you are right. This  
means Java arrays are quite limited in size by today's standards.

>
>> PS: I am using PersistentMatrix rather successfully in reading data
>> from HDF5 files!
>
> Exciting!  I was also taking a look at the NetCDF format.  It looks
> interesting as well.

I have been using netCDF a lot in the past, but currently I am  
switching to HDF5 because it is more flexible and the C library has  
parallel I/O features. netCDF 4 will be a layer on top of HDF5 as  
well, so that format seems to have the best future. On the other  
hand, if you want to deal with existing netCDF files, you have to use  
the netCDF library. I haven't looked at their Java version yet.

Konrad.


--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure at JavaOne

2009-05-21 Thread Timothy Pratley

I'd like to echo Laurent's words - getting rid of boiler plate code is
tops.
Quite an old example which I think demonstrates this well:
http://clojure.googlegroups.com/web/2c-calculator.clj
Most people are familiar with the code explosion that buttons and
action listeners usually involve.
[it needs some cleaning up - rset for example is not a good idea, and
looks better with default look and feel and layout love]

That being said ants is the best wow value obviously!

On May 18, 11:12 pm, Laurent PETIT  wrote:
> As a general idea, I would say :
>
> specific to lisp:
> the possibility to get rid of "boiler plate code", such as the one
> involved in each and every (re)implementation of some GOF design
> patterns.
>
> This could be either a demonstration of the power of higher order
> functions or macros (the first with higher order functions *can* be
> done in java, but it is such a pain in the ass to do this right with
> anonymous functions that it is rarely done in practice, some spring
> framework frameworks let apart)
>
> specific to clojure:
> a demonstration of the ease of use of concurrent/parallel programming
> constructs.
>
> 2009/5/18 Rich Hickey :
>
>
>
> > I'll be doing two sessions involving Clojure at JavaOne this June. One
> > is a traditional talk (TS-4164), the other is as a participant in the
> > Script Bowl 2009: A Scripting Languages Shootout (PAN-5348).
>
> > The 'script' bowl is a friendly competition, basically a place to show
> > off your language and seek audience acclaim.
>
> > "Scripting language gurus returning from 2008 are Groovy, JRuby,
> > Jython, and Scala. This year there is also a new kid on the block:
> > Clojure."
>
> > There are two very brief rounds, 4 minutes per language each round .
>
> > round 1: Core language and libraries round (show something really cool
> > with the core language and libraries)
>
> > round 2: Community round (show some significant community
> > contributions)
>
> > Note there is no comparative aspect, each language presenter talks up
> > their own language and the audience decides, so it's not an
> > opportunity to draw contrasts explicitly. It's about being pro-
> > Clojure, not anti- anything else.
>
> > The audience is Java developers, many of whom will have never seen
> > Clojure or any Lisp.
>
> > I'd appreciate some suggestions *and help* preparing demos for the
> > Script Bowl. What (that could be demonstrated in 4 minutes) would make
> > you think - 'Clojure looks cool, I need to look into it'? What
> > community contribution(s) should we showcase?
>
> > Thanks,
>
> > Rich
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure at JavaOne

2009-05-21 Thread NarayanS

Modifying the running Java application is definitely a big plus and
attraction.
Also, showing off the features in the mainstream IDEs tells the Java
developer that it is very easily approachable and participate in the
whole classpath and tight integration with Java. Telling them how Java
and Clojure can co-mingle as needed and inter-operate easily.

Netbeans is a very popular free IDE and Enclojure plugin adds a very
strong clojure support to it. Following blog post explains how the
application can have socket REPL and can be used easily through
Netbeans IDE to manipulate the running application in another JVM.
http://clojure101.blogspot.com/2009/05/creating-clojure-repl-in-your.html


On May 18, 10:46 am, falcon  wrote:
> I agree with John.  For certain applications, the ability to modify
> the code while it is running is very useful.
>
> Many language comparisons turn into syntax comparisons.  Clojure has
> enough interesting concepts (concurrency model, code as data, macros)
> that it should be made to stand out.
>
> On May 18, 9:30 am, John Newman  wrote:
>
>
>
> > I believe it was the presentation you gave on the ants simulation, where you
> > updated the program while it was running.  I'm not sure if the other
> > languages in the shootout can do that, but I thought that was pretty
> > awesome.
>
> > I think a display of building an application while it's running in front of
> > you (be that a web app or a desktop app) is flashy and compelling.  Not sure
> > how far you could go with that though.
>
> > 2 cents.
>
> > Regards,
>
> > On Mon, May 18, 2009 at 5:42 PM, Laurent PETIT 
> > wrote:
>
> > > As a general idea, I would say :
>
> > > specific to lisp:
> > > the possibility to get rid of "boiler plate code", such as the one
> > > involved in each and every (re)implementation of some GOF design
> > > patterns.
>
> > > This could be either a demonstration of the power of higher order
> > > functions or macros (the first with higher order functions *can* be
> > > done in java, but it is such a pain in the ass to do this right with
> > > anonymous functions that it is rarely done in practice, some spring
> > > framework frameworks let apart)
>
> > > specific to clojure:
> > > a demonstration of the ease of use of concurrent/parallel programming
> > > constructs.
>
> > > 2009/5/18 Rich Hickey :
>
> > > > I'll be doing two sessions involving Clojure at JavaOne this June. One
> > > > is a traditional talk (TS-4164), the other is as a participant in the
> > > > Script Bowl 2009: A Scripting Languages Shootout (PAN-5348).
>
> > > > The 'script' bowl is a friendly competition, basically a place to show
> > > > off your language and seek audience acclaim.
>
> > > > "Scripting language gurus returning from 2008 are Groovy, JRuby,
> > > > Jython, and Scala. This year there is also a new kid on the block:
> > > > Clojure."
>
> > > > There are two very brief rounds, 4 minutes per language each round .
>
> > > > round 1: Core language and libraries round (show something really cool
> > > > with the core language and libraries)
>
> > > > round 2: Community round (show some significant community
> > > > contributions)
>
> > > > Note there is no comparative aspect, each language presenter talks up
> > > > their own language and the audience decides, so it's not an
> > > > opportunity to draw contrasts explicitly. It's about being pro-
> > > > Clojure, not anti- anything else.
>
> > > > The audience is Java developers, many of whom will have never seen
> > > > Clojure or any Lisp.
>
> > > > I'd appreciate some suggestions *and help* preparing demos for the
> > > > Script Bowl. What (that could be demonstrated in 4 minutes) would make
> > > > you think - 'Clojure looks cool, I need to look into it'? What
> > > > community contribution(s) should we showcase?
>
> > > > Thanks,
>
> > > > Rich
>
> > --
> > John
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure at JavaOne

2009-05-21 Thread Rich Hickey



On May 21, 10:38 am, Chas Emerick  wrote:
> I'm guessing glitz and visual impact is what's going to wow the crowd,
> especially in that environment, where it's likely that most people are
> steeped in "business applications".
>
> Perhaps using one of the clojure-processing wrappers to do some
> outrageously-slick data visualization, and then showing how little
> code is required to do it and how much leverage the language provides
> when addressing changes in requirements?  Maybe the slick visual
> impact part can be merged with the "business application" mindset by
> generating a report that includes the data visualization (I think PDF
> generation is built into processing).
>

Last year the JRuby demo was a fancy graphics thing that utilized the
motion sensor in the laptop + OpenGL or something. It really said
little about JRuby (IMO), other than that being on the JVM lets you
reach these libs, and perf was good enough.

I'd like to do something modest but distinguishing. I have a vague
notion of showing some Clojure data originating in some XML off the
web, being passed to some filtering/walking code, getting displayed,
stored in a DB, all without specific DOM/model/recordset APIs, a
couple of lines for each task. This demonstrating the difference of
not being OO - using generic abstract data types like maps everywhere.

Help wanted in implementing some demo code.

Rich

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: clojure-mode install on Windows XP does not work, for me

2009-05-21 Thread Phil Hagelberg

klang  writes:

> There is still something obvious that I am missing, to get origin/
> master working, but at least I am missing it consistently on three
> operating systems, yay me! :-)

I think swank-clojure will have to be updated to support the latest
origin/master; there must have been a breaking change in Clojure. Stick
with 1.0 until it gets updated.

-Phil

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure at JavaOne

2009-05-21 Thread Sean Devlin

The duck streams library should give some examples the Java crowd will
be ready to appreciate.  That, or maybe use the with-open macro.

My $.02

On May 21, 7:42 am, Rich Hickey  wrote:
> On May 21, 3:39 am, mikel  wrote:
>
>
>
> > On May 18, 7:36 am, Rich Hickey  wrote:
>
> > > I'll be doing two sessions involving Clojure at JavaOne this June. One
> > > is a traditional talk (TS-4164), the other is as a participant in the
> > > Script Bowl 2009: A Scripting Languages Shootout (PAN-5348).
>
> > > The 'script' bowl is a friendly competition, basically a place to show
> > > off your language and seek audience acclaim.
>
> > > "Scripting language gurus returning from 2008 are Groovy, JRuby,
> > > Jython, and Scala. This year there is also a new kid on the block:
> > > Clojure."
>
> > > There are two very brief rounds, 4 minutes per language each round .
>
> > > round 1: Core language and libraries round (show something really cool
> > > with the core language and libraries)
>
> > > round 2: Community round (show some significant community
> > > contributions)
>
> > > Note there is no comparative aspect, each language presenter talks up
> > > their own language and the audience decides, so it's not an
> > > opportunity to draw contrasts explicitly. It's about being pro-
> > > Clojure, not anti- anything else.
>
> > > The audience is Java developers, many of whom will have never seen
> > > Clojure or any Lisp.
>
> > > I'd appreciate some suggestions *and help* preparing demos for the
> > > Script Bowl. What (that could be demonstrated in 4 minutes) would make
> > > you think - 'Clojure looks cool, I need to look into it'? What
> > > community contribution(s) should we showcase?
>
> > Show something that does a lot of visible work quickly with very
> > little code, where the code is still very readable and easy to
> > understand.
>
> > Show how to do something that Java programmers have to do pretty
> > often, and that requires many lines of code, but which requires very
> > few lines of code in Clojure, yet the code is still very
> > understandable.
>
> > Show how someone can look at a running demo and ask for a different
> > feature, and you can implement the feature and have it show up in the
> > running demo without needing to stop and restart it.
>
> > Show how you can run a demo with a bug in it, trigger the bug, to
> > cause a break, fix the bug while in the break, and resume the demo
> > with the corrected code.
>
> > Show how you can do all of this from a nice interactive session, but
> > also quickly and easily package the demo app as a jarfile that you can
> > deploy like any other jarfile.
>
> > Show how easy it is to look at the guts of any Java instance or class,
> > and how easy it is to instantiate and use classes and interfaces.
>
> > Take a concurrent Java example that exhibits hard-to-debug threading
> > issues (this should address pain that any server-side Java programmer
> > has felt), and show how they go away in the presence of Clojure's
> > safety guarantees.
>
> > Finally, show them that they don't lose performance by gaining these
> > features.
>
> And in the second 4 minutes? :)
>
> Rich
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure at JavaOne

2009-05-21 Thread Chas Emerick

I'm guessing glitz and visual impact is what's going to wow the crowd,  
especially in that environment, where it's likely that most people are  
steeped in "business applications".

Perhaps using one of the clojure-processing wrappers to do some  
outrageously-slick data visualization, and then showing how little  
code is required to do it and how much leverage the language provides  
when addressing changes in requirements?  Maybe the slick visual  
impact part can be merged with the "business application" mindset by  
generating a report that includes the data visualization (I think PDF  
generation is built into processing).

- Chas

On May 18, 7:36 am, Rich Hickey  wrote:

> The audience is Java developers, many of whom will have never seen
> Clojure or any Lisp.
>
> I'd appreciate some suggestions *and help* preparing demos for the
> Script Bowl. What (that could be demonstrated in 4 minutes) would make
> you think - 'Clojure looks cool, I need to look into it'? What
> community contribution(s) should we showcase?


--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: clojure-mode install on Windows XP does not work, for me

2009-05-21 Thread klang

I have just tried my setup on both OSX and Ubuntu .. (with Paul's
modifications) .. and there is something seriously wrong with my way
of using clojure-mode to bootstrap the whole installation.

I am looking at the same error-messages as described in my original
post, on additional two different systems.

Well, back to the drawing board for me.
There is still something obvious that I am missing, to get origin/
master working, but at least I am missing it consistently on three
operating systems, yay me! :-)

/klang

On May 21, 12:06 pm, Alen Ribic  wrote:
> Thanks this also worked for me on my Aquamacs Clojure slime setup. I
> added your code to the customization.el file in ~/Library/
> Preferences/...
>
> -Alen
>
> On May 18, 7:14 pm, Paul Stadig  wrote:
>
> > I just happened to be setting up emacs an a new Ubuntu install today. I
> > think it might have something to do with 'add-classpath. The
> > swank-clojure-init function is trying to add the swank-clojure directory to
> > the classpath, but the 'require still fails when starting up the clojure
> > REPL.
>
> > I added the following to my .emacs to get it to work:
>
> > (setq swank-clojure-extra-classpaths
> >       (cons "~/src/swank-clojure"
> >         (when (file-directory-p "~/.clojure")
> >           (directory-files "~/.clojure" t ".jar$"
>
> > Paul
>
> > On Mon, May 18, 2009 at 1:02 PM, Phil Hagelberg  wrote:
>
> > > klang  writes:
>
> > > > First things first:
>
> > > > swank doesn't load and slime can't connect to the *inferior-lisp*
> > > > running clojure
>
> > > > I am missing something obvious, please advice.
>
> > > It's not your fault; it looks like the latest Clojure 1.1 snapshot is
> > > not compatible with swank-clojure. I haven't been following it closely,
> > > but somewhere between 1.0 and the present it's broken. It looks like
> > > swank-clojure will need to be updated to work with the latest.
>
> > > In the meantime, cd to your checkout of clojure and perform:
>
> > >  $ git checkout origin/1.0
> > >  $ ant
>
> > > Then launch a new Emacs instance and M-x slime should work. This did the
> > > trick for me at least. I'll update clojure-mode to work with 1.0 by
> > > default so you don't need to do anything by hand.
>
> > > -Phil
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: possible bug?

2009-05-21 Thread Cosmin Stejerean
On Thu, May 21, 2009 at 3:35 AM, Michael Wood  wrote:

>
> On Thu, May 21, 2009 at 9:15 AM, Christophe Grand 
> wrote:
> >
> > Cosmin Stejerean a écrit :
> >> On Wed, May 20, 2009 at 7:04 PM, George Jahad
> >> mailto:andr...@blackbirdsystems.net>>
> >> wrote:
> >>
> >>
> >> (def s1 (Symbol/create (.intern (first (.split "user/n1" "/")
> >>
> >> will fix your problem.
> >>
> >>
> >> That makes a lot of sense and I guess I should have paid attention to
> >> the function definition for Symbol/create. Thanks!
> >
> > You should also use Symbol/intern instead of Symbol/create.
>
> Is Symbol/create or Symbol/intern necessary?  This seems to work:
>
> user=> (def s1 (symbol (first (.split "user/n1" "/"
> #'user/s1
> user=> (def s2 (symbol "user"))
> #'user/s2
> user=> (= s1 s2)
> true
> user=> (class s1)
> clojure.lang.Symbol
> user=> (class s2)
> clojure.lang.Symbol
> user=> (ns-publics s1)
> {s2 #'user/s2, s1 #'user/s1}
> user=> (ns-publics s2)
> {s2 #'user/s2, s1 #'user/s1}
> user=>
>

I don't know how I missed the symbol function in the API. Thanks.

-- 
Cosmin Stejerean
http://offbytwo.com

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Feedback on new persistentmatrix datatype

2009-05-21 Thread aperotte


> 1) What is the role of the first argument to PersistentMatrix/create?  
> It seems that anything else than (int-array [1]) leads to an error.

Though I can't say I've thoroughly tested this, the intended
functionality is that you provide a nested structure and you specify
the shape of the units with the first argument.  For example, if I
provide a 8x10x2 nested structure that's intended to be a complex
matrix, I would put an (int-array [2]) in the first argument and the
result should be an 8x10 data structure with 2x1 dimensional units.  I
intended that an exception be thrown if the unit shape doesn't match
the structure of the last few dimensions.

>
> 2) Shapes and indices are all int, rather than long. This excludes  
> really big arrays. Is there a reason for this choice other than  
> saving space?

I used ints because I don't think java arrays can be indexed with
longs.  I could theoretically back the data structures with more than
one array, but the maximum index is defined by the int, I think.

> PS: I am using PersistentMatrix rather successfully in reading data  
> from HDF5 files!

Exciting!  I was also taking a look at the NetCDF format.  It looks
interesting as well.
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Call for Help!: Clojure Code for JavaOne Talk

2009-05-21 Thread Chouser

On Thu, May 21, 2009 at 4:59 AM, michaelg  wrote:
>
> So if anyone would like to help, I would be very appreciative. All I
> can offer is recognition in my JavaOne talk. All I ask from the
> implementations is that they try to stay true to how the Java version
> worked, while also trying to be fairly idiomatic Clojure. I don't have
> a strong opinion on type hinting. If it is used, then I would not
> compare the results to Groovy, Ruby, Python, but to Scala, Fan instead
> and vice versa

I did reversible first -- here's what I came up with:

(defn all-odd? [n]
  (every? odd? (map #(Integer. (str %)) (str n

(defn reverse-num [n]
  (+ n (Integer. (apply str (reverse (str n))

(defn reversible-num? [n]
  (all-odd? (reverse-num n)))

(defn count-reversible [rev-max]
  {:max rev-max
   :num-reversible (count (filter reversible-num? (range 11 rev-max)))})

Those stay very true to the ruby version you've already got.
If you're willing to wander a bit, I'm not sure whether
you'd rather go more succinct or faster.  For example:

(defn all-odd? [n]
  (every? #{\1 \3 \5 \9} (str n)))

That's a bit simpler and more succinct, but it's also a bit
slower than the original above.  But you could go faster
instead:

(defn all-odd? [n]
  (loop [n (int n)]
(cond
  (zero? n) true
  (even? n) false
  :else (recur (int (quot n 10))

Use of primitive int and not messing with Strings makes that
one about 10x faster than the original.

Note we haven't used any traditional type hints yet, though
they can be useful.  We can add a single type hint to
reverse-num and double its speed:

(defn reverse-num [n]
  (+ n (Integer. #^String (apply str (reverse (str n))

But again primitive numbers win here if you care only about
speed.  This one is more than 5 times faster than the
original reverse-num:

(defn reverse-num [n]
  (loop [nrem (int n), rev (int 0)]
(if (zero? nrem)
  (+ n rev)
  (recur (int (quot nrem 10))
 (int (+ (* 10 rev) (rem nrem 10)))

--Chouser

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure at JavaOne

2009-05-21 Thread Rich Hickey



On May 21, 3:39 am, mikel  wrote:
> On May 18, 7:36 am, Rich Hickey  wrote:
>
>
>
> > I'll be doing two sessions involving Clojure at JavaOne this June. One
> > is a traditional talk (TS-4164), the other is as a participant in the
> > Script Bowl 2009: A Scripting Languages Shootout (PAN-5348).
>
> > The 'script' bowl is a friendly competition, basically a place to show
> > off your language and seek audience acclaim.
>
> > "Scripting language gurus returning from 2008 are Groovy, JRuby,
> > Jython, and Scala. This year there is also a new kid on the block:
> > Clojure."
>
> > There are two very brief rounds, 4 minutes per language each round .
>
> > round 1: Core language and libraries round (show something really cool
> > with the core language and libraries)
>
> > round 2: Community round (show some significant community
> > contributions)
>
> > Note there is no comparative aspect, each language presenter talks up
> > their own language and the audience decides, so it's not an
> > opportunity to draw contrasts explicitly. It's about being pro-
> > Clojure, not anti- anything else.
>
> > The audience is Java developers, many of whom will have never seen
> > Clojure or any Lisp.
>
> > I'd appreciate some suggestions *and help* preparing demos for the
> > Script Bowl. What (that could be demonstrated in 4 minutes) would make
> > you think - 'Clojure looks cool, I need to look into it'? What
> > community contribution(s) should we showcase?
>
> Show something that does a lot of visible work quickly with very
> little code, where the code is still very readable and easy to
> understand.
>
> Show how to do something that Java programmers have to do pretty
> often, and that requires many lines of code, but which requires very
> few lines of code in Clojure, yet the code is still very
> understandable.
>
> Show how someone can look at a running demo and ask for a different
> feature, and you can implement the feature and have it show up in the
> running demo without needing to stop and restart it.
>
> Show how you can run a demo with a bug in it, trigger the bug, to
> cause a break, fix the bug while in the break, and resume the demo
> with the corrected code.
>
> Show how you can do all of this from a nice interactive session, but
> also quickly and easily package the demo app as a jarfile that you can
> deploy like any other jarfile.
>
> Show how easy it is to look at the guts of any Java instance or class,
> and how easy it is to instantiate and use classes and interfaces.
>
> Take a concurrent Java example that exhibits hard-to-debug threading
> issues (this should address pain that any server-side Java programmer
> has felt), and show how they go away in the presence of Clojure's
> safety guarantees.
>
> Finally, show them that they don't lose performance by gaining these
> features.

And in the second 4 minutes? :)

Rich
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: clojure-mode install on Windows XP does not work, for me

2009-05-21 Thread Alen Ribic

Thanks this also worked for me on my Aquamacs Clojure slime setup. I
added your code to the customization.el file in ~/Library/
Preferences/...

-Alen

On May 18, 7:14 pm, Paul Stadig  wrote:
> I just happened to be setting up emacs an a new Ubuntu install today. I
> think it might have something to do with 'add-classpath. The
> swank-clojure-init function is trying to add the swank-clojure directory to
> the classpath, but the 'require still fails when starting up the clojure
> REPL.
>
> I added the following to my .emacs to get it to work:
>
> (setq swank-clojure-extra-classpaths
>       (cons "~/src/swank-clojure"
>         (when (file-directory-p "~/.clojure")
>           (directory-files "~/.clojure" t ".jar$"
>
> Paul
>
> On Mon, May 18, 2009 at 1:02 PM, Phil Hagelberg  wrote:
>
> > klang  writes:
>
> > > First things first:
>
> > > swank doesn't load and slime can't connect to the *inferior-lisp*
> > > running clojure
>
> > > I am missing something obvious, please advice.
>
> > It's not your fault; it looks like the latest Clojure 1.1 snapshot is
> > not compatible with swank-clojure. I haven't been following it closely,
> > but somewhere between 1.0 and the present it's broken. It looks like
> > swank-clojure will need to be updated to work with the latest.
>
> > In the meantime, cd to your checkout of clojure and perform:
>
> >  $ git checkout origin/1.0
> >  $ ant
>
> > Then launch a new Emacs instance and M-x slime should work. This did the
> > trick for me at least. I'll update clojure-mode to work with 1.0 by
> > default so you don't need to do anything by hand.
>
> > -Phil

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Call for Help!: Clojure Code for JavaOne Talk

2009-05-21 Thread michaelg

As they say on sports radio, long time listener, first time caller...
I am giving a talk at JavaOne on alternative language performance on
the JVM. I have written a couple of algorithms in Java, and then
mostly equivalent ones in Groovy, Ruby, Python, Scala, and Fan. I
would like to include Clojure in the talk, too, so I am hoping the
folks here could help me out with Clojure implementations.

You can see the Java examples here, along with the Ruby
implementations:
http://fupeg.blogspot.com/2009/05/javaone-talk-prime-sieve.html
http://fupeg.blogspot.com/2009/05/javaone-talk-being-less-efficient.html
http://fupeg.blogspot.com/2009/05/javaone-talk-ruby-prime-sieve.html

http://fupeg.blogspot.com/2009/05/javaone-talk-word-sort.html
http://fupeg.blogspot.com/2009/05/javaone-talk-ruby-word-sort.html

http://fupeg.blogspot.com/2009/05/javaone-talk-reversible-numbers.html
http://fupeg.blogspot.com/2009/05/javaone-talk-ruby-reversible-numbers.html

So if anyone would like to help, I would be very appreciative. All I
can offer is recognition in my JavaOne talk. All I ask from the
implementations is that they try to stay true to how the Java version
worked, while also trying to be fairly idiomatic Clojure. I don't have
a strong opinion on type hinting. If it is used, then I would not
compare the results to Groovy, Ruby, Python, but to Scala, Fan instead
and vice versa

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: possible bug?

2009-05-21 Thread Michael Wood

On Thu, May 21, 2009 at 9:15 AM, Christophe Grand  wrote:
>
> Cosmin Stejerean a écrit :
>> On Wed, May 20, 2009 at 7:04 PM, George Jahad
>> mailto:andr...@blackbirdsystems.net>>
>> wrote:
>>
>>
>>     (def s1 (Symbol/create (.intern (first (.split "user/n1" "/")
>>
>>     will fix your problem.
>>
>>
>> That makes a lot of sense and I guess I should have paid attention to
>> the function definition for Symbol/create. Thanks!
>
> You should also use Symbol/intern instead of Symbol/create.

Is Symbol/create or Symbol/intern necessary?  This seems to work:

user=> (def s1 (symbol (first (.split "user/n1" "/"
#'user/s1
user=> (def s2 (symbol "user"))
#'user/s2
user=> (= s1 s2)
true
user=> (class s1)
clojure.lang.Symbol
user=> (class s2)
clojure.lang.Symbol
user=> (ns-publics s1)
{s2 #'user/s2, s1 #'user/s1}
user=> (ns-publics s2)
{s2 #'user/s2, s1 #'user/s1}
user=>

-- 
Michael Wood 

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure at JavaOne

2009-05-21 Thread mikel



On May 18, 7:36 am, Rich Hickey  wrote:
> I'll be doing two sessions involving Clojure at JavaOne this June. One
> is a traditional talk (TS-4164), the other is as a participant in the
> Script Bowl 2009: A Scripting Languages Shootout (PAN-5348).
>
> The 'script' bowl is a friendly competition, basically a place to show
> off your language and seek audience acclaim.
>
> "Scripting language gurus returning from 2008 are Groovy, JRuby,
> Jython, and Scala. This year there is also a new kid on the block:
> Clojure."
>
> There are two very brief rounds, 4 minutes per language each round .
>
> round 1: Core language and libraries round (show something really cool
> with the core language and libraries)
>
> round 2: Community round (show some significant community
> contributions)
>
> Note there is no comparative aspect, each language presenter talks up
> their own language and the audience decides, so it's not an
> opportunity to draw contrasts explicitly. It's about being pro-
> Clojure, not anti- anything else.
>
> The audience is Java developers, many of whom will have never seen
> Clojure or any Lisp.
>
> I'd appreciate some suggestions *and help* preparing demos for the
> Script Bowl. What (that could be demonstrated in 4 minutes) would make
> you think - 'Clojure looks cool, I need to look into it'? What
> community contribution(s) should we showcase?
>

Show something that does a lot of visible work quickly with very
little code, where the code is still very readable and easy to
understand.

Show how to do something that Java programmers have to do pretty
often, and that requires many lines of code, but which requires very
few lines of code in Clojure, yet the code is still very
understandable.

Show how someone can look at a running demo and ask for a different
feature, and you can implement the feature and have it show up in the
running demo without needing to stop and restart it.

Show how you can run a demo with a bug in it, trigger the bug, to
cause a break, fix the bug while in the break, and resume the demo
with the corrected code.

Show how you can do all of this from a nice interactive session, but
also quickly and easily package the demo app as a jarfile that you can
deploy like any other jarfile.

Show how easy it is to look at the guts of any Java instance or class,
and how easy it is to instantiate and use classes and interfaces.

Take a concurrent Java example that exhibits hard-to-debug threading
issues (this should address pain that any server-side Java programmer
has felt), and show how they go away in the presence of Clojure's
safety guarantees.

Finally, show them that they don't lose performance by gaining these
features.
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: laziness performance question

2009-05-21 Thread Konrad Hinsen

On 21.05.2009, at 01:42, Raoul Duke wrote:

> Seems like Haskell's laziness has an aura of "it will bite you
> performance-wise sooner or later." What is different (I'm asking
> didactically, not snarkily) about Clojure's laziness? Does it manage
> to avoid some aspects of the "uh ohs" in Haskell?

The main difference is that in Haskell, all evaluation is lazy,  
whereas in Clojure, only sequences are lazy by default. You can make  
your own lazy evaluation using delay, but if you do you know why you  
did it. This makes a big difference in terms of memory usage: for  
sequence processing, lazy evaluation actually helps in most cases,  
whereas elswhere its impact is difficult to estimate. In terms of CPU  
performance, lazy evaluation always entails an overhead. I can't say  
if there is an important difference between Haskell and Clojure  
implementation-wise.

Konrad.

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Saving the Clojure.org webiste

2009-05-21 Thread Michael Wood

On Wed, May 20, 2009 at 9:05 PM, Kei Suzuki  wrote:
>
> I should have uploaded the file in the .zip format for ease of
> extraction. Since I don't know how to replace it with a .zip version
> and I don't want to clutter the file area, I don't upload the zip
> version. Mac and Linux users should have no problem of extracting the
> files, and there should be bunch of free .tar.bz2 extraction tools
> available for Windows. Sorry.
>
> On May 20, 5:36 am, Emeka  wrote:
>> What about the zip version of  save_clojure.org.tar.bz2?

Windows users can use 7-zip:
http://www.7-zip.org/

-- 
Michael Wood 

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: possible bug?

2009-05-21 Thread Christophe Grand

Cosmin Stejerean a écrit :
> On Wed, May 20, 2009 at 7:04 PM, George Jahad 
> mailto:andr...@blackbirdsystems.net>> 
> wrote:
>
>
> (def s1 (Symbol/create (.intern (first (.split "user/n1" "/")
>
> will fix your problem.
>
>
> That makes a lot of sense and I guess I should have paid attention to 
> the function definition for Symbol/create. Thanks!

You should also use Symbol/intern instead of Symbol/create.

Christophe


-- 
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.blogspot.com/ (en)



--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---