Re: Intro to Live Programming with Overtone
(I mean, the visual effects in particular) On Sun, Apr 24, 2011 at 6:49 PM, rob levy wrote: > Wow, that is awesome, I am definitely going to have to play with that. As > a side note, what did you write or use to configure your emacs in that way? > > On Sun, Apr 24, 2011 at 8:01 AM, Sam Aaron wrote: > >> Hey there, >> >> you may have heard about Overtone - the Clojure front-end to SuperCollider >> server that we've been working on for the past year or so. However, perhaps >> you've not seen much of it - and if not perhaps you'd like to? >> >> Well, I've just finished putting together a very short (4 min) fast-paced >> introduction to Live Programming with Overtone, or you might think of it as >> How to Hack Clojure to make Music :-) >> >> http://vimeo.com/22798433 >> >> (This video also serves to demo the Live Coding Emacs Config >> https://github.com/overtone/live-coding-emacs) >> >> If you're interested in finding out more and getting involved, head to our >> mailing list: http://groups.google.com/group/overtone >> >> Sam >> >> --- >> http://sam.aaron.name >> >> -- >> 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: Intro to Live Programming with Overtone
Wow, that is awesome, I am definitely going to have to play with that. As a side note, what did you write or use to configure your emacs in that way? On Sun, Apr 24, 2011 at 8:01 AM, Sam Aaron wrote: > Hey there, > > you may have heard about Overtone - the Clojure front-end to SuperCollider > server that we've been working on for the past year or so. However, perhaps > you've not seen much of it - and if not perhaps you'd like to? > > Well, I've just finished putting together a very short (4 min) fast-paced > introduction to Live Programming with Overtone, or you might think of it as > How to Hack Clojure to make Music :-) > > http://vimeo.com/22798433 > > (This video also serves to demo the Live Coding Emacs Config > https://github.com/overtone/live-coding-emacs) > > If you're interested in finding out more and getting involved, head to our > mailing list: http://groups.google.com/group/overtone > > Sam > > --- > http://sam.aaron.name > > -- > 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: ANN: Clojure Atlas (preview!)
Again, it's not that *I* wouldn't pay, it just seems unfortunate that most people won't get to use it. Whether right or misguided, there is a culture of free as in free beer on the net, that will result in most not giving it a chance. A separate but related issue is the advantage of free as in freedom; if designed for collaborative content development, that would make the service more actively used and free of errors, and more scalable to include models of other libraries, with library developers using the tool to model their own new libraries. On Tue, Apr 19, 2011 at 1:39 PM, Chas Emerick wrote: > > On Apr 19, 2011, at 1:10 PM, rob levy wrote: > > > This seems great. The $20 bothers me, not because I don't want to pay > it, I would gladly donate this meager amount for such a useful resource. > There's just something in poor taste about not making this open to > everyone. And there's an implicit camaraderie and good will that developer > communities have come to expect that makes this paywall seem weird and > unwelcoming. If you framed this as a donation, with access not contingent > on donation, it would be perfectly fine-- and people might actually use it. > > If people feel that the work is worthwhile, they'll pay, if not, they > won't. I suspect that I'll end up sinking about a full man-month into the > ontology when all is said and done (with incremental improvements as later > versions of Clojure are released, etc) so I don't feel badly about charging > real money for that, and being honest and direct about the nature of the > transaction. Nevermind the effort around the UX, etc. > > Really, I'd wish more developers would charge reasonable amounts for tools > that they work on for free in their spare time; perhaps more of them would > work on them full-time, and we'd have better tools! > > Anyway, it's just a preview site at the moment -- there's no "paywall" > anywhere. > > - 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 > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: ANN: Clojure Atlas (preview!)
I think there might be something I don't get about the "hand-curated" aspect. It would be great if it could be crowd sourced, with the kinds of heterarchical guarantees of quality and expertise that have served services like StackOverflow and Wikipedia so well. On Tue, Apr 19, 2011 at 1:26 PM, Aaron Bedra wrote: > Also, when I mean "per project", I mean that in the sense that I am > working with different customers who would find it valuable and pay for the > access for them :) > > > -- > Cheers, > > Aaron Bedra > -- > Clojure/corehttp://clojure.com > > > > On 04/19/2011 01:23 PM, Aaron Bedra wrote: > > I would pay $20 per project for this easily. You did some great work (from > the looks of it anyways) and you should get the financial reward from it. > This isn't a charity, it's a service, and I would treat it as such. Keep up > the awesome! > > -- > Cheers, > > Aaron Bedra > -- > Clojure/corehttp://clojure.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: ANN: Clojure Atlas (preview!)
This seems great. The $20 bothers me, not because I don't want to pay it, I would gladly donate this meager amount for such a useful resource. There's just something in poor taste about not making this open to everyone. And there's an implicit camaraderie and good will that developer communities have come to expect that makes this paywall seem weird and unwelcoming. If you framed this as a donation, with access not contingent on donation, it would be perfectly fine-- and people might actually use it. On Tue, Apr 19, 2011 at 12:45 PM, Paul deGrandis wrote: > This is a great piece visualization for Clojure and very much how I > think about the language as I'm working with it (based on the pictures > and descriptions). This is a nice niche piece of documentation for > the community, power users, and newly emerging Clojure shops. > > Is your freemium model limiting namespaces/content. functionality, or > both? > > Paul > > > On Apr 19, 9:27 am, Ambrose Bonnaire-Sergeant > wrote: > > Oh wow, this looks exciting! Subbed. > > > > Ambrose > > > > On Wed, Apr 20, 2011 at 12:19 AM, Chas Emerick >wrote: > > > > > > > > > > > > > > > > > Today, I’m opening up a “preview” site for Clojure Atlas [1], a new > side > > > project of mine that I’m particularly excited about. > > > > > Clojure Atlas is an experiment in visualizing a programming language > and > > > its standard library. I’ve long been frustrated with the limitations > of > > > text in programming, and this is my attempt to do something about it. > From > > > the site: > > > > > While Clojure Atlas has a number of *raisons d’être*, it fundamentally > > > exists because I’ve consistently thought that typical programming > language > > > and API references – being, in general, walls of text and alphabetized > links > > > – are really poor at conveying the most important information: not the > > > minutiae of function signatures and class hierarchies, but the stuff > that’s > > > “between the lines”, the context and interrelationships between such > things > > > that too often are only discovered and internalized by bumping into > them in > > > the course of programming. This is especially true if we’re learning a > > > language and its libraries (really, a never-ending process given the > march > > > of progress), and what’s standing in our way is not, for example, being > able > > > to easily access the documentation or signature for a particular known > > > function, but *discovering* the mere existence of a previously-unknown > > > function that is perfect for our needs at a given moment. > > > > > This is just a preview – all sizzle and no steak, as it were. I’m > working > > > away at the ontology that drives the visualization and user experience, > but > > > I want to get some more early (quiet) feedback from a few folks to make > sure > > > I’m not committing egregious sins in various ways before throwing open > the > > > doors to the world. > > > > > In the meantime, if you’re really interested, follow @ClojureAtlas [2], > > > and/or sign up for email updates [3] on the site. > > > - Chas > > > > > [1]http://clojureatlas.com > > > [2]http://twitter.com/ClojureAtlas > > > [3]http://clojureatlas.com/subscribe > > > > > P.S. This is a ML repost of my announcement @ > > >http://cemerick.com/2011/04/19/clojure-atlas-preview/ > > > > > -- > > > 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 > -- 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: Clojures macro system is essentially hygienic -- In the good sense.
Sometimes it is useful to have a referentially opaque symbol that you can refer to when calling a macro. Clojure's design encourages the idiom of let bindings instead of anaphora to maintain referential transparency, but in some cases it is preferable to capture a symbol and make use of it. If you are familiar with Perl, you know about the $_ anaphor. In Lisps you can create things of that sort using macros. For example you could define a simple macro you call as (aif foo (cons it lis)) where "it" seems to come out of nowhere but is in fact captured at macro-expansion time and in the expanded code this symbol is lexically bound to a value. On Tue, Apr 12, 2011 at 10:24 AM, Jeffrey Schwab wrote: > On Tuesday, April 12, 2011 9:25:25 AM UTC-4, rob wrote: >> >> One Scheme advocate I know has that suggested that it would be more >> hygienic to have gensyms be the rule instead of the exception to the rule >> (you could still get capture by asking to *not* gensym). I'm not certain I >> agree with him, because I haven't fully considered if that would add or >> reduce complexity when trying to do things like anaphora (which is already >> made somewhat non-idiomatic). >> > > What do you mean by "anaphora" in this context? Could you please provide > an example in code? > > -- > 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: Clojures macro system is essentially hygienic -- In the good sense.
Clojure's automatic gensym feature in defmacro is similar to the idea suggested in Hoyte's Common Lisp book "Let Them Eat Lambda", though I gather it's not historically originated by Hoyte as similar ideas have been implemented by others. One Scheme advocate I know has that suggested that it would be more hygienic to have gensyms be the rule instead of the exception to the rule (you could still get capture by asking to *not* gensym). I'm not certain I agree with him, because I haven't fully considered if that would add or reduce complexity when trying to do things like anaphora (which is already made somewhat non-idiomatic). On Mon, Apr 11, 2011 at 10:42 AM, Armando Blancas wrote: > That's because of the order of the definitions of foobar and let. > Thus: > > guik.evil=> (macroexpand '(foobar 10)) > (let* [a__44__auto__ 10] (clojure.core/+ a__44__auto__ a__44__auto__)) > > But defining let before foobar: > > guik.evil=> (macroexpand-1 '(let)) > (guik.evil/let*) > guik.evil=> (macroexpand-1 (macroexpand-1 '(let))) > 2 > guik.evil=> (macroexpand-1 '(foobar 10)) > (guik.evil/let [a__17__auto__ 10] (clojure.core/+ a__17__auto__ > a__17__auto__)) > guik.evil=> (macroexpand-1 (macroexpand-1 '(foobar 10))) > java.lang.IllegalArgumentException: Wrong number of args (4) passed > to: evil$let (NO_SOURCE_FILE:0) > > which is fine since let now takes no args. But this will activate the > local let*: > > guik.evil=> (defmacro let [& args] `(guik.evil/let*)) > #'guik.evil/let > guik.evil=> (foobar 10) > 2 > > On Apr 10, 6:50 pm, George Rogers wrote: > > (ns guik.evil) > > ;;1) Special forms cannot be shadowed > > (defmacro let* [] > > (+ 1 1)) > > ;; (let*) ; would yield > > ;=> clojure.lang.Compiler$CompilerException: > > java.lang.IllegalArgumentException: Bad binding form, expected vector > > (evil.clj:6) > > ;;2) Shadowing a macro does not change macros that depend on it. > > (defmacro foobar [x] > > `(let [a# ~x] > > (+ a# a#))) > > (defmacro let [] > > `(guik.evil/let*)) > > (foobar 10) ;=> 20 > > -- > 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: Where is the javadoc for clojure.lang ?
Also, there is the "Clojure in Small Pieces" doc that Tim Daly is working on. On Sat, Apr 9, 2011 at 11:00 AM, Stuart Sierra wrote: > Unfortunately, there is no JavaDoc for clojure.lang because there are no > comments in the source. If you want to understand Clojure's Java source > code, you'll just have to read it. > > -Stuart Sierra > clojure.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: Jesus, how the heck to do anything?
> Emacs is...wellemacs. Sorry, but when I'm trying to learn a > language, remembering what spell to cast on the keyboard to get the > editor to run my script, was just a little too much to keep track of > at one time. > > You either love emacs or you don't. I used to be surprised that there were *any* lispers who don't prefer emacs, considering the wonderful things you can do with emacs lisp, and the many other conveniences for working with s-expressions, slime, etc. I wonder if the mixed lineage of Clojure is the reason why there are many Clojurers who don't prefer emacs. My guess is that emacs still holds a majority even in the Clojure lisp world, and almost definitely in the Common Lisp world. As for the OP, yes Java is very annoying. Lein solves most of the Java annoyances, as others have also said. When *not* using lein, I *still* find it very annoying to say, write a script that does the correct java classpath incantations to get something to compile or run as a script. Java is just painful. -- 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
Reader macro suggestions
One useful reader macro would be do the analog of a syntax-quote in an ignored sexp ( #- is the analog of ~ ): #_(ignore (continuing to ignore #-"except do not ignore this" and ignore this)) Another language feature that I think many wish for to have some way of specifying a string without having to escape quotes within it. This also requires a reader macro. Perl has good ideas in this area. One way is to just have an alternate quote, #| this is a string in which I don't need to escape "quotes"| Or to make it possible to define the quote character #|{ ..."e|t|c"era }| Or to allow multi-character delimeters (heredoc) #|EOS string goes in here EOS| -- 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: [Code Bounty] Implementing "ClojureScript" - command-line/sys-admin scripting with Clojure
That would be extremely portable too, and there is Inline::Java in CPAN. My sense is that no one should bother with that until after Clojure-in-Clojure. I have heard some talk of Clojure on Parrot VM too. On Fri, Mar 4, 2011 at 2:32 PM, Chas Emerick wrote: > > I've actually come to think that perl may be a great Clojure host language; > the result would presumably be useful in the ways you've described. I > presume someone who actually knows perl well will beat me to implementing > it. > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: [ANN]VTD-XML 2.10
FWIW tagsoup is not bad for that. Nekohtml is alright as well. On Tue, Mar 1, 2011 at 8:03 PM, Kasim wrote: > Hi, > I was just wondering if I can use it for cleaning up not well formed html > files. > > 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 > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: ANN: Clojure Libraries
It looks like you would have to scrape it right now, as there doesn't appear to be rss for the library pages, but that would be a straightforward thing to add. On Mon, Feb 28, 2011 at 8:31 AM, rob levy wrote: > Nice! It would be cool if this could could be integrated with Clojars, to > keep the lein artifact & group ID up to date without manually editing. > > > > On Sun, Feb 27, 2011 at 6:56 PM, Glen Stampoultzis wrote: > >> Hi everyone, >> >> I'd like to announce the availability of Clojure Libraries >> (http://clojure-libraries.appspot.com/). Clojure Libraries is a >> database for keeping track of Clojure libraries and tools. Clojure >> Libraries can be edited by end users (by logging in with a Google >> account). Edits are tracked somewhat like a wiki and bad edits can be >> compared and rolled back. Comments can also be added to individual >> libraries and extra details like the group and artifact name can be >> added (which will link through to clojars automatically). >> >> Some of the features I plan on adding in the near future include: >> >> * Atom feeds for changes to the site >> * Editing of categories and subcategories >> * Ratings >> * A search feature >> >> I planned on putting this on it's own domain however there were a few >> technical issues when I attempted to do this so for now you can just >> access it via http://clojure-libraries.appspot.com/. >> >> If you'd like to add or edit a library but don't have a Google account >> (and would prefer not to create one) feel free to email me directly at >> gst...@gmail.com and I'll add it for you. >> >> PS. This overlaps somewhat with Clojure Toolbox which, via an >> unfortunate coincidence, came out about the same time. There are some >> important differences however, so I thought it best to continue with >> this release. >> >> Regards, >> >> Glen >> >> -- >> 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: ANN: Clojure Libraries
Nice! It would be cool if this could could be integrated with Clojars, to keep the lein artifact & group ID up to date without manually editing. On Sun, Feb 27, 2011 at 6:56 PM, Glen Stampoultzis wrote: > Hi everyone, > > I'd like to announce the availability of Clojure Libraries > (http://clojure-libraries.appspot.com/). Clojure Libraries is a > database for keeping track of Clojure libraries and tools. Clojure > Libraries can be edited by end users (by logging in with a Google > account). Edits are tracked somewhat like a wiki and bad edits can be > compared and rolled back. Comments can also be added to individual > libraries and extra details like the group and artifact name can be > added (which will link through to clojars automatically). > > Some of the features I plan on adding in the near future include: > > * Atom feeds for changes to the site > * Editing of categories and subcategories > * Ratings > * A search feature > > I planned on putting this on it's own domain however there were a few > technical issues when I attempted to do this so for now you can just > access it via http://clojure-libraries.appspot.com/. > > If you'd like to add or edit a library but don't have a Google account > (and would prefer not to create one) feel free to email me directly at > gst...@gmail.com and I'll add it for you. > > PS. This overlaps somewhat with Clojure Toolbox which, via an > unfortunate coincidence, came out about the same time. There are some > important differences however, so I thought it best to continue with > this release. > > Regards, > > Glen > > -- > 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: Ordering of defn's?
A related problem occurs when you separate your code into multiple namespaces. You can't create cyclic links with use or require. There's a case to be made for avoiding that situation, but the solution clojure provides when you need it is to import the vars using ns-resolve as in (def myfn (ns-resolve 'com.foo.bar.mylib 'myfn)) On Tue, Feb 22, 2011 at 1:05 AM, Jonathan Mitchem wrote: > I'm new to Lisps in general, and very new to Clojure. > > When I was trying out CL, I could put my "defun/defn"s in any order in > the file, and it would load and run fine in the REPL. However, in > Clojure, it seems to be much more C/C++-like and I have to define > things before I use them in other defns. > > Is this... correct? Or is it just a limitation of the IDEs I've been > trying out? > > > E.g., it seems like I have to define "sum" before I can define > "average". > > -- > 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: Transforming map entries
Yeah, fmap is perfect and definitely the most elegant for the specific problem described by the OP. I had never heard of that one. On Tue, Feb 22, 2011 at 6:56 PM, Benny Tsai wrote: > There is fmap from clojure.contrib.generic.functor, which expects a > function of arity 1, for just the value: > > (use 'clojure.contrib.generic.functor) > (require '[clojure.string :as str]) > > (def my-map {:first "john" :last "smith" :age 25}) > > (defn my-fn [value] > (if (string? value) >(str/upper-case value) >value)) > > user=> (fmap my-fn my-map) > {:first "JOHN", :last "SMITH", :age 25} > > On Feb 22, 4:23 pm, rob levy wrote: > > The usual intuitive options for this are reduce, zipmap, or into. You > can > > also write a lazily recursive solution. I wonder why there's no function > in > > core that lazily re-constructs the map with the results of the function? > It > > seems to have been discussed on the list at least once or twice. It > seems > > like there would have to be two versions of it, one expecting a function > > with an arity of one (for just the value) and another expecting an arity > of > > two (key and value). > > > > > > > > > > > > > > > > On Mon, Feb 21, 2011 at 10:08 PM, yair wrote: > > > I'm hoping this is a dumb question and I've missed something obvious. > > > I have a map with various key-value pairs and I want to transform some > > > of the values, e.g. > > > > > (def mymap {:first "john" :last "smith" :age 25}) and say I want to > > > change the strings to be upper case. > > > Right now all I can think of doing is using reduce and passing in an > > > empty map and the re-associating each key with the (possibly) > > > transformed value. Is there something like the map function that > > > takes two parameters, one a function that receives a pair and returns > > > a new pair, and the other a map, and returns a map that's > > > reconstituted from those pairs? > > > > > 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 > > -- > 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: Transforming map entries
Yeah, after I wrote that, it occurred to me that there are good reasons why Clojure nudges you away from doing lazy operations on maps, although I hadn't thought much about it. I didn't think of walk. That is probably the most elegant out of the approaches I have seen to this common problem. On Tue, Feb 22, 2011 at 6:43 PM, Alan wrote: > On Feb 22, 3:23 pm, rob levy wrote: > > The usual intuitive options for this are reduce, zipmap, or into. You > can > > also write a lazily recursive solution. I wonder why there's no function > in > > core that lazily re-constructs the map with the results of the function? > It > > seems to have been discussed on the list at least once or twice. It > seems > > like there would have to be two versions of it, one expecting a function > > with an arity of one (for just the value) and another expecting an arity > of > > two (key and value). > > Maps aren't lazy. They would be seqs if they were lazy, and not have > fast lookup by key. > > clojure.contrib.generic.functor/fmap updates values, and clojure.walk/ > walk (and maybe post-walk) can do what you're looking for with pairs: > > user=> (walk (fn [[k v]] [v k]) identity {:a 1 :b 2}) > {1 :a, 2 :b} > > -- > 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: Transforming map entries
The usual intuitive options for this are reduce, zipmap, or into. You can also write a lazily recursive solution. I wonder why there's no function in core that lazily re-constructs the map with the results of the function? It seems to have been discussed on the list at least once or twice. It seems like there would have to be two versions of it, one expecting a function with an arity of one (for just the value) and another expecting an arity of two (key and value). On Mon, Feb 21, 2011 at 10:08 PM, yair wrote: > I'm hoping this is a dumb question and I've missed something obvious. > I have a map with various key-value pairs and I want to transform some > of the values, e.g. > > (def mymap {:first "john" :last "smith" :age 25}) and say I want to > change the strings to be upper case. > Right now all I can think of doing is using reduce and passing in an > empty map and the re-associating each key with the (possibly) > transformed value. Is there something like the map function that > takes two parameters, one a function that receives a pair and returns > a new pair, and the other a map, and returns a map that's > reconstituted from those pairs? > > 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 -- 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: flattening a tree
That is, had flattening actually been your goal. It seem like you didn't really want to throw out that structure, just transform it, so flattening is irrelevant I guess other than the subject line. :) On Mon, Feb 21, 2011 at 5:34 PM, rob levy wrote: > One way to approve the problem is to write a function to convert the nested > maps into nested seqs. Once it is in that form you can use flatten on it and > partition the flat list as you like: > > (defn flatten-maptree [m] > (letfn [(maptree->seqtree >[m] >(lazy-seq > (cond > (map? m) (map #(cons > (key %) > (maptree->seqtree (val %))) >m) > :else [m])))] > (flatten (maptree->seqtree m > > > user=> (partition 4 (flatten-maptree {1 {2 {3 4 5 6} 7 {8 9}}})) > ((1 2 3 4) (5 6 7 8)) > > > On Mon, Feb 21, 2011 at 3:25 PM, James Reeves wrote: > >> On 21 February 2011 07:17, Damien wrote: >> > Not sure if I should talk about flattening but basically I'm trying to >> > achieve the following transformation: >> > >> > user=>(flatten-tree {1 {2 {3 4 5 6} 7 {8 9}}}) >> > ((1 2 3 4) (1 2 5 6) (1 7 8 9)) >> > >> > Any suggestion? >> >> (defn flatten-tree [t] >> (if (map? t) >>(for [[k v] t, w (flatten-tree v)] >> (cons k w)) >>(list (list t >> >> In this case, I think using protocols would be over-engineering. We >> can always add protocols in later if we happen to need them. That's >> one of the benefits of protocols as compared to Java's interfaces. >> >> - James >> >> -- >> 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: flattening a tree
One way to approve the problem is to write a function to convert the nested maps into nested seqs. Once it is in that form you can use flatten on it and partition the flat list as you like: (defn flatten-maptree [m] (letfn [(maptree->seqtree [m] (lazy-seq (cond (map? m) (map #(cons (key %) (maptree->seqtree (val %))) m) :else [m])))] (flatten (maptree->seqtree m user=> (partition 4 (flatten-maptree {1 {2 {3 4 5 6} 7 {8 9}}})) ((1 2 3 4) (5 6 7 8)) On Mon, Feb 21, 2011 at 3:25 PM, James Reeves wrote: > On 21 February 2011 07:17, Damien wrote: > > Not sure if I should talk about flattening but basically I'm trying to > > achieve the following transformation: > > > > user=>(flatten-tree {1 {2 {3 4 5 6} 7 {8 9}}}) > > ((1 2 3 4) (1 2 5 6) (1 7 8 9)) > > > > Any suggestion? > > (defn flatten-tree [t] > (if (map? t) >(for [[k v] t, w (flatten-tree v)] > (cons k w)) >(list (list t > > In this case, I think using protocols would be over-engineering. We > can always add protocols in later if we happen to need them. That's > one of the benefits of protocols as compared to Java's interfaces. > > - James > > -- > 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: Docstring on def
Have you looked at c.c.def/defvar? http://richhickey.github.com/clojure-contrib/def-api.html On Sun, Feb 20, 2011 at 2:53 PM, Ken Wesson wrote: > On Sun, Feb 20, 2011 at 12:45 PM, Daniel Solano Gomez > wrote: > > On Sun Feb 20 17:30 2011, Paul Richards wrote: > >> I've been trying to add docstrings to my constants that are defined > >> using 'def'. According to the webpage[1] I should be able to write: > >> > >> (def pi "hello" 3.14) > >> > >> But this fails with: > >> java.lang.Exception: Too many arguments to def (NO_SOURCE_FILE:1) > >> > >> This is with Clojure 1.2.0. > > > > As far as I can tell, the fix is not actually in 1.2.0. > > Then why is it documented on the page > > http://clojure.org/special_forms > > among documentation which otherwise seems to refer to 1.2 and not 1.3? > > -- > 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: Boston Clojure Meetup Thursday Jan 13
By the way, as those who attend the first meeting know, it was actually quite huge in terms of the number of people who attended. There are less than 40 people who list themselves on the meetup page as members, but closer to 50 people actually attended if I estimate correctly, in part due to a large contingent from Sonian's Clojure team who came from around the world, as well as a big group of Schemers and Haskellers from Northeastern that happened to show up. On Wed, Feb 16, 2011 at 9:16 AM, rob levy wrote: > No one has planned anything yet, but my sense is that anyone who wants to > take initiative to host or help plan a second meeting should get in touch > with Eric (who created the meetup.com page and organized the first > meeting), so as to coordinate with him and post the details on meetup. > Also, there is a "next topic" thread at > http://www.meetup.com/Boston-Clojure-Group/messages/boards/thread/10293090and > if you haven't already joined the meetup that would also be a good way > to stay up to date with any news. > > > On Sat, Feb 12, 2011 at 5:04 PM, David Jacobs < > develo...@allthingsprogress.com> wrote: > >> I don't know how I missed this originally. Is there another one planned? >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clojure@googlegroups.com >> Note that posts from new members are moderated - please be patient 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: Boston Clojure Meetup Thursday Jan 13
No one has planned anything yet, but my sense is that anyone who wants to take initiative to host or help plan a second meeting should get in touch with Eric (who created the meetup.com page and organized the first meeting), so as to coordinate with him and post the details on meetup. Also, there is a "next topic" thread at http://www.meetup.com/Boston-Clojure-Group/messages/boards/thread/10293090and if you haven't already joined the meetup that would also be a good way to stay up to date with any news. On Sat, Feb 12, 2011 at 5:04 PM, David Jacobs < develo...@allthingsprogress.com> wrote: > I don't know how I missed this originally. Is there another one planned? > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient 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: ANN: clojurejs -- a Clojure (subset) to Javascript translator
> I've just released a stable version of `clojurejs' -- an > unimaginatively named Clojure library for translating a Clojure subset > language to Javascript. > Unimaginative could be a good thing in this case, I was thinking maybe CloJSure, and then someone could invert abstractions and sacreligiously construct an object system and call it it CLOSjure to top off the the confusion. -- 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 Joy of Closure
This may be a typo, but since I saw it more than once, it could be worth noting (maybe save you some trouble) that clo[jsz]ure is not an equivalence class. Closure with a capital C can either be Google's JS library, or a Common Lisp web browser (and some of its associated component libraries like Closure XML). Clozure is a consulting company in Somerville, MA that develops Macintosh Common Lisp, also known as... Clozure! :) On Tue, Jan 18, 2011 at 6:02 PM, flebber wrote: > > > On Jan 19, 5:21 am, faenvie wrote: > > not to forget practical clojure from apress: > > > > http://apress.com/book/view/1430272317 > > > > which gives a good introduction too > > and mark volkmanns article: > > > > http://java.ociweb.com/mark/clojure/article.html > > > > which is free and also gives an excellent > > introduction. > > Thank you for the link to mark volkmanns article. It may be a good > starting point. I have concerns with the books printed back in 2009 as > it appears there has been a lot of development and advancement since > then with datatypes and other structures appearing in 1.2 in October > 2010. > > I might look at practical clojure and the joy of closure after reading > volkmann. there are a few used practical clojure books on amazon so it > wont break the budget. > > -- > 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 and Android update status
There was recently a stack overflow thread on this: http://stackoverflow.com/questions/4651757/clojure-on-android/4675855#4675855 One of the people who replied (Arthur Ulfeldt) says that JIT has helped greatly with performance. So maybe it's time to revisit it. It looks like remvee's example code has been upkept based on the commit history https://github.com/remvee/clojurehelloandroid On Fri, Jan 14, 2011 at 4:21 AM, Laurent PETIT wrote: > Hello, > > Say I want to write an app in Clojure for Android. > > The kind of app which does not require endless restarts. > > Would you recommand me to go for it ? > > And if so, what's the current "best way" of doing this ? > > I've seen many "ports", "special builds" of clojure for Android, but they > seem to be dated (late 2009). > > Is this because right now with clojure 1.2 I can just go with the official > 1.2 build ? Or because people lost interest in 2010 for the "Clojure + > Android" combo, and are waiting for a solution to come from Clojure/core ? > > > Thanks in advance if you can help me update the status of Android+clojure > combo for people having to make a decision for immediate needs. > > Regards, > > -- > 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 -- 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: When to use #'
One common use is for referring to private functions in other namespaces. For example, say you want to write tests for foo.core/p, a privately defined function. It is private in terms of your intent as expressed in your API, but you can still access the var from foo.core-test and call the function in your tests as #'foo.core/p. On Wed, Jan 12, 2011 at 10:29 PM, gaz jones wrote: > its a reader macro equivalent to the var special form: > > (var symbol) > The symbol must resolve to a var, and the Var object itself (not its > value) is returned. The reader macro #'x expands to (var x). > > from: > > http://clojure.org/special_forms#var > > On Wed, Jan 12, 2011 at 9:11 PM, Alex Baranosky > wrote: > > Hi, I find it extremely hard to google this to learn more! I'd like to > > know some good sources of further information on when to use #' . It is > a > > bit mysterious to me at this 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 > > -- > 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: running just one test
On Wed, Jan 12, 2011 at 1:41 AM, ka wrote: > > (detest xyz ...) > > Freudian slip? ;) -- 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: Boston meetup Jan 11?
I'm also going to Boston Coding Dojo tonight. The Clojure Meetup is going to be at Akamai, a week from tonight's dojo, which I'm looking forward to: http://groups.google.com/group/clojure/browse_thread/thread/821248c3dd0b69b8 On Thu, Dec 30, 2010 at 9:34 PM, Alyssa Kwan wrote: > Hi! > > You would be more than welcome at the Boston Coding Dojo (http:// > www.meetup.com/boston-coding-dojo/). We meet every other Thursday at > First Church in Boston, in Boston's Back Bay on Marlborough St. In > January, we are meeting on 1/6 and 1/20, so nothing on the week of > 1/9, I'm afraid. What kind of meeting do you have in mind? I could > certainly recommend some restaurants that are more conducive to > conversation. If you are looking for a space to hack, I can certainly > check with the church for availability; we meet in a lovely chapel > with plenty of room. It would cost $75 for the space for the night. > There's also the Workbar (http://www.workbarboston.com), which is > pricier and a little more cramped... :). > > Everyone on the list should also check out Boston Software > Craftsmanship (http://groups.google.com/group/boston-software- > craftsmanship/). Their next meeting is on 1/24 and is on monads > (http://gathers.us/events/jan-boston-software-craftsmanship-meeting). > > Thanks! > Alyssa > > On Dec 30, 1:52 pm, dysinger wrote: > > 10 of us from Sonian are going to converge on Boston the week of Jan > > 9. It's always awesome to meet other Clojure hackers. I propose we > > meet up somewhere central(ish) Jan 11 @ 7-9pm-ish. We have room at > > our company headquarters in Dedham but that might be a hike for some > > people. Any other places we could meet/greet & hack for an hour or > > two central to Boston? > > -- > 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: ANN: Clojure web application using NHPM for server push
Hi Anders, thanks. If I understand what you are asking, in fact the server in my case does not care if anyone is listening, however you can set how long the messages live in the queue. The client holds the responsibility of keeping track of what messages it has already seen based on the date in the response header. If you want to make sure your client doesn't miss messages you set a very long time to live and let the client catch up to what it hasn't seen yet in the spew of messages when it signs back on. For my application this was not necessary, as I treat push messages as ephemeral short lived things. When the client comes back on the direct request to the server to log in gives its next waiting event as a plain old response to the request to the application maintaining this state. Does this answer your question? On Dec 21, 2010 5:50 PM, "Anders Rune Jensen" wrote: > On Mon, Dec 20, 2010 at 6:06 PM, rob levy wrote: >> I have posted a repository containing the code for a web application I made >> using a server push (AKA Comet, long polling) architecture. The front end >> is in Javascript, and the back end is in Clojure. The clojure code is able >> to send notifications to clients' browsers effectively through use of >> nginx's push module, which the clients subscribe to. With websockets >> presently out of reach this can be a good way of doing this sort of thing, >> and at least on my small-scale testing it is a super responsive way of >> simulating a socket. > > Hi Rob > > Interesting project. I havn't looked at the machine learning part of > it, although that also sounds interesting, but at first I was more > interested in the long polling aspect of your application. I was > looking at something similar but in the end I decided that given my > use case (mostly a single client polling) it didn't make much sense to > use nginx. I'm guessing that in your architecture, nginx makes more > sense because you have a lot of clients polling the same interface? > That way you know that it is much more likely that there will be at > least one subscriber left for a message when the server actually has > something to send. And I guess the way the back-end knows that there > is still someone that wants to know about a message is that nginx says > that there is still clients waiting when it delivers the message. > Could you maybe elaborate a bit more on this? > >> https://github.com/rplevy/sayoperation >> >> The application itself is online (for now) at: >> >> http://www.robertplevy.net/sayoperation/ >> >> A little bit of context is necessary here. This is a game I made as part of >> my final project for a course I am in (I am taking courses part time as part >> of an MA program I will eventually complete) on the topic of Machine >> Learning and Natural Language Processing. The purpose of the game is to >> collect game move data. I'm in the process of figuring out how to train a >> classifier to learn to make the same sorts of game moves (though the text >> generation piece is out of scope), to have 1/2 of an AI game player. >> >> If you want to play the game and help me collect training data, here are >> some things to know: >> >>1. You will be asked to give an instruction to your team mate, given the >> information on the screen. The red is the target, and the green is what >> your teammate will move to the target. Notice that the target is always an >> empty space. For example "put the crab above the butterfly" would make >> sense if the crab had a green border, and there were a red bordered target >> above the butterfly. >> >>2. Use clear and natural language when entering data., try to explain in >> the way you would explain to a person. Punctuation and capitalization is >> stripped out/lowercased. >> >>3. The rounds work like this. Player 1 instruct -> Player 2 move --> >> Player 2 instruct --> Player 1 move. The game automatically presents your >> next available move just like in RIAs such as gchat or facebook (no need to >> refresh). >> >>4. Multiple concurrent games are encouraged. The game should be >> responsive and will immediately tell you if you have a move to play in any >> of your games. >> >>5. Caveat: The application has been tested thoroughly in Firefox and >> Chrome. While there is no inherent reason why it shouldn't be possible to >> make it work in Opera or Internet Explorer, I have not tested it in IE (so >> it probably doesn't work in that browser), and I am aware that it doesn't >> work in Opera. This is just a
ANN: Clojure web application using NHPM for server push
I have posted a repository containing the code for a web application I made using a server push (AKA Comet, long polling) architecture. The front end is in Javascript, and the back end is in Clojure. The clojure code is able to send notifications to clients' browsers effectively through use of nginx's push module, which the clients subscribe to. With websockets presently out of reach this can be a good way of doing this sort of thing, and at least on my small-scale testing it is a super responsive way of simulating a socket. https://github.com/rplevy/sayoperation The application itself is online (for now) at: http://www.robertplevy.net/sayoperation/ A little bit of context is necessary here. This is a game I made as part of my final project for a course I am in (I am taking courses part time as part of an MA program I will eventually complete) on the topic of Machine Learning and Natural Language Processing. The purpose of the game is to collect game move data. I'm in the process of figuring out how to train a classifier to learn to make the same sorts of game moves (though the text generation piece is out of scope), to have 1/2 of an AI game player. If you want to play the game and help me collect training data, here are some things to know: 1. You will be asked to give an instruction to your team mate, given the information on the screen. The red is the target, and the green is what your teammate will move to the target. Notice that the target is always an empty space. For example "put the crab above the butterfly" would make sense if the crab had a green border, and there were a red bordered target above the butterfly. 2. Use clear and natural language when entering data., try to explain in the way you would explain to a person. Punctuation and capitalization is stripped out/lowercased. 3. The rounds work like this. Player 1 instruct -> Player 2 move --> Player 2 instruct --> Player 1 move. The game automatically presents your next available move just like in RIAs such as gchat or facebook (no need to refresh). 4. Multiple concurrent games are encouraged. The game should be responsive and will immediately tell you if you have a move to play in any of your games. 5. Caveat: The application has been tested thoroughly in Firefox and Chrome. While there is no inherent reason why it shouldn't be possible to make it work in Opera or Internet Explorer, I have not tested it in IE (so it probably doesn't work in that browser), and I am aware that it doesn't work in Opera. This is just a matter of time and effort, that I need to spend on the NLP side of this project at the moment. 6. The high scoring team as of 2am tonight will win something (I haven't decide what, give me ideas please). Thanks, 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: Partition At True Values Of Predicate
fwiw my folding solution above yields the expected result. On Sat, Nov 27, 2010 at 7:07 PM, Benny Tsai wrote: > > Subvec, however, isn't lazy. > > That's true. I just realized there's another problem with my approach > as well: it does not preserve elements before the first true index. > > user=> (partition-when true? [false true]) > ([true]) > > When the result should probably be: > > user=> (partition-when true? [false true]) > ((false) (true)) > > On Nov 27, 2:05 pm, Ken Wesson wrote: > > Subvec, however, isn't lazy. This is: > > > > (defn split-when [pred coll] > > (let [ipred (complement pred) > > bits (iterate > >(fn [[out coll]] > > (let [[a b] (split-with ipred (rest coll))] > >[(cons (first coll) a) b])) > >[nil coll])] > > (map #(first (first %)) > > (take-while #(seq (second (second %))) (map vector (rest bits) > bits) > > > > user=> (take 10 (split-when #(= 0 (rem % 3)) (iterate inc 1))) > > ((1 2) > > (3 4 5) > > (6 7 8) > > (9 10 11) > > (12 13 14) > > (15 16 17) > > (18 19 20) > > (21 22 23) > > (24 25 26) > > (27 28 29)) > > -- > 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: Partition At True Values Of Predicate
This is clearer to read though: (defn partition-when [f l] (reduce #(if (f %2) (conj %1 (vector %2)) (conj (vec (butlast %1)) (conj (vec (last %1)) %2))) [] (vec l))) On Sat, Nov 27, 2010 at 4:47 PM, rob levy wrote: > This is more correct, because conj does not preserve the order correctly. > I wonder if there is a more idiomatic way to cons things onto the end of > the list. > > > (defn partition-when [f l] > (reduce #(if (f %2) > (concat %1 (vector (vector %2))) > (concat (butlast %1) > (vector (concat (last %1) (vector %2) > [] l)) > > > On Sat, Nov 27, 2010 at 4:18 PM, rob levy wrote: > >> Something like this? >> >> (defn partition-when [f l] >> (reduce #(if (f %2) >> (conj %1 (vector %2)) >> (conj (butlast %1) >>(conj (last %1) %2))) >> [] l)) >> >> On Sat, Nov 27, 2010 at 4:15 PM, Ken Wesson wrote: >> >>> On Sat, Nov 27, 2010 at 4:00 PM, rob levy wrote: >>> > partition-by does exactly what you need. >>> >>> Not quite. >>> >>> user=> (take 10 (partition-by #(= 0 (rem % 3)) (iterate inc 1))) >>> ((1 2) >>> (3) >>> (4 5) >>> (6) >>> (7 8) >>> (9) >>> (10 11) >>> (12) >>> (13 14) >>> (15)) >>> >>> At first it seems you can fix this as follows: >>> >>> user=> (defn questionable-split-when [pred coll] >>> (let [p (partition-by pred coll)] >>> (cons (first p) (map #(apply concat %) (partition 2 2 [] >>> (rest p)) >>> #'user/questionable-split-when >>> user=> (take 10 (questionable-split-when #(= 0 (rem % 3)) (iterate inc >>> 1))) >>> ((1 2) >>> (3 4 5) >>> (6 7 8) >>> (9 10 11) >>> (12 13 14) >>> (15 16 17) >>> (18 19 20) >>> (21 22 23) >>> (24 25 26) >>> (27 28 29)) >>> >>> So far, so good. But: >>> >>> user=> (questionable-split-when #(= 0 (rem % 3)) [1 2 3 6 7 8 9]) >>> ((1 2) >>> (3 6 7 8) >>> (9)) >>> >>> Whereas: >>> >>> user=> (split-when #(= 0 (rem % 3)) [1 2 3 6 7 8 9]) >>> ((1 2) >>> (3) >>> (6 7 8) >>> (9)) >>> >>> The latter correctly starts a new partition each time the pred is >>> true; the former fails if the pred is ever true twice in a row. >>> >>> -- >>> 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: Partition At True Values Of Predicate
This is more correct, because conj does not preserve the order correctly. I wonder if there is a more idiomatic way to cons things onto the end of the list. (defn partition-when [f l] (reduce #(if (f %2) (concat %1 (vector (vector %2))) (concat (butlast %1) (vector (concat (last %1) (vector %2) [] l)) On Sat, Nov 27, 2010 at 4:18 PM, rob levy wrote: > Something like this? > > (defn partition-when [f l] > (reduce #(if (f %2) > (conj %1 (vector %2)) > (conj (butlast %1) >(conj (last %1) %2))) > [] l)) > > On Sat, Nov 27, 2010 at 4:15 PM, Ken Wesson wrote: > >> On Sat, Nov 27, 2010 at 4:00 PM, rob levy wrote: >> > partition-by does exactly what you need. >> >> Not quite. >> >> user=> (take 10 (partition-by #(= 0 (rem % 3)) (iterate inc 1))) >> ((1 2) >> (3) >> (4 5) >> (6) >> (7 8) >> (9) >> (10 11) >> (12) >> (13 14) >> (15)) >> >> At first it seems you can fix this as follows: >> >> user=> (defn questionable-split-when [pred coll] >> (let [p (partition-by pred coll)] >> (cons (first p) (map #(apply concat %) (partition 2 2 [] >> (rest p)) >> #'user/questionable-split-when >> user=> (take 10 (questionable-split-when #(= 0 (rem % 3)) (iterate inc >> 1))) >> ((1 2) >> (3 4 5) >> (6 7 8) >> (9 10 11) >> (12 13 14) >> (15 16 17) >> (18 19 20) >> (21 22 23) >> (24 25 26) >> (27 28 29)) >> >> So far, so good. But: >> >> user=> (questionable-split-when #(= 0 (rem % 3)) [1 2 3 6 7 8 9]) >> ((1 2) >> (3 6 7 8) >> (9)) >> >> Whereas: >> >> user=> (split-when #(= 0 (rem % 3)) [1 2 3 6 7 8 9]) >> ((1 2) >> (3) >> (6 7 8) >> (9)) >> >> The latter correctly starts a new partition each time the pred is >> true; the former fails if the pred is ever true twice in a row. >> >> -- >> 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: Partition At True Values Of Predicate
Something like this? (defn partition-when [f l] (reduce #(if (f %2) (conj %1 (vector %2)) (conj (butlast %1) (conj (last %1) %2))) [] l)) On Sat, Nov 27, 2010 at 4:15 PM, Ken Wesson wrote: > On Sat, Nov 27, 2010 at 4:00 PM, rob levy wrote: > > partition-by does exactly what you need. > > Not quite. > > user=> (take 10 (partition-by #(= 0 (rem % 3)) (iterate inc 1))) > ((1 2) > (3) > (4 5) > (6) > (7 8) > (9) > (10 11) > (12) > (13 14) > (15)) > > At first it seems you can fix this as follows: > > user=> (defn questionable-split-when [pred coll] > (let [p (partition-by pred coll)] > (cons (first p) (map #(apply concat %) (partition 2 2 [] > (rest p)) > #'user/questionable-split-when > user=> (take 10 (questionable-split-when #(= 0 (rem % 3)) (iterate inc 1))) > ((1 2) > (3 4 5) > (6 7 8) > (9 10 11) > (12 13 14) > (15 16 17) > (18 19 20) > (21 22 23) > (24 25 26) > (27 28 29)) > > So far, so good. But: > > user=> (questionable-split-when #(= 0 (rem % 3)) [1 2 3 6 7 8 9]) > ((1 2) > (3 6 7 8) > (9)) > > Whereas: > > user=> (split-when #(= 0 (rem % 3)) [1 2 3 6 7 8 9]) > ((1 2) > (3) > (6 7 8) > (9)) > > The latter correctly starts a new partition each time the pred is > true; the former fails if the pred is ever true twice in a row. > > -- > 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: Partition At True Values Of Predicate
partition-by does exactly what you need. On Sat, Nov 27, 2010 at 3:04 PM, Benny Tsai wrote: > Could do it this way. Use index-filter (borrowed from Programming > Clojure) to get the indices where the predicate is true in the > sequence. partition-when-true then just calls subvec with pairs of > indices to get the subsequences. > > coll-end is the index just past the end of the collection. This is > used as a pad element so that the last true index is included in the > pairs, and also accounts for the case where there is only a single > true index. > > (use '[clojure.contrib.seq :only (indexed)]) > > (defn index-filter [pred coll] > (when pred >(for [[idx elt] (indexed coll) :when (pred elt)] idx))) > > (defn partition-when [pred coll] > (let [coll-end (count coll) >indices (index-filter pred coll) >index-pairs (partition 2 1 [coll-end] indices) >coll-vec (vec coll)] >(for [[start end] index-pairs] (subvec coll-vec start end > > user=> (partition-when true? '(true false false true false true true)) > ([true false false] [true false] [true] [true]) > > On Nov 27, 10:02 am, Asim Jalis wrote: > > I want to partition a sequence based on the values of a predicate so > > that every true starts a new sequence in the partition. Here is an > > example of how partition-with could be used: > > > > (partition-when true? '(true false false true false true true)) > > -> '((true false false) (true false) (true) (true)) > > > > I have written this lazy-seq and recursion. However, I was wondering > > if there is a way to do this with core Clojure sequence primitives. > > Any suggestions? > > > > Asim > > -- > > San Francisco, CA > > -- > 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: RegEx
That's not a Clojure question, but if you ask it on StackOverflow you'll get an answer in like 2 seconds. :) From your description it sounds like you want /^[ML]{3}[0-9]{2}$/ but the description of your problem could be interpreted in a few other ways, so that might not be what you want. On Fri, Jul 30, 2010 at 5:02 PM, Base wrote: > Hi All - > > I am sure that this is an easy one, but I am stuck. > > I have a document that should have triplets of a letter (M or L) > flllowed by 2 numbers. But the file has a ton of errors and often I > find a number that would be > > M123.5554 > or 1234.435M > > i.e. - the letter gets appended to the end of the number. > > This seems like a great place to use regexhow would one craft a > pattern for this? > > Thanks > > Base > > -- > 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: Idea for personal Clojure project
I think that a big part of the problem is that most approaches to word similarity (especially thesaurus-based approaches like Wordnet, but also the significantly better distributional approaches) use very impoverished representations of knowledge. As such, they are unable to make useful inferences because they lack the underlying representation of knowledge and experience that is necessary for the kind of similarity judgements that people are able to make. I am especially interested in how Gardenfors-style conceptual space modelling can improve the situation, in the context of other NLP techniques. The Cognitive Geography group at UCSB is doing some interesting work, including a Java library for conceptual space modeling. They plan to release it as free software, but it's not done yet. I got an early version of the code from them last year and played with it some in Clojure. I plan to do more with that and see what results I can get. Also, most of NLTK works in Jython*, and by extension in Jython running in Clojure ( which is why I started writing a convenience wrapper to make it easier to use python libraries: http://code.google.com/p/clojure-python/ ). *Actually getting NLTK to work in Jython is kind of problematic presently because you need to modify a few things to allow it to work. I think it's great that there's a Clojure NLP library in the works. If the Clojure NLP libs are better than NLTK then everyone in computational linguistics will switch to Clojure. :) On Thu, Jul 29, 2010 at 9:16 AM, Michael Harrison (goodmike) < goodmike...@gmail.com> wrote: > As others have said, this is a difficult problem, but a fascinating > one too. I'm currently nibbling on building some grouping-by- > similarity algorithms for Clojure, although I'm sticking to numerical > criteria for similarity or "distance". New developments in text > analysis and the Learning by Reading approach to AI, as described at > http://blog.steinberg.org/?p=11 e.g., are making data science an > exciting place. If you make some headway, please do share with us. I > for one would love to see where you go and contribute if possible. > > Cheers, > Michael > > > On Jul 28, 4:58 pm, Daniel wrote: > > I want to write a clojure program that searches for similarities of > > words in the english language and places them in a graph, where the > > distance between nodes indicates their similarity. I don't mean > > syntactical similarity. Related contextual meaning is closer to the > > mark. > > > > For instance: "fish" and "reel" don't have much similarity, but in the > > context of fishing they do, so the distance in such a graph wouldn't > > be very large. > > > > I'm sure research has been done in this area (I suspect with no small > > portion belonging to google), so can anybody point me in the right > > direction? > > > > 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 > -- 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: Idea for personal Clojure project
I think that a big part of the problem is that most approaches to word similarity (especially thesaurus-based approaches like Wordnet, but also the significantly better distributional approaches) use very impoverished representations of knowledge. As such, they are unable to make useful inferences because they lack the underlying representation of knowledge and experience that is necessary for the kind of similarity judgements that people are able to make. I am especially interested in how Gardenfors-style conceptual space modelling can improve the situation, in the context of other NLP techniques. The Cognitive Geography group at UCSB is doing some interesting work, including a Java library for conceptual space modeling. They plan to release it as free software, but it's not done yet. I got an early version of the code from them last year and played with it some in Clojure. I plan to do more with that and see what results I can get. Also, most of NLTK works in Jython*, and by extension in Jython running in Clojure ( which is why I started writing a convenience wrapper to make it easier to use python libraries: http://code.google.com/p/clojure-python/ ). *Actually getting NLTK to work in Jython is kind of problematic presently because you need to modify a few things to allow it to work. I think it's great that there's a Clojure NLP library in the works. If the Clojure NLP libs are better than NLTK then everyone in computational linguistics will switch to Clojure. :) On Thu, Jul 29, 2010 at 9:16 AM, Michael Harrison (goodmike) < goodmike...@gmail.com> wrote: > As others have said, this is a difficult problem, but a fascinating > one too. I'm currently nibbling on building some grouping-by- > similarity algorithms for Clojure, although I'm sticking to numerical > criteria for similarity or "distance". New developments in text > analysis and the Learning by Reading approach to AI, as described at > http://blog.steinberg.org/?p=11 e.g., are making data science an > exciting place. If you make some headway, please do share with us. I > for one would love to see where you go and contribute if possible. > > Cheers, > Michael > > > On Jul 28, 4:58 pm, Daniel wrote: > > I want to write a clojure program that searches for similarities of > > words in the english language and places them in a graph, where the > > distance between nodes indicates their similarity. I don't mean > > syntactical similarity. Related contextual meaning is closer to the > > mark. > > > > For instance: "fish" and "reel" don't have much similarity, but in the > > context of fishing they do, so the distance in such a graph wouldn't > > be very large. > > > > I'm sure research has been done in this area (I suspect with no small > > portion belonging to google), so can anybody point me in the right > > direction? > > > > 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 > -- 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: terracotta?
Maybe terrastore would be a good solution then? http://clojars.org/search?q=terrastore http://github.com/sbtourist/terrastore-cloj On Sun, Jul 11, 2010 at 10:10 PM, scx wrote: > that's too bad. i'm actually more interested in terracotta as a > persistence solution than as a distributed computing solution. > > On Jul 11, 9:02 pm, rob levy wrote: > > I've been following this too, and have not heard anything in a while. I > > know that Luc Prefontaine was trying to get terracotta to work with > Clojure > > as well. I have not heard any news recently. A potentially more > > straightforward solution for distributed processing right now is > swarmiji. > > With this it seems you need to be more explicit about dispatching in > > swarmiji, where as in Terracotta, at least as I understand it not having > > tried it out, your agents will automatically find a machine to run on, > just > > as they run on some thread when your JVM is running the normal way on a > > single machine. > > > > > > > > > > > > > > > > On Sun, Jul 11, 2010 at 12:50 PM, scx wrote: > > > hi -- > > > > > i've seen paul standig's work with clojure + terracotta. wondering if > > > anyone has continued his work? > > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Clojure" group. > > > To post to this group, send email to clojure@googlegroups.com > > > 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 > -- 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: terracotta?
I've been following this too, and have not heard anything in a while. I know that Luc Prefontaine was trying to get terracotta to work with Clojure as well. I have not heard any news recently. A potentially more straightforward solution for distributed processing right now is swarmiji. With this it seems you need to be more explicit about dispatching in swarmiji, where as in Terracotta, at least as I understand it not having tried it out, your agents will automatically find a machine to run on, just as they run on some thread when your JVM is running the normal way on a single machine. On Sun, Jul 11, 2010 at 12:50 PM, scx wrote: > hi -- > > i've seen paul standig's work with clojure + terracotta. wondering if > anyone has continued his work? > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > 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
Certainly macros can be dangerous if used recklessly or clumsily, but > isn't trusting the programmer and giving him powerful tools what Lisp > is all about? No other language provides the same power of expression. > A tour through the Clojure code demonstrates just how powerful this > idea is and how easy it makes it for the language implementors to > implement features in a few lines of code that are major bullet-point > features in other languages. > > In my opinion it is much better to empower developers and build a culture of good taste and self-discipline, than to limit the language in an attempt to enforce particular styles. Python is the latter and Lisp is the former. And Python code is often convoluted because of programmers working around the limitations imposed by the language. And don't get me started on lines of code that begin at column 80 etc. ;) I would argue in favor of user-defined reader macros for these same reasons, they are rarely needed but why not maximize the power of Clojure? I think the last word on this from Rich Hickey was "many things that would otherwise have forced people to reader macros may end up in Clojure, where everyone can benefit from a common approach". To me this is Rich being like Guido von Rossum, but maybe there are other good reasons behind the decision that he has either not articulated or I just am not aware of/haven't read. 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: Dynamic gen-class
HI Michael, If I understand correctly, the proxy function might be what you are looking for. I think gen-class can only be used with AOT compilation. -Rob On Sun, Jun 27, 2010 at 8:19 AM, Michael Jaaka wrote: > Hi, > > Is there any way to generate class in runtime and then use it? > How far I can only generate interfaces. > > This works: > > (do > (gen-interface :name test.commons.Me >:methods [[ me [ String ] void ]]) > > (def z (reify test.commons.Me >(me [t z] (println "hello world" z > > (.me z "wowo") > ) > > > > That doesn't: > > > > (do > (gen-class :name test.commons.Mee >:state sema >:methods [ >[ me2 [ String ] void ]] >:prefix "mee-" > ) > > (defn mee-me2[ this a ] >(println "hello" a "had state" (.sema this))) > > (.me2 (test.commons.Mee. ) "world") > ) > > > > -- > 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 / Common Lisp Question
> You can use Perl's map/grep pretty much anywhere, though they're not as > nice to use because the language is a mess (albeit more functional than > Python). I, too, have found myself using fewer and fewer explicit loops as > time goes on, starting with a revelation about the versatility of map while > I was still living in Perlistan. I haven't used a single loop statement yet > in Clojure, and I doubt I will ever do so except for performance reasons. > > Yes, that is true, you can use that approach everywhere in Perl, but for the exact reason you cite an explicit loop in Perl can sometimes be less awkward/ hard to read/ require less auxiliary yak-shaving, whereas in Lisps these higher order forms that abstract away the looping are consistently the natural way to do things, and the code is more declarative/clean. In Perl, the "right way" to do it seems to depend on the situation, sometimes a while loop, sometimes a foreach-style loop (though I can't remember the last time it seemed like a good idea to use a classic "for i to n"-style loop). Perl offers an obscene amount of syntax to choose from which is good for expressiveness, but I'll take ultra-simplicity, homoiconicity, no-syntax/DIY-syntax approach to expressiveness of the Lisp family of languages over that any day. -- 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 / Common Lisp Question
> > It can (but its startup is slow, currently). May I ask you why you > wouldn't want to use it? > > One reason is that from what little I know about ABCL it seems more straightforward working with Java libraries in Clojure, but also there is a huge amount of enthusiasm and energy going into Clojure, whereas with ABCL the developer is more on their own, with less eyes on the code, smaller community of users, etc. That and I enjoy lots of other things about Clojure, and want to use it, so playing with two JVM Lisps seems a little redundant and it becomes an either/or proposition for me. But I think I would use it if there was something written common lisp thing that I wanted to integrate into some other JVM-based thing, why not? I haven't had that experience but it seems like it could happen. > The nudging of paradigm/idiom makes many things easier in Common > Lisp. > > That depends on a lot of things and it's very personal. Common Lisp is > not automatically easier than Clojure for everyone. > > I agree with you on this actually, I was kind of playing devil's advocate to try to think of arguments for both sides... > I use Common Lisp because that's the Lisp I know. I'm interested in > Clojure because it has put some nice ideas on the table, but currently > I see no reason to use it outside heavily parallelism-oriented > applications, especially given that ABCL is there and it offers a nice > combination of CL with Java libraries. OTOH, I think that for the > average Java developer Clojure is probably friendlier. > > Concurrency is not very developed at all in Common Lisp, which could be a major point against it going forward, but I'm sure people will remedy that, as Lisp is always a good laboratory for adding new things to the language as libraries etc. Of course in the case of Clojure the interesting new ideas didn't come from CL, though many good old ideas did. CL people should probably study and consider Clojure's innovations in this case. -- 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 / Common Lisp Question
> > Rich Hickey's insightful videos have caused me to stop > writing loops whenever possible. For me this is the same > level of "thinking-change" that happened when I moved to > using "Structured Programming" rather than GOTO (in Fortran). > Rich needs to write a paper called > "Loops considered harmful" > That is a great thing, I like that about both Common Lisp and Clojure. Compare with Perl or even Python; you can use map/grep, list comprehensions etc some of the time but not all of the time. I Lisp it's always possible to that in a neat way I think. I know there is a loop macro in CL, which I'm sure can cause many people to just write in some other language's idiom instead of the native one. > Common lisp, however, gives me precise machine-level to > massive function semantics, e.g. (car ...) is a machine > pointer and (integrate ...) is a huge function but I can > freely mix them in (integrate (car ...)). I don't feel the > same "one-ness" in Clojure/Java. > > Yes it is awesome. SBCL has a good enough compile that someone could write a fast OS kernel in it I think. And then we could actually read it and know what it's doing later on, and not have weird buffer overflows. ;) -- 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: cond formatting
user=> (ns utils) utils=> (ns-unmap 'utils 'cond) utils=> (defmacro cond [& body] `(clojure.core/cond ~@(apply concat body))) #'utils/cond utils=> (macroexpand-1 '(cond (false "false") (true "true"))) (clojure.core/cond false "false" true "true") utils=> (cond (false "false") (true "true")) "true" On Tue, Jun 22, 2010 at 6:11 PM, cageface wrote: > I think I'm going to take this route. The style seems pretty common in > clojure contrib and it's readable, if a bit odd at first. > > On Jun 22, 2:20 pm, David Powell wrote: > > I tend to write the condition and action on separate lines, and put a > > blank comment in between each, like this: > > -- > 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: Keyboard Input in Applets
For the sake of anyone who finds this thread in a search at some point, here is the actual answer to my original question: 1. It doesn't matter whether you extend Applet or JApplet, at least for my purposes so far, it seems. JApplet is swing, and solves some of the bugginess found in awt (such as buffered image flicker for example). 2. For Java applets there seems to be two different and incompatible methods of listening to the mouse. One is using the mouseDown handler, and other than throwing random null pointer exceptions, there is no corresponding handler for keyboard events that actually works from that API as far as I can tell. Therefore you need to implement java.awt.event.KeyListener and java.awt.event.MouseListener in your gen-class. Gen-class should have this at least (syntax as embedded in ns macro call): (:gen-class :extends javax.swing.JApplet :implements [java.awt.event.KeyListener java.awt.event.MouseListener]) You need to import from java.awt.event: KeyListener KeyEvent MouseListener and MouseEvent. 3. The prefered event handlers to implement are those from KeyListener et al. Do not write handlers for mouseDown, etc (also those alternate handlers won't work if you have implemented the above in your gen-class). (defn -keyReleased [#^JApplet this #^KeyEvent e] ) (defn -keyTyped [#^JApplet this #^KeyEvent e] ) (defn -keyPressed [#^JApplet this #^KeyEvent e] (and (condp = (. e getKeyCode) KeyEvent/VK_LEFT (go-left) KeyEvent/VK_RIGHT (go-right) KeyEvent/VK_UP (go-up) KeyEvent/VK_DOWN (go-down) false) (.repaint this))) (defn -mouseEntered [#^JApplet this #^MouseEvent e] ) (defn -mouseExited [#^JApplet this #^MouseEvent e] ) (defn -mousePressed [#^JApplet this #^MouseEvent e] ) (defn -mouseReleased [#^JApplet this #^MouseEvent e] ) (defn -mouseClicked [#^JApplet this #^MouseEvent e] ; do something with (.getX e) (.getY e) (.repaint this)) Repaint is a method of JApplet (or Applet if you use that). 4. Implement JApplet (or Applet)'s init handler (not to be confused with gen-class's init/post-init handlers, which I'm not entirely clear on just yet). (defn -init [#^JApplet this] (.addKeyListener this this) (.addMouseListener this this) (.setFocusable this true) Very important: add the listeners, and setFocusable as shown above. 5. Implement paint to render any graphics based on your applet's updated state. Like so: (defn -paint [#^JApplet this #^Graphics g] (draw-images this g)) Rob On Mon, Jun 14, 2010 at 3:52 AM, Meikel Brandmeyer wrote: > Hi, > > On Jun 14, 8:55 am, rob levy wrote: > > > (ns ... > > ... > > (:gen-class > > :extends javax.swing.JApplet > > ??? :implements java.awt.event.KeyListener)) > > :implements [java.awt.event.KeyListener] > > Note: vector. > > > (defn -init [#^JApplet applet] > > ??? addKeyListener ) > > You probably want :post-init. > > > (defn -keyPressed [#^JApplet applet #^KeyEvent event] > > (let [key (. event getKeyCode)] > > (cond (= key (. KeyEvent VK_LEFT)) (dosync (ref-set message "left")) > > (= key (. KeyEvent VK_RIGHT)) (dosync (ref-set message > "right")) > > (= key (. KeyEvent VK_UP))(dosync (ref-set message "up")) > > (= key (. KeyEvent VK_DOWN)) (dosync (ref-set message > "down" > > You can simplify this with condp. > > (condp = key > KeyEvent/VK_LEFT > KeyEvent/VK_RIGHT > KeyEvent/VK_UP > KeyEvent/VK_DOWN ) > > Concerning the question how to make the applet respond: Dunno what the > best way is. I would probably put the KeyListener into a proxy, which > drives the necessary changes (changing the refs in your example). In > the GUI code I would add listeners to the refs, which update the UI on > change. > > Sincerely > Meikel > > PS: Shameless self-promotion: > For proxy: > http://kotka.de/blog/2010/03/proxy_gen-class_little_brother.html > For gen-class: > http://kotka.de/blog/2010/02/gen-class_how_it_works_and_how_to_use_it.html > For GUI driving: > http://kotka.de/blog/2010/05/Decoupling_Logic_and_GUI.html > > Hope some of this helps. > > -- > 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
Clojure / Common Lisp Question
As an informal survey of people who use both Clojure and Common Lisp for different projects, what do you see as the main determining factors behind your choice to use either Clojure or Common Lisp for a project, given the present state of Clojure. Let's only assume we are talking about projects you completely own and have complete freedom to do what you want with. Common lisp: Compiled on the processor, fast. Reader macros. Quality, not quantity of libraries. Multi-paradigm programming with no nudging -- programmer has freedom to be insane/bizarre in ways Clojure makes hard (see Let Over Lambda for examples) Downsides: Hard to deploy. -- but not a problem as server side of web app Can't run on on GAE. -- need to run a server or rent/maintain virtual server. Limited to native librares, though they tend to be awesome. Clojure: Neat concurrency stuff. Better deployment. Can run on Google App Engine. (maybe ABCL can too, but I wouldn't want to use that personally). Lots of Java libraries, many more than for CL. Increasing a large number of awesome native libraries. Downsides: As server side of web app in apache, less straigtforward requires Tomcat, Java crud. Java interop is great-- but Java itself sucks! There is an impedance mismatch of language semantics. The nudging of paradigm/idiom makes many things easier in Common Lisp. Lots of cool benefits of Clojure (such as any/all GUI stuff for example) depend on crufty Java nonsense you must contend with. So, for me at this point, if I don't need interesting concurrent stuff, and I do my own hosting, Common Lisp in Hunchentoot or mod lisp still seems like a superior web development approach. On the other hand if I am doing desktop apps, applets, want to use GAE, etc, Clojure seems better. I feel like as time goes on we will be more abstracted away from the pain of Java. Any thoughts on how you make your decision for specific projects? Thanks, 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: Keyboard Input in Applets
Meikel, Thank you! This gives me some ideas I'm going try. I read your blog posts too, great stuff. The new book by Vanderhart & Sierra serves as good documentation of proxy as well. I have not yet come across a good "Java for Clojure Programmers" guide that really explores all the hairy problems of operating Java libraries via Clojure. Maybe there should be a wiki for this. I think a lot of Clojurers are dynamic language folk like me who have avoided Java for the most part (actually my computer science courses used Java, so I could only imagine the learning curve must be even worse for some people). Rob On Mon, Jun 14, 2010 at 3:52 AM, Meikel Brandmeyer wrote: > Hi, > > On Jun 14, 8:55 am, rob levy wrote: > > > (ns ... > > ... > > (:gen-class > > :extends javax.swing.JApplet > > ??? :implements java.awt.event.KeyListener)) > > :implements [java.awt.event.KeyListener] > > Note: vector. > > > (defn -init [#^JApplet applet] > > ??? addKeyListener ) > > You probably want :post-init. > > > (defn -keyPressed [#^JApplet applet #^KeyEvent event] > > (let [key (. event getKeyCode)] > > (cond (= key (. KeyEvent VK_LEFT)) (dosync (ref-set message "left")) > > (= key (. KeyEvent VK_RIGHT)) (dosync (ref-set message > "right")) > > (= key (. KeyEvent VK_UP))(dosync (ref-set message "up")) > > (= key (. KeyEvent VK_DOWN)) (dosync (ref-set message > "down" > > You can simplify this with condp. > > (condp = key > KeyEvent/VK_LEFT > KeyEvent/VK_RIGHT > KeyEvent/VK_UP > KeyEvent/VK_DOWN ) > > Concerning the question how to make the applet respond: Dunno what the > best way is. I would probably put the KeyListener into a proxy, which > drives the necessary changes (changing the refs in your example). In > the GUI code I would add listeners to the refs, which update the UI on > change. > > Sincerely > Meikel > > PS: Shameless self-promotion: > For proxy: > http://kotka.de/blog/2010/03/proxy_gen-class_little_brother.html > For gen-class: > http://kotka.de/blog/2010/02/gen-class_how_it_works_and_how_to_use_it.html > For GUI driving: > http://kotka.de/blog/2010/05/Decoupling_Logic_and_GUI.html > > Hope some of this helps. > > -- > 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
Keyboard Input in Applets
Hi All, I've been able to figure out many Java things based on Sun's online documentation, and this is undoubtedly due to my not being a Java programmer, but for the life of me I can't figure out based on Java examples how to get my Clojure JApplets to respond to keyboard input. Does anyone have any ideas as to how to go about doing this? (set! *warn-on-reflection* true) (ns ... ... (:gen-class :extends javax.swing.JApplet ??? :implements java.awt.event.KeyListener)) ... (defn -init [#^JApplet applet] ??? addKeyListener ) (defn -paint [#^JApplet applet #^Graphics g] ... (.drawString #^String @message 60 40) ...) (defn -keyPressed [#^JApplet applet #^KeyEvent event] (let [key (. event getKeyCode)] (cond (= key (. KeyEvent VK_LEFT)) (dosync (ref-set message "left")) (= key (. KeyEvent VK_RIGHT)) (dosync (ref-set message "right")) (= key (. KeyEvent VK_UP))(dosync (ref-set message "up")) (= key (. KeyEvent VK_DOWN)) (dosync (ref-set message "down" (. applet repaint)) Thanks, 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: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?
This is a great idea, and is something that Clojure really needs in my opinion (for starters it would be nice to be able to write GUI apps in Clojure without worrying about the Java level, with its completely different and completely annoying semantics). My vote is for Swing, simply because the difference in look and feel doesn't seem to be all that great. If the added difficulty of deploying bought tremendous LAF benefits I would say yeah use SWT, but really the differences don't seem to justify it. Also, it could always be forked later on if there were a big enough contingency of SWT fans, and the work put into building Swing version would go a long way toward that goal, especially considering that this is going to abstract away the Swing-specific stuff. Rob On Thu, May 27, 2010 at 11:18 AM, Luke VanderHart wrote: > My side project is a fairly complex GUI application written in > Clojure. Recently, I've become irritated with using Java interop for > everything. It's not that Clojure doesn't have nice java interop - it > does. It's just that when interacting with a GUI framework, which is a > large part of my app, I have to be back in mutable object-oriented > land, worrying about class hierarchies, mutable state, locks, etc. > Yucky. > > So, with a perhaps dangerous lack of sanity and without any guarantee > of success, I've decided to try my hand at writing an idiomatic > Clojure GUI library. If I have success (which I doubt) I will of > course make it available as open source. > > I intend for it to be mostly declarative, with a nice DSL for defining > GUI elements. Each component will also implement map, and use one of > Clojure's reference types as an interface for inspecting / updating > its state. I may also implement some aspects of Functional Reactive > Programming wherever it's convenient to do so. > > What you all must help me decide is what GUI framework to use as the > underpinnings of it. It's genuinely hard to decide. I have at least > some experience with all of them, so I have no strong preference, but > I'd like to get your input. I did consider trying to make it abstract > enough that you could plug in *any* of them under the hood, but > there's enough differences between the frameworks that that would get > very ugly very fast. > > Possibilities are: > > AWT > Pros: native widgets, bundled with Java, low-level > Cons: few widgets, considered somewhat obselete > > Swing > Pros: bundled with Java, good widget selection > Cons: non-native widgets > > SWT > Pros: native widgets, widely used > Cons: requires platform-specific libs > > QT Jambi > Pros: native widgets, huge widget selection, highly-regarded framework > Cons: requires platform-specific libs, writing custom widgets is > hairy, momentum and support seem to be lagging since Nokia dropped > official support. > > Remember, the actual API won't matter - that will be completely > abstracted away. So try to focus on the framework's look and feel. > Also let me know if I've missed any of the framework's key > characteristics. > > Thanks! > > -Luke > > > > > > > > > > > > > > > > -- > 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 on Android
Also see the tutorial: http://riddell.us/ClojureAndAndroidWithEmacsOnUbuntu.html On Thu, May 20, 2010 at 3:21 PM, rob levy wrote: > Hi David, > > Check-out http://github.com/remvee/clojurehelloandroid > > I'm surprised we don't hear more talk of people doing this. It's on my > list of things to do too (I just got an mp3 player that runs Android 1.6 and > I'm going to start with Remvee's Hello World example). > > Rob > > > On Thu, May 20, 2010 at 12:37 PM, David Blubaugh < > davidblubaugh2...@gmail.com> wrote: > >> To All, >> >> >> Has anyone yet ported clojure to the android cellphones at this >> time ?? I want to develop applications for the Android cellphones by >> utilizing a dialect of the lisp programming language >> >> >> 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 > > > -- 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 on Android
Hi David, Check-out http://github.com/remvee/clojurehelloandroid I'm surprised we don't hear more talk of people doing this. It's on my list of things to do too (I just got an mp3 player that runs Android 1.6 and I'm going to start with Remvee's Hello World example). Rob On Thu, May 20, 2010 at 12:37 PM, David Blubaugh < davidblubaugh2...@gmail.com> wrote: > To All, > > > Has anyone yet ported clojure to the android cellphones at this > time ?? I want to develop applications for the Android cellphones by > utilizing a dialect of the lisp programming language > > > 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 -- 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
compiling a GUI app and also: interference of Java's built-in architechture
Hi, I know that all Java GUI libraries can be used within the REPL, but it is my understanding that in order to make it self-contained and executable (a jar or a class file), it is necessary to write some Java and call the Clojure code from the java applet or application. Is this true, or am I doing it wrong? I know a lot more about Common Lisp than I know about Java by the way, so I end up having to figure out Java stuff sometimes in order to do certain things in Clojure... Another question I have has to do with the applet model and mutable state. It seems like an applet's required architecture forces you to do things less idiomatically and make use of globally defined agents or refs that change. To give an example from the applet I am writing (but this is general across almost all applets I would think), the paint function in Clojure (called by the paint method of the java applet) receives a graphics object. Meanwhile the mouseDown function receives the coordinates of the pointing device, does something, and calls repaint. Mousedown function therefore is expected to modify some globally defined state so that repaint can use it in repainting. Would I be wrong to assume that this forces a Clojure-unfriendly structure onto the Clojure applet? So if I am right about these two facts, it seems like Clojure should include a native way of making applets/applications that both enables the truly functional style that Clojure is built on, and doesn't require writing Java to call it (it seems like Clojure should replace Java, not perpetuate it, other than to build on its vast libraries, IMHO). What do you think (and is there something I'm understanding wrong here)? 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 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 -~--~~~~--~~--~--~---