Re: Continuation monad tutorial

2009-12-01 Thread Konrad Hinsen
On 30 Nov 2009, at 23:07, jim wrote:

 Just finished the tutorial explaining the continuation monad in
 clojure. Haven't even proofed it but I want to head to the gym. :)

 http://intensivesystems.net/tutorials/cont_m.html

Great work!

One comment I'd add is that in the last example:

(def fn11 (m-chain [mf-a mark mf-b mf-c]))
(def mark-cont ((fn11 10) identity))
(doall (map mark-cont [0 1 2]))

the argument to fn11, 10, has no influence on the result.

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
Note that posts from new members are moderated - please be patient with your 
first post.
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: Deep deref

2009-12-01 Thread Christophe Grand
Glad to hear that!
https://www.assembla.com/spaces/clojure/tickets/213-Invariants-and-the-STM

On Sun, Nov 29, 2009 at 3:05 PM, Rich Hickey richhic...@gmail.com wrote:

 On Tue, Nov 24, 2009 at 3:14 AM, Christophe Grand christo...@cgrand.net
 wrote:
  On Mon, Nov 23, 2009 at 11:56 PM, John Harrop jharrop...@gmail.com
 wrote:
 
  I'm starting to think that for some tasks Clojure could use a concept of
  row locking with maps.  It would mean having a map-of-refs type that
 was
  integrated with the STM, so multiple updates whose keys didn't collide
 could
  occur concurrently.
  It *might* be possible to do this using commute and update-in, with a
 ref
  wrapping the whole map. The tricky thing is you want the update-ins to
  commute if the keys are not the same, but not if they are. Perhaps we
 need a
  conditional commute that takes two extra arguments, a value to test
 and a
  binary predicate. Then it could be done with (conditional-commute key =
 map
  update-in [key] val-transform-fn).
  The idea here being, in this case, that if two of these were done in
  overlapping transactions, the first arguments would be compared using
 the
  second argument. If the result was true one transaction would be
 retried, if
  false the operations would commute. (If the second arguments to the two
  conditional-commutes differed the transaction would be retried.)
 
  I had a similar idea but more general: being able to specify invariants
  inside a transaction. Commit will procede only if the invariant still
 holds.
  Your proposed conditional-commute could be rewritten:
 
  ;; (conditional-commute key = map update-in [key] val-transform-fn)
  (invariant (@map key))
  (commute map update-in [key] val-transform-fn)
 
  See the attached patch for a prototype.
 

 I had forgotten about this, could you please make an issue for it? I'd
 like to look into it for a future feature.

 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
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en




-- 
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.cgrand.net/ (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
Note that posts from new members are moderated - please be patient with your 
first post.
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 first programming language?

2009-12-01 Thread Towle
Hi all,

Thanks for taking the time to read my post. I'm interested to get some
opinions from experienced Clojure programmers on whether the language
would be a good first language to learn, or rather to learn in-depth.
I have minimal experienced with more common languages like Java, HTML,
and C++, but having the personality I do, felt compelled to shop
around a bit before choosing a first language to learn seriously on a
deep and intuitive level-- perhaps my odd notion of there being a
connection between a programmer and the first language s/he
understands on that high of a level. So after shopping around
thoroughly and picking up bits about on theoretical computer science
and the history of programming languages, I decided to pick up a Lisp;
I'm intrigued by the greater concept/idea behind the Lisp family of
languages.

After a long while trying to figure out which of the Lisps would be a
good first choice, I stumbled across Clojure and immediately thought
it a brilliant idea, conceding of course that at my current level of
knowledge, I likely have no idea what a brilliant idea in computer
programming looks like. Regardless, it still feels brilliant.

As I see it, among other features of the language, the idea of a Lisp
designed to be a capable choice for real-world code applications,
that is a Lisp which embodies the spirit of that family of languages
yet one which resolves many of the practicality complaints which
stand as hurdles on a Lisp's path to real-world use. For my situation,
that of a student who wants both a) to learn a first language I can
have a real, intellectual appreciation for and b) to begin the journey
to expertise in a language it would be practical to code web
applications in.

So, Clojure programmers, am I wrong? Should I pass on Clojure in favor
of another langauge? Or learn Common Lisp or Scheme first, then try my
hand at Clojure? Am I mistaken for a different reason? Or perhaps
there are some criteria I should consider before diving in?

Thanks in advance, and again for taking the time to read.
--Towle

-- 
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 with your 
first post.
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


Getting Started in Mac OS X Snow Leopard

2009-12-01 Thread Charras
Hello;

I already install Clojure using MacPorts, and I can use it with clj.
But the environment is not what I will like. I'm trying to set up
clojure, so I can use it in Aquamacs. I already download the clojure-
mode.el, in there says that I can install it using ELPA, but I don't
know how to install ELPA in aquamacs.

Please, if someone can help me to setup clojure, in my Mac, and be
able to use it, with Aquamacs, I'll appreciated very much.

Regards!

Guido

-- 
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 with your 
first post.
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: Query blobs in clojure.contrib.sql?

2009-12-01 Thread John Harrop
On Mon, Nov 30, 2009 at 9:57 PM, Base basselsm...@gmail.com wrote:

 Hi

 I have a database that has a table with complex java objects stored in
 a binary field.

 In java i would do something like:

 protected Object read(byte[] buf){
 Object obj = null;
 if (buf==null) return obj;
 try {
ObjectInputStream objectIn =
 new ObjectInputStream(
   new ByteArrayInputStream(buf));
obj = objectIn.readObject();
} catch (IOException e){
 ...
 }
   return obj;
 }


 I am stumped as to how to handle this sort of syntax in clojure.

 (defn select-test2[]
  (with-connection db
(with-query-results res [SELECT BIN_OBJ FROM MYTABLE  where ID
 =16000254] (doall res


There seems to be some sort of disconnect here. The second piece of code
queries a database and realizes the result seq. The first extracts a
serialized Java object from a byte buffer. The missing link would be however
one extracts a BLOB from the result seq in the form of a Java byte buffer.

As for the clojure syntax, that for obtaining the byte buffer is unknown,
but presumably involves Java interop. That for the deserialization is
straightforward:

(if-not (nil? byte-buffer)
  (with-open [object-in (ObjectInputStream.
  (ByteArrayInputStream. byte-buffer))]
(.readObject object-in)))

(Just four lines of Clojure code, versus 11 of Java. :))

(If your Java try block didn't just clean up the streams but also e.g.
logged the error you'll need a try form added, e.g.

(if-not (nil? byte-buffer)
  (try
(with-open [object-in (ObjectInputStream.
(ByteArrayInputStream. byte-buffer))]
  (.readObject object-in))
(catch (Throwable t)
  (log-error t)
  (throw t

or perhaps more specific handling of particular exceptions.)

-- 
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 with your 
first post.
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: Query blobs in clojure.contrib.sql?

2009-12-01 Thread Base
This is exactly what I was looking for!

Early Christmas for me.

Thank you Santa...e...John

On Dec 1, 2:04 am, John Harrop jharrop...@gmail.com wrote:
 On Mon, Nov 30, 2009 at 9:57 PM, Base basselsm...@gmail.com wrote:
  Hi

  I have a database that has a table with complex java objects stored in
  a binary field.

  In java i would do something like:

  protected Object read(byte[] buf){
      Object obj = null;
      if (buf==null) return obj;
          try {
         ObjectInputStream objectIn =
                              new ObjectInputStream(
                    new ByteArrayInputStream(buf));
         obj = objectIn.readObject();
         } catch (IOException e){
                                      ...
          }
    return obj;
  }

  I am stumped as to how to handle this sort of syntax in clojure.

  (defn select-test2[]
   (with-connection db
     (with-query-results res [SELECT BIN_OBJ FROM MYTABLE  where ID
  =16000254] (doall res

 There seems to be some sort of disconnect here. The second piece of code
 queries a database and realizes the result seq. The first extracts a
 serialized Java object from a byte buffer. The missing link would be however
 one extracts a BLOB from the result seq in the form of a Java byte buffer.

 As for the clojure syntax, that for obtaining the byte buffer is unknown,
 but presumably involves Java interop. That for the deserialization is
 straightforward:

 (if-not (nil? byte-buffer)
   (with-open [object-in (ObjectInputStream.
                           (ByteArrayInputStream. byte-buffer))]
     (.readObject object-in)))

 (Just four lines of Clojure code, versus 11 of Java. :))

 (If your Java try block didn't just clean up the streams but also e.g.
 logged the error you'll need a try form added, e.g.

 (if-not (nil? byte-buffer)
   (try
     (with-open [object-in (ObjectInputStream.
                             (ByteArrayInputStream. byte-buffer))]
       (.readObject object-in))
     (catch (Throwable t)
       (log-error t)
       (throw t

 or perhaps more specific handling of particular exceptions.)- Hide quoted 
 text -

 - Show quoted text -

-- 
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 with your 
first post.
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 first programming language?

2009-12-01 Thread Adrian Cuthbertson
Hi Towle,

Judging by the articulateness of your post, I would say that Clojure
would definitely be an ideal language for what you are looking for. It
is not handed to you on a plate and you will have to engage deeply
to achieve your goals, but if you do so, along with the increasingly
prolific documentation available, the archives of this forum and the
on-going posts here, you will be able to learn and apply just about
any technique that has ever been addressed regarding advanced
programming, best computer science practices and very practical
applications.

- Regards, Adrian.

On Tue, Dec 1, 2009 at 7:38 AM, Towle towle.m...@gmail.com wrote:
 Hi all,

 Thanks for taking the time to read my post. I'm interested to get some
 opinions from experienced Clojure programmers on whether the language
 would be a good first language to learn, or rather to learn in-depth.
 I have minimal experienced with more common languages like Java, HTML,
 and C++, but having the personality I do, felt compelled to shop
 around a bit before choosing a first language to learn seriously on a
 deep and intuitive level-- perhaps my odd notion of there being a
 connection between a programmer and the first language s/he
 understands on that high of a level. So after shopping around
 thoroughly and picking up bits about on theoretical computer science
 and the history of programming languages, I decided to pick up a Lisp;
 I'm intrigued by the greater concept/idea behind the Lisp family of
 languages.

 After a long while trying to figure out which of the Lisps would be a
 good first choice, I stumbled across Clojure and immediately thought
 it a brilliant idea, conceding of course that at my current level of
 knowledge, I likely have no idea what a brilliant idea in computer
 programming looks like. Regardless, it still feels brilliant.

 As I see it, among other features of the language, the idea of a Lisp
 designed to be a capable choice for real-world code applications,
 that is a Lisp which embodies the spirit of that family of languages
 yet one which resolves many of the practicality complaints which
 stand as hurdles on a Lisp's path to real-world use. For my situation,
 that of a student who wants both a) to learn a first language I can
 have a real, intellectual appreciation for and b) to begin the journey
 to expertise in a language it would be practical to code web
 applications in.

 So, Clojure programmers, am I wrong? Should I pass on Clojure in favor
 of another langauge? Or learn Common Lisp or Scheme first, then try my
 hand at Clojure? Am I mistaken for a different reason? Or perhaps
 there are some criteria I should consider before diving in?

 Thanks in advance, and again for taking the time to read.
 --Towle

 --
 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 with your 
 first post.
 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

-- 
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 with your 
first post.
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 first programming language?

2009-12-01 Thread Geoffrey Teale
Hi,

I don't post here much and so you may see that as a reason to discount 
what I say.  Infact that would probably be a good plan.   I generally 
talk a load of twaddle.  With those caveats firmly in mind here's my 
tuppence worth.

I'd hate to think your first language is defining as you suggest.  I, 
like most people of my age, wrote mostly BASIC and assembly code for the 
first five or six years of my programming experience.  In my case that 
was all for the Zilog Z80 and later the  Motorola 68000.   While I have 
fond memories of those times I generally wouldn't want to go back to 
those languages or tools, and most of my work exhibits a functional 
style that is far from idiomatic for the average BASIC or assembler 
programmer.I suspect that what Clojure programmers have in common is 
not their programming roots, but the openness of their minds and a 
desire to continuously learn and improve.   A large number of 
programmers learn one language and then try desperately to avoid 
learning anything else.   Another group are keen only to learn new 
skills they think are marketable (they tend to be the ones who are 
always begging to go on the latest training course in Microsoft this or 
Oracle that in my experience).   I would tell you to avoid being in 
those groups, but I think it's useless - you will develop in accordance 
to your character.  That you are here is probably a good sign though.

So.. back to your actual question.  Here's my thoughts.  Clojure is a 
relatively young language and there's still a lot about the landscape 
that is evolving.This in turn means that some things are hard to 
work out, and only documented in the most superficial way.   This is 
both a joy (after all you need a challenge!) and occasionally a pain in 
the bum.   In fact it is quite reminiscent of those days of assembly 
programming I had back in the 1980s.  Whether this is something you want 
in your life only you can tell, and perhaps the answer is too try.   
Prepare to be frustrated and prepare to get good at asking questions - 
two elements that are unavoidable in life, so why not practise!  If you 
think you have the interest and the will power to get through those 
things then Clojure would indeed be an excellent place to throw your hat 
into the ring.

Before you dive in there are some other aspects to consider.  Although 
there are new libraries being written all the time, it is not at all 
uncommon to drop directly into the world of Java libraries when doing 
productive work in Clojure.  This is a great strength of Clojure and 
also a weakness.  Dropping into Java space can make it harder to realise 
the benefits that Clojure offers.   There also a danger that, in order 
to get things done, what you'll end up learning is the java libraries, 
not the idiomatic Clojure way of doing things.   Furthermore Clojure 
inherits some of the complexities of Java.   The word CLASSPATH could 
easily haunt you for the rest of your life.   There are easier 
environments to work in!

So I guess the answer is this: if you're looking to get the most from 
Clojure as a language the first step might be to become proficient as a 
functional programmer - if you get there then the way Clojure does 
things will mostly just make sense.   In terms of the materials 
available to you a better language to learn functional programming in 
might be Haskell, or if it really must be a Lisp (which is certainly not 
a bad idea!) then I would look to Scheme.  Then, armed with that 
knowledge come back to Clojure.

Now, please forget everything I just told you and go out and make your 
own mistakes - it's the only way to learn!

-- 
Geoff Teale

On 12/01/2009 06:38 AM, Towle wrote:
 Hi all,

 Thanks for taking the time to read my post. I'm interested to get some
 opinions from experienced Clojure programmers on whether the language
 would be a good first language to learn, or rather to learn in-depth.
 I have minimal experienced with more common languages like Java, HTML,
 and C++, but having the personality I do, felt compelled to shop
 around a bit before choosing a first language to learn seriously on a
 deep and intuitive level-- perhaps my odd notion of there being a
 connection between a programmer and the first language s/he
 understands on that high of a level. So after shopping around
 thoroughly and picking up bits about on theoretical computer science
 and the history of programming languages, I decided to pick up a Lisp;
 I'm intrigued by the greater concept/idea behind the Lisp family of
 languages.

 After a long while trying to figure out which of the Lisps would be a
 good first choice, I stumbled across Clojure and immediately thought
 it a brilliant idea, conceding of course that at my current level of
 knowledge, I likely have no idea what a brilliant idea in computer
 programming looks like. Regardless, it still feels brilliant.

 As I see it, among other features of the language, the idea of a Lisp
 designed to 

Re: roll call of production use?

2009-12-01 Thread Jamie
On Nov 23, 5:00 pm, Raoul Duke rao...@gmail.com wrote:

 i'd be interested to hear who has successfully used clojure in
 production. i know of some, as some folks have been vocal; any other
 interesting-but-so-far-silent uses people'd be willing to fess up
 about?

Our real-world use reported here:

  
http://groups.google.com/group/clojure/browse_thread/thread/ffcd4bc722852b4/d07a1ca449e83a8b

Summary: Moderate-scale data processing.  Millions of records.
Timeseries and regressions.  Works great.  Based on this pilot, we're
expanding our use of Clojure.

It's surprising to me just how solid this innovative platform is.
Outstanding work.

Thanks again to Rich and the other contributors.

--Jamie

-- 
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 with your 
first post.
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: ANN: Clojuratica v2 -- Seamless Mathematica-within-Clojure!

2009-12-01 Thread Jamie
On Dec 1, 7:51 am, Mark Fayngersh phunny.pha...@gmail.com wrote:

 I dont suppose this is possible on *nix machines? If i recall correctly, the
 Mathematica Kernel is not available for *nix-based architectures.

The Mathematica kernel runs on Solaris, Linux, and Max OS X:

  http://www.wolfram.com/products/mathematica/platforms/

Player runs on Linux and Mac OS X but not Solaris:

  http://www.wolfram.com/solutions/interactivedeployment/compare.html

We use Mathematica primarily to generate production graphics.

--Jamie

-- 
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 with your 
first post.
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 first programming language?

2009-12-01 Thread Tayssir John Gabbour
Hi,

As an occasional Clojure user, and someone who's used Common Lisp a
lot, I'd venture that Clojure is a good first choice. But let me
metion areas of difficulty first. Geoffrey Teale discussed the big
things, so let me mention some little ones:

- Java's classpath currently demands that you respect its
inflexibility. If you have a problem with a library which seems to
work for everyone else, the classpath is a big thing to check.

(Clojure's add-classpath should increase its flexibility. But people
aren't supposed to depend on it; and I noticed it interacts weirdly
with Java's database manager, JDBC. Last week, JDBC promised it knew
of my MySQL lib which I loaded using add-classpath; but when it came
time to actually pull data, it complained that it didn't have the
library loaded.)

- Also, Java prioritizes security over usability. Which I also
recently ran into:
http://my.opera.com/karmazilla/blog/how-to-grab-the-certificate-from-
a-website-and-import-it-with-java-keytool

That said, I would've been best served by learning Clojure or Common
Lisp first. (Or flexible ancestors like Lisp Machine lisp. Not Scheme
though.) Due to whatever quirks in my personality. For me, Clojure can
be engrossing like a good video game; I'm not always happy (maybe I'm
coasting along and then the big boss kills me a few times, and I have
to figure out how to defeat or bypass it), but it's at least not
unnecessarily boring.

In addition to the all-important video game metric, you get to interop
with the normal world through Java/.net/etc, and I'm sure you'll meet
with the approval of at least some theoreticians. Clojure may also
help you evaluate other languages better.

There's some advantages Common Lisp holds over Clojure (and vice-
versa), but the ones most important to me are dwindling. For instance,
CL's multimethods have really nice features. I use them regularly for
web programming. However, Mikel Evins is releasing an interesting
Clojure library for this called Categories. (Not that I know much
about it.)
http://mikelevins.livejournal.com/


Hope this helps,
Tayssir


On Dec 1, 6:38 am, Towle towle.m...@gmail.com wrote:
 Hi all,

 Thanks for taking the time to read my post. I'm interested to get some
 opinions from experienced Clojure programmers on whether the language
 would be a good first language to learn, or rather to learn in-depth.
 I have minimal experienced with more common languages like Java, HTML,
 and C++, but having the personality I do, felt compelled to shop
 around a bit before choosing a first language to learn seriously on a
 deep and intuitive level-- perhaps my odd notion of there being a
 connection between a programmer and the first language s/he
 understands on that high of a level. So after shopping around
 thoroughly and picking up bits about on theoretical computer science
 and the history of programming languages, I decided to pick up a Lisp;
 I'm intrigued by the greater concept/idea behind the Lisp family of
 languages.

 After a long while trying to figure out which of the Lisps would be a
 good first choice, I stumbled across Clojure and immediately thought
 it a brilliant idea, conceding of course that at my current level of
 knowledge, I likely have no idea what a brilliant idea in computer
 programming looks like. Regardless, it still feels brilliant.

 As I see it, among other features of the language, the idea of a Lisp
 designed to be a capable choice for real-world code applications,
 that is a Lisp which embodies the spirit of that family of languages
 yet one which resolves many of the practicality complaints which
 stand as hurdles on a Lisp's path to real-world use. For my situation,
 that of a student who wants both a) to learn a first language I can
 have a real, intellectual appreciation for and b) to begin the journey
 to expertise in a language it would be practical to code web
 applications in.

 So, Clojure programmers, am I wrong? Should I pass on Clojure in favor
 of another langauge? Or learn Common Lisp or Scheme first, then try my
 hand at Clojure? Am I mistaken for a different reason? Or perhaps
 there are some criteria I should consider before diving in?

 Thanks in advance, and again for taking the time to read.
 --Towle

-- 
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 with your 
first post.
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: Continuation monad tutorial

2009-12-01 Thread jim
Thanks. I'll add that comment.

Konrad Hinsen wrote:
 On 30 Nov 2009, at 23:07, jim wrote:

  Just finished the tutorial explaining the continuation monad in
  clojure. Haven't even proofed it but I want to head to the gym. :)
 
  http://intensivesystems.net/tutorials/cont_m.html

 Great work!

 One comment I'd add is that in the last example:

   (def fn11 (m-chain [mf-a mark mf-b mf-c]))
   (def mark-cont ((fn11 10) identity))
   (doall (map mark-cont [0 1 2]))

 the argument to fn11, 10, has no influence on the result.

 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
Note that posts from new members are moderated - please be patient with your 
first post.
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 first programming language?

2009-12-01 Thread CuppoJava
There are more qualified people than me on these boards, but I can
offer my own personal experience, which is to say, as a first language
I would still recommend going the C/Java/Basic/Assembly route first
before going with a Lisp.

Because simply, I couldn't appreciate functional programming until I
did a fair bit of imperative programming first. And because imperative
programming is closer to the raw machine, I find that reasoning about
functional programming requires, in a lot of instances, to think about
the equivalent code in an imperative language.

For example, why is Laziness a good idea? What are the inherent
limitations of Class-based object-oriented programming? Why is single
inheritance limiting? How can multiple-inheritance come back to haunt
you? What is hanging onto your head? Why does this really elegant
functional code run so slowly? Why is eval a bad idea?

So I think avoiding an imperative language means that there's too much
fundamental understanding about the machine that you would skip over.
Not to mention, that most libraries will be using an imperative
language, so you'll be having to learn it eventually in order to read
the libraries even if you don't plan on writing any imperative code
yourself.

These points are especially important with Clojure, which is designed
to interoperate closely with its underlying Java. Many people on these
forums have already expressed the opinion that it's too impossible to
understand Clojure completely without knowing Java.

Just my 2 cents
  -Patrick

PS: If you decide to go ahead anyway and learn Clojure, and find it an
easy and enjoyable trip. I would be glad to hear about your
experiences. I am preparing to teach an introduction course in
programming and I'm still debating what language to use as an intro.

-- 
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 with your 
first post.
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 first programming language?

2009-12-01 Thread Base
My 2 cents (probably only worth 1 cent...) as someone who is learning
Clojure right now is that it is a great language, but there are a lot
of great languages and all have their strengths and weaknesses.  Given
your curiosity and apparent thirst for knowledge, you wont learn just
one language and that is the way to go, IMO.  Programming languages
are, to me, tools to accomplish goals, and what is right in one
situation is not necessarily the best in another.

I started programming using SAS (statistical software), which is
likely not the avenue of most of these people.  I moved into web
stuff, then Java,etc.  What is great about Lisp(s) is that it is
different conceptually from many of the other languages out there
(i.e.- Java), in how you think, but still flexible enough to encompass
many problems.  That is the coolest part of it to me.

So in that regards I totally agree with Lisp as a choice.  The
difficulty with Clojure is (as others have mentioned) that the
interoperability with Java (which is so great) also means that you
have to learn Java as well - and really do so simultaniously.  That
will be a challenge, but you will be better for it, for sure.

I rhighly recommend you check out SICP (free HTML book herehttp://
mitpress.mit.edu/sicp/full-text/book/book.html and videos here
http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/)
and prepare to have your mind blown. They use Scheme in this class
(though I hear they have just switched to Python for this calss
now...!) which is just another Lisp with slightly different syntax.
It was a good place for me to start.

Good luck!

On Nov 30, 11:38 pm, Towle towle.m...@gmail.com wrote:
 Hi all,

 Thanks for taking the time to read my post. I'm interested to get some
 opinions from experienced Clojure programmers on whether the language
 would be a good first language to learn, or rather to learn in-depth.
 I have minimal experienced with more common languages like Java, HTML,
 and C++, but having the personality I do, felt compelled to shop
 around a bit before choosing a first language to learn seriously on a
 deep and intuitive level-- perhaps my odd notion of there being a
 connection between a programmer and the first language s/he
 understands on that high of a level. So after shopping around
 thoroughly and picking up bits about on theoretical computer science
 and the history of programming languages, I decided to pick up a Lisp;
 I'm intrigued by the greater concept/idea behind the Lisp family of
 languages.

 After a long while trying to figure out which of the Lisps would be a
 good first choice, I stumbled across Clojure and immediately thought
 it a brilliant idea, conceding of course that at my current level of
 knowledge, I likely have no idea what a brilliant idea in computer
 programming looks like. Regardless, it still feels brilliant.

 As I see it, among other features of the language, the idea of a Lisp
 designed to be a capable choice for real-world code applications,
 that is a Lisp which embodies the spirit of that family of languages
 yet one which resolves many of the practicality complaints which
 stand as hurdles on a Lisp's path to real-world use. For my situation,
 that of a student who wants both a) to learn a first language I can
 have a real, intellectual appreciation for and b) to begin the journey
 to expertise in a language it would be practical to code web
 applications in.

 So, Clojure programmers, am I wrong? Should I pass on Clojure in favor
 of another langauge? Or learn Common Lisp or Scheme first, then try my
 hand at Clojure? Am I mistaken for a different reason? Or perhaps
 there are some criteria I should consider before diving in?

 Thanks in advance, and again for taking the time to read.
 --Towle

-- 
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 with your 
first post.
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 first programming language?

2009-12-01 Thread Constantine Vetoshev
On Dec 1, 12:38 am, Towle towle.m...@gmail.com wrote:
 So after shopping around
 thoroughly and picking up bits about on theoretical computer science
 and the history of programming languages, I decided to pick up a Lisp;
 I'm intrigued by the greater concept/idea behind the Lisp family of
 languages.

In your research, did you find Abelson and Sussman's book, Structure
and Interpretation of Computer Programs? The full text is freely
available at http://mitpress.mit.edu/sicp/, and video lectures from
the class are at 
http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/.
I have never seen a better introduction to programming and computing
than SICP. It uses Scheme, but you do not need to study the language
separately; you'll learn it naturally as you go through the book. Be
sure to do the exercises. :)

You can certainly go through SICP using Clojure, but you'll have to
deal with semantic differences between Scheme and Clojure (especially
in laziness and sequence behavior), so I don't recommend it. After you
have gone through the book, you'll pick up Clojure in no time at all,
and will probably find it an enjoyable language for real-world
programming.

-- 
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 with your 
first post.
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


clojars and licences

2009-12-01 Thread bOR_
How in clojars do I attach a licence to the jar? I'm about to
redistribute a BSD-licensed jarfile to clojars, but I'm not sure how I
can make sure that the licence also gets redistributed. Are these
things embedded in jar files by default?

(the jar in question is automaton-1.11.jar)

-- 
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 with your 
first post.
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: ANN: Clojuratica v2 -- Seamless Mathematica-within-Clojure!

2009-12-01 Thread Mark Fayngersh
oh, great!

On Tue, Dec 1, 2009 at 9:11 AM, Jamie jsmo...@gmail.com wrote:

 On Dec 1, 7:51 am, Mark Fayngersh phunny.pha...@gmail.com wrote:

  I dont suppose this is possible on *nix machines? If i recall correctly,
 the
  Mathematica Kernel is not available for *nix-based architectures.

 The Mathematica kernel runs on Solaris, Linux, and Max OS X:

  http://www.wolfram.com/products/mathematica/platforms/

 Player runs on Linux and Mac OS X but not Solaris:

  http://www.wolfram.com/solutions/interactivedeployment/compare.html

 We use Mathematica primarily to generate production graphics.

 --Jamie

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




-- 
~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
Note that posts from new members are moderated - please be patient with your 
first post.
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 first programming language?

2009-12-01 Thread Geoffrey Teale
Just want to second everyone pointing to SICP.  A better in-depth 
introduction to programming has yet to grace my desk.There are also 
video lectures available on line:

http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/

If this material had been so readily available in the late 80s I would 
have saved myself a long, long path to enlightenment :-D

-- 
Geoff

-- 
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 with your 
first post.
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: roll call of production use?

2009-12-01 Thread Luc Préfontaine



 On Nov 23, 5:00 pm, Raoul Duke rao...@gmail.com wrote:
 
  i'd be interested to hear who has successfully used clojure in
  production. i know of some, as some folks have been vocal; any other
  interesting-but-so-far-silent uses people'd be willing to fess up
  about?
 
 Our real-world use reported here:
 
   
 http://groups.google.com/group/clojure/browse_thread/thread/ffcd4bc722852b4/d07a1ca449e83a8b
 
 Summary: Moderate-scale data processing.  Millions of records.
 Timeseries and regressions.  Works great.  Based on this pilot, we're
 expanding our use of Clojure.
 
 It's surprising to me just how solid this innovative platform is.
 Outstanding work.
 
 Thanks again to Rich and the other contributors.
 
 --Jamie
 

-- 
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 with your 
first post.
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: Leiningen Run ?

2009-12-01 Thread David Nolen
On Tue, Dec 1, 2009 at 12:16 AM, Alex Osborne a...@meshy.org wrote:

 Hi David,

 David Nolen wrote:
  So my Java ignorance once again rears it's ugly head. It turns out
  that JNI dynamic libs can't really be part of a .jar.

 I can't say I know much about JNI but I've used some libraries like
 SQLiteJDBC and Qt Jambi which bundle the native libraries in the jar, so
 the consumer of the library can use them just as if they were normal
 java libraries, which is very convenient.  Looking at the source code to
 SQLiteJDBC it looks like what they do is check the platform with
 (System/getPropertly os.name) and then copy the appropriate lib files
 (extracted from the jar with getResourceAsStream) to /tmp (just using
 java.io.File/createTempFile) and then call System/load on them.


From what I understand you have 2 two options with JNI libraries:

1. The method you mentioned above.
2. Unpack the JNIs from the .jar and place in a directory that is on
java.library.path or java.ext.dirs.

While it's nice that (1) keeps everything in the .jar I'm not sure if this
will be more complicated to support (I want to use JOGL and SQLiteJDBC)? I
suppose the project would need to specify each JNI that needs loading?


 I'm a little unclear about what are you proposing lein run would
 actually do for JNI stuff.  Something like this?

 java -cp 'src:classes:lib/*' -Djava.library.path=native-lib/ \
  clojure.main -i src/gears.clj -e (gears/-main)


Yes.


 What would it set java.library.path to?  Or are suggesting that would be
 configurable in the project.clj?


Only necessary with (2). Probably useful to set from project.clj as well.



 Cheers,

 Alex

 --
 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 with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=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
Note that posts from new members are moderated - please be patient with your 
first post.
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: Leiningen Run ?

2009-12-01 Thread David Nolen
On Tue, Dec 1, 2009 at 1:10 AM, Phil Hagelberg p...@hagelb.org wrote:

 David Nolen dnolen.li...@gmail.com writes:

  The problem is that JOGL needs JNIs and JNIs need to be on
  java.library.path or java.ext.dirs, not the classpath. In order to
  make life easier for people learning about clojure as well generally
  making lein projects simpler to play around for newbies do people see
  any utility in supporting something like lein run?

 It sounds like you're talking about two orthogonal things: setting java
 options for JNI and a run task. We have talked about adding a run task;
 if you're interested we could even get it in for the 1.0.0 release. If
 the java.library.path flag can be set in a subclassloader like we do
 with the classpath in the deps task in the isolated-compile branch that
 Alex just cooked up, then this could be added soon as well. But it would
 be helpful to discuss these as two separate steps.


Yes.



 Also from talking on IRC it sounded like there might also be a third
 unpacking step involved; could you explain that in more detail here? It
 sounds like the SqliteJDBC libraries do that for you, but perhaps that
 is not always the case with native libraries?


SQLiteJDBC decides to take the runtime solution via System.load. Benefit is
that everything stays in the jar.

The other tack is to support specifying platform specific library jars and
unpacking them into whatever folder is specified by project.clj
library.path.

David



 -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
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=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
Note that posts from new members are moderated - please be patient with your 
first post.
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 first programming language?

2009-12-01 Thread Chouser
On Tue, Dec 1, 2009 at 10:29 AM, CuppoJava patrickli_2...@hotmail.com wrote:
 There are more qualified people than me on these boards, but I can
 offer my own personal experience, which is to say, as a first language
 I would still recommend going the C/Java/Basic/Assembly route first
 before going with a Lisp.

I think understanding how computers work (Von Neumann machines,
I suppose) is indeed important.  If you're serious about being
a good programmer, you need to understand pointers, memory
allocation, virtual memory, IO scheduling, etc.  You at least
need to be aware of all the fiddly bits that modern programming
environments try to abstract away, so that when they fail to
behave well, or just plain fail, you have a fighting chance of
understanding what's going on.

But do you need to learn all that *first*?  I don't think so.
I didn't -- I learned BASIC and didn't know anything about
pointers.  Then I learned Pascal and pointers, and didn't know
anything about malloc or process scheduling.  Then I learned
C and some operating system internals.

So I think there's no harm in learning a nice clean high-level
language first, as long as you eventually learn some C and OS
stuff.  Maybe you'll find you like C and get into hardware driver
development.  Or more likely you'll be happy to tuck away the
C knowledge and do mid- or high-level work in a language that
allows you to (most of the time) ignore such details.  Clojure is
designed to be a good place to end up in this more likely case,
and I think is largely succeeding.

I think the biggest down side to learning Clojure as a first
language, as others have mentioned, is its relationship to the
JVM.  Although this is a strength when it comes to actually using
Clojure to get real things done, especially while Clojure is
still so young, I fear it's a weakness for a first language.
Currently doing almost anything interesting requires not only
knowledge of Clojurey things (immutable collections, functional
style, lazy seqs, etc.) but also Javay things (static methods,
method inheritence, classpaths, javadocs).  This is one reason
why I recommend http://projecteuler.net -- it allows you to
accomplish *something* with nearly pure Clojure, even though you
don't get to do anything graphical or webby.  So I *hope* that's
good enough for Clojure to be a good first language -- after all,
why not start off where you should end up? -- but I worry that
it's not.

If you're tenacious and hungry for knowledge, I'd say go for it.

--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
Note that posts from new members are moderated - please be patient with your 
first post.
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: roll call of production use?

2009-12-01 Thread Luc Préfontaine

 On Nov 23, 5:00 pm, Raoul Duke rao...@gmail.com wrote:
 
  i'd be interested to hear who has successfully used clojure in
  production. i know of some, as some folks have been vocal; any other
  interesting-but-so-far-silent uses people'd be willing to fess up
  about?

http://www.infoq.com/news/2009/01/clojure_production

The bus has been up for months now and down times have been related
to either some hardware changes (system is fully redundant so most
of the time no downtime occurred)
and network stability issues over which we have little control (managed
by the customer's IT group).

We are adding more functions tapping on the information flowing on the
bus, of course these are now written in Clojure...

Census tracking, decentralized service request management, ...

This year the bus will also extend to interconnect other hospital
services. The bus is also a way to convince users to move to a paperless
environment and focus on data entry completeness to achieve that goal.

We have also in the works a Clojure/Terracotta/Java messaging layer to
improve parallelism. This should be rolled out in summer time.

Transitioning to Clojure V1.0 was not a problem and we do not expect 
that moving 1.1 will prove difficult.

The bus is still running on a cluster of small foot print computers but
we moved to Atom 330 motherboards to boost processing power.

This thing will celebrate it's first year in production very soon
without significant pain and this a proof to me that Clojure is mature.


Luc


-- 
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 with your 
first post.
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 first programming language?

2009-12-01 Thread Tayssir John Gabbour
Interestingly, there's this book which is a crash course on building a
computer stack from the ground up: from logic gates, to a compiler, to
an OS. And the simulator, in which you build all these things, is in
Java.

Nisan/Schocken's _The Elements of Computing Systems_: http://
www1.idc.ac.il/tecs/

Luke Gorrie mentioned porting the circuits he wrote (not, and, or,
xor, mux, dmux, half-adder, full-adder, adder) to Clojure.
http://lukego.livejournal.com/17711.html

So... there may be a strange loop here where a good path to learning
these low-level things is a counter-intuitive one.

I agree that Java-y things (static methods, method inheritence,
classpaths, javadocs) are an issue; maybe there should be a little
tutorial for people that surveys What's a .jar file? and public
static void... whuh?


All the best,
Tayssir


And their simulator -- which you build and simulate your computer on
-- is a Java program.

On Dec 1, 5:19 pm, Chouser chou...@gmail.com wrote:
 On Tue, Dec 1, 2009 at 10:29 AM, CuppoJava patrickli_2...@hotmail.com wrote:
  There are more qualified people than me on these boards, but I can
  offer my own personal experience, which is to say, as a first language
  I would still recommend going the C/Java/Basic/Assembly route first
  before going with a Lisp.

 I think understanding how computers work (Von Neumann machines,
 I suppose) is indeed important.  If you're serious about being
 a good programmer, you need to understand pointers, memory
 allocation, virtual memory, IO scheduling, etc.  You at least
 need to be aware of all the fiddly bits that modern programming
 environments try to abstract away, so that when they fail to
 behave well, or just plain fail, you have a fighting chance of
 understanding what's going on.

 But do you need to learn all that *first*?  I don't think so.
 I didn't -- I learned BASIC and didn't know anything about
 pointers.  Then I learned Pascal and pointers, and didn't know
 anything about malloc or process scheduling.  Then I learned
 C and some operating system internals.

 So I think there's no harm in learning a nice clean high-level
 language first, as long as you eventually learn some C and OS
 stuff.  Maybe you'll find you like C and get into hardware driver
 development.  Or more likely you'll be happy to tuck away the
 C knowledge and do mid- or high-level work in a language that
 allows you to (most of the time) ignore such details.  Clojure is
 designed to be a good place to end up in this more likely case,
 and I think is largely succeeding.

 I think the biggest down side to learning Clojure as a first
 language, as others have mentioned, is its relationship to the
 JVM.  Although this is a strength when it comes to actually using
 Clojure to get real things done, especially while Clojure is
 still so young, I fear it's a weakness for a first language.
 Currently doing almost anything interesting requires not only
 knowledge of Clojurey things (immutable collections, functional
 style, lazy seqs, etc.) but also Javay things (static methods,
 method inheritence, classpaths, javadocs).  This is one reason
 why I recommendhttp://projecteuler.net-- it allows you to
 accomplish *something* with nearly pure Clojure, even though you
 don't get to do anything graphical or webby.  So I *hope* that's
 good enough for Clojure to be a good first language -- after all,
 why not start off where you should end up? -- but I worry that
 it's not.

 If you're tenacious and hungry for knowledge, I'd say go for it.

 --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
Note that posts from new members are moderated - please be patient with your 
first post.
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 first programming language?

2009-12-01 Thread Tayssir John Gabbour
Interestingly, there's this book which is a crash course on building a
computer stack from the ground up: from logic gates, to a compiler, to
an OS. And the simulator, in which you build all these things, is in
Java.

Nisan/Schocken's _The Elements of Computing Systems_: http://
www1.idc.ac.il/tecs/

Luke Gorrie mentioned porting the circuits he wrote (not, and, or,
xor, mux, dmux, half-adder, full-adder, adder) to Clojure.
http://lukego.livejournal.com/17711.html

So... there may be a strange loop here where a good path to learning
these low-level things is a counter-intuitive one.

I agree that Java-y things (static methods, method inheritence,
classpaths, javadocs) are an issue; maybe there should be a little
tutorial for people that surveys What's a .jar file? and public
static void... whuh?


All the best,
Tayssir


On Dec 1, 5:19 pm, Chouser chou...@gmail.com wrote:
 On Tue, Dec 1, 2009 at 10:29 AM, CuppoJava patrickli_2...@hotmail.com wrote:
  There are more qualified people than me on these boards, but I can
  offer my own personal experience, which is to say, as a first language
  I would still recommend going the C/Java/Basic/Assembly route first
  before going with a Lisp.

 I think understanding how computers work (Von Neumann machines,
 I suppose) is indeed important.  If you're serious about being
 a good programmer, you need to understand pointers, memory
 allocation, virtual memory, IO scheduling, etc.  You at least
 need to be aware of all the fiddly bits that modern programming
 environments try to abstract away, so that when they fail to
 behave well, or just plain fail, you have a fighting chance of
 understanding what's going on.

 But do you need to learn all that *first*?  I don't think so.
 I didn't -- I learned BASIC and didn't know anything about
 pointers.  Then I learned Pascal and pointers, and didn't know
 anything about malloc or process scheduling.  Then I learned
 C and some operating system internals.

 So I think there's no harm in learning a nice clean high-level
 language first, as long as you eventually learn some C and OS
 stuff.  Maybe you'll find you like C and get into hardware driver
 development.  Or more likely you'll be happy to tuck away the
 C knowledge and do mid- or high-level work in a language that
 allows you to (most of the time) ignore such details.  Clojure is
 designed to be a good place to end up in this more likely case,
 and I think is largely succeeding.

 I think the biggest down side to learning Clojure as a first
 language, as others have mentioned, is its relationship to the
 JVM.  Although this is a strength when it comes to actually using
 Clojure to get real things done, especially while Clojure is
 still so young, I fear it's a weakness for a first language.
 Currently doing almost anything interesting requires not only
 knowledge of Clojurey things (immutable collections, functional
 style, lazy seqs, etc.) but also Javay things (static methods,
 method inheritence, classpaths, javadocs).  This is one reason
 why I recommendhttp://projecteuler.net-- it allows you to
 accomplish *something* with nearly pure Clojure, even though you
 don't get to do anything graphical or webby.  So I *hope* that's
 good enough for Clojure to be a good first language -- after all,
 why not start off where you should end up? -- but I worry that
 it's not.

 If you're tenacious and hungry for knowledge, I'd say go for it.

 --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
Note that posts from new members are moderated - please be patient with your 
first post.
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: roll call of production use?

2009-12-01 Thread Daniel Werner
On Dec 1, 5:20 pm, Luc Préfontaine lprefonta...@softaddicts.ca
wrote:
 http://www.infoq.com/news/2009/01/clojure_production

Slightly off-topic:

What prompted you to choose ActiveMQ over other popular message bus
systems like RabbitMQ? Was it the ease of operability with Clojure/
Java, or are there other strong factors?

-- 
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 with your 
first post.
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: roll call of production use?

2009-12-01 Thread Luc Préfontaine
We picked one that met our minimal requirements... our prototype was in
Java however and that probably biased
the choice a bit.

But for us it's an intermediate step. We need a more flexible solution.
We will keep ActiveMQ in the picture to link different clusters (or an
alternative) but for intra cluster processing
we want something more in line with the contraints we need to meet
especially regarding event serialization.

We think that custom fit message serialization is not easily managed
using a message bus generic layer.
We need a more specific solution and some management hooks to deal with
this in day to day operations.

Luc


On Tue, 2009-12-01 at 10:02 -0800, Daniel Werner wrote:

 On Dec 1, 5:20 pm, Luc Préfontaine lprefonta...@softaddicts.ca
 wrote:
  http://www.infoq.com/news/2009/01/clojure_production
 
 Slightly off-topic:
 
 What prompted you to choose ActiveMQ over other popular message bus
 systems like RabbitMQ? Was it the ease of operability with Clojure/
 Java, or are there other strong factors?
 

-- 
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 with your 
first post.
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: Web application framework (beta)

2009-12-01 Thread rzeze...@gmail.com
I'm not privy to all the technical details, but perhaps work done on
Swarm could be insightful?

http://code.google.com/p/swarm-dpl/

-- 
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 with your 
first post.
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: Datatypes and protocols - update

2009-12-01 Thread Krukow


On Dec 1, 2:42 am, Rich Hickey richhic...@gmail.com wrote:
 I have done a lot of work on performance, and refined the design. The
 big news is that you can now directly implement a protocol inside a
 deftype, and you can also reify protocols. This cements protocols as
 the superior way to model the things for which they are suitable,
 since they can match the performance of interfaces without their
 limitations.

First of all, I think this is a wonderful addition to the language.
I've tried what is in the new branch on a small but real example,
and I am quite happy with it: So thanks!

Could you go into more detail about how protocols and datatypes are
actually implemented, and the performance improvements you've recently
made? (probably I'm not the only one interested :-)

What is generated when I define a protocol, datatype and extend the
type to the protocol?

As I understand the performance of calling a protocol function matches
the performance of calling an interface method in Java. How is it
possible to achieve this in combination with the dynamic extensibility
of extend?

/Karl

-- 
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 with your 
first post.
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: Leiningen Run ?

2009-12-01 Thread Zach Tellman
On Dec 1, 8:15 am, David Nolen dnolen.li...@gmail.com wrote:
 On Tue, Dec 1, 2009 at 1:10 AM, Phil Hagelberg p...@hagelb.org wrote:
  David Nolen dnolen.li...@gmail.com writes:

   The problem is that JOGL needs JNIs and JNIs need to be on
   java.library.path or java.ext.dirs, not the classpath. In order to
   make life easier for people learning about clojure as well generally
   making lein projects simpler to play around for newbies do people see
   any utility in supporting something like lein run?

  It sounds like you're talking about two orthogonal things: setting java
  options for JNI and a run task. We have talked about adding a run task;
  if you're interested we could even get it in for the 1.0.0 release. If
  the java.library.path flag can be set in a subclassloader like we do
  with the classpath in the deps task in the isolated-compile branch that
  Alex just cooked up, then this could be added soon as well. But it would
  be helpful to discuss these as two separate steps.

 Yes.



  Also from talking on IRC it sounded like there might also be a third
  unpacking step involved; could you explain that in more detail here? It
  sounds like the SqliteJDBC libraries do that for you, but perhaps that
  is not always the case with native libraries?

 SQLiteJDBC decides to take the runtime solution via System.load. Benefit is
 that everything stays in the jar.

 The other tack is to support specifying platform specific library jars and
 unpacking them into whatever folder is specified by project.clj
 library.path.

 David



  -Phil


I've looked into this a bit, because right now setting up Penumbra
(http://github.com/ztellman/penumbra) is way too complex. As far as I
can see, there are two different situations to think about:

1) A standalone executable which relies on Penumbra.  This situation
is actually pretty well supported by JOGL's use of JNLP, which will
download the appropriate binaries at startup (and cache them for later
usage). This has the benefit of being more lightweight (the jar
doesn't have to contain all the binaries for all the target
platforms), so maybe there's an argument for Leiningen generating
the .jnlp file.

2) A library which relies on Penumbra, or any development work towards
a standalone executable.  If there were some generic code provided by
Leiningen which did the runtime extraction of the binaries, I don't
really see any issue with doing it that way.  The lein run approach
described above would also work, with the caveat that lein swank
would also need to have similar functionality.

With all that said, I'm certainly not an expert on the subject.  If
any of the above seems suspect, please feel free to correct me.

Zach

-- 
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 with your 
first post.
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: Non-blocking I/O

2009-12-01 Thread Ivan Sagalaev
John Harrop wrote:
 The java.nio.channels package. :) 

In other words there's no special patterns for non-bocking I/O in 
Clojure and it's done with callbacks as usually, right?

-- 
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 with your 
first post.
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: Getting Started in Mac OS X Snow Leopard

2009-12-01 Thread Charras
Steve, I already try to follow does instructions. I copied the text
into the *scratch* buffer, and did control j (C-j), but nothing
happen, it just move the cursos to the next line. Do you know how can
I make Aquamacs eval the *scratch* buffer? 'Cause I think that's my
problem.

Guido

On Dec 1, 7:19 am, Steve Purcell st...@sanityinc.com wrote:
 Theinstallationpage for ELPA tells you how to install ELPA itself and to show 
 a list of installable packages:http://tromey.com/elpa/install.html

 That should work fine in Aquamacs.

 When you've got as far as the package list, press 'i' next to the clojure 
 entry, then x. These steps should get you a working clojure-mode.

 As far as hooking clojure-mode up to a working clojureinstallationgoes, I'd 
 suggest skipping your MacPortsinstallationand running M-x clojure-install.

 -Steve

 On 1 Dec 2009, at 06:32, Charras wrote:

  Hello;

  I already install Clojure using MacPorts, and I can use it with clj.
  But the environment is not what I will like. I'm trying to set up
  clojure, so I can use it in Aquamacs. I already download the clojure-
  mode.el, in there says that I can install it using ELPA, but I don't
  know how to install ELPA in aquamacs.

  Please, if someone can help me to setup clojure, in myMac, and be
  able to use it, with Aquamacs, I'll appreciated very much.

  Regards!

  Guido

  --
  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 with 
  your first post.
  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

-- 
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 with your 
first post.
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


Updating Agent

2009-12-01 Thread Don
I am having trouble resetting an agent.

I created a vector agent as such:

(def ce2 (agent []))

I add to this vector by:

(send ce2 conj 2)
(await ce2)

But I am having trouble thinking of a way to reset this agent.  I
don't believe there is a reset function for agents.

Thank You

-- 
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 with your 
first post.
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: Updating Agent

2009-12-01 Thread Don
I actually came up with this function that takes in an agent and
proceeds to pop each item while agent still has items.
It's rugged, so maybe someone else will have a better solution.


(defn ca [c]
  (let [cnt (count @c)]
(loop [i cnt]
  (if (not (= i 0))
(do
  (send c pop)
  (await c)
  (recur (dec i)))



On Dec 1, 2:27 pm, Don josereyno...@gmail.com wrote:
 I am having trouble resetting an agent.

 I created a vector agent as such:

 (def ce2 (agent []))

 I add to this vector by:

 (send ce2 conj 2)
 (await ce2)

 But I am having trouble thinking of a way to reset this agent.  I
 don't believe there is a reset function for agents.

 Thank You

-- 
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 with your 
first post.
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: clojars and licences

2009-12-01 Thread Alex Osborne
bOR_ boris.sch...@gmail.com writes:

 How in clojars do I attach a licence to the jar? I'm about to
 redistribute a BSD-licensed jarfile to clojars, but I'm not sure how I
 can make sure that the licence also gets redistributed. Are these
 things embedded in jar files by default?

I think it's quite common to put them in the jar.  So the clause from
the license is:

2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.

I'd say that putting it in the jar would satisfy other materials
provided with the distribution.  Note you can also specify a license
section in the POM (though that wouldn't satisfy the license):

  licenses
license
  nameThe Apache Software License, Version 2.0/name
  urlhttp://www.apache.org/licenses/LICENSE-2.0.txt/url
  distributionrepo/distribution
/license
  /licenses

At some point in the future I intend to have Clojars read that also
check for COPYING and LICENSE files in the uploaded jar and display
the license on the Clojars per-jar page.

-- 
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 with your 
first post.
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: clojars and licences

2009-12-01 Thread Alex Osborne
bOR_ boris.sch...@gmail.com writes:

 How in clojars do I attach a licence to the jar? I'm about to
 redistribute a BSD-licensed jarfile to clojars, but I'm not sure how I
 can make sure that the licence also gets redistributed. Are these
 things embedded in jar files by default?

 (the jar in question is automaton-1.11.jar)

Oh sorry, I didn't answer your question.  It doesn't look like the
license is bundled into the automaton jar, so you just add it before you
upload it:

jar -uvf dist/automaton.jar COPYING

-- 
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 with your 
first post.
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: Updating Agent

2009-12-01 Thread Kevin Downey
uh, and you just want the agent to reference an empty vector?
(send a (comp second list) [])
(send a (constantly []))
(send a empty)
...

On Tue, Dec 1, 2009 at 2:37 PM, Don josereyno...@gmail.com wrote:
 I actually came up with this function that takes in an agent and
 proceeds to pop each item while agent still has items.
 It's rugged, so maybe someone else will have a better solution.


 (defn ca [c]
  (let [cnt (count @c)]
    (loop [i cnt]
      (if (not (= i 0))
        (do
          (send c pop)
          (await c)
          (recur (dec i)))



 On Dec 1, 2:27 pm, Don josereyno...@gmail.com wrote:
 I am having trouble resetting an agent.

 I created a vector agent as such:

 (def ce2 (agent []))

 I add to this vector by:

 (send ce2 conj 2)
 (await ce2)

 But I am having trouble thinking of a way to reset this agent.  I
 don't believe there is a reset function for agents.

 Thank You

 --
 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 with your 
 first post.
 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



-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

-- 
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 with your 
first post.
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: Updating Agent

2009-12-01 Thread Don
Yes.  I actually use it reference a vector, then after certain
computation I need to reset it, or reference an empty vector.
Awesome.  Much more efficient solution.  Thank you.


On Dec 1, 2:45 pm, Kevin Downey redc...@gmail.com wrote:
 uh, and you just want the agent to reference an empty vector?
 (send a (comp second list) [])
 (send a (constantly []))
 (send a empty)
 ...





 On Tue, Dec 1, 2009 at 2:37 PM, Don josereyno...@gmail.com wrote:
  I actually came up with this function that takes in an agent and
  proceeds to pop each item while agent still has items.
  It's rugged, so maybe someone else will have a better solution.

  (defn ca [c]
   (let [cnt (count @c)]
     (loop [i cnt]
       (if (not (= i 0))
         (do
           (send c pop)
           (await c)
           (recur (dec i)))

  On Dec 1, 2:27 pm, Don josereyno...@gmail.com wrote:
  I am having trouble resetting an agent.

  I created a vector agent as such:

  (def ce2 (agent []))

  I add to this vector by:

  (send ce2 conj 2)
  (await ce2)

  But I am having trouble thinking of a way to reset this agent.  I
  don't believe there is a reset function for agents.

  Thank You

  --
  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 with 
  your first post.
  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

 --
 And what is good, Phaedrus,
 And what is not good—
 Need we ask anyone to tell us these things?

-- 
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 with your 
first post.
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: Leiningen Run ?

2009-12-01 Thread David Nolen
So just to keep the conversation going:

http://download.java.net/maven/2/net/java/dev/gluegen/
http://download.java.net/maven/2/net/java/dev/jogl/

I note that these two maven repos specify the platform with the following:

lib-{platform}-{arch}

where platform is:
macosx
linux
windows

arch is:
universal
i586

followed by the architecture. I'm assuming lein should resolve this
auto-magically based on the platform Java is running on? I don't mind
contributing some code to make this work if there's feedback on how it
should work what it should look like.

David

-- 
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 with your 
first post.
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: how goes ClojureCheck?

2009-12-01 Thread Raoul Duke
ah. i guess i'm supposed to use clojure.test and clojure.test.tap, i see.

On Tue, Dec 1, 2009 at 5:05 PM, Raoul Duke rao...@gmail.com wrote:
 how far along is the implementation of QuickCheck-esque features?

 (from http://bitbucket.org/kotarak/clojurecheck/ it looks to me like
 it hasn't had things done to it in almost a year, which could be
 either a good or bad sign :-)

 thanks.


-- 
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 with your 
first post.
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: Getting Started in Mac OS X Snow Leopard

2009-12-01 Thread David Nolen
http://tromey.com/elpa/install.html

Just follow the instructions here.

They are pretty clear.

David

On Tue, Dec 1, 2009 at 5:30 PM, Charras guido.carba...@gmail.com wrote:

 David;

 My problem is that I haven't been able to install the clojure-mode.
 What I read is that this is done using ELPA, but that means that I
 need to install ELPA as well, and this make things even worse, now I
 have two things that I can't install.

 Do you have a different way to do this? If so, please send a dummies
 type instruction list.

 Guido

 On Dec 1, 4:03 pm, David Nolen dnolen.li...@gmail.com wrote:
  On Tue, Dec 1, 2009 at 3:59 PM, Charras guido.carba...@gmail.com
 wrote:
   Steve, I already try to follow does instructions. I copied the text
   into the *scratch* buffer, and did control j (C-j), but nothing
   happen, it just move the cursos to the next line. Do you know how can
   I make Aquamacs eval the *scratch* buffer? 'Cause I think that's my
   problem.
   Guido
 
  You can eval the scratch buffer but you'll only be eval'ing elisp.
 
  Make a new buffer called foo.clj. Clojure mode should be loaded here, if
  not, clojure-mode is not properly intalled. M-x slime to start a repl.
 Now
  if you are at the end of a sexpr C-x C-e should send it to the REPL.
 
  Hope that works for you.
 
  David
 
 
 
   On Dec 1, 7:19 am, Steve Purcell st...@sanityinc.com wrote:
Theinstallationpage for ELPA tells you how to install ELPA itself and
 to
   show a list of installable packages:
 http://tromey.com/elpa/install.html
 
That should work fine in Aquamacs.
 
When you've got as far as the package list, press 'i' next to the
 clojure
   entry, then x. These steps should get you a working clojure-mode.
 
As far as hooking clojure-mode up to a working
 clojureinstallationgoes,
   I'd suggest skipping your MacPortsinstallationand running M-x
   clojure-install.
 
-Steve
 
On 1 Dec 2009, at 06:32, Charras wrote:
 
 Hello;
 
 I already install Clojure using MacPorts, and I can use it with
 clj.
 But the environment is not what I will like. I'm trying to set up
 clojure, so I can use it in Aquamacs. I already download the
 clojure-
 mode.el, in there says that I can install it using ELPA, but I
 don't
 know how to install ELPA in aquamacs.
 
 Please, if someone can help me to setup clojure, in myMac, and be
 able to use it, with Aquamacs, I'll appreciated very much.
 
 Regards!
 
 Guido
 
 --
 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
 with
   your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 clojure%2bunsubscr...@googlegroups.comclojure%252bunsubscr...@googlegroups.com
 
 For more options, visit this group at
http://groups.google.com/group/clojure?hl=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
   Note that posts from new members are moderated - please be patient with
   your first post.
   To unsubscribe from this group, send email to
   clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 clojure%2bunsubscr...@googlegroups.comclojure%252bunsubscr...@googlegroups.com
 
   For more options, visit this group at
  http://groups.google.com/group/clojure?hl=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
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=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
Note that posts from new members are moderated - please be patient with your 
first post.
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

Remove Value From Vector at Given Index

2009-12-01 Thread Don
I have a vector [2 4 5 8 6 4]

And I want to remove a value based on index.  Specifically, I want to
remove every third item.

So my new vector would be [2 4 8 6]

Thank you.

-- 
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 with your 
first post.
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: Remove Value From Vector at Given Index

2009-12-01 Thread Wilson MacGyver
you can do it using partition and flatten from clojure.contrib.seq-utils

(use 'clojure.contrib.seq-utils)
(flatten (partition 2 3 [2 4 5 8 6 4]))

this yields (2 4 8 6)

On Tue, Dec 1, 2009 at 10:06 PM, Don josereyno...@gmail.com wrote:
 I have a vector [2 4 5 8 6 4]

 And I want to remove a value based on index.  Specifically, I want to
 remove every third item.

 So my new vector would be [2 4 8 6]

 Thank you.

 --
 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 with your 
 first post.
 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



-- 
Omnem crede diem tibi diluxisse supremum.

-- 
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 with your 
first post.
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: Remove Value From Vector at Given Index

2009-12-01 Thread Don
Thank you Wilson.

On Dec 1, 7:31 pm, Wilson MacGyver wmacgy...@gmail.com wrote:
 you can do it using partition and flatten from clojure.contrib.seq-utils

 (use 'clojure.contrib.seq-utils)
 (flatten (partition 2 3 [2 4 5 8 6 4]))

 this yields (2 4 8 6)





 On Tue, Dec 1, 2009 at 10:06 PM, Don josereyno...@gmail.com wrote:
  I have a vector [2 4 5 8 6 4]

  And I want to remove a value based on index.  Specifically, I want to
  remove every third item.

  So my new vector would be [2 4 8 6]

  Thank you.

  --
  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 with 
  your first post.
  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

 --
 Omnem crede diem tibi diluxisse supremum.

-- 
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 with your 
first post.
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


HOWTO: Compojure Development without Web Server Restarts using VimClojure

2009-12-01 Thread Gilbert
I figured this out recently; hopefully this is helpful to others.

1. Install VimClojure http://kotka.de/projects/clojure/vimclojure.html

- vimclojure offers a number of features, but the documentation is
hidden in a text file inside ~/.vim/doc/clojure.txt (you can also read
it here:  http://bitbucket.org/kotarak/vimclojure/src/tip/doc/clojure.txt)

- you need to put your source files in the classpath when running the
nailgun server; if you use lein, you can install lein-nailgun as a dev-
dependency and call lein nailgun to run the nailgun server

2. Fire up vim; open up the files you want to edit.
3. Type \sr to open a REPL.
4. Call (run-server  ) in the REPL to start your server.
5. Edit some of the source files on which your server runs. When
you're done, type \ef, which evaluates the entire file in the REPL.
6. Refresh your browser. Voila!

P.S It's possible to do something similar in swank, but I've never
used it before so I wouldn't know.

-- 
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 with your 
first post.
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 first programming language?

2009-12-01 Thread John Harrop
On Tue, Dec 1, 2009 at 8:30 PM, Alex Osborne a...@meshy.org wrote:

 Clojure would be challenging language to start with, as (all?) the books
 and documentation are aimed at people who are already programmers.  But
 if you like a challenge then perhaps that's even a good thing.  If
 you're already a techie type person and are happy to fiddle around in
 configuration files and the command-line I don't think it should be that
 much of an obstacle.


Actually, you can download Netbeans and install it with a few mouse clicks,
and Enclojure with a few more, and then have a working REPL to try short
code snippets at with a few more. No mess, no fuss, no manual configuration
file hacking, no command line (excluding the REPL prompt of course).

-- 
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 with your 
first post.
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: Space leak with lazy sequences.

2009-12-01 Thread rzeze...@gmail.com
I'm having similar problems, but am hesitant to post until I do some
further analysis.

However, I thought I'd share some techniques I'm trying to use to hunt
down my memory leak.

First, you can make GC verbose.

-verbose:gc

For even more detail, add the following.

-XX:+PrintGCTimeStamps -XX:+PrintGCDetails.

Second, do a heap dump.  If you are using Java 6 then you can use the
jmap tool.

jmap -dump:live,format=b,file=foo.hprof PID

Once you have the heap dump you can use the Eclipse Memory Analyzer
Tool.  It can take your heap dump and create various reports.  One of
them being a dominator tree which will show you what object has the
largest retained heap size.  I'm still a complete novice with it, but
it already helped me track down some memory leaks at work.

Check out this article, goes over what I just said and much more.

http://olex.openlogic.com/wazi/2009/how-to-fix-memory-leaks-in-java/ .

-- 
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 with your 
first post.
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: Datatypes and protocols - update

2009-12-01 Thread Krukow


On Dec 1, 10:56 pm, Rich Hickey richhic...@gmail.com wrote:
[snip]
 There are 2 ways to make a deftype reach a protocol. First, you can
 implement the protocol directly in the deftype/reify, supplying the
 protocol where you do interfaces, and the methods of the protocol as
 methods of the type. The type will be made to implement the protocol's
 interface.

OK. With extend you can use maps and merge to share implementations.
Does directly implementing the protocol in deftype allow also for
abstract super-classes, i.e., sharing protocol-function
implementations across types?

[snip]

 Different methods of implementing the protocol have different
 performance. Implementing directly in deftype or reify is as fast as a
 direct interface call. Using extend-* is not quite as fast, but still
 fast. Both methods have direct support in callsites, so a call to a
 protocol fn has support both for using the interface and caching
 lookup results.

Great. So the preferred way for data-types in my program is to
implement the protocol directly, whereas for other types I can still
use my protocol with extend.

Just to confirm my understanding: Is it correct to say, for example,
that clojure.lang.Seqable will be a protocol implemented directly in
the Clojure data types, whereas it would reach the Java lang types
using extend?

In Clojure-in-Java interfaces like IPersistentCollection extend
Seqable:  would these be unrelated type-wise as protocols?

 The most important thing is, writing to protocols gives you a dynamic,
 open, extensible system not tied to derivation, and is fast, so a
 great way to architect the polymorphic part of your designs (when
 single-dispatch is appropriate).

 Rich

I think these constructs will have great impact on how we will
structure our Clojure programs.

/Karl

-- 
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 with your 
first post.
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: Getting Started in Mac OS X Snow Leopard

2009-12-01 Thread Jason
in Aquamacs try coping the code on the ELPA install page and then
eval'ing with C-x-e

(hold down control key, then type x key and then e key)

On Dec 1, 2:30 pm, Charras guido.carba...@gmail.com wrote:
 David;

 My problem is that I haven't been able to install the clojure-mode.
 What I read is that this is done using ELPA, but that means that I
 need to install ELPA as well, and this make things even worse, now I
 have two things that I can't install.

 Do you have a different way to do this? If so, please send a dummies
 type instruction list.

 Guido

 On Dec 1, 4:03 pm, David Nolen dnolen.li...@gmail.com wrote:



  On Tue, Dec 1, 2009 at 3:59 PM, Charras guido.carba...@gmail.com wrote:
   Steve, I already try to follow does instructions. I copied the text
   into the *scratch* buffer, and did control j (C-j), but nothing
   happen, it just move the cursos to the next line. Do you know how can
   I make Aquamacs eval the *scratch* buffer? 'Cause I think that's my
   problem.
   Guido

  You can eval the scratch buffer but you'll only be eval'ing elisp.

  Make a new buffer called foo.clj. Clojure mode should be loaded here, if
  not, clojure-mode is not properly intalled. M-x slime to start a repl. Now
  if you are at the end of a sexpr C-x C-e should send it to the REPL.

  Hope that works for you.

  David

   On Dec 1, 7:19 am, Steve Purcell st...@sanityinc.com wrote:
Theinstallationpage for ELPA tells you how to install ELPA itself and to
   show a list of installable packages:http://tromey.com/elpa/install.html

That should work fine in Aquamacs.

When you've got as far as the package list, press 'i' next to the 
clojure
   entry, then x. These steps should get you a working clojure-mode.

As far as hooking clojure-mode up to a working clojureinstallationgoes,
   I'd suggest skipping your MacPortsinstallationand running M-x
   clojure-install.

-Steve

On 1 Dec 2009, at 06:32, Charras wrote:

 Hello;

 I already install Clojure using MacPorts, and I can use it with clj.
 But the environment is not what I will like. I'm trying to set up
 clojure, so I can use it in Aquamacs. I already download the clojure-
 mode.el, in there says that I can install it using ELPA, but I don't
 know how to install ELPA in aquamacs.

 Please, if someone can help me to setup clojure, in myMac, and be
 able to use it, with Aquamacs, I'll appreciated very much.

 Regards!

 Guido

 --
 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 
 with
   your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
  
 For more options, visit this group at
http://groups.google.com/group/clojure?hl=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
   Note that posts from new members are moderated - please be patient with
   your first post.
   To unsubscribe from this group, send email to
   clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com

   For more options, visit this group at
  http://groups.google.com/group/clojure?hl=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
Note that posts from new members are moderated - please be patient with your 
first post.
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


ClojureCLR questions

2009-12-01 Thread Mike K
Hi Clojurites!

I'm reading about Clojure and ClojureCLR with great interest.  Since
I'm a .net developer with little Java / JVM experience, I'm
particularly interested in ClojureCLR.  It seems like David M. and
crew are doing a fantastic job with the CLR implementation!  A few
quick questions:

1.  Re. CLR Interop -- one thing I didn't see mentioned on the wiki
is .net attributes (metadata).  Will annotating methods, properties,
etc with attributes be supported?

2.  What are the performance goals for ClojureCLR?  I saw a video
overview of Clojure by Rich in which he stated (perhaps with certain
caveats that I don't recall) that essentially Clojure ran at speeds
comparable to Java.  Is having ClojureCLR run at speeds comparable to
C# a realistic goal?  What's the current performance story?

3.  I get the basic concept that native Clojure data structures are
immutable and persistent.  This is obviously an impedance mismatch
when dealing with JVM or .net objects and APIs that are built around
mutable state.   Where can I more info regarding best practices in
getting these two different animals to work well together within an
app?

   Thanks,
   Mike

-- 
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 with your 
first post.
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: Getting Started in Mac OS X Snow Leopard

2009-12-01 Thread Giancarlo Angulo
I also had trouble installing elpa

I went the more roundabout route.


What I did was download clojuremode.el
here:
http://github.com/technomancy/clojure-mode

I got this code snippet

(add-to-list 'load-path ~/clojure/clojure-mode)
 (setq inferior-lisp-program clj)
 (require 'clojure-mode)
 (setq auto-mode-alist
 (cons '(\\.clj$ . clojure-mode)
 auto-mode-alist))

 (add-hook 'clojure-mode-hook
 '(lambda ()
 (define-key clojure-mode-map \C-c\C-e 'lisp-eval-last-sexp)))


from here:
http://paulbarry.com/articles/2008/07/02/getting-started-with-clojure-and-aquamacs

put it in your *customizations.el* file
found in

 ~/Library/Preferences/Aquamacs Emacs/

put

then I believed I restarted aquamacs, out of habit, don't think I needed to.

then,
M-x clojure-install (I don't remember but I think if you haven't installed
git you have to..)

follow the prompts

I'm not sure how properly I did things but whatever works.

Hope this helps.


=
angol
=
-|-^...@^_^, =|+^_^X++~_~,@-
The only thing worse than a hopeless romantic is a hopeful one
Magbasa bago Mamuna. Mag-isip bago mambatikos
Without Truth there is no Justice, Without Justice, there is Tyranny
Semper fi
Proof of Desire is Pursuit
www.onthe8spot.com
http://www.facebook.com/giancarlo.angulo
http://twitter.com/Neoryder
09173822367


On Tue, Dec 1, 2009 at 2:32 PM, Charras guido.carba...@gmail.com wrote:

 Hello;

 I already install Clojure using MacPorts, and I can use it with clj.
 But the environment is not what I will like. I'm trying to set up
 clojure, so I can use it in Aquamacs. I already download the clojure-
 mode.el, in there says that I can install it using ELPA, but I don't
 know how to install ELPA in aquamacs.

 Please, if someone can help me to setup clojure, in my Mac, and be
 able to use it, with Aquamacs, I'll appreciated very much.

 Regards!

 Guido

 --
 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 with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=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
Note that posts from new members are moderated - please be patient with your 
first post.
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