Re: usage examples in clojure api docs

2010-06-29 Thread Tom Faulhaber
I like the idea of having example code for all the functions.

However, speaking for myself only, I don't think that the doc strings
are the place for a comprehensive set of examples.

How about building them in some external place? (Maybe as a separate
github project to begin with.) In particular, it would be nice if the
examples used some literate programming technique that let users open
the examples and play with them. That way, they could be linked to
from the documentation (I could roll it into autodoc, for instance,
subject to Rich and Stuart's constraints) but also directly opened,
tried, copied, etc. from your editor and repl.

It's easy for me to imagine that, in the not too distant future, we
could roll that into Clojure core in a way similar to the tests.

Tom

On Jun 28, 9:06 pm, cageface  wrote:
> Several people have suggested that usage examples in the docs would be
> helpful and this is something I often find myself wishing for. Are
> patches introducing examples welcomed by the core team?

-- 
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: Protocols

2010-06-29 Thread Mark Engelberg
On Sun, Jun 27, 2010 at 7:18 AM, Rich Hickey  wrote:
> There are no extension points built on protocols in Clojure yet. Delivering
> protocols is step one, re-architecting the core abstractions in terms of
> protocols is still to come.
>
> Rich

So how hard it would it be right now, for example, to implement in
Clojure a deftype that responds to all the functions a sorted map
responds to?

I started looking through the source code to try to figure out what
interfaces I'd need to override, but it seemed like an overwhelming
mixture of Clojure and Java interfaces, and very difficult to get
right without the ability to use the existing abstract base classes
that are in place (AFn, ASeq, APersistentMap, etc.).  For example, it
seems like to implement IFn, you'd need to manually write out cases
for the first twenty arities.

Would you recommend waiting until the core abstractions are
re-architected before tackling something like this, or is there an
easy way to do this I'm not seeing?

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: Protocols

2010-06-29 Thread Kevin Downey
manually? did we lose macros?

On Tue, Jun 29, 2010 at 12:54 AM, Mark Engelberg
 wrote:
> On Sun, Jun 27, 2010 at 7:18 AM, Rich Hickey  wrote:
>> There are no extension points built on protocols in Clojure yet. Delivering
>> protocols is step one, re-architecting the core abstractions in terms of
>> protocols is still to come.
>>
>> Rich
>
> So how hard it would it be right now, for example, to implement in
> Clojure a deftype that responds to all the functions a sorted map
> responds to?
>
> I started looking through the source code to try to figure out what
> interfaces I'd need to override, but it seemed like an overwhelming
> mixture of Clojure and Java interfaces, and very difficult to get
> right without the ability to use the existing abstract base classes
> that are in place (AFn, ASeq, APersistentMap, etc.).  For example, it
> seems like to implement IFn, you'd need to manually write out cases
> for the first twenty arities.
>
> Would you recommend waiting until the core abstractions are
> re-architected before tackling something like this, or is there an
> easy way to do this I'm not seeing?
>
> 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



-- 
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: bioinformatics toolkit in clojure: what would that look like?

2010-06-29 Thread Edmund Jackson
Hi Jan,

Perhaps R's excellent bioconductor project could be mapped nicely into 
Incanter (Clojure's R) ? 

Edmund

On 27 Jun 2010, at 23:15, jandot wrote:

> Hi all,
> 
> I have been a ruby user for several years and have contributed to the
> bioruby toolkit for bioinformatics. Lately however I got interested in
> clojure as it's a functional language and should be very good for
> working with the huge datasets we have to handle.
> 
> Although there are bioinformatics toolkits for many OO languages
> (biojava, bioperl, biopython and bioruby), nothing similar exists for
> clojure yet. And I'd be interested to start building such toolkit
> while I learn the language. At first for my own use, but maybe
> later... who knows.
> 
> Being new to functional languages, I wonder how such a toolkit would
> be best approached. In an OO language you create classes with
> properties and methods that describe one particular entitiy in the
> field. For example: you define a DNASequence class with a "name" and
> "sequence" property, and a method to print it out in an international
> standard text format, and another method for translating the DNA
> sequence in that of the resulting protein. Much of the functionality
> of these toolkits is about retrieving a bit of information,
> manipulating it and ultimately writing it to screen/file.
> 
> As functional languages are more about verbs than nouns: how could a
> bioinformatics toolkit be idiomatically set up? Would it still be the
> Right Way (TM) to create some type of classes, a-la OO?
> 
> For more information on the OO toolkits, see www.bioperl.org, www.biojava.org,
> bioruby.org and biopython.org.
> 
> As clojure (especially combined with incanter) seems to be a very good
> candidate for future work in bioinformatics, I would very much welcome
> a little discussion on this.
> 
> Many thanks,
> jan.
> 
> -- 
> 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

  Edmund





-- 
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 distribution (like what ubuntu is for linux)

2010-06-29 Thread Jeff Rose
Just a quick note.  You should also be aware of this project that came
out recently:

http://github.com/liebke/clj

I haven't tried either yet so I can't really comment, but I like the
idea of creating and integrated package manager and repl utility.  Clj
also seems nice in the way it integrates with clojars.org.

-Jeff

On Jun 28, 10:09 pm, Brent Millare  wrote:
> Hello all,
>
> I finally published my experiment to githubhttp://github.com/bmillare/dj
>
> The idea was to create the concept of a distribution for clojure which
> can maintain itself as well as all the projects created by the
> developer. It uses public maven repositories as resources but uses no
> maven code. This has pros and cons, it was relatively simple to
> implement the basics and I don't have to deal with complicated
> configurations to get maven work the way I wanted to. The downside was
> there is a lot of maven-plugins that provide functionality that I have
> to duplicate. Perhaps I can make a hybrid system in the future.
> Eventually the goal is to be building-tool agnostic, and provide glue
> to all the different tools, after all, native dependencies don't
> really fit the maven model that well.
>
> I'm still experimenting how to approach using git repositories as
> dependencies and versioning them properly.
>
> One nice feature I implemented is the ability to add to the classpath
> at runtime.
>
> The README should help explain the motivation and concepts behind the
> project, and the TUTORIAL should help get someone started in using it.
> For the truly curious, diving into the code is the only way.
>
> There very well should be bugs as well as missing functionality. It at
> least works well enough for my simple projects.
>
> I appreciate any feedback.
>
> Best,
> Brent Millare
>
> P.S.
> I'll update the tutorial in a bit but...
>
> using inferior-lisp with dj is easy,
>
> just add to the .emacs,
> (setq inferior-lisp-program "~/bin/dj repl")

-- 
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: bioinformatics toolkit in clojure: what would that look like?

2010-06-29 Thread Jeff Rose
Hi Jan,
  After coming from Ruby and previous OO languages I think many of us
have the same questions.  For starters, I'd recommend reading a couple
other libraries to get a sense for how people organize libraries.
That will probably give you the most concrete sense for how to really
get started.  Beyond that, I think it is best to just start out light
weight and see how far you can go.  Represent anything you currently
think of as an object, a.k.a. a bag of properties, as a regular
clojure map.  Don't use records or protocols or structs or metadata or
anything fancy, just regular old maps.  For modeling sequential data,
like DNA base pairs, use vectors.  Then create a series of functions
to read these things in, write them out, and perform some different
transformations.  Don't worry so much about where or how in memory you
are going to "store" stuff.  Just write a library of functions that
can read, write and manipulate your objects of interest.  That's
pretty much a functional library, and you'll surprise yourself how
much can be done in this way.

I'm also interested in learning more about bio-informatics so I'd be
willing to help out.  What is your first target application of the
library?  What specific kind of research do you want to support?

-Jeff

On Jun 28, 12:15 am, jandot  wrote:
> Hi all,
>
> I have been a ruby user for several years and have contributed to the
> bioruby toolkit for bioinformatics. Lately however I got interested in
> clojure as it's a functional language and should be very good for
> working with the huge datasets we have to handle.
>
> Although there are bioinformatics toolkits for many OO languages
> (biojava, bioperl, biopython and bioruby), nothing similar exists for
> clojure yet. And I'd be interested to start building such toolkit
> while I learn the language. At first for my own use, but maybe
> later... who knows.
>
> Being new to functional languages, I wonder how such a toolkit would
> be best approached. In an OO language you create classes with
> properties and methods that describe one particular entitiy in the
> field. For example: you define a DNASequence class with a "name" and
> "sequence" property, and a method to print it out in an international
> standard text format, and another method for translating the DNA
> sequence in that of the resulting protein. Much of the functionality
> of these toolkits is about retrieving a bit of information,
> manipulating it and ultimately writing it to screen/file.
>
> As functional languages are more about verbs than nouns: how could a
> bioinformatics toolkit be idiomatically set up? Would it still be the
> Right Way (TM) to create some type of classes, a-la OO?
>
> For more information on the OO toolkits, seewww.bioperl.org,www.biojava.org,
> bioruby.org and biopython.org.
>
> As clojure (especially combined with incanter) seems to be a very good
> candidate for future work in bioinformatics, I would very much welcome
> a little discussion on this.
>
> Many thanks,
> jan.

-- 
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: bioinformatics toolkit in clojure: what would that look like?

2010-06-29 Thread npt11tpn
Hi,
There has been some interest towards Clojure from the cheminformatics
community as well (e.g. http://blog.rguha.net/?tag=clojure ) in
relation to the Chemistry Development Toolkit (CDK, 
http://sourceforge.net/projects/cdk)
and the approach seems to be to use the CDK java classes directly in
clojure or write simple wrapper functions around them and build
further abstractions on top. A similar approach here would be to build
bioclojure on top of biojava.
Best
Nik

On Jun 27, 11:15 pm, jandot  wrote:
> Hi all,
>
> I have been a ruby user for several years and have contributed to the
> bioruby toolkit for bioinformatics. Lately however I got interested in
> clojure as it's a functional language and should be very good for
> working with the huge datasets we have to handle.
>
> Although there are bioinformatics toolkits for many OO languages
> (biojava, bioperl, biopython and bioruby), nothing similar exists for
> clojure yet. And I'd be interested to start building such toolkit
> while I learn the language. At first for my own use, but maybe
> later... who knows.
>
> Being new to functional languages, I wonder how such a toolkit would
> be best approached. In an OO language you create classes with
> properties and methods that describe one particular entitiy in the
> field. For example: you define a DNASequence class with a "name" and
> "sequence" property, and a method to print it out in an international
> standard text format, and another method for translating the DNA
> sequence in that of the resulting protein. Much of the functionality
> of these toolkits is about retrieving a bit of information,
> manipulating it and ultimately writing it to screen/file.
>
> As functional languages are more about verbs than nouns: how could a
> bioinformatics toolkit be idiomatically set up? Would it still be the
> Right Way (TM) to create some type of classes, a-la OO?
>
> For more information on the OO toolkits, seewww.bioperl.org,www.biojava.org,
> bioruby.org and biopython.org.
>
> As clojure (especially combined with incanter) seems to be a very good
> candidate for future work in bioinformatics, I would very much welcome
> a little discussion on this.
>
> Many thanks,
> jan.

-- 
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: bioinformatics toolkit in clojure: what would that look like?

2010-06-29 Thread Nicolas Oury
On Tue, Jun 29, 2010 at 10:50 AM, Jeff Rose  wrote:

> Don't use records or protocols or structs or metadata or
> anything fancy, just regular old maps.  For modeling sequential data,
> like DNA base pairs, use vectors.  Then create a series of functions
> to read these things in, write them out, and perform some different
> transformations.  Don't worry so much about where or how in memory you
> are going to "store" stuff.  Just write a library of functions that
> can read, write and manipulate your objects of interest.  That's
> pretty much a functional library, and you'll surprise yourself how
> much can be done in this way.
>


+1 if you make the function not just for vector but for any seqs. That way
of we need special BioSeqs someday...

-- 
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: usage examples in clojure api docs

2010-06-29 Thread Heinz N. Gies
There is Walton that covers that. Talk to defn in #clojure if you want to know 
detail

Regards,
Heinz

Sent from my iPad

On Jun 29, 2010, at 6:06 AM, cageface  wrote:

> Several people have suggested that usage examples in the docs would be
> helpful and this is something I often find myself wishing for. Are
> patches introducing examples welcomed by the core team?
> 
> -- 
> 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: Newb Question

2010-06-29 Thread Jose Luis Romero
Oh well.. Thanks for the tips!!!

On Mon, Jun 28, 2010 at 1:37 PM, Mike Meyer  wrote:

> On Sun, 27 Jun 2010 11:22:15 -0700 (PDT)
> José Luis Romero  wrote:
>
> > Hi! I am learning the core of clojure, and so far, I am loving it. But
> > I am not a lisp programmer (python, java, among others), but never
> > functional programming. I am practicing with codingbat.com, coding the
> > exercises on clojure. I am stuck with loops. I want to concatenate n
> > times a string. For example, given the parameters 3 and "code" the
> > output will be "codecodecode". How can I do a loop in order to get
> > this output.
> >
> > I know that this is a very newb question, any help will be
> > appreciated.
>
> You really shouldn't be doing loops in clojure. There's almost always
> a non-looping construct that solves the same problem. I.e., your
> string repeat would be:
>
> (apply str (repeat 3 "code"))
>
> Other than that, there are two "common" looping constructs:
> dotimes and recur. You can find out about them by asking at the repl:
>
> user> (doc dotimes).
>
> Except loop points you to the web, so here's a summary:
>
> recur terminates a loop that was started by either a "loop" or
> "defn". recur has the form (recur new-values). An initial loop
> statement has the form (loop [var value ...] body). Defn you should
> know :-). The recur statement goes back to loop replacing the value of
> each var (either in the loop or function arguments) with the new
> values in the recur statement.
>
> You could write your string-repeater as:
>
> (defn string-dup [count string-in]
>   (loop [count count resuls string-in]
>  (if (== count 0)
>  result
>  (recur (dec count) (str result string-in)
>
> But again, the better way would be
>
> (defn string-dup [count string]
>   (apply str (repeat count string)))
>
>--
> Mike Meyer 
> http://www.mired.org/consulting.html
> Independent Network/Unix/Perforce consultant, email for more information.
>
> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
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: bioinformatics toolkit in clojure: what would that look like?

2010-06-29 Thread jandot
Bonjour Nicolas,

I've started using clojure for my bioinformatics work, but it is still
*very* early days. Will try to become more proficient in it, but
slowly building up a toolkit for myself might just be the seed for
bioclojure. Have no idea to what extent clojure is used at the moment
in the field.

Will have a look at protocols and defrecord. Will keep you informed if/
when I think I can take it further.

jan.

On Jun 28, 7:22 pm, Nicolas Oury  wrote:
> Hi,
>
> I am using Clojure for bioinformatics, but not the same kind of stuff.
> I am writing a stochastic simulator.
>
> Would love to discuss more about your idea though.
>
> You can have something quite close to what you describe as the OO approach
> with
> protocols and data-types.
> + by using defrecord, you can easily have generic functions.
>
> That would the easier approach, I think.
>
> I will have a look to bio*.
>
> But if you want to start a project, count me in.
>
>
>
> On Sun, Jun 27, 2010 at 11:15 PM, jandot  wrote:
> > Hi all,
>
> > I have been a ruby user for several years and have contributed to the
> > bioruby toolkit for bioinformatics. Lately however I got interested in
> > clojure as it's a functional language and should be very good for
> > working with the huge datasets we have to handle.
>
> > Although there are bioinformatics toolkits for many OO languages
> > (biojava, bioperl, biopython and bioruby), nothing similar exists for
> > clojure yet. And I'd be interested to start building such toolkit
> > while I learn the language. At first for my own use, but maybe
> > later... who knows.
>
> > Being new to functional languages, I wonder how such a toolkit would
> > be best approached. In an OO language you create classes with
> > properties and methods that describe one particular entitiy in the
> > field. For example: you define a DNASequence class with a "name" and
> > "sequence" property, and a method to print it out in an international
> > standard text format, and another method for translating the DNA
> > sequence in that of the resulting protein. Much of the functionality
> > of these toolkits is about retrieving a bit of information,
> > manipulating it and ultimately writing it to screen/file.
>
> > As functional languages are more about verbs than nouns: how could a
> > bioinformatics toolkit be idiomatically set up? Would it still be the
> > Right Way (TM) to create some type of classes, a-la OO?
>
> > For more information on the OO toolkits, seewww.bioperl.org,
> >www.biojava.org,
> > bioruby.org and biopython.org.
>
> > As clojure (especially combined with incanter) seems to be a very good
> > candidate for future work in bioinformatics, I would very much welcome
> > a little discussion on this.
>
> > Many thanks,
> > jan.
>
> > --
> > 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: New Primitive data types (equal branch) - impact on optimized code.

2010-06-29 Thread j-g-faustus
Well, it gives a baseline to compare 1.2 improvements against. In
terms of speed, convenience or readability.

On Jun 28, 8:02 pm, Aaron Cohen  wrote:
> Doing these tests on clojure 1.1, while self-enlightening, is kind of
> missing the point.

-- 
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's n00b attraction problem

2010-06-29 Thread Avram
Full disclosure, I never liked ruby or python, I'm more of a perl/c++/
R guy.

I'm new to clojure as well, and love it. I don't mind learning LISP at
all.  I find it refreshing.   It takes the bureaucracy out of Java.
When I can, I explore ways in which incanter, cascalog, hadoop,
mahout, weka, and compojure might play nice together.  If they can, I
will be pretty ecstatic.

I'm not a CLASSPATH expert by any means, but I think Leiningen should
be the tool to deal with all that.  I really like the idea of the
project.clj file.  I just add a few lines to that and lein does the
rest.  I think letting Leiningen solve installation problems is a good
way to go.  Even for newbies.

Go Leiningen!!


~Avram

On Jun 28, 12:58 pm, cageface  wrote:
> On Jun 28, 12:25 pm, Daniel Gagnon  wrote:
>
> > I believe that the success of ruby is due in great part to *Why's Poignant
> > Guide to Ruby* and *Learn You a Haskell* is doing the same for Haskell. It's
> > fun to read, it holds your hand in setting up everything you have to and it
> > makes you want to learn more.
>
> I'm not so sure. Certainly things like the poignant guide made getting
> started with Ruby easier, but I'd argue that the success of Ruby has a
> lot more to do with how simple the core language it is and how easy it
> makes it to get simple things done. Conversely, despite increasingly
> beginner-friendly docs and one-shot installers I don't get the
> impression there's a bit upsurge of interest in Haskell outside of
> circles of elites or language afficionados. Haskell just isn't the
> kind of language that lets you slap a couple of web forms on a
> database 30 minutes after getting started. It's a power language for
> power users, like Clojure. I've been following FP for about ten years
> now and in that time I've seen Ruby and Python grow like gangbusters
> while languages like Haskell make very small, incremental inroads into
> niche areas. I don't expect this to change.
>
> Again though, I'm all for making the beginner's experience no harder
> than it absolutely has to be. No point having people turned away by
> things extrinsic to the language.
>
> I often find myself frustrated browsing through the docs that there
> aren't concrete examples for most of the functions in the API. I
> always have to google their usage or find an example in the clojure
> code. I'd be happy to help flesh out the docs with some usage examples
> if this kind of help is wanted.

-- 
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's n00b attraction problem

2010-06-29 Thread Greg
> A certain proportion of new clojure users are coming from
> non-Java/non-JVM backgrounds. To them, "how do I make an executable"
> is a perfectly valid question. And "clojure doesn't do executables"
> isn't a particularly encouraging answer (not even if you blame Java
> for it :-)) Classpaths, server vs client JVMs, ant/maven, all of these
> are confusing hurdles to get over if you don't have any Java
> experience.

Thanks Paul, you get it. :-)

To Mike: I of course know what a jar file is, but your nitpicking at my choice 
of words of "executable" is unhelpful, abrasive, and totally counterproductive.

A jar file with a main class is the pretty much an executable for all intents 
and purposes. The question "how do I make an executable from my source code in 
Clojure?" is, as Paul points out, a perfectly valid question that newbs to 
Clojure *will ask*, and they need a good answer. Not "there's not such thing as 
an executable you n00b! Bah humbug!"

BTW, I really like Paul's Q&A's, how would one go about getting something like 
that on either clojure.org or the Assembla wiki?

- Greg

On Jun 28, 2010, at 4:02 PM, Paul Moore wrote:

> On 28 June 2010 19:49, Mike Meyer
>  wrote:
>>> Yet another set of choices n00bs are faced with is figuring out how
>>> to actually compile their source into an executable.
>> 
>> Executable? We're talking about Java here. It doesn't do executables -
>> it does jar files. There's little reason to build those as a newb, as
>> it's not noticeably harder to run the source than it is to run a jar
>> file - or to import them if you're building libraries.
> 
> We're not talking about Java here, we're talking about clojure!
> 
> A certain proportion of new clojure users are coming from
> non-Java/non-JVM backgrounds. To them, "how do I make an executable"
> is a perfectly valid question. And "clojure doesn't do executables"
> isn't a particularly encouraging answer (not even if you blame Java
> for it :-)) Classpaths, server vs client JVMs, ant/maven, all of these
> are confusing hurdles to get over if you don't have any Java
> experience.
> 
> For such people, introductory clojure material needs to (a) assume no
> JVM/Java knowledge, and (b) provide some guidance for how to interpret
> the inevitable Java terminology that a newcomer will encounter. For
> example:
> 
> Q: How do I make an executable in clojure?
> A: Clojure scripts can be executed in a similar manner to scripting
> languages like Python or Perl - clj myscript.clj. [Note: a standard
> clj wrapper script should be supplied with clojure!] However, even
> when executed like this, clojure code is compiled (for more details
> read up on JVM bytecode, and the Java "just in time" compilers). You
> can compile clojure code into a "jar" file - which is a JVM executable
> format which can be run using the "java" command (insert reference to
> more detailed explanation here). More or less self-contained formats
> (bundling dependencies, or hiding the invocation of the "java"
> command) are possible, but are generally reserved for more specialised
> applications.
> 
> Q: What are ant, maven?
> A: JVM build systems, commonly used in the Java world. The clojure
> community is beginning to standardise on Leiningen (insert reference
> here) which uses a more clojure-like language for describing builds,
> but which works with the existing ant/maven infrastructure (so all of
> the existing libraries available via these tools are available for
> free in Leiningen).
> 
> If these examples are useful, feel free to add them to a FAQ or newbie
> documentation.
> 
> Paul.

-- 
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: the joys of lisp

2010-06-29 Thread Steve Molitor
> The Python approach leads to more readable
>code: http://www.mired.org/home/mwm/papers/readability.html

The two cases he sites do not apply to Clojure:

The first case is a function that is allowed to change the value of a
variable passed into it.  Variables are immutable in Clojure so you can't
write the dangerous 'inc' function he describes.  You can't change the value
of a variable passed to a function in Python either, but you can pass a
mutable object to a function and have the function modify the object, which
is close to the same thing.  Clojure is much more readable than Python in
this regard.

The second case is a function that is allowed to change the order of
evaluation of its arguments, decide how many times to evaluate its
arguments, and even whether or not to evaluate an argument at all.  True, in
a language that allows side effects this can be confusing.  But this doesn't
apply to Clojure.  (Clojure does allow side effects through STM of course,
but this is very explicit and controlled - more readable.)

I agree that macros can in some cases lead to less readable code.  On the
other hand, mutability hurts readability too.

Steve


On Mon, Jun 28, 2010 at 2:04 PM, Mike Meyer <
mwm-keyword-googlegroups.620...@mired.org> wrote:

> On Mon, 28 Jun 2010 11:21:24 -0700 (PDT)
> cageface  wrote:
>
> > On Jun 28, 11:09 am, Daniel Gagnon  wrote:
> > > That feature would *not* be a simple macro. It isn't simply a call to
> .close
> > > on whatever object, it's an arbitrary cleanup procedure on any object
> that
> > > implements the feature. The whole standard library implements it and
> objects
> > > know how to clean after themselves. So do most third objects like
> database
> > > connexions and what not.
> >
> > So in order to make this work in Python the *entire* standard library
> > had to be modified to support it? That's worse than I thought.
>
> No, only those that wanted to take advantage of it.
>
> > It's an interesting point though. In a certain sense, a macro is
> > establishing an interface across a set of objects. In writing a macro
> > you are implying that there exists a set of objects for which the
> > macro's transformation is logical. The python "with" statement
> > required implementation of the implied interface across all valid
> > arguments, whereas the macro version takes advantage of the fact that
> > most of the applicable objects just happen to have a .close method. In
> > both cases you're dealing with "with-able" objects. The difference is
> > that the "interface" that objects can expose to macros is much richer
> > because arbitrary syntactic fragments are "objects" in this sense.
>
> You're making a false assumption. Most of the valid library objects
> *didn't* have a ".close" method. The decimal library was tweaked to
> allow the with statement to create a new context, and automatically
> restore the previous one. The various forms of locking things were all
> tweaked so that you could use the with statement to acquire a lock
> that was released on exit.
>
> These things could have been done with a simple macro, but would have
> required tweaking the library to add a "close" function for the
> objects, even if the function name made no semantic sense. Either
> that, or use a different name for the function, and then go through
> and rewrite "the *entire* standard library" to take advantage of it.
>
> > The python approach is superior if you believe, as Guido apparently
> > does, that the useful set of syntactic constructs is small and well-
> > bounded. If you think, as most lispers do, that syntactic manipulation
> > is the essence of expressive power then the work it takes to add *one*
> > new keyword to a language like python seems farcical.
>
> The Python approach leads to more readable code:
> http://www.mired.org/home/mwm/papers/readability.html
>
> --
> Mike Meyer 
> http://www.mired.org/consulting.html
> Independent Network/Unix/Perforce consultant, email for more information.
>
> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> 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: the joys of lisp

2010-06-29 Thread Ryan Crum
Terseness and density is what attracted me to lisp-style languages in the
first place. In Clojure it is generally easier to locally comprehend
everything that is going on without having to go chasing through a bunch of
class definitions, and the code is often declarative enough to serve as its
own documentation.

Of course poorly written code is always painful to read, and written macros
are even worse. Isn't this why it's generally an accepted principle that
macros should only be written when there is a truly compelling reason to do
so? I would also argue that Clojure's functional immutability and lazy
sequences tend to nudge us in the right direction in a better way than
Python's "linguistic strictness" does. Whenever I write bad Clojure, I get a
Very Bad Feeling and the You're Doing It Wrong alarms start going crazy in
the back of my mind because there is a lot of philosophical "impedance".
With Python it seems much more likely for an initially clean code base to
devolve into a side-effect-filled, OO-inheritance-crazy imperative mess over
time.

-Ryan

On Mon, Jun 28, 2010 at 4:32 PM, Daniel Gagnon  wrote:

>
>> This is mostly due to Python's "There is only one obvious way to do it"
> which makes reading code much simpler. On the other hand it is possible but
> harder to make lisp code as readable (my code became much more readable
> after I discovered the threading macros for instance) and often lisp is
> harder to read per line but does much more in that small amount of space
> than another language would. Same principle as yet another Java class full
> of getters and setters being trivial to read but not getting much done per
> line.
>

-- 
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: Newb Question

2010-06-29 Thread Paul Moore
On 28 June 2010 20:24, Angel Java Lopez  wrote:
> Hi people!
>
> Any way to produce a lazy seq of chars, that prints as a string, based on
> two parameters, n (number of repeats), text (text to repeat)?
>
> Then, something like
>
> (myrepeat 100 "superdupertext")
>
> could be implemented without a big processing or concatenation.

The built in repeat is lazy:

user=> (doc repeat)
-
clojure.core/repeat
([x] [n x])
  Returns a lazy (infinite!, or length n if supplied) sequence of xs.

Paul.

-- 
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


Apply/Laziness question (was Re: Newb Question)

2010-06-29 Thread Savanni D'Gerinel
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Along those lines, why is the apply necessary?

More clearly, and I encountered this with a different block of code
earlier today, repeat returns a lazy sequence.  Str does nothing to
evaluate that sequences, so (str (repeat ...)) returns a lazy sequence.

Why does (apply str (repeat ...)) evaluate the sequence?  The
documentation for apply does not mention that it will do so.

Generally I am having a lot of trouble with sequences because I am never
clear on when a lazy sequence will be evaluated strictly.

- --
Savanni


On 06/28/2010 01:14 PM, Nurullah Akkaya wrote:
> Hi José,
> 
> user=> (apply str (repeat 3 "code"))
> "codecodecode"
> 
> will give you what you want,
> if we break it down,
> 
> user=> (repeat 3 "code")
> ("code" "code" "code")
> 
> repeat will give you a sequence of xs,
> since you don't know the length of the
> sequence at compile time we apply str
> to the sequence
> 
> (apply str '("code" "code" "code"))
> 
> which basically expands to,
> 
> (str "code" "code" "code")
> 
> then you get,
> 
> "codecodecode"
> 
> 
> --
> Nurullah Akkaya
> http://nakkaya.com
> 
> 
> 
> 2010/6/27 José Luis Romero :
>> Hi! I am learning the core of clojure, and so far, I am loving it. But
>> I am not a lisp programmer (python, java, among others), but never
>> functional programming. I am practicing with codingbat.com, coding the
>> exercises on clojure. I am stuck with loops. I want to concatenate n
>> times a string. For example, given the parameters 3 and "code" the
>> output will be "codecodecode". How can I do a loop in order to get
>> this output.
>>
>> I know that this is a very newb question, any help will be
>> appreciated.
>>
>> --
>> 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
>>
> 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwo6pEACgkQZIuDAZ4avD+JiQCgkiZg4ADytAL7ujIjq3S/73Up
msoAn0Z28vIwjTUXZb9bAN5o8LyDBUja
=I0Ni
-END PGP SIGNATURE-

-- 
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


reify bug?

2010-06-29 Thread itistoday
I'm probably doing something wrong but this doesn't work for some
reason:

user=> (seq (.list (java.io.File. ".") (reify java.io.FilenameFilter
(accept [f s] (not (.startsWith s "."))
java.lang.IllegalArgumentException: Can't define method not in
interfaces: accept (NO_SOURCE_FILE:36)

This does though:

user=> (seq (.list (java.io.File. ".") (proxy [java.io.FilenameFilter]
[] (accept [f s] (not (.startsWith s "."))
("file1" "file2" ... )

Thoughts?

-- 
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's n00b attraction problem

2010-06-29 Thread Greg
Sean,

There are many ways in which one could have the point of view that getting 
started with Clojure is simple.

As I tried to illustrate in the post, there exist other points of view from 
which this is not true.

Just because you found it easy to get started, does not mean others do, and 
judging from the reaction to my post, I'm by no means the only person to feel 
this way.

You went to a bootcamp to learn clojure, you found some Clojure-MacOSX package, 
and you're perfectly fine with using a Terminal and TextMate. Others do not 
come from your point of view.

This entire discussion is an exercise in accepting the fact that hundreds of 
other people who want to learn Clojure and are very much interested in it, 
nevertheless find it very difficult to get started. Just because you found it 
simple, does in no way invalidate their point of view.

It will only help the language and the community if we address their concerns. 
Plus, it's just a nice thing to do.

If I have time, I'm going to see what I can do about improving clojure's API 
docs, and if anyone is already working on this sort of project, I'd be 
interested in possibly helping out.

- Greg

On Jun 28, 2010, at 9:01 PM, Sean Corfield wrote:

> On Sun, Jun 27, 2010 at 2:58 PM, Greg  wrote:
>> This weekend I've been diving head-first into Clojure, and I've documented a 
>> lot of the sticking points that I've run into as a n00b.
>> 
>> I'd like to share them with the community here, in the hopes that we might 
>> be able to improve the getting started experience for people considering 
>> Clojure:
>> 
>> http://gregslepak.posterous.com/clojures-n00b-attraction-problem
> 
> Whilst I have some sympathy with the apparent range of choices, as
> someone who is also new to Clojure (I attended Amit Rathore's
> "bootcamp" in May as my very first exposure to the language), I think
> you've made life much worse for yourself than you needed to...
> 
> I'm on a Mac so I use TextMate with a Clojure bundle or I use vi. I
> don't think you need to worry about an "IDE" when you're first
> learning a language. Finding and installing a simple clj script is
> pretty easy, IMO (I used the Clojure-MacOSX package to get my initial
> Clojure installation up and running), but mostly I work with lein for
> 'building' stuff. Getting lein installed was pretty simple, then it's
> just a case of 'lein new projectname', drop into the new directory,
> 'lein deps' and then 'lein test'. At that point you can edit the
> tests, edit the source and compile, test etc as much as you want.
> 
> I recently had cause to create a JAR that allowed me to call Clojure
> from a Java web application. There was a pretty good example of that
> on clojure.org as I recall. 'lein uberjar' was key there. It was about
> as hard as I would have expected such an experience to be with any new
> language (new overall and new to me).
> -- 
> Sean A Corfield -- (904) 302-SEAN
> Railo Technologies, Inc. -- http://getrailo.com/
> An Architect's View -- http://corfield.org/
> 
> "If you're not annoying somebody, you're not really alive."
> -- Margaret Atwood
> 
> -- 
> 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's n00b attraction problem

2010-06-29 Thread Paul Moore
On 28 June 2010 19:49, Mike Meyer
 wrote:
>> Yet another set of choices n00bs are faced with is figuring out how
>> to actually compile their source into an executable.
>
> Executable? We're talking about Java here. It doesn't do executables -
> it does jar files. There's little reason to build those as a newb, as
> it's not noticeably harder to run the source than it is to run a jar
> file - or to import them if you're building libraries.

We're not talking about Java here, we're talking about clojure!

A certain proportion of new clojure users are coming from
non-Java/non-JVM backgrounds. To them, "how do I make an executable"
is a perfectly valid question. And "clojure doesn't do executables"
isn't a particularly encouraging answer (not even if you blame Java
for it :-)) Classpaths, server vs client JVMs, ant/maven, all of these
are confusing hurdles to get over if you don't have any Java
experience.

For such people, introductory clojure material needs to (a) assume no
JVM/Java knowledge, and (b) provide some guidance for how to interpret
the inevitable Java terminology that a newcomer will encounter. For
example:

Q: How do I make an executable in clojure?
A: Clojure scripts can be executed in a similar manner to scripting
languages like Python or Perl - clj myscript.clj. [Note: a standard
clj wrapper script should be supplied with clojure!] However, even
when executed like this, clojure code is compiled (for more details
read up on JVM bytecode, and the Java "just in time" compilers). You
can compile clojure code into a "jar" file - which is a JVM executable
format which can be run using the "java" command (insert reference to
more detailed explanation here). More or less self-contained formats
(bundling dependencies, or hiding the invocation of the "java"
command) are possible, but are generally reserved for more specialised
applications.

Q: What are ant, maven?
A: JVM build systems, commonly used in the Java world. The clojure
community is beginning to standardise on Leiningen (insert reference
here) which uses a more clojure-like language for describing builds,
but which works with the existing ant/maven infrastructure (so all of
the existing libraries available via these tools are available for
free in Leiningen).

If these examples are useful, feel free to add them to a FAQ or newbie
documentation.

Paul.

-- 
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's n00b attraction problem

2010-06-29 Thread Greg
On Jun 28, 2010, at 4:44 PM, Lee Spectorr wrote:

> CLJ might indeed be handy but an editor is essential, and neither this nor 
> the other options mentioned in the CLJ readme includes one as far as I know. 
> My minimal requirements for an editor are that it have a interface that will 
> be natural to any user of the platform and that it provide 
> language-appropriate indentation. Syntax coloring, auto-completion, and 
> integrated access to documentation would also be highly desirable, but not 
> essential.
> 
> -Lee

Have you tried IntelliJ with the La Clojure plugin? I tried all 3 IDEs and I 
was most impressed with IntelliJ IDEA. It's not too difficult to setup, and 
once you do it's really nice and has I think all of the stuff you asked about 
(syntax coloring, auto-completion, doc access, etc.).

- Greg



> 
> --
> Lee Spector, Professor of Computer Science
> School of Cognitive Science, Hampshire College
> 893 West Street, Amherst, MA 01002-3359
> lspec...@hampshire.edu, http://hampshire.edu/lspector/
> Phone: 413-559-5352, Fax: 413-559-5438
> 
> Check out Genetic Programming and Evolvable Machines:
> http://www.springer.com/10710 - http://gpemjournal.blogspot.com/
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> 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's n00b attraction problem

2010-06-29 Thread Tim Robinson
Being a n00b, 1 year programming, not formally educated in such, 2
weeks with Clojure
I am going to agree. Clojure is NOT n00b friendly. The easiest setup I
have ever seen dealt with is python.

* Most n00bs want a "hello world" in an application output (via script
or compojure). Not in a repl. The repl is a tool to get you there. In
order to do this users should really have a 7 step guide on leinington
and optionally compojure, unfortunately it's so poorly documented and
incorrectly documented it's frustrating for n00bs. In my case I
thought I was downloading the current version @4.0, which quite
frankly bites because it won't run version 1.2 clojure, which most
blogs use functions from. And almost every blog/doc on leinington is
old omits/incorrectly states basic steps.(ie they walk you all the way
through to lein uberjar, but don't actually put a namespace in the
project.clj example), therefore none of the classes compile). If
you're on macsox, and get the namespaces down even then the current
leinington release barfs on DS_store files (the hot to trot release
doesn't however).

Quite frankly I love Clojure, but I TOTALLY agree -> The clojure world
is not stable even if clojure core is.

The thing is that it's S close. After days of sifting through all
the BS, I don't know why we couldn't have the relevant 7 easy steps
documented linked from the front page of clojure.org. To do so however
still requires all the bleeding edge versions.

My 2 cents.
Tim







On Jun 27, 3:58 pm, Greg  wrote:
> This weekend I've been diving head-first into Clojure, and I've documented a 
> lot of the sticking points that I've run into as a n00b.
>
> I'd like to share them with the community here, in the hopes that we might be 
> able to improve the getting started experience for people considering Clojure:
>
> http://gregslepak.posterous.com/clojures-n00b-attraction-problem
>
> In the post I cover issues with:
>
> - Obtaining Clojure
> - Running Clojure
> - IDEs
> - Emacs/VIM
> - Build systems
> - Documentation
>
> Cheers,
> Greg

-- 
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: Question: pmap + number of threads + number of cpus

2010-06-29 Thread Todd

Chris -
Thanks for your response. I have a few follow up questions:

toddg=> (show (range 10))
===  public final clojure.lang.LazySeq  ===

... so range returns a lazy seq

toddg=> (show (seq (range 10)))
===  public final clojure.lang.ChunkedCons  ===

... but seq'ing it returns a ChunkedCons

Q: Why does range return a LazySeq whereas seq returns a ChunkedCons? I 
can see that these two classes are very different...but I don't really 
understand what's going on here.


toddg=> (show (doall (range 10)))
===  public final clojure.lang.LazySeq  ===

Q: Since doall walks the entire seq, it almost seems like the lazy seq 
isn't a lazy seq anymore... I mean, if seq'ing a LazySeq returns a 
different type, then I'd almost expect doall to return a different type, 
too. One that's not lazy.


toddg=> (show list)
===  static clojure.lang.PersistentList$1  ===

toddg=> (show (list (range 10)))
===  public clojure.lang.PersistentList  ===

Q: So, is this the idiomatic way to convert the LazySeq or ChunkedCons 
to a Persistent (list|vector)?


toddg=> (show (into [] (range 10)))
===  public clojure.lang.PersistentVector  ===

toddg=> (show (into () (range 10)))
===  public clojure.lang.PersistentList  ===

Q: Where are the clojure.lang classes documented? I see the classes in 
the source, but they do not appear to have javadocs.


BTW - I really enjoyed your book.

-Todd

On 6/28/10 6:45 AM, Chouser wrote:

On Sat, Jun 26, 2010 at 7:01 PM, toddg  wrote:

(running clojure 1.2 snapshot)

Q1: Why does pmap use the number of available processors + 2? I would
have thought it would just use the number of avail processors...


I'm not entirely sure, but I think the idea is to prevent too
much context-switching on each core.  Perhaps +2 helps fill in
gaps in the processor's pipelines or something.  The agent pool
for 'send' has a similar limit formula.


Q2: Could someone clear up my misunderstanding of pmap w/ respect to
the code snippets below? Pmap doesn't seem to be limiting the number
of threads to the number of processors + 2...

I've created an anon func that does't return, so I wouldn't expect the
pmap step function to advance beyond 4 (I have 2 processors):

#1: Limit pmap to # of processors
--


[snip]


-->  just two threads running, as expected


#2: Limit pmap to # of processors * 10
--

user=>  (pmap #(while true (do (println "Thread: " (.getId (Thread/
currentThread)) "item: " %)(Thread/sleep 500))) (range (* 10
(.availableProcessors (Runtime/getRuntime)
Thread: Thread:   12 item:  0
(Thread:  25 item:  13
Thread:  24 item:  12
Thread:  23 item:  11
Thread:  22 item:  10
Thread:  21 item:  9
Thread:  20 item:  8
Thread:  19 item:  7
Thread:  18 item:  6
Thread:  17 item:  5
Thread:  16 item:  4
Thread:  15 item:  3

-->  In this short snippet, you can see>  4 threads running...expected?


Range produces a chunked seq, which if my answer to Q1 is
correct, I guess pmap isn't expecting.  So pmap creates one
'future' per element, but instead of only doing this for procs+2
elements at a time, it does so for every element of the first
chunk.  If you use range of more than 32 elements, you'll see
your example doesn't go beyond the first 32 (range's chunk size).
...or you can use a PersistentList instead of a range, which
produces unchunked seqs, and see that it only uses procs+2
threads.

--Chouser
http://joyofclojure.com/



--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
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: Life on the bleeding edge

2010-06-29 Thread Paul Moore
On 29 June 2010 06:47, Mark Engelberg  wrote:
> Yes, that is disconcerting that clojure-contrib produces errors on
> Windows (sigh, it often feels like Windows is a second-class citizen
> when it comes to clojure), but that did the trick and allowed the
> build to complete.  Thanks for the tip.

Is there anything a clojure newbie with little JVM development
experience (but a willingness to learn) can do to help with the
Windows situation? From what I understand, Java itself is fine on
Windows, so I assume this is a clojure-specific issue?

Paul.

-- 
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's n00b attraction problem

2010-06-29 Thread Paul Moore
On 28 June 2010 23:13, Lee Spector  wrote:
> and more recently I had to figure out about.dotted.names and their meaning 
> with respect to directory structures,
> in order to get require to find a second clj file. It's not complicated, but 
> it's also not obvious to everyone first coming
> to Clojure.

That's actually far more of a stumbling block than the classpath. In
my experience, very few languages/environments tie directory structure
and language identifiers (class name in Java, namespace in Clojure)
together as closely as the Java/JVM environment. As in, if you change
the filename, you have to change the namespace declaration as well -
and vice versa. Or Clojure can't find your code, and you have no idea
why :-(

And yet, there's no reference that I can see to this fact in any of
the Clojure tutorials. Not even in "Programming Clojure" (which is
generally a great book). I could have missed something, of course - I
wasn't looking for the information - but I've hit the issue a couple
of times, so I suspect if I had seen anything, I would have
remembered.

Paul.

-- 
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's n00b attraction problem

2010-06-29 Thread Paul Moore
On 28 June 2010 22:41, cageface  wrote:
> On Jun 28, 12:16 pm, Martin DeMello  wrote:
>> It depends. I found the concepts pretty easy, since I have done a lot
>> of functional programming, but when I was new to clojure I had a truly
>> horrible time figuring out the various classpath issues needed to get
>> things working.
>
> What is it about the classpath in particular that people find
> difficult? Is it that different from things like PYTHONPATH or
> RUBYLIB? The main differences I can see are:

For me (and to be honest, I don't have any real problem with the
*concept* of the classpath, just with some of the practicalities) it's
the fact that by default, Clojure doesn't work. OK, that's overstating
it - the issue is that clojure.jar isn't on the *default* classpath.
This is hardly surprising, of course, but it does make it harder - you
encounter the classpath right at the start, before you even get
Clojure running. And unless you write your own wrapper, you keep
having to deal with it ("hmm, java -cp, now where did I put clojure,
D:\Apps\Clojure\clojure.jar, clojure.main, oops no, this is the PC
it's on the C drive. Or ..."). I know you can set the global
CLASSPATH, but that feels a bit too general - what else might it
affect?

The simple fix to that, of course, is to supply a small wrapper script
with clojure. The response "it's easy for you to write one yourself"
misses the point - we're talking about the out of the box experience.

If clojure.org included a "Download Clojure" link that pointed at a
zipfile containing clojure.jar, clojure-contrib.jar, and a wrapper
script (well, two, one for Unix, one for Windows) which set classpath
based on the location of the script and ran Clojure, then people could
download that, unzip it anywhere, and go. It doesn't solve all the
world's problems, but it sure simplifies the initial experience!

For what it's worth, here's a trivial clj.bat for Windows:

@echo off
setlocal
set CLASSPATH=%~dp0clojure.jar;%~dp0clojure-contrib.jar;%CLASSPATH%
java clojure.main %*
endlocal

Add as much extra complexity as you like, but that's enough for a starter.

Paul.

-- 
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's n00b attraction problem

2010-06-29 Thread Jared
I guess I'll throw in my 2 cents, since I'm a new guy with very
limited Java experience.

It is tricky getting Clojure to run, but not all of this is Clojure's
fault. It took me 2 days to get it running on my desktop running
ubuntu 10.04, with netbeans. I still have not been able to get the
labrepl working with netbeans on my desktop. I've been working off and
on getting Clojure to run on my laptop for a week now. My laptop had
ubuntu 9.04, but there was some bug between ubuntu and java that was
fixed in the later version. I upgraded to 10.04, now my touchpad and
keyboard are not detected and I'm doing a complete reinstall...

Netbeans isn't my ideal environment either. I'd prefer vim, but having
an entire group dedicated to getting vim working with Clojure suggests
it is not easy. Then there's the Java commandline compilation stuff,
which I'd imagine is trickier than hitting compile in an IDE like
Netbeans.

-- 
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's n00b attraction problem

2010-06-29 Thread Greg
Very insightful comments Chas!

I agree with most of what you've said, in the sense that I definitely see your 
point of view.

On Jun 28, 2010, at 7:17 PM, Chas Emerick wrote:

> Greg, thanks for this post, it's a helpful perspective.  Many of us have been 
> working on this problem from various angles (though often uncoordinated, but 
> that's how it goes), and I do what I can.  Here's some general 
> comments/thoughts in no particular order after re-skimming your post and the 
> comments on this thread so far:
> 
> - Clojure (and some environment for working with it) must be as "friendly" 
> and approachable for new users as possible.  It is not an "expert's" or 
> "professional's" language, at least in my conception, and thinking of it that 
> way will doom it to irrelevancy.  Our community has been extraordinarily open 
> and welcoming to newcomers for years, and any change in that posture would be 
> devastating.  I (thankfully) have little fear of this actually happening.

I hope you're right, because it seems like some people are really gunning for 
this silly "comp. sci. professors-only" perspective. It's made sillier still 
considering that one of the main motivations behind Clojure was to create a 
practical Lisp.

With regards to the "to-each his own" argument on environments, I definitely 
agree, but I was never suggesting that we impose any environment on anyone. 
Just that there be an excellent default environment that the docs can 
recommend. I see nothing wrong with that, it would only serve to help enhance 
the getting started experience. Again, look at Xcode.

I think someone said it well (I forgot who), but part of the reason why there's 
so much fragmentation amongst setups right now is because they all generally 
tend to suck in some way or another. If there was a single-awesome catch-all 
setup that served the needs of 80% of Clojure users, that would not be the 
case, and Clojure's community would thrive.

> Feeling like 1.2 is a requirement for learning clojure is unwarranted, and an 
> unfortunate side-effect of the gestalt of the community discussion.

I never said it was a requirement for learning Clojure.

I said that I as a semi-informed newb would like to use Clojure 1.2, and that 
it should be simple to do this. 'Should' is a strong word, and it will incite 
many to disagree, but that doesn't change the fact that mine is not a unique 
viewpoint. Perhaps, "there's no reason why there shouldn't be" would be a 
better way of putting it. In general, what should be simple is switching 
between clojure.jar files, whether you're switching to a bleeding-edge copy or 
not.

The Assembla wiki states:

reify is preferable to proxy in all cases where its limitations are not 
prohibitive.

And I intend to follow that advice. :-)

There's no reason for making it difficult to do so.

On a different note, is it normal for messages emailed to the list to take 
hours before appearing in the thread? I sent several replies to this thread and 
they've yet to appear (currently), it's been several hours. I would figure that 
once my initial message was approved my email address would be automatically 
white-listed..?

- Greg

> - Clojure is fundamentally a hosted language -- whether it's the JVM or the 
> CLR or Javascript or Cocoa or LLVM or Gambit or whatever other platforms 
> Clojure will be hosted on in the future, there will always be some tension 
> between Clojure and the underlying runtime.  The key is having tools around 
> that effectively plaster over that tension for long enough for newcomers to 
> tinker, get comfortable, and become effective in some small way before 
> forcing them to peel back the veil and understand things deeply.  Currently, 
> the classpath is the biggest thing that needs to be plastered over, but 
> that's a simple issue that, honestly, existing IDE plugins fundamentally 
> solved years ago.
> 
> - I suspect there will never be an "officially-sanctioned" toolchain, unless 
> one particular environment becomes so capable and ubiquitous and approachable 
> that it's pointed to because suggesting anything else would just be mean.  
> That's good, insofar as, to a certain extent, we're not sure what that 
> über-environment should look like (though I've been trying to cultivate a 
> conceptualization of that here, haphazard as it may be: 
> http://muckandbrass.com/web/x/DoBZ).  Yes, we'll "lose" some newcomers while 
> efforts are splintered, but if and until that changes, it's best to simply 
> say, "here's our best effort at getting you started, come find us in #clojure 
> or on the ggroup if you need help".
> 
> - Not all newcomers are alike.  What a Java programmer needs is very 
> different than what a Rubyist or pythonista or old-time lisper need.  This 
> fact needs to be taken into account when recommendations are being made for 
> build tools, editors/IDEs, etc. etc.  (I'll bet the correlation between prior 
> Java usage:clojure-maven-plugin::prior

Re: Conjure / Compojure Docs etc

2010-06-29 Thread Ryan Waters
An excellent post regarding compojure documentation was made by James
Reeves on the compojure group June 26, 2010:

http://groups.google.com/group/compojure/msg/da0de026bbbfbec1

In it, he discusses a strong desire to update the docs and provides
links a person would want to use in the mean time.


On Mon, Jun 28, 2010 at 1:46 PM, Oleg  wrote:
> Dear John!
>
> I think that a lot of interesting about "Compojure" most used clojure
> web development library you can find there: 
> http://weavejester.github.com/compojure/
>
> See also http://github.com/briancarper/cow-blog this beautiful project
> from Brian Carper, which shows many interesting clojure and compojure
> development tricks.
>
> - Oleg
>
> On 28 июн, 00:56, "john.holland"  wrote:
>> I've seen a lot of mentions of Compojure on the group. I found the
>> documentation a little lacking. Am I missing something obvious?
>>
>> Also, Conjure (sort of Rails done in Clojure) seems very nice, is well
>> documented, etc. But I don't see any mention of it. Is there any
>> reason for it not to be popular?
>
> --
> 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: the joys of lisp

2010-06-29 Thread Timothy Baldridge
Erlang basically treats strings in one or two ways. 1) as pure binary
data (useless for most cases) or 2) as a list of numbers. Imagine if
clojure treated strings like this: (43, 22, 23, 32, 43)

So when you print any list in Erlang it checks to make sure if all the
numbers in the list are in a valid ascii range, if so it prints the
data as a string, if not, it uses a list format like above. Yes, it is
truly terrible.

Timothy

> I haven't done any Erlang coding but I have heard various complaints
> in blogs etc that Erlang isn't great for string handling.
>
> Is that what you mean? Is Erlang a good or bad example of this?
>
> On Jun 27, 1:11 pm, Timothy Baldridge  wrote:
>> "1. a string/text type"
>>
>> *cough * Erlang *cough *
>>

-- 
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's n00b attraction problem

2010-06-29 Thread Paul Moore
On 29 June 2010 06:11, cageface  wrote:
> On Jun 28, 9:14 pm, Michael Richter  wrote:
>> Ah.  The Clojure community has already started down the road to Common
>> Lisp-style, smugness-generated obscurity and disdain.  Bravo!  Well-played!
>
> Not at all. Nothing would make me happier than "Clojure for Dummies"
> and Wrox Professional Clojure books on the shelves of every Barnes &
> Noble programming section. It's pained me to watch Python and Ruby far
> outpace the growth of any functional language in the last ten years.
> I'd love to stop looking for excuses to sneak things like Clojure
> under the radar at work and actually have a management mandate to use
> them.

It is very, very hard to get a decent characterisation of "newbies".
It's too wide a range. You've lumped at least three different
possibilities in the paragraph above alone:

- Completely new programmers ("Clojure for dummies") who need to learn
things like "what is recursion", "how do I do the same thing 10
times", etc.
- Experienced programmers in a scripting language (Python/Ruby) who
know how to program and need to know how Clojure differs (and there's
a whole subrange in here).
- People who work in a "Java Shop" ("sneak things like Clojure under
the radar" - I'm making assumptions here) and who work with the JVM
regularly, but maybe have little or no experience with
"non-traditional" languages.

And by my own argument, there are many more possibilities. Each of
these groups will want something different (or more likely, look for
the "best fit" in what they can find, and ignore the bits they don't
need).

It's important to look at what people are actually asking for in each
case, and not offer a single generic response to everyone (you'd
offend me if you suggested I need "Clojure for Dummies", but on the
other hand, you'd look "elitist" to someone who had never programmed
before if you launched straight into recursion or the advantages of
immutability when a new programmer asked for help getting his "Hello,
World" program to write its output 10 times...)

> The fact remains though that Clojure trades in heavy concepts. The
> syntax alone will simply be a non-starter for at least half the
> potential audience. Toss in concurrency and non-mutability and
> ubiquitous recursion which are tricky concepts no matter how cleanly
> exposed in the language.

Only for certain audiences. And anyone can learn given a sympathetic
teacher. What I wouldn't do is expect people to have to pick up
multiple things at once. That's why, for people who are new to the
language concepts in Clojure, I'd say you want a "fast start"
environment which lets them get straight to writing (simple) code.
Writing a "hello world" program, or your first recursive factorial,
shouldn't be hard.

"java -cp clojure.jar clojure.main myprog.clj" isn't hard, but a
trivial script that wraps that as "clj myprog.clj" is a little less
intimidating (and as a bonus, matches the expectations of people who
have seen Python, Ruby, or any one of many others). And a
straightforward "if you like IDEs like Visual Studio, grab this
package for now and you're off" will help people who prefer an IDE.
(They can make their own choice from the various options later, when
they have more experience).

> As many posters have said in this thread, you
> really do have to have a decent grasp on Java to do real work in
> Clojure so you're already on the hook for two languages, one of which
> is a baroque and provincial monster.

OK, that's a good point. For people who won't have an issue with
Clojure's concepts (e.g. Lisp users, people with a wider range of
programming experience, etc) this means the message is "you want to
learn Clojure - presumably because it's a high-level, sophisticated
language - so you also need to learn Java" (which, frankly, is pretty
much the antithesis of a "sophisticated language" in many such
people's minds).

Maybe JVM experience can't be avoided. But it's a bitter pill to
swallow for a certain class of newbies (and this is where I'd place
myself) so why not try to make it easier? As some examples of what
could be done:

- Build a page of "JVM concepts for non-Java programmers"
- Collect links to tutorial information on the key JVM concepts,
looking particularly for material which is as language-agnostic as
possible. The Jython, JRuby, Groovy, Scala people presumably also have
this problem - why not share any generic links with them?
- Promote clojure-like alternatives to Java tools (Leiningen vs Maven)
for people with non-Java background. Work with such people to pick out
places where the documentation of such tools assumes too much
knowledge, and work to improve it (I'll help here!)
- Give examples of how to use the more obvious benefits of the
JVM-hosted environment:
  * How to find and use some of the huge range of 3rd party Java code
out there (not interop, but finding things on the net, referencing
them in your project, etc etc).
  * How to use the scalability of the JVM 

Documentation and examples (and where is the documentation on reduce)?

2010-06-29 Thread michele
I really like Clojure, but as a complete n00b on Lisp languages, it is
frustrating that I many times have to hunt high and low for
documentation on basic stuff.

Recently I saw a code snippet that showed that reduce takes an
optional initial value, something I didn't know. When I see something
new, I usually go back to the documentation or the book I might be
reading to see if there is something more to learn about the current
function, and to familiarize myself with the documentation.

Well, to my surprise and frustration, I haven't found any place which
documents that reduce takes an optional initial value.

The first impression of the Clojure home page was a nice ordered set
of pages of documentation, but I soon realized that listing all the
functions with some textual explanation, just doesn't cut it. I
usually end up googling for more conrete information that shows me how
to actually use the functions.

Please, dear very good Clojure creators, if you don't want Clojure to
be another language for the specially initiated, good examples will
take Clojure to the next level.

People are just like Clojure, lazy.

-- 
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's n00b attraction problem

2010-06-29 Thread Lee Spector

On Jun 29, 2010, at 1:05 AM, Mike Meyer wrote:
>> Yes emacs has built-in paren matching but emacs (like vi) is something
>> that has to be learned, not all newcomers will know it, I don't want
>> to force my students to use it (although I use it)
> 
> But you're willing to force them to use some other editor?

The ideal is to provide an editor that can be used without effort because it 
follows the standard interface conventions of the platform. That's what's so 
helpful about the editors in MCL, DrScheme, Processing, etc. Each has fancy 
stuff too, available through platform-conventional menus etc., but you don't 
need a lesson to do basic editing tasks (as you do with emacs and vi).

> See, I find this funny. Getting emacs to do clojure indentation is
> pretty much exactly as hard as getting clojure to use some third party
> library: dump clojure-mode.el onto your load-path, and then load
> it.

Not true. I had several hiccups in the process of getting emacs clojure mode to 
work (maybe because I first tried an outdated way and then that left stuff that 
clashed the next thing I tried... there are a a couple of clojure-mode 
tools/installers out there) and so have others -- if you check the list 
archives you'll see that periodic calls for help with this.

> Considering that I've never seen an IDE that I thought had an editor
> that was "good enough for real use", I find that statement highly
> subjective.

What I meant here was pretty simple: New users can begin using the editor 
without any specific instructions about how to use the editor per se, and a 
semester later they can be writing substantial programs in the same editor 
without feeling like it's holding them back. In my experience that's true of 
the editors in many IDEs for many languages.

> Basically, you need someone to either a) write an editor for clojure,
> or b) provide instructions for setting up a suitable java-sourced
> editor (so it runs everywhere) to do clojure indentation, then bundle
> all that with clojure and clojure-contrib and a little bit of support?

I think that several versions of "nearly the right stuff" are available but 
that the bundling/instructions could be made a little more clear for newcomers 
in every case that I know of (each case maybe needing a slightly different 
tweak).

--
Lee Spector, Professor of Computer Science
School of Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
lspec...@hampshire.edu, http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438

Check out Genetic Programming and Evolvable Machines:
http://www.springer.com/10710 - http://gpemjournal.blogspot.com/

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
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: Life on the bleeding edge

2010-06-29 Thread Rich Hickey


On Jun 29, 2010, at 1:47 AM, Mark Engelberg wrote:


Yes, that is disconcerting that clojure-contrib produces errors on
Windows (sigh, it often feels like Windows is a second-class citizen
when it comes to clojure), but that did the trick and allowed the
build to complete.  Thanks for the tip.

So now, finally, I've had the chance to run my regular code under the
equiv branch of clojure.jar.  Across the board, I'm finding that my
code runs 10-20% *slower* under the equiv branch of Clojure 1.2 than
Clojure 1.1.



The thing to compare equiv to is 1.2 master. You've said you are a  
heavy user of range, which may at the moment be slower in 1.2 than 1.1.


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.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Documentation and examples (and where is the documentation on reduce)?

2010-06-29 Thread David Nolen
On Tue, Jun 29, 2010 at 5:55 AM, michele  wrote:

> I really like Clojure, but as a complete n00b on Lisp languages, it is
> frustrating that I many times have to hunt high and low for
> documentation on basic stuff.
>
> Recently I saw a code snippet that showed that reduce takes an
> optional initial value, something I didn't know. When I see something
> new, I usually go back to the documentation or the book I might be
> reading to see if there is something more to learn about the current
> function, and to familiarize myself with the documentation.
>
> Well, to my surprise and frustration, I haven't found any place which
> documents that reduce takes an optional initial value.
>
> The first impression of the Clojure home page was a nice ordered set
> of pages of documentation, but I soon realized that listing all the
> functions with some textual explanation, just doesn't cut it. I
> usually end up googling for more conrete information that shows me how
> to actually use the functions.
>
> Please, dear very good Clojure creators, if you don't want Clojure to
> be another language for the specially initiated, good examples will
> take Clojure to the next level.
>
> People are just like Clojure, lazy.


True, while we wait for someone to actually build such a site I recommend
that you ask your questions on:

1) The mailing list
2) #clojure channel at irc.freenode.net
3) StackOverflow

In all three places you'll get nice friendly answers pronto.

Two other useful things at the REPL are (doc function-name) and (source
function-name).

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: Clojure's n00b attraction problem

2010-06-29 Thread Laurent PETIT
2010/6/29 Jared :
> I guess I'll throw in my 2 cents, since I'm a new guy with very
> limited Java experience.
>
> It is tricky getting Clojure to run, but not all of this is Clojure's
> fault. It took me 2 days to get it running on my desktop running
> ubuntu 10.04, with netbeans. I still have not been able to get the
> labrepl working with netbeans on my desktop. I've been working off and
> on getting Clojure to run on my laptop for a week now. My laptop had
> ubuntu 9.04, but there was some bug between ubuntu and java that was
> fixed in the later version. I upgraded to 10.04, now my touchpad and
> keyboard are not detected and I'm doing a complete reinstall...

Do you have details on what made you spend 2 days for having an
enclojure running environment ?

-- 
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's n00b attraction problem

2010-06-29 Thread Joost
On Jun 29, 5:50 am, Sean Corfield  wrote:
> If folks find the Java stack intimidating, maybe Clojure isn't for
> them? Lots of language run on the JVM and they all require some basic
> knowledge of classpaths, build tools and existing IDEs such as
> Ecliper, NetBeans, IntelliJ etc. If folks are new to all that, I don't
> think it's Clojure's job to teach them - there's plenty of literature
> out there about the JVM environment and tools.

I've programmed Java for a while, and frankly, the standard Java build
tools suck if you want to get anything done quickly. That's one of the
reasons IDEs are so popular in Java - once you figured them out, at
least they keep your dependencies in check without having to write
oodles of XML.

Anyway, you don't need that in Clojure. What I want is open an editor,
and start banging out code interactively. From what I've seen, leining
is probably the best
way to set that up. I much prefer Emacs/SLIME to any Java IDE.

My conclusion: whoever said above that there appears to be two
development/build-tool preferences based more or less on Java vs Ruby/
Perl/Python developers is right IMO. And  I'd probably recommend
leiningen to any newbie not coming from a Java background. Sure you
can write a few batch files to start your repl etc, but I think
leiningen is probably doing things the right way if you just want to
get started using whatever editor you like (plus, it supports Emacs/
SLIME out of the box, which is nice for Lisp programmers who've
probably already got the whole Emacs side of things set up correctly
anyway).

-- 
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: Documentation and examples (and where is the documentation on reduce)?

2010-06-29 Thread Meikel Brandmeyer
Hi,

On Jun 29, 11:55 am, michele  wrote:

> Well, to my surprise and frustration, I haven't found any place which
> documents that reduce takes an optional initial value.

http://richhickey.github.com/clojure/branch-1.1.x/index.html

In particular:

http://richhickey.github.com/clojure/branch-1.1.x/clojure.core-api.html#clojure.core/reduce

(or alternatively: (doc reduce) at the repl)

What does this leave open on questions? (Granted: reduce is rather
well documented, there are worse examples.)

> Please, dear very good Clojure creators, if you don't want Clojure to
> be another language for the specially initiated, good examples will
> take Clojure to the next level.

Uh. Sky is falling again. But your are right. Nice examples would be a
nice addition. It's the first thing I'm looking for, when learning
something new. I'm not sure they should go to the reference docs,
though.

> People are just like Clojure, lazy.

Why do I support lazy people in my spare time? I'm an idiot.

Sincerely
Meikel

-- 
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: Protocols

2010-06-29 Thread Rich Hickey


On Jun 29, 2010, at 3:54 AM, Mark Engelberg wrote:

On Sun, Jun 27, 2010 at 7:18 AM, Rich Hickey   
wrote:
There are no extension points built on protocols in Clojure yet.  
Delivering
protocols is step one, re-architecting the core abstractions in  
terms of

protocols is still to come.

Rich


So how hard it would it be right now, for example, to implement in
Clojure a deftype that responds to all the functions a sorted map
responds to?

I started looking through the source code to try to figure out what
interfaces I'd need to override, but it seemed like an overwhelming
mixture of Clojure and Java interfaces, and very difficult to get
right without the ability to use the existing abstract base classes
that are in place (AFn, ASeq, APersistentMap, etc.).  For example, it
seems like to implement IFn, you'd need to manually write out cases
for the first twenty arities.

Would you recommend waiting until the core abstractions are
re-architected before tackling something like this, or is there an
easy way to do this I'm not seeing?




To start, you could look at the ancestors:

(ancestors (class (sorted-map)))

#{java.io.Serializable clojure.lang.ILookup clojure.lang.IMeta  
java.lang.Iterable clojure.lang.Associative  
java.util.concurrent.Callable clojure.lang.Reversible  
clojure.lang.IPersistentCollection java.lang.Runnable  
clojure.lang.APersistentMap clojure.lang.Sorted clojure.lang.Counted  
clojure.lang.IObj java.lang.Object clojure.lang.IFn  
clojure.lang.Seqable clojure.lang.IPersistentMap java.util.Map  
clojure.lang.AFn}


You may or may not want to implement all of these.

To get an idea of what is involved, look at emit-defrecord in  
core_deftype.clj.


Yes, in deftype-land we can't use the abstract bases.

I'm not sure it is every going to be made 'easy' to correctly support   
so many abstractions, but it is certainly tractable, and not something  
one needs to do often. emit-defrecord implements a dozen interfaces in  
about 60 lines of heavy lifting (and as a macro to boot).


As to whether or not you want to wait, that's up to you. These things  
are likely to change, but there are people who implement the  
interfaces right now with great success.


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.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure's n00b attraction problem

2010-06-29 Thread Lee Spector

On Jun 28, 2010, at 5:31 PM, Greg wrote:
> Have you tried IntelliJ with the La Clojure plugin? I tried all 3 IDEs and I 
> was most impressed with IntelliJ IDEA. It's not too difficult to setup, and 
> once you do it's really nice and has I think all of the stuff you asked about 
> (syntax coloring, auto-completion, doc access, etc.).


Thanks for the recommendation. Somehow I had overlooked this one previously.

I just downloaded and installed it, installed the Plugin (a little weird that 
there's no "Download and Install" button when you select the plugin, and you 
have to know to right-click, but the assembla instructions told me I'd have to 
right click it was okay), but then what?

The assembla instructions 
(http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Idea_and_La_Clojure)
 have a section for "To checkout a project from git" and a section for "To open 
an existing maven-based project", but I don't want to do either. I want to 
write and run some Clojure code from scratch. I'd like a REPL and an editor 
buffer or two...

Starting from Create New Project I clicked through a bunch of dialogs that I 
didn't understand, said okay to a warning about not assigning a JDK (because I 
didn't know what else to do there), and eventually got what looks like a 
project window but not (as far as I see) an editor buffer or a REPL. 

Returning to the assembla instructions I saw (both in the git section and in 
the maven section) "Choose Tools|Clojure REPL|Add new Clojure REPL to launch a 
REPL on your project." So I tried this but got "Can't creat REPL. Clojure home 
path is not configured correctly!"

It's possible that this is the environment that I'm looking for, but my new 
user experience is not going very well at this point.

Any pointers would be appreciated. 

Thanks,

 -Lee

--
Lee Spector, Professor of Computer Science
School of Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
lspec...@hampshire.edu, http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438

Check out Genetic Programming and Evolvable Machines:
http://www.springer.com/10710 - http://gpemjournal.blogspot.com/

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
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: Conjure / Compojure Docs etc

2010-06-29 Thread Matt
Unfortunately, I'm not very good at promoting Conjure. Though there
does seem to be more interest recently.

Also, I've some complaints about Conjure not working like other
Clojure libraries. This will hopefully be addressed in the next
release which breaks Conjure up into a few jar files and adds a
Leiningen plugin. If you're familiar with Leiningen, to add Conjure,
simply add the core library to your dependency list and the plugin to
your dev dependency list, update your dependencies and you're good to
go.

Conjure 0.7 is in feature freeze now and I expect to have a final
release sometime next week.

-Matt Courtney


On Jun 27, 4:56 pm, "john.holland"  wrote:
> I've seen a lot of mentions of Compojure on the group. I found the
> documentation a little lacking. Am I missing something obvious?
>
> Also, Conjure (sort of Rails done in Clojure) seems very nice, is well
> documented, etc. But I don't see any mention of it. Is there any
> reason for it not to be popular?

-- 
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: Question: pmap + number of threads + number of cpus

2010-06-29 Thread Meikel Brandmeyer
Hi,

On Jun 29, 6:56 am, Todd  wrote:
> Q: Why does range return a LazySeq whereas seq returns
> a ChunkedCons? I can see that these two classes are
> very different...but I don't really understand what's
> going on here.

seq returns whatever is contained in the lazy-seq:

user=> (type (lazy-seq [1 2 3]))
clojure.lang.LazySeq
user=> (type (seq (lazy-seq [1 2 3])))
clojure.lang.PersistentVector$ChunkedSeq
user=> (type (seq (lazy-seq (cons 1 nil
clojure.lang.PersistentList

LazySeq is a container which stores information on *how* to obtain
the next steps of the sequence. Once realised, it stores the result.

Which already points to...

> Q: Since doall walks the entire seq, it almost seems
> like the lazy seq isn't a lazy seq anymore... I mean,
> if seq'ing a LazySeq returns a different type, then
> I'd almost expect doall to return a different type,
> too. One that's not lazy.

Running through the sequence with doall will realise the contents of
the sequence. You still have a LazySeq, but the computation stored in
it is now replaced by the actual result of the computation.

> Q: So, is this the idiomatic way to convert the
> LazySeq or ChunkedCons to a Persistent (list|vector)?

For vector: (vec your-seq); for list: (list* your-seq). Although this
is not really interesting. The list will just act like the sequence.
So just calling doall is sufficient in case you have to get rid of
the laziness. If you need the properties of the vector, there is vec.

> Q: Where are the clojure.lang classes documented?
> I see the classes in the source, but they do not
> appear to have javadocs.

You should treat the underlying classes as implementation detail.

Hope this helps.

Sincerely
Meikel

-- 
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's n00b attraction problem

2010-06-29 Thread Laurent PETIT
Ok, so now, please take a look at this video (it's just 3 minutes),
and you'll get a grasp at how easy it is to bootstrap an Eclipse based
clojure environment : http://www.youtube.com/watch?v=1T0ZjBMIQS8

Works with eclipse 3.5 and eclipse 3.6.

I'm not claiming Eclipse / counterclockwise is better than IDE X or Y,
but that I've rarely have complaints in the ml concerning installation
problems.

Oh, and the video, while a little bit outdated, shows a bunch of
already existing features in Eclipse / Counterclockwise : the
namespace navigator, the clojure file "outline", navigating from the
namespace navigator and the file containing the definition of the var,
etc.

And to be totally clear, no there is currently no history in the REPL,
that's planned on our TODO list. :-)

-- 
Laurent

2010/6/29 Lee Spector :
>
> On Jun 28, 2010, at 5:31 PM, Greg wrote:
>> Have you tried IntelliJ with the La Clojure plugin? I tried all 3 IDEs and I 
>> was most impressed with IntelliJ IDEA. It's not too difficult to setup, and 
>> once you do it's really nice and has I think all of the stuff you asked 
>> about (syntax coloring, auto-completion, doc access, etc.).
>
>
> Thanks for the recommendation. Somehow I had overlooked this one previously.
>
> I just downloaded and installed it, installed the Plugin (a little weird that 
> there's no "Download and Install" button when you select the plugin, and you 
> have to know to right-click, but the assembla instructions told me I'd have 
> to right click it was okay), but then what?
>
> The assembla instructions 
> (http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Idea_and_La_Clojure)
>  have a section for "To checkout a project from git" and a section for "To 
> open an existing maven-based project", but I don't want to do either. I want 
> to write and run some Clojure code from scratch. I'd like a REPL and an 
> editor buffer or two...
>
> Starting from Create New Project I clicked through a bunch of dialogs that I 
> didn't understand, said okay to a warning about not assigning a JDK (because 
> I didn't know what else to do there), and eventually got what looks like a 
> project window but not (as far as I see) an editor buffer or a REPL.
>
> Returning to the assembla instructions I saw (both in the git section and in 
> the maven section) "Choose Tools|Clojure REPL|Add new Clojure REPL to launch 
> a REPL on your project." So I tried this but got "Can't creat REPL. Clojure 
> home path is not configured correctly!"
>
> It's possible that this is the environment that I'm looking for, but my new 
> user experience is not going very well at this point.
>
> Any pointers would be appreciated.
>
> Thanks,
>
>  -Lee
>
> --
> Lee Spector, Professor of Computer Science
> School of Cognitive Science, Hampshire College
> 893 West Street, Amherst, MA 01002-3359
> lspec...@hampshire.edu, http://hampshire.edu/lspector/
> Phone: 413-559-5352, Fax: 413-559-5438
>
> Check out Genetic Programming and Evolvable Machines:
> http://www.springer.com/10710 - http://gpemjournal.blogspot.com/
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> 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's n00b attraction problem

2010-06-29 Thread Laurent PETIT
The video must be seen in HD if you want to have a chance to see
anything on it. It has no sound, it's not a problem with your
computer.

2010/6/29 Laurent PETIT :
> Ok, so now, please take a look at this video (it's just 3 minutes),
> and you'll get a grasp at how easy it is to bootstrap an Eclipse based
> clojure environment : http://www.youtube.com/watch?v=1T0ZjBMIQS8
>
> Works with eclipse 3.5 and eclipse 3.6.
>
> I'm not claiming Eclipse / counterclockwise is better than IDE X or Y,
> but that I've rarely have complaints in the ml concerning installation
> problems.
>
> Oh, and the video, while a little bit outdated, shows a bunch of
> already existing features in Eclipse / Counterclockwise : the
> namespace navigator, the clojure file "outline", navigating from the
> namespace navigator and the file containing the definition of the var,
> etc.
>
> And to be totally clear, no there is currently no history in the REPL,
> that's planned on our TODO list. :-)
>
> --
> Laurent
>
> 2010/6/29 Lee Spector :
>>
>> On Jun 28, 2010, at 5:31 PM, Greg wrote:
>>> Have you tried IntelliJ with the La Clojure plugin? I tried all 3 IDEs and 
>>> I was most impressed with IntelliJ IDEA. It's not too difficult to setup, 
>>> and once you do it's really nice and has I think all of the stuff you asked 
>>> about (syntax coloring, auto-completion, doc access, etc.).
>>
>>
>> Thanks for the recommendation. Somehow I had overlooked this one previously.
>>
>> I just downloaded and installed it, installed the Plugin (a little weird 
>> that there's no "Download and Install" button when you select the plugin, 
>> and you have to know to right-click, but the assembla instructions told me 
>> I'd have to right click it was okay), but then what?
>>
>> The assembla instructions 
>> (http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Idea_and_La_Clojure)
>>  have a section for "To checkout a project from git" and a section for "To 
>> open an existing maven-based project", but I don't want to do either. I want 
>> to write and run some Clojure code from scratch. I'd like a REPL and an 
>> editor buffer or two...
>>
>> Starting from Create New Project I clicked through a bunch of dialogs that I 
>> didn't understand, said okay to a warning about not assigning a JDK (because 
>> I didn't know what else to do there), and eventually got what looks like a 
>> project window but not (as far as I see) an editor buffer or a REPL.
>>
>> Returning to the assembla instructions I saw (both in the git section and in 
>> the maven section) "Choose Tools|Clojure REPL|Add new Clojure REPL to launch 
>> a REPL on your project." So I tried this but got "Can't creat REPL. Clojure 
>> home path is not configured correctly!"
>>
>> It's possible that this is the environment that I'm looking for, but my new 
>> user experience is not going very well at this point.
>>
>> Any pointers would be appreciated.
>>
>> Thanks,
>>
>>  -Lee
>>
>> --
>> Lee Spector, Professor of Computer Science
>> School of Cognitive Science, Hampshire College
>> 893 West Street, Amherst, MA 01002-3359
>> lspec...@hampshire.edu, http://hampshire.edu/lspector/
>> Phone: 413-559-5352, Fax: 413-559-5438
>>
>> Check out Genetic Programming and Evolvable Machines:
>> http://www.springer.com/10710 - http://gpemjournal.blogspot.com/
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> 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: State of Clojure web development

2010-06-29 Thread Matt
> If I had a full-stack, well-documented clojure framework, I'd jump to that.

Have you looked at Conjure? http://github.com/macourtney/Conjure

Docs: http://wiki.github.com/macourtney/Conjure/

It's not as fully featured as Django, but it's a good start and it's
in Clojure. Conjure doesn't have an autogenerated admin section, but
you can get some authentication and admin through the simple-
authentication plugin. Unfortunately, I haven't had time to update it
for the latest version of Conjure.

-- 
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: the joys of lisp

2010-06-29 Thread Mike Meyer

"Steve Molitor"  wrote:

>> The Python approach leads to more readable
>>code: http://www.mired.org/home/mwm/papers/readability.html
>
>The two cases he sites do not apply to Clojure:

More accurately, the problem being analyzed (a variable changing to a bad 
value) can't happen in clojure. It has to have been bound with a bad value.

>The first case is a function that is allowed to change the value of a
>variable passed into it.  Variables are immutable in Clojure so you can't
>write the dangerous 'inc' function he describes.  You can't change the value
>of a variable passed to a function in Python either, but you can pass a
>mutable object to a function and have the function modify the object, which
>is close to the same thing.  Clojure is much more readable than Python in
>this regard.

You might also note that lisp behaves the same way as python - at least outside 
of macros. As noted in the last paragraph, the paper isn't about lisp vs other 
languages, its about readability vs "power as terseness". The examples just 
happened to pick on a feature heavily associated with lisp.
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

-- 
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: State of Clojure web development

2010-06-29 Thread Matt
> 1. Have you written, or are you writing, a web application that uses
> Clojure? What does it do?

We are currently writing a web interface for the project I'm on. The
project, IMSMA, keeps track of landmines in war-torn countries so
humanitarian efforts can clean them up. The main program is a java
swing application, but they wanted a stripped down web app for data
entry. Conjure was an obvious solution since it allowed us, through
Clojure, to reuse much of our code from the swing app and gave us a
very quick and easy way to build the web app.

> 2. Which libraries or frameworks are you using? Which versions?

We're using Conjure (of course). It's an older version, probably a 0.4
or 0.5, I'm not sure which. Unfortunately, Conjure has changed
drastically since then and would require a major rewrite of our code
to catch up. I may try to do that, but after our first release when I
have some time to refactor and clean up code.

> 3. What made you choose Clojure to develop web applications in? What
> are the strengths of Clojure web development?

One of the biggest strengths for us is the java interop of Clojure.
Without it we couldn't reuse much of our java code, and would have put
us way behind. We could have used JRuby, but we felt Clojure is a much
better language which allows us to write even less code to do what we
want.

> 4. What do you think are the current weaknesses of web development in
> Clojure? What could be improved?

Deployment has been a problem. I hacked together an installer for our
app, which sets up our Conjure app as a windows service. I'm thinking
of creating a Leiningen plugin for it, but it would require izPack
which is very hard to use.

We've also had some trouble with support with java script. It's there,
but we're doing some crazy stuff with it, and even JQuery is having a
hard time. I'm not sure what can be done there.

> 5. Anything else you want to comment on?

I see a lot of people asking about a full stack web framework, but not
finding Conjure for some reason. I understand for a good number of
people in the Clojure community, Compojure and supporting libraries
are what they want and need. However, Conjure does have a niche, and I
would like to see more people using it. Is there anything I should be
doing to get more people interested?

-- 
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's n00b attraction problem

2010-06-29 Thread Mike Meyer
"Tim Robinson"  wrote:

>* Most n00bs want a "hello world" in an application output (via script
>or compojure). Not in a repl. The repl is a tool to get you there. In
>order to do this users should really have a 7 step guide on leinington

I happen to think that they're wanting the wrong thing. Even so, you don't need 
lein or ant or maven to get there. One of the joys of interpreted languages is 
losing the middle step in the edit- compile-test cycle. (Yes, I know that 
clojure does a compile; so does every production interpreter. This isn't 
something to bother beginners with.) Taking that away from them is wrong, and 
leads them away from the part of the lisp way known as exploratory programming. 
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

-- 
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: State of Clojure web development

2010-06-29 Thread Matt
Here's the Conjure scaffold controller in 4 lines:

(ns controllers.message-controller
  (:use [conjure.controller.base])
  (:require [controllers.template-controller :as template-
controller]))

(copy-actions :template)

And, you can still add any actions you want, or override the action
which are already there.

-Matt Courtney

On Jun 25, 10:33 am, Luc Préfontaine 
wrote:
> Were not using Clojure yet for our
> Web based GUIs.
> The main reason being that we jumped
> on Rails last year. Most of our needs
> are to display/edit database data and
> the ActiveScaffold plugin allows us
> to write a controller in 20 lines.
>
> We do not need to write forms,
> it's all done through partial renderings
> provided by the plugin.
>
> We just provide layouts and customize
> CSS stuf.
>
> We will give a closer look to
> Compojure this year and see if can
> achieve the same code ratio somehow.
>
> Luc P
>
> Sent from my iPod
>
> On 2010-06-24, at 12:27, Daniel Gagnon  wrote:
>
> > I don't use Clojure for web development and I thought sharing why  
> > could be useful too.
>
> > For web development, my favourite tool is Django. It comes as a  
> > fullstack framework which means I have everything I need out of the  
> > box. Templates, caching, ORM, a kick-ass autogenerated admin  
> > section, cross-domain request forgery protection etc. and the  
> > documentation is really top notch.
>
> > I'd rather have Clojure than Python but all the goodness that Django  
> > provides is such a time saver that I feel I'd lose too much time  
> > with Clojure.
>
> > If I had a full-stack, well-documented clojure framework, I'd jump  
> > to that.
> > --
> > 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 distribution (like what ubuntu is for linux)

2010-06-29 Thread Brent Millare
Well it looks like I have some competition ;)

> I haven't tried either yet so I can't really comment, but I like the
> idea of creating and integrated package manager and repl utility.  Clj
> also seems nice in the way it integrates with clojars.org.

At the moment, dj uses several maven repositories including
clojars.org for grabbing jar resources. The main difference between dj
and clj from what I see is I bit the bullet and wrote my own
dependency tool instead of using leiningen/maven. Its definitely
tractable to write commands that make it easy to upload jars and
include other integration features. Also note that dj has a different
approach to package management in terms of installing compared to clj.
dj treats its local repository as a cache and downloads packages on
the fly (I can also implement different "garbage collection" type
features where unused dependencies can be cleared out automatically to
save space). I can't think of a use case where the user would want to
download a certain package without it already being downloaded by the
information specified in the project.clj file or pom file. I can
imagine the user wanting to pretend to download all the dependencies
to determine what packages would be downloaded, I implemented that as
dj deps . dj will download only the pom files from the
jars and calculate the dependencies from those.

Best,
Brent

-- 
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: reify bug?

2010-06-29 Thread Adrian Cuthbertson
You need the "this" arg and I find you need to hint the exact types
when reifying java interfaces;

(seq (.list (java.io.File. ".") (reify java.io.FilenameFilter
(^boolean accept [_ ^java.io.File f ^String s] (not (.startsWith s
"."))

... works for me.

- Rgds, Adrian

-- 
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's n00b attraction problem

2010-06-29 Thread Lee Spector

Thanks Laurent.

Is there automatic Clojure indentation in Counterclockwise now?

I played with it a couple of months ago and saw a lot to like, and if I recall 
correctly a lack of indentation support was one of the main reasons I kept 
looking for alternatives. I think I was also a little confused by some of 
Eclipse's overall complexity and terminology (e.g. "perspectives") coming from 
a non-Java world, and maybe by some platform-related mismatches between the 
instructions and what I had to do (in Mac OS X) which, though minor, can still 
be confusing when starting from zero. I think I could get over these latter 
issues if there's indentation now.

Thanks so much for providing this tool!

 -Lee

On Jun 29, 2010, at 8:49 AM, Laurent PETIT wrote:

> The video must be seen in HD if you want to have a chance to see
> anything on it. It has no sound, it's not a problem with your
> computer.
> 
> 2010/6/29 Laurent PETIT :
>> Ok, so now, please take a look at this video (it's just 3 minutes),
>> and you'll get a grasp at how easy it is to bootstrap an Eclipse based
>> clojure environment : http://www.youtube.com/watch?v=1T0ZjBMIQS8
>> 
>> Works with eclipse 3.5 and eclipse 3.6.
>> 
>> I'm not claiming Eclipse / counterclockwise is better than IDE X or Y,
>> but that I've rarely have complaints in the ml concerning installation
>> problems.
>> 
>> Oh, and the video, while a little bit outdated, shows a bunch of
>> already existing features in Eclipse / Counterclockwise : the
>> namespace navigator, the clojure file "outline", navigating from the
>> namespace navigator and the file containing the definition of the var,
>> etc.
>> 
>> And to be totally clear, no there is currently no history in the REPL,
>> that's planned on our TODO list. :-)
>> 
>> --
>> Laurent
>> 
>> 2010/6/29 Lee Spector :
>>> 
>>> On Jun 28, 2010, at 5:31 PM, Greg wrote:
 Have you tried IntelliJ with the La Clojure plugin? I tried all 3 IDEs and 
 I was most impressed with IntelliJ IDEA. It's not too difficult to setup, 
 and once you do it's really nice and has I think all of the stuff you 
 asked about (syntax coloring, auto-completion, doc access, etc.).
>>> 
>>> 
>>> Thanks for the recommendation. Somehow I had overlooked this one previously.
>>> 
>>> I just downloaded and installed it, installed the Plugin (a little weird 
>>> that there's no "Download and Install" button when you select the plugin, 
>>> and you have to know to right-click, but the assembla instructions told me 
>>> I'd have to right click it was okay), but then what?
>>> 
>>> The assembla instructions 
>>> (http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Idea_and_La_Clojure)
>>>  have a section for "To checkout a project from git" and a section for "To 
>>> open an existing maven-based project", but I don't want to do either. I 
>>> want to write and run some Clojure code from scratch. I'd like a REPL and 
>>> an editor buffer or two...
>>> 
>>> Starting from Create New Project I clicked through a bunch of dialogs that 
>>> I didn't understand, said okay to a warning about not assigning a JDK 
>>> (because I didn't know what else to do there), and eventually got what 
>>> looks like a project window but not (as far as I see) an editor buffer or a 
>>> REPL.
>>> 
>>> Returning to the assembla instructions I saw (both in the git section and 
>>> in the maven section) "Choose Tools|Clojure REPL|Add new Clojure REPL to 
>>> launch a REPL on your project." So I tried this but got "Can't creat REPL. 
>>> Clojure home path is not configured correctly!"
>>> 
>>> It's possible that this is the environment that I'm looking for, but my new 
>>> user experience is not going very well at this point.
>>> 
>>> Any pointers would be appreciated.
>>> 
>>> Thanks,
>>> 
>>>  -Lee
>>> 
>>> --
>>> Lee Spector, Professor of Computer Science
>>> School of Cognitive Science, Hampshire College
>>> 893 West Street, Amherst, MA 01002-3359
>>> lspec...@hampshire.edu, http://hampshire.edu/lspector/
>>> Phone: 413-559-5352, Fax: 413-559-5438
>>> 
>>> Check out Genetic Programming and Evolvable Machines:
>>> http://www.springer.com/10710 - http://gpemjournal.blogspot.com/
>>> 
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clojure@googlegroups.com
>>> 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.c

Re: reify bug?

2010-06-29 Thread Adrian Cuthbertson
Sorry, you don't need the type hists just the "this" arg...

(seq (.list (java.io.File. ".") (reify java.io.FilenameFilter (accept
[_ f s] (not (.startsWith s "."))

On Tue, Jun 29, 2010 at 3:35 PM, Adrian Cuthbertson
 wrote:
> You need the "this" arg and I find you need to hint the exact types
> when reifying java interfaces;
>
> (seq (.list (java.io.File. ".") (reify java.io.FilenameFilter
> (^boolean accept [_ ^java.io.File f ^String s] (not (.startsWith s
> "."))
>
> ... works for me.
>
> - Rgds, Adrian
>

-- 
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: usage examples in clojure api docs

2010-06-29 Thread Lee Spector

I would LOVE to have simple examples for all functions, anyplace that makes 
them easy to access during coding. In docstrings would be fine with me, but 
other places would work as well.

Here again the Processing project (among others, I'm sure) provides a nice 
example IMHO, even though Processing and Clojure are obviously very different 
beasts. For each Processing function there's a web page with a description and 
a simple example. For example http://processing.org/reference/ellipse_.html . 
From the IDE you can jump instantly to a local copy of the page for any 
function by highlighting it and selecting "Find in Reference"  -- of course in 
Clojure people will be using different IDEs or none at all, so the integration 
with the coding environment might not always be this smooth, but the important 
thing is that you can get most of what you need for most uses of the function, 
including an example, in one place that's easy to find. 

By contrast, with Clojure I often end up puzzling over descriptions that 
require me to do more hunting to understand what some of the terms mean, or 
looking through source code, etc. This is perfectly understandable considering 
Clojure's youth and scope, and the focus of the developers on other things. But 
I think that this kind of model would be very nice to aim for, especially as a 
way to help beginners.

 -Lee

On Jun 29, 2010, at 3:13 AM, Tom Faulhaber wrote:

> I like the idea of having example code for all the functions.
> 
> However, speaking for myself only, I don't think that the doc strings
> are the place for a comprehensive set of examples.
> 
> How about building them in some external place? (Maybe as a separate
> github project to begin with.) In particular, it would be nice if the
> examples used some literate programming technique that let users open
> the examples and play with them. That way, they could be linked to
> from the documentation (I could roll it into autodoc, for instance,
> subject to Rich and Stuart's constraints) but also directly opened,
> tried, copied, etc. from your editor and repl.
> 
> It's easy for me to imagine that, in the not too distant future, we
> could roll that into Clojure core in a way similar to the tests.
> 
> Tom

--
Lee Spector, Professor of Computer Science
School of Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
lspec...@hampshire.edu, http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438

Check out Genetic Programming and Evolvable Machines:
http://www.springer.com/10710 - http://gpemjournal.blogspot.com/

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
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: Apply/Laziness question (was Re: Newb Question)

2010-06-29 Thread Mike Meyer
On Mon, 28 Jun 2010 13:31:45 -0500
Savanni D'Gerinel  wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Along those lines, why is the apply necessary?
> 
> More clearly, and I encountered this with a different block of code
> earlier today, repeat returns a lazy sequence.  Str does nothing to
> evaluate that sequences, so (str (repeat ...)) returns a lazy sequence.

str applys .toString to it's arguments, and then concatenates the
results together. .toString of a lazy sequence is an internal token
that you can use to infer it's from a lazy sequence, and that's about
it.

> Why does (apply str (repeat ...)) evaluate the sequence?  The
> documentation for apply does not mention that it will do so.

apply turns the values in sequence into arguments to a call to
str. For example, (apply str ["a" "b" "c"]) evaluates (str "a" "b" "c").
Since function arguments are passed by value (you can't apply a
macro), the lazy sequence has to be evaluated out to the end.

> Generally I am having a lot of trouble with sequences because I am never
> clear on when a lazy sequence will be evaluated strictly.

Sorry if this was already answered; I found it and realized I hadn't
seen an answer yet.

  http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
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: Can't send from agent error handler?

2010-06-29 Thread Chouser
On Wed, Jun 23, 2010 at 11:27 AM, Shawn Hoover  wrote:
> My first thought for an agent error handler was to send the exception to
> another agent.
> user=> (let [handler (agent nil)
>             a (agent 42
>                      :error-handler
>                      (fn [_ ex] (send handler
>                                       (fn [_] (println ex)]
>           (send a (fn [_] (throw (Exception. "bad news"
>           (await a)
>          �...@a)
> 42
> ;; No println!
> user=>
> Is this the way it should work? I saw some stuff about it in the wiki [1],
> but it's hard to tell what was decided explicitly.

Thanks for the report.  Ticket is here:
http://www.assembla.com/spaces/clojure/tickets/390

Please try out the patch there and see if it works and/or causes
other problems.  Thanks.

--Chouser
http://joyofclojure.com/

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
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: Documentation and examples (and where is the documentation on reduce)?

2010-06-29 Thread Jimmy

> Uh. Sky is falling again. But your are right. Nice examples would be a
> nice addition. It's the first thing I'm looking for, when learning
> something new. I'm not sure they should go to the reference docs,
> though.

Ruby is an example of a language that does have some examples in the
reference docs and i think it helps a lot.
Regards,
Jimmy

-- 
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: Newb Question

2010-06-29 Thread Angel Java Lopez
Hi people!

Paul, yes! but...

The apply and str evaluations in (apply str (repeat n text))
are lazy?

I guess the result could be a big string.  Isn't it?

Angel "Java" Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

On Mon, Jun 28, 2010 at 5:31 PM, Paul Moore  wrote:

> On 28 June 2010 20:24, Angel Java Lopez  wrote:
> > Hi people!
> >
> > Any way to produce a lazy seq of chars, that prints as a string, based on
> > two parameters, n (number of repeats), text (text to repeat)?
> >
> > Then, something like
> >
> > (myrepeat 100 "superdupertext")
> >
> > could be implemented without a big processing or concatenation.
>
> The built in repeat is lazy:
>
> user=> (doc repeat)
> -
> clojure.core/repeat
> ([x] [n x])
>  Returns a lazy (infinite!, or length n if supplied) sequence of xs.
>
> Paul.
>
> --
>

-- 
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: Can't send from agent error handler?

2010-06-29 Thread Chouser
On Thu, Jun 24, 2010 at 6:51 AM, ka  wrote:
> I'm also facing the same problem -
>
> (let [handler (agent 50)
>        a (agent 42
>            :error-handler
>            (fn [_ ex]
>              (do
>                (println "Inside agent a error handler fn" (Thread/
> currentThread))
>                (send handler
>                  (fn [_] (do (println ex (Thread/currentThread)))
> 60))
>                (println "Inside agent a error handler fn - after
> sending to the handler agent")
>                (await handler)
>                (println "CODE DOESN'T REACH HERE ??")
>                (println "State of handler agent:" @handler]
>    (send a (fn [_]
>              (println "Inside agent a function" (Thread/
> currentThread))
>              (throw (Exception. "bad news"
>    (Thread/sleep 1000)
>    ;(println "Errors with a:" (agent-error a))
>    ;(println "Errors with handler:" (agent-error handler))
>    (shutdown-agents)
>    (println "Errors with a:" (agent-error a))
>    (println "Errors with handler:" (agent-error handler))
>    (println @a)
>    (println @handler))

With the patch in http://www.assembla.com/spaces/clojure/tickets/390
your example will get a little further, but it has another
problem.  The error handler is still executed serially with agent
action, as if it was itself an agent action, but you may not use
'await' inside an agent action.  Using await there throws an
exception, but since you're already in an error handler, that
exception is silently thrown away and you still won't see the
"CODE DOESN'T REACH HERE" message.  If you wrap your await call
in its own exception handler, you'll be able to see that's what's
going on.

--Chouser
http://joyofclojure.com/

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
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: Apply/Laziness question (was Re: Newb Question)

2010-06-29 Thread B Smith-Mannschott
On Mon, Jun 28, 2010 at 20:31, Savanni D'Gerinel  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Along those lines, why is the apply necessary?
>
> More clearly, and I encountered this with a different block of code
> earlier today, repeat returns a lazy sequence.  Str does nothing to
> evaluate that sequences, so (str (repeat ...)) returns a lazy sequence.
>
> Why does (apply str (repeat ...)) evaluate the sequence?  The
> documentation for apply does not mention that it will do so.

apply fully realizes the argument sequence it's applying the function
to. Even in cases like this:

(defn foo [& more]
  ...)

(apply foo (range 1))

This fully realizes the (range 1) before calling foo, which is
wasteful if foo is written to consume more incrementally.

I've run into this trouble with concat, when I've wanted a lazy
sequence of the concatenation of the sequences produced by a list
comprehension:

(apply concat (for [n (range 1000)]
  (range 100)))

Concat gets passed a fully realized sequence of 1000 lazy sequences of
100 integers.

There may be some well-considered reasons why apply behaves this way,
but I do wish that functions like concat provided a variant that took
a single sequence of sequences as its argument, rather than a variable
number of sequences.

// Ben

-- 
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's n00b attraction problem

2010-06-29 Thread Mike Meyer
On Tue, 29 Jun 2010 07:56:09 -0400
Lee Spector  wrote:

> 
> On Jun 29, 2010, at 1:05 AM, Mike Meyer wrote:
> >> Yes emacs has built-in paren matching but emacs (like vi) is something
> >> that has to be learned, not all newcomers will know it, I don't want
> >> to force my students to use it (although I use it)
> > 
> > But you're willing to force them to use some other editor?
> 
> The ideal is to provide an editor that can be used without effort because it 
> follows the standard interface conventions of the platform. That's what's so 
> helpful about the editors in MCL, DrScheme, Processing, etc. Each has fancy 
> stuff too, available through platform-conventional menus etc., but you don't 
> need a lesson to do basic editing tasks (as you do with emacs and vi).

So you don't want one editor, you want a three (mac/windows/unix). Or
four (mac/windows/gnome/kde). Or maybe five
(mac/windows/gnome/kde/wmiietall).

Actually, have you looked at jedit? It's the only free Java editor
that isn't trying to be an IDE.

> > See, I find this funny. Getting emacs to do clojure indentation is
> > pretty much exactly as hard as getting clojure to use some third party
> > library: dump clojure-mode.el onto your load-path, and then load
> > it.
> 
> Not true. I had several hiccups in the process of getting emacs clojure mode 
> to work (maybe because I first tried an outdated way and then that left stuff 
> that clashed the next thing I tried... there are a a couple of clojure-mode 
> tools/installers out there) and so have others -- if you check the list 
> archives you'll see that periodic calls for help with this.

Um, I've been watching the list for quite a while, and have never seen
anyone with problems with just clojure-mode. What I have seen are
people having problems with getting slime and swank set up and running
in clojure-mode, but you don't need that to get smart clojure
indenting.  All you need is the clojure-mode.el file and requiring
it. Of course, that clojure-mode.el encourages you to install clojure,
slime, and swank-clojure doesn't help, but I had it doing
clojure-specific indentation before starting down that rathole.

> > Considering that I've never seen an IDE that I thought had an editor
> > that was "good enough for real use", I find that statement highly
> > subjective.
> What I meant here was pretty simple: New users can begin using the editor 
> without any specific instructions about how to use the editor per se, and a 
> semester later they can be writing substantial programs in the same editor 
> without feeling like it's holding them back. In my experience that's true of 
> the editors in many IDEs for many languages.

I think you're asking to much for the first step. They don't need
clojure-specific indentation; they just need a simple-minded
autoindent and paren matching. Those should be available in pretty
much any editor. Clojure-specific is nice, but they can correct it by
hand trivially.

That won't get them to the second step, though. To me, that means you
have to have an editor that's tightly coupled to a REPL. I need to be
able to send a file from an edit buffer to the REPL, or send a marked
region of text in the buffer, or the definition surrounding the point,
and then type text at the reply to test the just evaluated code. All
without having to touch the mouse. Here's where individual preferences
comes to the fore - some people will want to do everything via the
mouse, some won't want to touch the little rodent, some will want doc
strings available in the editors, others will want them in the repl,
yet others will want them in an external document.

All of which is why I think that starting with "your favorite text
editor with paren matching and auto-indent" is the right way to get
started - at least for people who aren't learning to use a computer
for the first time.

> > Basically, you need someone to either a) write an editor for clojure,
> > or b) provide instructions for setting up a suitable java-sourced
> > editor (so it runs everywhere) to do clojure indentation, then bundle
> > all that with clojure and clojure-contrib and a little bit of support?
> 
> I think that several versions of "nearly the right stuff" are available but 
> that the bundling/instructions could be made a little more clear for 
> newcomers in every case that I know of (each case maybe needing a slightly 
> different tweak).

If that's the case, is there some reason you haven't created this? I'd
be more than happy to provide web space for it if you need it.

http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubsc

Exceptions

2010-06-29 Thread Nicolas Oury
Dear all,

Is there a high level facility in Clojure to create your own exceptions?
I know you can use genclass/proxies and extend Throwable/Exception but it
seems very (too?) close to the host language
whereas the concept of exceptions is shared among most potential hosts.

It would seems reasonable to have a few macros (defexception, deferror,
defthrowable for example...) to abstract away
from the JVM (for clarity and portability) while keeping the same underlying
mechanism (for compatibility with the host).

Has anyone tried anything like that? Is there a big problem with such an
approach?

Best regards,

Nicolas.

-- 
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: usage examples in clojure api docs

2010-06-29 Thread Angel Java Lopez
Hi people!

I love PHP documentation

http://www.php.net/manual/en/

and its function reference:
http://www.php.net/manual/en/funcref.php

Each function has a dedicated page, with detailed description, initial
examples. And visitors can add new examples or limit cases. Example:

http://www.php.net/manual/en/function.array-combine.php

And the documentation can be built in .pdf and other formats. I never need
an irc channel or send an email in a list to understand a function. Maybe
for other topics, but not to understand a function.

That's the level of function documentation to match, I guess. And it's
pretty good in the non-function part: good explanation of language and its
usage.

Angel "Java" Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

On Tue, Jun 29, 2010 at 1:06 AM, cageface  wrote:

> Several people have suggested that usage examples in the docs would be
> helpful and this is something I often find myself wishing for. Are
> patches introducing examples welcomed by the core team?
>
> --
> 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: Apply/Laziness question (was Re: Newb Question)

2010-06-29 Thread Angel Java Lopez
Hi people!

Hmmm (str (repeat )) doesn't concatenate the repeated values.

As (str ("f" "o" "o")) doesn't return "foo", it returns "("f" "o" "o")" the
stringified sequence.

But (apply str '("f" "o" "o")) returns "foo", as expected in the initial
question.

Angel "Java" Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

On Mon, Jun 28, 2010 at 3:31 PM, Savanni D'Gerinel wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Along those lines, why is the apply necessary?
>
> More clearly, and I encountered this with a different block of code
> earlier today, repeat returns a lazy sequence.  Str does nothing to
> evaluate that sequences, so (str (repeat ...)) returns a lazy sequence.
>
> Why does (apply str (repeat ...)) evaluate the sequence?  The
> documentation for apply does not mention that it will do so.
>
> Generally I am having a lot of trouble with sequences because I am never
> clear on when a lazy sequence will be evaluated strictly.
>
> - --
> Savanni
>
>
> On 06/28/2010 01:14 PM, Nurullah Akkaya wrote:
> > Hi José,
> >
> > user=> (apply str (repeat 3 "code"))
> > "codecodecode"
> >
> > will give you what you want,
> > if we break it down,
> >
> > user=> (repeat 3 "code")
> > ("code" "code" "code")
> >
> > repeat will give you a sequence of xs,
> > since you don't know the length of the
> > sequence at compile time we apply str
> > to the sequence
> >
> > (apply str '("code" "code" "code"))
> >
> > which basically expands to,
> >
> > (str "code" "code" "code")
> >
> > then you get,
> >
> > "codecodecode"
> >
> >
> > --
> > Nurullah Akkaya
> > http://nakkaya.com
> >
> >
> >
> > 2010/6/27 José Luis Romero :
> >> Hi! I am learning the core of clojure, and so far, I am loving it. But
> >> I am not a lisp programmer (python, java, among others), but never
> >> functional programming. I am practicing with codingbat.com, coding the
> >> exercises on clojure. I am stuck with loops. I want to concatenate n
> >> times a string. For example, given the parameters 3 and "code" the
> >> output will be "codecodecode". How can I do a loop in order to get
> >> this output.
> >>
> >> I know that this is a very newb question, any help will be
> >> appreciated.
> >>
> >> --
> >> 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
> >>
> >
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkwo6pEACgkQZIuDAZ4avD+JiQCgkiZg4ADytAL7ujIjq3S/73Up
> msoAn0Z28vIwjTUXZb9bAN5o8LyDBUja
> =I0Ni
> -END PGP SIGNATURE-
>
> --
> 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's n00b attraction problem

2010-06-29 Thread Lee Spector

On Jun 29, 2010, at 10:26 AM, Mike Meyer wrote:
> Actually, have you looked at jedit? It's the only free Java editor
> that isn't trying to be an IDE.

Thanks for this tip. I didn't know about jedit. I've grabbed it and see that it 
has a built-in Clojure mode. Promising! Its idea of proper Clojure indentation 
seems pretty nutty to me (you may have to view this in a monospace font to see 
how odd it is):

(defn bar 
"check out the formatting of the let and the placement of the last line"
[]
(let [x 1
y 2
z 3]
(list x y z)))

It gets weirder for some of my more complicated definitions.

But maybe I can tweak the settings to get something more reasonable (I've only 
tried for a minute so far).

> Um, I've been watching the list for quite a while, and have never seen
> anyone with problems with just clojure-mode. 

Well I had trouble with this and I think I posted about it and that others did 
too. But in any event emacs isn't what I'm looking for.

> I think you're asking to much for the first step. They don't need
> clojure-specific indentation; they just need a simple-minded
> autoindent and paren matching. Those should be available in pretty
> much any editor. Clojure-specific is nice, but they can correct it by
> hand trivially.

Over many years of teaching Lisp to beginners the single most effective 
debugging advice I've given is "first auto-indent it and then the error may 
become obvious." Of course that works only for certain syntax errors but that 
covers a lot of territory for beginners, and even helps me as a Lisper with 
many years of experience. Correcting indentation by hand is easy when your code 
is correct and you know what you're doing. Language-specific indentation is 
really helpful when it's not already correct or you're just learning.

>> I think that several versions of "nearly the right stuff" are available but 
>> that the bundling/instructions could be made a little more clear for 
>> newcomers in every case that I know of (each case maybe needing a slightly 
>> different tweak).
> 
> If that's the case, is there some reason you haven't created this? I'd
> be more than happy to provide web space for it if you need it.


Because I don't know how, and I'm writing here because I know that many people 
here do know how and have already done 90+% of the work. I can write you a 
quantum computer simulator or an AI search engine or a genetic programming 
engine or an ecological simulator or many other things in many languages 
including Lisp and Clojure, but writing and packaging cross-platform editors 
and development tools just isn't in my bag of tricks right now. I know it could 
be, and maybe some day I'll acquire those skills, but many others are already 
quite good at this stuff and have gone to considerable effort to create 
environments that provide almost all of what I want. So I figure it's a service 
to give my perspective on what small tweaks would make their efforts reach a 
wider audience.

--
Lee Spector, Professor of Computer Science
School of Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
lspec...@hampshire.edu, http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438

Check out Genetic Programming and Evolvable Machines:
http://www.springer.com/10710 - http://gpemjournal.blogspot.com/

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
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: Apply/Laziness question (was Re: Newb Question)

2010-06-29 Thread Meikel Brandmeyer
Hi,

On Jun 29, 4:24 pm, B Smith-Mannschott  wrote:

> This fully realizes the (range 1) before calling foo, which is
> wasteful if foo is written to consume more incrementally.
>
> I've run into this trouble with concat, when I've wanted a lazy
> sequence of the concatenation of the sequences produced by a list
> comprehension:
>
> (apply concat (for [n (range 1000)]
>                   (range 100)))
>
> Concat gets passed a fully realized sequence of 1000 lazy sequences of
> 100 integers.

I don't think that this is true. Otherwise the following wouldn't
work:
user=> (defn take-5 [& more] (take 5 more))
#'user/take-5
user=> (apply take-5 (iterate inc 0))
(0 1 2 3 4)

iterate creates an infinite sequence. So if the problem was apply, the
second call should not return.

If more than necessary is realised, I suspect some effect with chunked
seqs.

Sincerely
Meikel

-- 
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: Exceptions

2010-06-29 Thread Brenton
Nicolas,

Check out error-kit in contrib.

Brenton

On Jun 29, 7:26 am, Nicolas Oury  wrote:
> Dear all,
>
> Is there a high level facility in Clojure to create your own exceptions?
> I know you can use genclass/proxies and extend Throwable/Exception but it
> seems very (too?) close to the host language
> whereas the concept of exceptions is shared among most potential hosts.
>
> It would seems reasonable to have a few macros (defexception, deferror,
> defthrowable for example...) to abstract away
> from the JVM (for clarity and portability) while keeping the same underlying
> mechanism (for compatibility with the host).
>
> Has anyone tried anything like that? Is there a big problem with such an
> approach?
>
> Best regards,
>
> Nicolas.

-- 
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: Apply/Laziness question (was Re: Newb Question)

2010-06-29 Thread B Smith-Mannschott
On Tue, Jun 29, 2010 at 17:24, Meikel Brandmeyer  wrote:
> Hi,
>
> On Jun 29, 4:24 pm, B Smith-Mannschott  wrote:
>
>> This fully realizes the (range 1) before calling foo, which is
>> wasteful if foo is written to consume more incrementally.
>>
>> I've run into this trouble with concat, when I've wanted a lazy
>> sequence of the concatenation of the sequences produced by a list
>> comprehension:
>>
>> (apply concat (for [n (range 1000)]
>>                   (range 100)))
>>
>> Concat gets passed a fully realized sequence of 1000 lazy sequences of
>> 100 integers.
>
> I don't think that this is true. Otherwise the following wouldn't
> work:
> user=> (defn take-5 [& more] (take 5 more))
> #'user/take-5
> user=> (apply take-5 (iterate inc 0))
> (0 1 2 3 4)
>
> iterate creates an infinite sequence. So if the problem was apply, the
> second call should not return.
>
> If more than necessary is realised, I suspect some effect with chunked
> seqs.

There's nothing quite as powerful as a good counter example. You're
quite right.

I guess what I'd observed at the time I "discovered" this must have
been the effect of chunking. At the time, I did attempt the understand
the implementation of apply and through I was seeing the args sequence
being realized, but I guess I must have misunderstood the code.

// Ben

-- 
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: Life on the bleeding edge

2010-06-29 Thread Mark Engelberg
On Tue, Jun 29, 2010 at 12:30 AM, Paul Moore  wrote:
> Is there anything a clojure newbie with little JVM development
> experience (but a willingness to learn) can do to help with the
> Windows situation? From what I understand, Java itself is fine on
> Windows, so I assume this is a clojure-specific issue?
>
> Paul.

Tom mentioned to me a few weeks ago that he'd love to have some help
getting autodoc to work on Windows, and that he'd be willing to
supervise someone who had the time to make the changes.  That might be
a great way to dive in!

-- 
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: bioinformatics toolkit in clojure: what would that look like?

2010-06-29 Thread Rob Lachlan
>
> +1 if you make the function not just for vector but for any seqs. That way
> of we need special BioSeqs someday...

Yes, I concur.  I think that the default in-memory data format for
(DNA, RNA, Protein sequences) should be a vector, but that the
functions should take sequences. Mind you in some cases, we might want
to exploit transient vectors for better performance.

Rob

-- 
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: bioinformatics toolkit in clojure: what would that look like?

2010-06-29 Thread Nicolas Oury
If you want to open-source it, one way of learning and keeping other
involved
 would be to have a repository where you put what you do.
Other can look and comment at first, and maybe commit too when you think
your work will be ready for more commiters.

On Mon, Jun 28, 2010 at 9:06 PM, jandot  wrote:

>
> I've started using clojure for my bioinformatics work, but it is still
> *very* early days. Will try to become more proficient in it, but
> slowly building up a toolkit for myself might just be the seed for
> bioclojure. Have no idea to what extent clojure is used at the moment
> in the field.
>
>

-- 
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: bioinformatics toolkit in clojure: what would that look like?

2010-06-29 Thread Moritz Ulrich
I would recommend Github as a hosting-service for the code. It's free,
collaboration with others is extreme cool and most other notable
clojure projects (and even clojure itself) is hosted there.

On Tue, Jun 29, 2010 at 7:45 PM, Nicolas Oury  wrote:
> If you want to open-source it, one way of learning and keeping other
> involved
>  would be to have a repository where you put what you do.
> Other can look and comment at first, and maybe commit too when you think
> your work will be ready for more commiters.
> On Mon, Jun 28, 2010 at 9:06 PM, jandot  wrote:
>>
>> I've started using clojure for my bioinformatics work, but it is still
>> *very* early days. Will try to become more proficient in it, but
>> slowly building up a toolkit for myself might just be the seed for
>> bioclojure. Have no idea to what extent clojure is used at the moment
>> in the field.
>>
>
> --
> 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



-- 
Moritz Ulrich
Programmer, Student, Almost normal Guy

http://www.google.com/profiles/ulrich.moritz

-- 
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's n00b attraction problem

2010-06-29 Thread Mike Meyer
On Tue, 29 Jun 2010 11:15:40 -0400
Lee Spector  wrote:

> 
> On Jun 29, 2010, at 10:26 AM, Mike Meyer wrote:
> > Actually, have you looked at jedit? It's the only free Java editor
> > that isn't trying to be an IDE.
> 
> Thanks for this tip. I didn't know about jedit. I've grabbed it and see that 
> it has a built-in Clojure mode. Promising! Its idea of proper Clojure 
> indentation seems pretty nutty to me (you may have to view this in a 
> monospace font to see how odd it is):
> 
> (defn bar 
>   "check out the formatting of the let and the placement of the last line"
>   []
>   (let [x 1
>   y 2
>   z 3]
> (list x y z)))
> 
> It gets weirder for some of my more complicated definitions.
> 
> But maybe I can tweak the settings to get something more reasonable (I've 
> only tried for a minute so far).

The cross-platform editor is the only thing for the package you want
that I couldn't just grab off the net. Unfortunately, the version that
installs from ports locally doesn't have a clojure mode.

> > I think you're asking to much for the first step. They don't need
> > clojure-specific indentation; they just need a simple-minded
> > autoindent and paren matching. Those should be available in pretty
> > much any editor. Clojure-specific is nice, but they can correct it by
> > hand trivially.
> 
> Over many years of teaching Lisp to beginners the single most effective 
> debugging advice I've given is "first auto-indent it and then the error may 
> become obvious." Of course that works only for certain syntax errors but that 
> covers a lot of territory for beginners, and even helps me as a Lisper with 
> many years of experience. Correcting indentation by hand is easy when your 
> code is correct and you know what you're doing. Language-specific indentation 
> is really helpful when it's not already correct or you're just learning.

I use paren matching for that. Go to the end of the function, and walk
through the close parens, checking that they match what I think they
should. Repeat for each line that ends in more than two parens. It's
more work than the autoindent, but provides more data.

> > If that's the case, is there some reason you haven't created this? I'd
> > be more than happy to provide web space for it if you need it.
> Because I don't know how, and I'm writing here because I know that many 
> people here do know how and have already done 90+% of the work. I can write 
> you a quantum computer simulator or an AI search engine or a genetic 
> programming engine or an ecological simulator or many other things in many 
> languages including Lisp and Clojure, but writing and packaging 
> cross-platform editors and development tools just isn't in my bag of tricks 
> right now. I know it could be, and maybe some day I'll acquire those skills, 
> but many others are already quite good at this stuff and have gone to 
> considerable effort to create environments that provide almost all of what I 
> want. So I figure it's a service to give my perspective on what small tweaks 
> would make their efforts reach a wider audience.

Fair enough. Given the Jar files, it's relatively easy. You need to 1)
install the requisite jar files in a to-be-determined location, and 2)
tweak the batch scripts to know where you put the jar files, then
install them somewhere where they'll be found by the users command
processor. Do you think it's to much to require they get the JVM
somewhere else, or should that be part of the bundle as well?

 http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
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: Newb Question

2010-06-29 Thread Paul Moore
On 29 June 2010 15:14, Angel Java Lopez  wrote:
> Hi people!
>
> Paul, yes! but...
>
> The apply and str evaluations in (apply str (repeat n text))
> are lazy?
>
> I guess the result could be a big string.  Isn't it?

So you're looking for a result that behaves like a string, but isn't
an actual java.lang.String, rather it's a type that produces
characters lazily, "on demand" somehow?

I'm afraid I've no idea if Clojure has such a thing, or even if it
could support such a thing. (There's no "string abstraction" similar
to the "seq abstraction", as far as I'm aware). But I'm very new at
Clojure, so I could easily be wrong...

Paul.

-- 
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


Clj on OSX

2010-06-29 Thread Glenn, Jacob
In the spirit of getting yet another Clojure newbie up and running, I'm hoping 
someone can help me with my efforts to install Clj 
(http://github.com/liebke/clj) on OSX 10.6.3. I've been using the clj script 
provided by ClojureX, but it looks like that project has now been deprecated so 
I figured I'd upgrade.

I first tried downloading the Clj.jar file and following the recommended quick 
install:

jake$ java -jar clj-1.0.0-SNAPSHOT-standalone.jar self-install
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.VerifyError: class clojure.java.io$loading__4403__auto__ 
overrides final method meta.()Lclojure/lang/IPersistentMap; (internal.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:4658)
at clojure.lang.Compiler.eval(Compiler.java:4634)
at clojure.lang.Compiler.load(Compiler.java:4972)
at clojure.lang.RT.loadResourceScript(RT.java:330)
at clojure.lang.RT.loadResourceScript(RT.java:321)
at clojure.lang.RT.load(RT.java:399)
at clojure.lang.RT.load(RT.java:371)
at clojure.core$load__6449$fn__6458.invoke(core.clj:4171)
at clojure.core$load__6449.doInvoke(core.clj:4170)
at clojure.lang.RestFn.invoke(RestFn.java:413)
at clojure.core$load_one__6379.invoke(core.clj:4007)
at clojure.core$load_lib__6400.doInvoke(core.clj:4044)
at clojure.lang.RestFn.applyTo(RestFn.java:147)
at clojure.core$apply__4370.invoke(core.clj:438)
at clojure.core$load_libs__6417.doInvoke(core.clj:4074)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply__4370.invoke(core.clj:440)
at clojure.core$use__6443.doInvoke(core.clj:4148)
at clojure.lang.RestFn.invoke(RestFn.java:458)
at clj.main$eval__4$loading__6309__auto6.invoke(main.clj:1)
at clj.main$eval__4.invoke(main.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:4642)
at clojure.lang.Compiler.eval(Compiler.java:4634)
at clojure.lang.Compiler.load(Compiler.java:4972)
at clojure.lang.RT.loadResourceScript(RT.java:330)
at clojure.lang.RT.loadResourceScript(RT.java:321)
at clojure.lang.RT.load(RT.java:399)
at clojure.lang.RT.load(RT.java:371)
at clojure.core$load__6449$fn__6458.invoke(core.clj:4171)
at clojure.core$load__6449.doInvoke(core.clj:4170)
at clojure.lang.RestFn.invoke(RestFn.java:413)
at clojure.lang.Var.invoke(Var.java:359)
at clj.main.(Unknown Source)
Caused by: java.lang.VerifyError: class clojure.java.io$loading__4403__auto__ 
overrides final method meta.()Lclojure/lang/IPersistentMap;
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at 
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at clojure.java.io__init.load(Unknown Source)
at clojure.java.io__init.(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at clojure.lang.RT.loadClassForName(RT.java:1516)
at clojure.lang.RT.load(RT.java:389)
at clojure.lang.RT.load(RT.java:371)
at clojure.core$load__6449$fn__6458.invoke(core.clj:4171)
at clojure.core$load__6449.doInvoke(core.clj:4170)
at clojure.lang.RestFn.invoke(RestFn.java:413)
at clojure.core$load_one__6379.invoke(core.clj:4007)
at clojure.core$load_lib__6400.doInvoke(core.clj:4044)
at clojure.lang.RestFn.applyTo(RestFn.java:147)
at clojure.core$apply__4370.invoke(core.clj:438)
at clojure.core$load_libs__6417.doInvoke(core.clj:4070)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply__4370.invoke(core.clj:440)
at clojure.core$use__6443.doInvoke(core.clj:4148)
at clojure.lang.RestFn.invoke(RestFn.java:426)
at 
clj.internal$eval__12$loading__6309__auto14.invoke(internal.clj:1)
at clj.internal$eval__12.invoke(internal.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:4642)
... 32 more

I then tried cloning the git repository and building with Lein as per the 
instructions:

jake$ lein deps
[INFO] snapshot org.clojure:clojure:1.2.0-master-SNAPSHOT: checking for updates 
from central
[I

Re: Documentation and examples (and where is the documentation on reduce)?

2010-06-29 Thread michele

Silly me. I forgot about (doc …).

Thanks for the answers. Well, it's good there is documentation, pity
it's all over the place.

Meikel, idiots are nice people too, so don't feel bad. But seriously,
why do you think we work this hard to make the computer do all this
things for us? Because we're lazy.




On Jun 29, 2:17 pm, Meikel Brandmeyer  wrote:
> Hi,
>
> On Jun 29, 11:55 am, michele  wrote:
>
> > Well, to my surprise and frustration, I haven't found any place which
> > documents that reduce takes an optional initial value.
>
> http://richhickey.github.com/clojure/branch-1.1.x/index.html
>
> In particular:
>
> http://richhickey.github.com/clojure/branch-1.1.x/clojure.core-api.ht...
>
> (or alternatively: (doc reduce) at the repl)
>
> What does this leave open on questions? (Granted: reduce is rather
> well documented, there are worse examples.)
>
> > Please, dear very good Clojure creators, if you don't want Clojure to
> > be another language for the specially initiated, good examples will
> > take Clojure to the next level.
>
> Uh. Sky is falling again. But your are right. Nice examples would be a
> nice addition. It's the first thing I'm looking for, when learning
> something new. I'm not sure they should go to the reference docs,
> though.
>
> > People are just like Clojure, lazy.
>
> Why do I support lazy people in my spare time? I'm an idiot.
>
> Sincerely
> Meikel

-- 
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's n00b attraction problem

2010-06-29 Thread Sean Corfield
I believe this is what I ultimately ended up installing on my Macs:

http://github.com/carlism/Clojure-MacOSX

On Mon, Jun 28, 2010 at 8:54 PM, Lee Spector  wrote:
> What TextMate clojure bundle & instructions do you use? I've tried to play 
> with this but the installations haven't worked as advertised.
>
> On Jun 28, 2010, at 11:50 PM, Sean Corfield wrote:
>
>> TextMate has a Clojure bundle. I use it as my primary Clojure editor.

-- 
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: New Primitive data types (equal branch) - impact on optimized code.

2010-06-29 Thread j-g-faustus
OK, I tried this. Object field access instead of arrays made a few
percent difference, but not enough to be significant.

Definterface and defprotocol, on the other hand, not only gave cleaner
code but was more than twice as fast. A huge win if you ask me :)

So summarizing this particular benchmark:
* 1.1 style optimization using primitive Java arrays peaks at ~4x
slower than Java.
* 1.2 style optimization using mutable primitive fields in a deftype
is only ~1.7x (70%) slower than Java.

Links:
* more detail including profiling snapshots, JVM version etc.
  http://wiki.github.com/j-g-faustus/Clojure-test-code/
* 1.2 implementation:
  
http://github.com/j-g-faustus/Clojure-test-code/blob/master/shootout/nbody_type.clj


I haven't tried the new numeric branches, there seems to be a
sufficient number of people with opinions on those already :)

But I can add the observation that it is possible to write very fast
numeric code in the 1.2 master branch as it stands today. Possibly non-
idiomatically by using mutable fields, but still fast, still Clojure
and far cleaner than the 1.1 optimizations.

Thanks for the deftype tip.

Regards
jf

On Jun 27, 6:03 pm, Nicolas Oury  wrote:
> You could be more idiomatic and probably faster with 1.2's (definterface
> Body-ish  (x[]..). x= ...)  and the like with type annotations (or better
> with protocols, but they have no annotations yet, I think)
>  and (deftype Body [x y ...] Body-ish ).
> Object field access are a bit faster than array access on the jvm. (as a
> first try, you could mesure the difference with using the Body class from
> java and the main loop in clojure, to check where the
> difference comes from)
>
> Best regards,
>
> Nicolas.

-- 
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: Life on the bleeding edge

2010-06-29 Thread Paul Moore
On 29 June 2010 18:36, Mark Engelberg  wrote:
> On Tue, Jun 29, 2010 at 12:30 AM, Paul Moore  wrote:
>> Is there anything a clojure newbie with little JVM development
>> experience (but a willingness to learn) can do to help with the
>> Windows situation? From what I understand, Java itself is fine on
>> Windows, so I assume this is a clojure-specific issue?
>>
>> Paul.
>
> Tom mentioned to me a few weeks ago that he'd love to have some help
> getting autodoc to work on Windows, and that he'd be willing to
> supervise someone who had the time to make the changes.  That might be
> a great way to dive in!

OK, I'll take a look.

Thanks.
Paul

-- 
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's n00b attraction problem

2010-06-29 Thread Laurent PETIT
Hi Lee,

2010/6/29 Lee Spector :
>
> Thanks Laurent.
>
> Is there automatic Clojure indentation in Counterclockwise now?

There's now auto-indentation (when you hit the Enter key). What is
still missing is "bulk" reindentation (whole file at once).

There's also a "paredit-like" mode. I've called it "Structural Editing
mode", because outside emacs users, "paredit" means nothing.
The mode comes in two flavors : the "default mode" and the "strict
mode". The default mode is, well, active by default, and does not
"block" the user (e.g. a newbie user fighting the editor to add/remove
a closing paren). The "strict mode" is my preferred one, it is close
to paredit (hitting a closing paren goes right after the closing paren
of the enclosing form, etc.). Still perfectible, but already providing
great value, I think.

One think some may find as a "drawback", some not: paredit
functionalities, auto-indentation feature, only work if the code is
well structured (balanced parens , double quotes ; writing a wrong
"atom" -e.g. a symbol with invalid chars- does no harm to the overall
structure, and thus does not disable the features).

The best I can offer you as an honest answer is: if you tried it
several months ago, it's worth trying it again. You may be surprised,
but still consider it does not fit your expectations in critical areas
(in this case, please let me know), or you may consider that, while
still full of problems, your main expectations are fulfilled and then
I'll welcome you onboard.

>
> I played with it a couple of months ago and saw a lot to like, and if I 
> recall correctly a lack of indentation support was one of the main reasons I 
> kept looking for alternatives. I think I was also a little confused by some 
> of Eclipse's overall complexity and terminology (e.g. "perspectives") coming 
> from a non-Java world, and maybe by some platform-related mismatches between 
> the instructions and what I had to do (in Mac OS X) which, though minor, can 
> still be confusing when starting from zero. I think I could get over these 
> latter issues if there's indentation now.
>
> Thanks so much for providing this tool!
>
>  -Lee
>
> On Jun 29, 2010, at 8:49 AM, Laurent PETIT wrote:
>
>> The video must be seen in HD if you want to have a chance to see
>> anything on it. It has no sound, it's not a problem with your
>> computer.
>>
>> 2010/6/29 Laurent PETIT :
>>> Ok, so now, please take a look at this video (it's just 3 minutes),
>>> and you'll get a grasp at how easy it is to bootstrap an Eclipse based
>>> clojure environment : http://www.youtube.com/watch?v=1T0ZjBMIQS8
>>>
>>> Works with eclipse 3.5 and eclipse 3.6.
>>>
>>> I'm not claiming Eclipse / counterclockwise is better than IDE X or Y,
>>> but that I've rarely have complaints in the ml concerning installation
>>> problems.
>>>
>>> Oh, and the video, while a little bit outdated, shows a bunch of
>>> already existing features in Eclipse / Counterclockwise : the
>>> namespace navigator, the clojure file "outline", navigating from the
>>> namespace navigator and the file containing the definition of the var,
>>> etc.
>>>
>>> And to be totally clear, no there is currently no history in the REPL,
>>> that's planned on our TODO list. :-)
>>>
>>> --
>>> Laurent
>>>
>>> 2010/6/29 Lee Spector :

 On Jun 28, 2010, at 5:31 PM, Greg wrote:
> Have you tried IntelliJ with the La Clojure plugin? I tried all 3 IDEs 
> and I was most impressed with IntelliJ IDEA. It's not too difficult to 
> setup, and once you do it's really nice and has I think all of the stuff 
> you asked about (syntax coloring, auto-completion, doc access, etc.).


 Thanks for the recommendation. Somehow I had overlooked this one 
 previously.

 I just downloaded and installed it, installed the Plugin (a little weird 
 that there's no "Download and Install" button when you select the plugin, 
 and you have to know to right-click, but the assembla instructions told me 
 I'd have to right click it was okay), but then what?

 The assembla instructions 
 (http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Idea_and_La_Clojure)
  have a section for "To checkout a project from git" and a section for "To 
 open an existing maven-based project", but I don't want to do either. I 
 want to write and run some Clojure code from scratch. I'd like a REPL and 
 an editor buffer or two...

 Starting from Create New Project I clicked through a bunch of dialogs that 
 I didn't understand, said okay to a warning about not assigning a JDK 
 (because I didn't know what else to do there), and eventually got what 
 looks like a project window but not (as far as I see) an editor buffer or 
 a REPL.

 Returning to the assembla instructions I saw (both in the git section and 
 in the maven section) "Choose Tools|Clojure REPL|Add new Clojure REPL to 
 launch a REPL on your project." So I tr

A capital point if we don't want to loose newbies "for free"

2010-06-29 Thread Laurent PETIT
... at least it's my opinion : we should stop consider newbies are as
excited as us by the idea of working with SNAPSHOT dependencies which
work day A, break day B.

So  I think we should have no SNAPSHOT dependencies in the Getting
Starting docs, or transitive SNAPSHOT dependencies.

We can still have snapshots, of course ! But always have the doc point
a version known to work and whose dependencies are totally resolved.


Shameless plug, but I think that plugins for IDEs like
Counterclockwise for Eclipse, Enclojure for Netbeans, La Clojure for
Intellij have less "I don't manage this up and running" messages is
because the users are provided with pre-built and pre-tested versions.

Interestingly enough, problems with Enclojure seem to arise when
  * the people try to deal with labrepl (I guess labrepl has SNAPSHOT
dependencies)
  * the people try to install enclojure in the most recent version of
Netbeans (but here, the people doing this eat their own food, since
they don't use one of the versions of netbeans suggested by the
enclojure team).

In both cases, guess what ? Configuration management is the problem.

HTH,

-- 
Laurent

-- 
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's n00b attraction problem

2010-06-29 Thread Lee Spector

On Jun 29, 2010, at 2:32 PM, Sean Corfield wrote:

> I believe this is what I ultimately ended up installing on my Macs:
> 
> http://github.com/carlism/Clojure-MacOSX

Thanks... but wasn't this package declared to be obsoleted by clj? Or was that 
something else? In any event I note that there are a fair number of steps to 
the process... and it *may* be what I already tried :-). Still, I'll look into 
trying it again.

--
Lee Spector, Professor of Computer Science
School of Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
lspec...@hampshire.edu, http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438

Check out Genetic Programming and Evolvable Machines:
http://www.springer.com/10710 - http://gpemjournal.blogspot.com/

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
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's n00b attraction problem

2010-06-29 Thread Lee Spector

Laurent,

It definitely sounds like I should try the newest version, and I will. Thanks!!

 -Lee


On Jun 29, 2010, at 2:41 PM, Laurent PETIT wrote:
> 
> There's now auto-indentation (when you hit the Enter key). What is
> still missing is "bulk" reindentation (whole file at once).
> 
> There's also a "paredit-like" mode. I've called it "Structural Editing
> mode", because outside emacs users, "paredit" means nothing.
> The mode comes in two flavors : the "default mode" and the "strict
> mode". The default mode is, well, active by default, and does not
> "block" the user (e.g. a newbie user fighting the editor to add/remove
> a closing paren). The "strict mode" is my preferred one, it is close
> to paredit (hitting a closing paren goes right after the closing paren
> of the enclosing form, etc.). Still perfectible, but already providing
> great value, I think.
> 
> One think some may find as a "drawback", some not: paredit
> functionalities, auto-indentation feature, only work if the code is
> well structured (balanced parens , double quotes ; writing a wrong
> "atom" -e.g. a symbol with invalid chars- does no harm to the overall
> structure, and thus does not disable the features).
> 
> The best I can offer you as an honest answer is: if you tried it
> several months ago, it's worth trying it again. You may be surprised,
> but still consider it does not fit your expectations in critical areas
> (in this case, please let me know), or you may consider that, while
> still full of problems, your main expectations are fulfilled and then
> I'll welcome you onboard.

--
Lee Spector, Professor of Computer Science
School of Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
lspec...@hampshire.edu, http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438

Check out Genetic Programming and Evolvable Machines:
http://www.springer.com/10710 - http://gpemjournal.blogspot.com/

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
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


Record bug?

2010-06-29 Thread Daniel Gagnon
Under the latest snapshot of the equiv branch (07f05862c2), if I create a
record:

(defrecord MyRecord [foo bar baz])

and then create a record out of it:

(def x (MyRecord. 1 2 3))

I can use a keyword as a function to get the data:

(:foo x)
1

But if I use the record as a function like I would for a map, I get an
error:

(x :foo)
java.lang.ClassCastException: user.MyRecord cannot be cast to
clojure.lang.IFn

Is that a bug or is there something I don't get about records?

-- 
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: A capital point if we don't want to loose newbies "for free"

2010-06-29 Thread Tim Daly

This is a well-solved problem in open source.

It involves keep a "gold version" of the system on some well-known
site (e.g. sourceforge) and a "silver version" on another well-known
site (e.g. github).

The gold version is released on a regular basis (say, once every 2
months). It is tested using an ever-growing test suite. It is
packaged with both source and binary for a wide variety of systems.
There should be a website supporting the gold version. Docs on this
site are up to date. There is a revision history.

The silver version changes daily. Changes are only posted to the
silver system after they pass the test suite. If they add new functions
they are posted with new tests. If they change old functions the tests
have to be updated to pass. It is a cardinal sin to "break the build".
A week before release to Gold the silver version is frozen except for
bug fixes.

Laurent PETIT wrote:

... at least it's my opinion : we should stop consider newbies are as
excited as us by the idea of working with SNAPSHOT dependencies which
work day A, break day B.

So  I think we should have no SNAPSHOT dependencies in the Getting
Starting docs, or transitive SNAPSHOT dependencies.

We can still have snapshots, of course ! But always have the doc point
a version known to work and whose dependencies are totally resolved.


Shameless plug, but I think that plugins for IDEs like
Counterclockwise for Eclipse, Enclojure for Netbeans, La Clojure for
Intellij have less "I don't manage this up and running" messages is
because the users are provided with pre-built and pre-tested versions.

Interestingly enough, problems with Enclojure seem to arise when
  * the people try to deal with labrepl (I guess labrepl has SNAPSHOT
dependencies)
  * the people try to install enclojure in the most recent version of
Netbeans (but here, the people doing this eat their own food, since
they don't use one of the versions of netbeans suggested by the
enclojure team).

In both cases, guess what ? Configuration management is the problem.

HTH,

  


--
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: New Primitive data types (equal branch) - impact on optimized code.

2010-06-29 Thread David Nolen
On Tue, Jun 29, 2010 at 2:05 PM, j-g-faustus wrote:

> OK, I tried this. Object field access instead of arrays made a few
> percent difference, but not enough to be significant.
>
> Definterface and defprotocol, on the other hand, not only gave cleaner
> code but was more than twice as fast. A huge win if you ask me :)
>
> So summarizing this particular benchmark:
> * 1.1 style optimization using primitive Java arrays peaks at ~4x
> slower than Java.
> * 1.2 style optimization using mutable primitive fields in a deftype
> is only ~1.7x (70%) slower than Java.
>
> Links:
> * more detail including profiling snapshots, JVM version etc.
>  http://wiki.github.com/j-g-faustus/Clojure-test-code/
> * 1.2 implementation:
>
> http://github.com/j-g-faustus/Clojure-test-code/blob/master/shootout/nbody_type.clj
>
> I haven't tried the new numeric branches, there seems to be a
> sufficient number of people with opinions on those already :)
>

You should give the latest equiv branch a shot and let us know. The gap
should be a bit smaller since arithmetic operations won't box their results.

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: A capital point if we don't want to loose newbies "for free"

2010-06-29 Thread Laurent PETIT
Course, this seems ideal.

But I'm pretty sure that already 80% of the value will come if we just
correctly "control" what we deliver to newbies in terms of fixed
dependency graph.

2010/6/29 Tim Daly :
> This is a well-solved problem in open source.
>
> It involves keep a "gold version" of the system on some well-known
> site (e.g. sourceforge) and a "silver version" on another well-known
> site (e.g. github).
>
> The gold version is released on a regular basis (say, once every 2
> months). It is tested using an ever-growing test suite. It is
> packaged with both source and binary for a wide variety of systems.
> There should be a website supporting the gold version. Docs on this
> site are up to date. There is a revision history.
>
> The silver version changes daily. Changes are only posted to the
> silver system after they pass the test suite. If they add new functions
> they are posted with new tests. If they change old functions the tests
> have to be updated to pass. It is a cardinal sin to "break the build".
> A week before release to Gold the silver version is frozen except for
> bug fixes.
>
> Laurent PETIT wrote:
>>
>> ... at least it's my opinion : we should stop consider newbies are as
>> excited as us by the idea of working with SNAPSHOT dependencies which
>> work day A, break day B.
>>
>> So  I think we should have no SNAPSHOT dependencies in the Getting
>> Starting docs, or transitive SNAPSHOT dependencies.
>>
>> We can still have snapshots, of course ! But always have the doc point
>> a version known to work and whose dependencies are totally resolved.
>>
>>
>> Shameless plug, but I think that plugins for IDEs like
>> Counterclockwise for Eclipse, Enclojure for Netbeans, La Clojure for
>> Intellij have less "I don't manage this up and running" messages is
>> because the users are provided with pre-built and pre-tested versions.
>>
>> Interestingly enough, problems with Enclojure seem to arise when
>>  * the people try to deal with labrepl (I guess labrepl has SNAPSHOT
>> dependencies)
>>  * the people try to install enclojure in the most recent version of
>> Netbeans (but here, the people doing this eat their own food, since
>> they don't use one of the versions of netbeans suggested by the
>> enclojure team).
>>
>> In both cases, guess what ? Configuration management is the problem.
>>
>> HTH,
>>
>>
>
> --
> 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's n00b attraction problem

2010-06-29 Thread Chas Emerick

Yes, CCW has automatic indentation at this point.

- Chas

On Jun 29, 2010, at 9:32 AM, Lee Spector wrote:



Thanks Laurent.

Is there automatic Clojure indentation in Counterclockwise now?

I played with it a couple of months ago and saw a lot to like, and  
if I recall correctly a lack of indentation support was one of the  
main reasons I kept looking for alternatives. I think I was also a  
little confused by some of Eclipse's overall complexity and  
terminology (e.g. "perspectives") coming from a non-Java world, and  
maybe by some platform-related mismatches between the instructions  
and what I had to do (in Mac OS X) which, though minor, can still be  
confusing when starting from zero. I think I could get over these  
latter issues if there's indentation now.


Thanks so much for providing this tool!

-Lee

On Jun 29, 2010, at 8:49 AM, Laurent PETIT wrote:


The video must be seen in HD if you want to have a chance to see
anything on it. It has no sound, it's not a problem with your
computer.

2010/6/29 Laurent PETIT :

Ok, so now, please take a look at this video (it's just 3 minutes),
and you'll get a grasp at how easy it is to bootstrap an Eclipse  
based

clojure environment : http://www.youtube.com/watch?v=1T0ZjBMIQS8

Works with eclipse 3.5 and eclipse 3.6.

I'm not claiming Eclipse / counterclockwise is better than IDE X  
or Y,
but that I've rarely have complaints in the ml concerning  
installation

problems.

Oh, and the video, while a little bit outdated, shows a bunch of
already existing features in Eclipse / Counterclockwise : the
namespace navigator, the clojure file "outline", navigating from the
namespace navigator and the file containing the definition of the  
var,

etc.

And to be totally clear, no there is currently no history in the  
REPL,

that's planned on our TODO list. :-)

--
Laurent

2010/6/29 Lee Spector :


On Jun 28, 2010, at 5:31 PM, Greg wrote:
Have you tried IntelliJ with the La Clojure plugin? I tried all  
3 IDEs and I was most impressed with IntelliJ IDEA. It's not too  
difficult to setup, and once you do it's really nice and has I  
think all of the stuff you asked about (syntax coloring, auto- 
completion, doc access, etc.).



Thanks for the recommendation. Somehow I had overlooked this one  
previously.


I just downloaded and installed it, installed the Plugin (a  
little weird that there's no "Download and Install" button when  
you select the plugin, and you have to know to right-click, but  
the assembla instructions told me I'd have to right click it was  
okay), but then what?


The assembla instructions (http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Idea_and_La_Clojure 
) have a section for "To checkout a project from git" and a  
section for "To open an existing maven-based project", but I  
don't want to do either. I want to write and run some Clojure  
code from scratch. I'd like a REPL and an editor buffer or two...


Starting from Create New Project I clicked through a bunch of  
dialogs that I didn't understand, said okay to a warning about  
not assigning a JDK (because I didn't know what else to do  
there), and eventually got what looks like a project window but  
not (as far as I see) an editor buffer or a REPL.


Returning to the assembla instructions I saw (both in the git  
section and in the maven section) "Choose Tools|Clojure REPL|Add  
new Clojure REPL to launch a REPL on your project." So I tried  
this but got "Can't creat REPL. Clojure home path is not  
configured correctly!"


It's possible that this is the environment that I'm looking for,  
but my new user experience is not going very well at this point.


Any pointers would be appreciated.

Thanks,

-Lee

--
Lee Spector, Professor of Computer Science
School of Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
lspec...@hampshire.edu, http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438

Check out Genetic Programming and Evolvable Machines:
http://www.springer.com/10710 - http://gpemjournal.blogspot.com/

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
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


--
Lee Spector, Professor of Computer Science
School of Cognitive Science, Hampshire College

Re: Documentation and examples (and where is the documentation on reduce)?

2010-06-29 Thread Meikel Brandmeyer
Hi,

Am 29.06.2010 um 19:11 schrieb michele:

> Meikel, idiots are nice people too, so don't feel bad. But seriously,
> why do you think we work this hard to make the computer do all this
> things for us? Because we're lazy.

Ah. IMHO, computer help us solving problems which we wouldn't have without them.

But then: laziness is the source of intelligence. Or was it the other way 
around?

;)

Sincerely
Meikel

-- 
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's n00b attraction problem

2010-06-29 Thread Chas Emerick


On Jun 28, 2010, at 8:30 PM, Greg wrote:

- Clojure (and some environment for working with it) must be as  
"friendly" and approachable for new users as possible.  It is not  
an "expert's" or "professional's" language, at least in my  
conception, and thinking of it that way will doom it to  
irrelevancy.  Our community has been extraordinarily open and  
welcoming to newcomers for years, and any change in that posture  
would be devastating.  I (thankfully) have little fear of this  
actually happening.


I hope you're right, because it seems like some people are really  
gunning for this silly "comp. sci. professors-only" perspective.  
It's made sillier still considering that one of the main motivations  
behind Clojure was to create a practical Lisp.


Indeed, there are many nontrivial personas that actively wish for a  
smaller (or at least not maximally large), more exclusive community.   
It's extraordinarily helpful that Rich et al. established early on  
that RTFM (or RTFSourceCode) shan't be the community's default  
posture.  That tension is revisited once every several months (such as  
it has been the last few days), and probably will be again for years  
to come depending on how much the community grows.


- Chas

--
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 documentation review?

2010-06-29 Thread Phil Hagelberg
On Wed, Jun 16, 2010 at 9:24 PM, Phil Hagelberg  wrote:
> I'm pushing for a Leiningen 1.2.0 release really soon now, and part of
> that effort is sprucing up the documentation. I've revamped the readme
> and added a tutorial for folks just getting started. Of course,
> self-editing is never as good as having outside help, so I'd love it
> if I could get some feedback on it. I'm particularly interested in
> opinions from people who are just starting out with Clojure--it's easy
> for me to take things for granted that not everyone understands.
>
> Mostly I'd like feedback on the tutorial:
> http://github.com/technomancy/leiningen/blob/master/TUTORIAL.md
>
> But if you've got some time to look over the readme, that would be
> great too: http://github.com/technomancy/leiningen/blob/master/README.md

With all the newbies that have chimed in recently with strong opinions
on the newbies thread, I was wondering if I could convince some of
them to help the out-of-the-box experience by suggesting improvements
to the recently-revised pieces of documentation above. =)

-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.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Record bug?

2010-06-29 Thread Moritz Ulrich
I think record doen't implements all the stuff a PersistentMap
implementes. It implementes the interface for map-lookup (with get and
:foo) but doesn't implements IFn (for using an instance as a
function).

On Tue, Jun 29, 2010 at 9:16 PM, Daniel Gagnon  wrote:
> Under the latest snapshot of the equiv branch (07f05862c2), if I create a
> record:
> (defrecord MyRecord [foo bar baz])
> and then create a record out of it:
> (def x (MyRecord. 1 2 3))
> I can use a keyword as a function to get the data:
> (:foo x)
> 1
> But if I use the record as a function like I would for a map, I get an
> error:
> (x :foo)
> java.lang.ClassCastException: user.MyRecord cannot be cast to
> clojure.lang.IFn
> Is that a bug or is there something I don't get about records?
>
> --
> 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



-- 
Moritz Ulrich
Programmer, Student, Almost normal Guy

http://www.google.com/profiles/ulrich.moritz

-- 
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's n00b attraction problem

2010-06-29 Thread Chas Emerick
First, just to gather a gestalt here (names elided as I'm not trying  
to single anyone out):


On Jun 28, 2010, at 10:54 PM, XXX wrote:


If you are going to go to all the trouble to work with Clojure, you
might as well be exposed to the reality of a semi-production Clojure
project.  Put the waterwings on the kid, but then throw him in the
deep end.  If he can't swim, he isn't ready for macros anyway.



On Jun 28, 2010, at 11:50 PM, XXX wrote:


If folks find the Java stack intimidating, maybe Clojure isn't for
them? Lots of language run on the JVM and they all require some basic
knowledge of classpaths, build tools and existing IDEs such as
Ecliper, NetBeans, IntelliJ etc. If folks are new to all that, I don't
think it's Clojure's job to teach them - there's plenty of literature
out there about the JVM environment and tools.



On Jun 29, 2010, at 1:11 AM, XXX wrote:


The fact remains though that Clojure trades in heavy concepts. The
syntax alone will simply be a non-starter for at least half the
potential audience. Toss in concurrency and non-mutability and
ubiquitous recursion which are tricky concepts no matter how cleanly
exposed in the language. As many posters have said in this thread, you
really do have to have a decent grasp on Java to do real work in
Clojure so you're already on the hook for two languages, one of which
is a baroque and provincial monster. Like any engineering problem,
language design is about tradeoffs. Obviously Rich has worked hard to
make Clojure as approachable as possible but you can't simultaneously
emphasize tackling the really hard problems in software engineering
and making CRUDDY webapps as painless as possible for the average
programmer.


Stop.  Please, just stop.

The discussion about newcomers is *not* about what one needs to know  
or should know in order to build über-complicated applications for  
deployment in "production" -- it's about what the learning curve looks  
and feels like to various constituencies.


Any talk about how Clojure might be "too much" for some, for whatever  
reason, is out of bounds IMO.  Clojure, as a language, is *simpler*  
than just about all of the popular alternatives out there, and the  
language is eminently approachable and practical for programmers from  
varying domains and with varying levels of experience.


The key is making the sometimes-tricky, sometimes-unfamiliar  
operational details of the underlying platform less of a burden, or  
ideally, nonexistent for that critical first couple of weeks or months  
of exploratory, experimental programming.  As I said in a prior note,  
this challenge will remain for any flavor of Clojure, so it'd be best  
if we embraced the fact that plastering over platform minutiae is  
going to be a constant requirement, and thoughtfully approach the  
problem rather than reverting to showing people the door if they don't  
grok the full stack or simply believe that it's not relevant to them  
(e.g. within a purely pedagogical environment).


Cheers,

- Chas

--
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's n00b attraction problem

2010-06-29 Thread WoodHacker

> So I wonder how much making the first few baby steps easier is really
> going to help the uptake of Clojure. I have to imagine that the kind
> of person that can't figure out  a CLASSPATH is going to have his head
> explode when he has to figure out how to restructure all his
> iterations in terms of loop/recur.

This discussion, although interesting, is ridiculous.I've been
doing this for nearly 40 years and if I'd listened to all the people
who worried that new languages were to hard for noobs, I'd still be
writing Fortran or Cobal.C was hard when it first came out - for
most of the same reasons people are using with Clojure.Clojure is
a great language now and can only get better because it mixes the
greatest language ever invented (Lisp) with the best library
available.People have complained for years about the limitations
of Lisp, but it's still with us (whatever happened to PL1?)All
Lisp has ever needed was a universal library.   Let the faint of heart
turn away - they will come back.

-- 
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: A capital point if we don't want to loose newbies "for free"

2010-06-29 Thread Mike Meyer
On Tue, 29 Jun 2010 20:54:28 +0200
Laurent PETIT  wrote:

> ... at least it's my opinion : we should stop consider newbies are as
> excited as us by the idea of working with SNAPSHOT dependencies which
> work day A, break day B.
> 
> So  I think we should have no SNAPSHOT dependencies in the Getting
> Starting docs, or transitive SNAPSHOT dependencies.

Doesn't this just boil down to "newbies shouldn't run unreleased
software"? Which is considered simple common sense in most
communities.

> We can still have snapshots, of course ! But always have the doc point
> a version known to work and whose dependencies are totally resolved.

I'd recommend that pages telling you how to install them *also* point
out that this is bleeding edge stuff, may have problems or be hard to
install, and if you're not prepared to deal with those and provide
feedback on them, you'd best go back to the released software.

  http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
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's n00b attraction problem

2010-06-29 Thread Sean Corfield
On Mon, Jun 28, 2010 at 8:14 PM, Greg  wrote:
> Just because you found it easy to get started, does not mean others do, and 
> judging from the reaction to my post, I'm by no means the only person to feel 
> this way.
>
> You went to a bootcamp to learn clojure, you found some Clojure-MacOSX 
> package, and you're perfectly fine with using a Terminal and TextMate. Others 
> do not come from your point of view.

Right, and I wasn't trying to invalidate those other points of view. I
was just saying that I don't think Clojure itself - language and
environment - is *unusually* difficult to get up and running. I
actually agree with all the comments in the thread about the base
level of Java / JVM complexity that acts as a barrier to entry for
those not coming from a Java / JVM background. It afflicts all the
'new' JVM-targeted languages pretty much equally: Groovy / Grails,
Scala / Lift are both good examples of 'new'(-ish) technologies that
have a lot of Java / JVM baggage which can be off-putting. With Lift,
I didn't even get further than the first example that wanted me to use
Maven... sorry, but I just don't need that much pain in my life! Now
there's a movement to get Lift powered by sbt (Scala Build Tool) which
is to Scala something like lein is to Clojure (sbt actually does a
better job of hiding the underlying unpleasantness, IMO, but it has a
head start and I expect lein will continue to improve too). I'll
probably start using Lift once sbt becomes the preferred build tool
for it.

Back to Clojure: I think some of the folks coming here from non-JVM
backgrounds would find the same obstacles with Scala or any other
JVM-based language. I'm not sure realistically how much that can be
simplified beyond lein. I think the IDE question is interesting. When
looking at any new language (and I try to learn a new language every
year), I don't want to be forced to learn a new IDE. I want to be able
to use one of my existing IDEs or editors. I suspect that's true for a
number of people and the only viable result is lots of plugins for
lots of IDEs - which, with a very new language, means variable quality
or even lack of support within some IDEs. Clojure is probably the
youngest language I've ever tried to learn. Certainly its tool support
seems to be the most immature of anything I've tried to work with (no
criticism intended - it's just young).

I don't think there are any easy solutions. I _do_ think it'll improve
over time. Clojure may simply be at a point where, right now, it's
just not able to be very n00b-friendly for some classes of n00bs. The
feedback from those n00bs - and I still consider myself one of them -
is still useful (of course) but I suspect we'll have to muddle through
for quite a while yet before things get friendly enough to satisfy
most people :)

In response to Chas, you said "If there was a single-awesome catch-all
setup that served the needs of 80% of Clojure users, that would not be
the case, and Clojure's community would thrive." and when I first
started asking about Clojure I was pointed at Emacs and I was like
"Uh-oh! There has to be a simpler way to learn Clojure?". It does seem
like Emacs is the default IDE choice that's offered to n00bs and I
used Emacs a long, long time ago and never want to go back to it (and,
yes, I know people who love Emacs and I'm not saying it's a bad IDE,
it's just not one I want to use).

I'd prefer to use an Eclipse-based solution because I already do all
my Java / Groovy / Scala (and CFML) development in Eclipse. Sounds
like there's a viable option for that now so I'll try it.

As for the Java / JVM baggage. I don't know what to suggest there. I
agree it's "yet another thing to learn" if you don't have that
background but it's a one-time thing and it sets you up for using any
of the other JVM-targeted languages since they all work the same way.
I suspect I'd hit the same problem trying to learn Ruby with its gem
system or any .NET language (although, of course, there I'd be pretty
much forced to learn a new IDE - Visual Whatever - and, in my case, a
new O/S since I'm a Mac/Linux guy primarily).
-- 
Sean A Corfield -- (904) 302-SEAN
Railo Technologies, Inc. -- http://getrailo.com/
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

-- 
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: Record bug?

2010-06-29 Thread Daniel Gagnon
Is it by design or it just doesn't implement it yet?

On Tue, Jun 29, 2010 at 4:14 PM, Moritz Ulrich  wrote:

> I think record doen't implements all the stuff a PersistentMap
> implementes. It implementes the interface for map-lookup (with get and
> :foo) but doesn't implements IFn (for using an instance as a
> function).
>
> On Tue, Jun 29, 2010 at 9:16 PM, Daniel Gagnon 
> wrote:
> > Under the latest snapshot of the equiv branch (07f05862c2), if I create a
> > record:
> > (defrecord MyRecord [foo bar baz])
> > and then create a record out of it:
> > (def x (MyRecord. 1 2 3))
> > I can use a keyword as a function to get the data:
> > (:foo x)
> > 1
> > But if I use the record as a function like I would for a map, I get an
> > error:
> > (x :foo)
> > java.lang.ClassCastException: user.MyRecord cannot be cast to
> > clojure.lang.IFn
> > Is that a bug or is there something I don't get about records?
> >
> > --
> > 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
>
>
>
> --
> Moritz Ulrich
> Programmer, Student, Almost normal Guy
>
> http://www.google.com/profiles/ulrich.moritz
>
> --
> 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: Record bug?

2010-06-29 Thread Moritz Ulrich
I think it's by-design, but I might be wrong.

On Tue, Jun 29, 2010 at 11:01 PM, Daniel Gagnon  wrote:
> Is it by design or it just doesn't implement it yet?
>
> On Tue, Jun 29, 2010 at 4:14 PM, Moritz Ulrich
>  wrote:
>>
>> I think record doen't implements all the stuff a PersistentMap
>> implementes. It implementes the interface for map-lookup (with get and
>> :foo) but doesn't implements IFn (for using an instance as a
>> function).
>>
>> On Tue, Jun 29, 2010 at 9:16 PM, Daniel Gagnon 
>> wrote:
>> > Under the latest snapshot of the equiv branch (07f05862c2), if I create
>> > a
>> > record:
>> > (defrecord MyRecord [foo bar baz])
>> > and then create a record out of it:
>> > (def x (MyRecord. 1 2 3))
>> > I can use a keyword as a function to get the data:
>> > (:foo x)
>> > 1
>> > But if I use the record as a function like I would for a map, I get an
>> > error:
>> > (x :foo)
>> > java.lang.ClassCastException: user.MyRecord cannot be cast to
>> > clojure.lang.IFn
>> > Is that a bug or is there something I don't get about records?
>> >
>> > --
>> > 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
>>
>>
>>
>> --
>> Moritz Ulrich
>> Programmer, Student, Almost normal Guy
>>
>> http://www.google.com/profiles/ulrich.moritz
>>
>> --
>> 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



-- 
Moritz Ulrich
Programmer, Student, Almost normal Guy

http://www.google.com/profiles/ulrich.moritz

-- 
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's n00b attraction problem

2010-06-29 Thread Brian Hurt
On Tue, Jun 29, 2010 at 4:22 PM, Chas Emerick  wrote:

>
> The discussion about newcomers is *not* about what one needs to know or
> should know in order to build über-complicated applications for deployment
> in "production" -- it's about what the learning curve looks and feels like
> to various constituencies.
>
>
No.  This discussion is/was about (non-specific) changes being proposed to
Clojure.  And the making the word "constituencies" plural implies "more than
one", when only one constituency has been advocated for in the entire
discussion- the constituency of programmers whose heads explode if they are
introduced to editors more complicated than notepad, version control more
complicated than backing up floppy (USB keychain nowadays, I'd guess), build
environments more complicated than "click run", and more than one choice in
any of the above.

And before you get on me about my characterization here, these aren't the
assumptions I'm making, these are assumptions other people in this thread
(including the original blog post) are making.  They're just not phrased
quite so bluntly.


> Any talk about how Clojure might be "too much" for some, for whatever
> reason, is out of bounds IMO.  Clojure, as a language, is *simpler* than
> just about all of the popular alternatives out there, and the language is
> eminently approachable and practical for programmers from varying domains
> and with varying levels of experience.
>

Ignoring the Java side of things, and for a specific definition of "simple",
this may be correct.  But you can't ignore the Java side of things when
measuring complexity.  Even relatively simple things, like opening up a
network socket, require you to interact with Java.

Ever seen the cockpit of a 747?

Brian

-- 
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

  1   2   >