Re: What is the status of Clojure on LLVM or C?
A previous thread that covers a lot of ground, but should give you a lot of the information you are looking for [1]. There aren't too many use cases that couldn't be covered with ClojureScript+V8 or some of the other suggestions. [1] https://groups.google.com/forum/?fromgroups=#!topic/clojure/UWBpyHndluA On Wed, Mar 27, 2013 at 4:05 PM, Joe Graham josgr...@gmail.com wrote: Hi Group, Good afternoon I hope everyone is well. I just wanted to reach out to this group and get the current status of Clojure today on the LLVM compiler or C based implementation? Has anyone looked into a Julia implementation? Just trying to get a roadmap on the main forks before searching on every permutation of this question. Thanks so much for your help and valuable input of this group. BR_joe -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Natively Compiled Clojure
Embedding in applications - Python is used very often as a scripting language in 3d apps, games, mapping software, etc. I've yet to hear of the JVM ever being used for this. Related to this, do you have any thoughts on the viability of embedding clojure-py into a C++ application for similar use cases? Seems that performance could be a concern, but sandboxing might be more straightforward. Haven't had time to try this myself yet. Thanks. On Fri, Jan 25, 2013 at 11:28 AM, Timothy Baldridge tbaldri...@gmail.com wrote: The important question to ask yourself (and I'll cover this in my talk), is why do you want native Clojure? A native implementation of Clojure will fail to deliver on several fronts: Interop with systems - Java has one of the biggest ecosystems on the planet Performance - The JVM JIT and GC are really the best that the world has to offer. Beating them in the general use case is very, very hard. However, a native clojure implementation could succeed on a few other fronts: Deterministic behavior - The JVM JIT/GC are not very deterministic, and are hard to reason about. In this area they trade off simplicity for performance. 99% of the time that is what you want. But perhaps in some cases you would like different behavior. Embedding in applications - Python is used very often as a scripting language in 3d apps, games, mapping software, etc. I've yet to hear of the JVM ever being used for this. Systems where the JVM isn't available/allowed - think iOS So while I think there is a use for a non JVM/JS implementation of Clojure, the use cases are much smaller than many think. I've gotten a bit sidetracked on the more general topic of generating native code via Clojure and LLVM lately, so while my talk will show some basic Clojure code running in the Python VM via LLVM, it will also cover the more broad concept of leveraging LLVM directly from Clojure on the JVM. The latter is a prerequisite to the former, so the library I'll be showcasing can be used for generating code for either situation. Should be fun times for all! Timothy On Fri, Jan 25, 2013 at 9:08 AM, Tony Pitluga tony.pitl...@gmail.com wrote: There are a couple projects that might be worth looking at although it seems both have not been updated in a few months. ClojureC: https://github.com/schani/clojurec Clojure-Scheme: https://github.com/takeoutweight/clojure-scheme On Fri, Jan 25, 2013 at 10:35 AM, Nahuel Greco ngr...@gmail.com wrote: Check the clojure-py2 project, they plan to use LLVM to generate native modules (as C compiled) for Python. When that objective is reached probably you will have almost all the machinery to compile python-less native binaries: http://lanyrd.com/2013/clojurewest/sccgmm/ Saludos, Nahuel Greco. On Fri, Jan 25, 2013 at 12:18 PM, Marko Kocić ma...@euptera.com wrote: On Friday, January 25, 2013 6:12:07 AM UTC+1, Mikera wrote: A natively compiled Clojure would be very very interesting (perhaps targeting LLVM?) However it would also be very hard to implement. Clojure depends on a lot of features provided by the JVM (JIT compilation, interop with Java libraries, garbage collection being the most significant ones). It would be very hard to reimplement all of these from the ground up. The JVM is already a very good host platform, why fix something that isn't broken? What about native ClojuresScript? It doesn't have to implement everything Clojure have already, and many people could consider it good enough alternative to Clojure. I could personally live without runtime macros and eval if it would gain me small and performant native executable. Arguably the effort would be better spend improving the JVM with extra features that would help Clojure (e.g. TCO). On Tuesday, 22 January 2013 00:29:54 UTC+8, octopusgrabbus wrote: I use Clojure primarily as a very reliable tool to aid in data transformations, that is taking data in one application's database and transforming it into the format needed for another applications' database. So, my question is would a natively compiled Clojure make sense or turn the language into something that was not intended? In almost all instances I have not found a problem with Clojure's execution speed so my question is not about pro or anti Java. 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
Re: Natively Compiled Clojure
On Sun, Jan 27, 2013 at 1:31 PM, Paul deGrandis paul.degran...@gmail.com wrote: As far as embedding Clojure is concerned, another option is ClojureScript-Lua + LuaJit + C. I've recently started going through the CLJS-Lua source to see how viable this is. Thanks, I had forgotten about ClojureScript-Lua. (And hopefully the content of the clojure-py2 talk will be available afterwards, very interesting 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
Re: Natively Compiled Clojure
I haven't hit any hard limits at this point, but you hit on a use case where Python and Lua currently hit a sweet spot that I think would be nice to use Clojure: C/C++ systems that want to expose scripting capabilities to users (e.g. game engines, robotics systems). For these types of use cases, the ability to deploy native Clojure executables is not as important as the ability embed a low-resource runtime, the ability to call C/C++ code, the ability to sandbox the environment, etc. On Sun, Jan 27, 2013 at 6:56 PM, Timothy Baldridge tbaldri...@gmail.com wrote: That's why I think it's a good idea to ask what the goals are for native Clojure. The ClojureScript and Clojure-Py options while nice both don't allow for a good concurrency story. On top of that, I'm not sure either of those would actually run on iOS. However, a pure, from-scratch option has a much smaller ecosystem to draw from. But on the upside, you're also not limited by the host VM. This means that the type system could be based purely on protocols instead of having to fit protocols into a OOP type system. These are the questions I'd like to see people answer here: what hard limits have you hit with Clojure/ClojureScript that you think could be resolved with a native Clojure implementation? Timothy Baldridge On Sun, Jan 27, 2013 at 4:32 PM, Paul deGrandis paul.degran...@gmail.com wrote: Additionally, you might also consider ClojureScript itself. With a little work you could embed V8 into your application (https://developers.google.com/v8/embed). Martin Trojer just wrote a really nice blog post on embedded runtimes - http://martinsprogrammingblog.blogspot.co.uk/ All that said, for most apps where an embedded, scripting runtime is advantageous, ClojureScript-Lua +LuaJIT and PyClojure+cFFI+Python/PyPy are two very attractive options. In the best case scenario, the former delivers more speed and a smaller footprint, trading off some library and ecosystem comforts. The latter has a great ecosystem, but will be slower and have a larger memory footprint. Paul -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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] clj-xpath 1.3.3
You can contact the maintainers at the address found at the bottom of [1] and ask them to remove the clj-xpath group, but you probably don't want to do that if anyone is using the library. [1] https://github.com/ato/clojars-web/wiki/Contact On Tue, Nov 20, 2012 at 10:07 AM, Kyle R. Burton kyle.bur...@gmail.comwrote: The Leiningen coordiates are: [org.clojars.kyleburton/clj-**xpath 1.3.3] Just curious, why isn't that just [clj-xpath 1.3.3]? Searching clojars, you seem to have uploaded 1.3.0 a while back... That was a mistake. I didn't want to claim a global 'clj-xpath' namespace on Clojars so I added a namespace. I'm not sure if I can remove that. Kyle -- Twitter: @kyleburton Github: https://github.com/kyleburton Blog: http://asymmetrical-view.com/ Fun: http://snapclean.me/ -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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] clj-xpath 1.3.3
Thanks for the link. I have no idea if anyone is using the library w/o the group name. Is there any way to tell via Clojars? No. I think the only real option would be to contact anyone following the repo on Github and inquire. Honestly, though, I would just leave it, I don't see it causing any issues. On Tue, Nov 20, 2012 at 10:47 AM, Kyle R. Burton kyle.bur...@gmail.com wrote: On Tue, Nov 20, 2012 at 10:35 AM, Mark Rathwell mark.rathw...@gmail.com wrote: You can contact the maintainers at the address found at the bottom of [1] and ask them to remove the clj-xpath group, but you probably don't want to do that if anyone is using the library. Thanks for the link. I have no idea if anyone is using the library w/o the group name. Is there any way to tell via Clojars? Regards, Kyle -- Twitter: @kyleburton Github: https://github.com/kyleburton Blog: http://asymmetrical-view.com/ Fun: http://snapclean.me/ -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: First foray into clojure - questions for new project
Should I dive into Ring as well? What about Compojure versus Noir? Noir is higher level than Compojure, and usually easier for new people to jump into, but not always as flexible, functional or composable. On Tue, Nov 13, 2012 at 10:27 AM, Jonathon McKitrick jmckitr...@gmail.com wrote: Thanks, Michael. Should I dive into Ring as well? What about Compojure versus Noir? On Monday, November 12, 2012 9:26:25 PM UTC-5, Michael Klishin wrote: 2012/11/13 Jonathon McKitrick jmcki...@gmail.com - Any caveats I should be aware of running clojure on heroku? For small pure Clojure apps, probably none. - What libraries should I become familiar with for straightforward web apps? Compojure, Noir, clojure.java.jdbc, clojurewerkz.org libraries. See also http://clojure-doc.org/articles/ecosystem/libraries_directory.html - What tutorials would get me up and running ASAP? I'm currently an intermediate SBCL user. http://clojure-doc.org/articles/tutorials/basic_web_development.html is very new and not very complete but sounds like what you are looking for. -- MK http://github.com/michaelklishin http://twitter.com/michaelklishin -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: First foray into clojure - questions for new project
These 4 should help you get from zero to a simple web app running on Heroku pretty quickly: https://github.com/technomancy/leiningen/wiki/Upgrading https://github.com/technomancy/swank-clojure https://github.com/kingtim/nrepl.el https://devcenter.heroku.com/articles/clojure-web-application Some other background you will probably want to start with: https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md https://github.com/weavejester/compojure/wiki http://webnoir.org/ And the Clojure Doc Site is quickly turning into an amazing resource: http://clojure-doc.org/ On Mon, Nov 12, 2012 at 7:29 PM, Jonathon McKitrick jmckitr...@gmail.comwrote: Hi all, I've heard many good things about clojure, and I'm finally taking the plunge. I've been using Hunchentoot on SBCL for several years, and I've finally decided it's time to move to a current lisp with a proven platform and (from what I have heard) a great community. I have a project currently in php that receives POST data, saves it to a db, and then serves report data via JSON. It's a dead easy concept. The catch is, I've committed to moving to clojure on heroku, and I need to quickly learn the language and the best tools I need to do the job with a short learning curve. I've found a number of tutorials and intros that I'll start with, but I'm open to suggestions: - Any caveats I should be aware of running clojure on heroku? - Is it simple enough to use SLIME (which I'm very comfortable with) and then push to production on heroku? - What libraries should I become familiar with for straightforward web apps? - What tutorials would get me up and running ASAP? I'm currently an intermediate SBCL user. thanks in advance -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: lein-clr for building ClojureCLR projects
Great work! Really looking forward to NuGet integration. On Sun, Oct 28, 2012 at 9:13 AM, Shantanu Kumar kumar.shant...@gmail.comwrote: Hi, I am happy to announce `lein-clr`, a Leiningen plugin for building ClojureCLR projects: https://github.com/kumarshantanu/lein-clr As of 0.1.0, dependency mechanism is not provided (external dependencies can be specified) but the following tasks work: * clean * compile * repl * run * test I have tested it on Windows 7 (64-bit) on both .NET and Mono. I saw no issues when using ClojureCLR 1.4, though there were few problems with ClojureCLR 1.3. Give it a try and please feel free to let me know what you think. Full changelog and TODO is here: https://github.com/kumarshantanu/lein-clr/blob/master/CHANGES.md Shantanu -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: What is this function?
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L588 On Tue, Oct 9, 2012 at 1:03 PM, Larry Travis tra...@cs.wisc.edu wrote: As participants in this googlegroup have often observed, an excellent way to learn Clojure is to study the source definitions of its API functions. This advice works better for learners who know Java, which I don't. I sometimes think that, if I were to teach a Clojure Programming course, I would list a Java Programming course as a prerequisite (for both teacher and students!). But here is some Clojure.core source code that raises a problem for me which surely doesn't have anything to do with not knowing Java. user (source list*) (defn list* Creates a new list containing the items prepended to the rest, the last of which will be treated as a sequence. {:added 1.0 :static true} ([args] (seq args)) ([a args] (cons a args)) ([a b args] (cons a (cons b args))) ([a b c args] (cons a (cons b (cons c args ([a b c d more] (cons a (cons b (cons c (cons d (spread more))) -- What is the function spread? It is not in the Clojure API -- and the definition of list* seems to me to be complete without it. --Larry -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: *foo*
It's in there, search Asterisks: Variants, Internal Routines, Mutable Globals On Tue, Oct 9, 2012 at 1:58 PM, Grant Rettke gret...@acm.org wrote: Gosh I thought it was in there... maybe it is not. Sorry. On Tue, Oct 9, 2012 at 12:55 PM, Grant Rettke gret...@acm.org wrote: On Tue, Oct 9, 2012 at 12:54 PM, Brian Craft craft.br...@gmail.com wrote: I know I saw an explanation of this on some obscure page, but I can't find it now. What's up with the symbols with stars at front end? http://mumble.net/~campbell/scheme/style.txt -- ((λ (x) (x x)) (λ (x) (x x))) http://www.wisdomandwonder.com/ ACM, AMA, COG, IEEE -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: *foo*
It's in there, search Asterisks: Variants, Internal Routines, Mutable Globals Should have noted that's not how it is used in Clojure though On Tue, Oct 9, 2012 at 2:00 PM, Mark Rathwell mark.rathw...@gmail.com wrote: It's in there, search Asterisks: Variants, Internal Routines, Mutable Globals On Tue, Oct 9, 2012 at 1:58 PM, Grant Rettke gret...@acm.org wrote: Gosh I thought it was in there... maybe it is not. Sorry. On Tue, Oct 9, 2012 at 12:55 PM, Grant Rettke gret...@acm.org wrote: On Tue, Oct 9, 2012 at 12:54 PM, Brian Craft craft.br...@gmail.com wrote: I know I saw an explanation of this on some obscure page, but I can't find it now. What's up with the symbols with stars at front end? http://mumble.net/~campbell/scheme/style.txt -- ((λ (x) (x x)) (λ (x) (x x))) http://www.wisdomandwonder.com/ ACM, AMA, COG, IEEE -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Clojurejs: a lightweight clojure to javascript compiler
Now I'm confused! Isn't clojureScript exactly that? ClojureScript is a Clojure implementation that targets Javascript (meaning that Clojure core, et al, is also necessarily converted to Javascript in the build process and a part of what you ship). I'm assuming this project is a straight translator from Clojure source to the equivalent Javascript, which would mean smaller output but not a robust implementation of Clojure. On Mon, Oct 8, 2012 at 9:10 AM, Jim foo.bar jimpil1...@gmail.com wrote: On 08/10/12 07:18, Hoàng Minh Thắng wrote: Clojurejs started by [kriyative](https://github.com/kriyative) is an amazing project that compile clojure to javascript. Now I'm confused! Isn't clojureScript exactly that? Jim -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 web framework
Documentation around libraries (and elsewhere) is recognized as a primary weakness, but starting a new, larger web Framework project isn't an obvious solution to that very distributed problem. Agree 100% with this. I think the various libraries are mostly at the right level, and are mostly being worked on a the right pace, but having a wiki-like place with tutorials and contributed project examples (or walk-throughs of open stuff already available) showing how all of the pieces can be used together (including both clj and cljs), and which pieces are right for various types of projects would be beneficial, I think. Like everyone else, time is not plentiful right now, but I'd be willing to contribute if someone has time to take the lead. - Mark On Fri, Sep 28, 2012 at 10:42 AM, Chas Emerick c...@cemerick.com wrote: If I may offer a couple of counterpoints: Compojure is slightly more popular than noir, at least based on the (perhaps faulty) measures of stars and forks on github, and used by count on http://clojuresphere.herokuapp.com. There are good reasons why a Rails-esque framework has not yet caught on with Clojure programmers. Libraries frameworks, and all the goodness that flows from that. Given that perspective (smaller libraries made to compose trivially), there's really not enough work for 5-6 people to do on a single project. Better to have some very large number of people working together on a plurality of focused libraries. From the data we have[1], people are being quite successful with Clojure in web development contexts (anecdotally, using Compojure as well as Noir and others, too). Documentation around libraries (and elsewhere) is recognized as a primary weakness, but starting a new, larger web Framework project isn't an obvious solution to that very distributed problem. Finally, although it is not free, note that 'Clojure Programming'[2] provides a from scratch tutorial of how to use Ring, Compojure, and Enlive. Cheers, - Chas [1] http://cemerick.com/2012/07/19/2012-state-of-clojure-survey/ [2] http://www.clojurebook.com On Sep 28, 2012, at 3:36 AM, goracio wrote: Hi So i'd like to point to the problem here. Clojure web framework in google get these results, at least for me 1. noir 2. stackoverflow question 2008 year 3. stackoverflow question 2010 year 4. joodo ( outdated thing developed by one person) 5. Compojure ( routing dsl) So there is no popular framework these days for clojure. Noir is mostly Chris Granger thing. As he make Lighttable today Noir developed by some other people ( or may be on person not sure). Main site instructions are nice but already outdated ( lein2). No news, no blog, no new features, no examples, no infrastructure. Lein new project, insert noir in dependencies and you don't have working app, you must add :main and stuff to work. What about testing ? no info, no structure, decide on your own. It's no secret that web development today is biggest and popular trend. If language and it's community have good web framework that language will gain more popularity. Take Ruby on rails it has over 30 core contributers, huuuge community, active development, industry standart web development framework. Good testing, development infrastracture, easy start, sprockets for js css managment and so on. Also it has some books about testing and framework itself which is good start point for newbies. I like Clojure, for simplicity mostly. It has amazing power and i believe it can be very good platform for web development. So what i suggest : Take 1 platform for web development in Clojure (for example noir as most mature framework) . Form working core group from 5-6 people. Decide about name of the project ( or take Noir) Make good site about it Make a plan for development ( what core features should have first version) Make first version Make couple good examples Make good documentation and maybe a book ( community book for example on github that will be online and updated frequently). -- http://www.playframework.org/ good example what site could be Alternative to online book can be guides, as for ruby on rails http://guides.rubyonrails.org/index.html Another good news that there is nice web IDE for Clojure by Bodil Stokke https://github.com/bodil/catnip. Super easy install, very nice insterface, reactive interface ( no need for browser refresh, autorecompile when you save ) web based ! and under active development, just perfect place for newbies to start. So this project also can be added to Clojure Web framework project. Also we have ClojureScript so Clojure web framework would be perfect place where this thing can shine. Let's discuss. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first
Re: Clojure web framework
Well there are many usefull libs for web development you can choose this and that combine them and get something. But from newbie perspective it's kind of a difficult question where to start from, what to use, what good practice is. What lib to use for persistance with Mysql, Postgre, for Mongo, is there alternative to Backbone here, how make site reactive, how to use ajax, is there MVC pattern or there is no any and so on. How can i test my app, what best libs for that and what best practices. How can i deploy my app, what tools i can use for that. What debbuging tools can i use. Is there any special IDE or plugin to existing IDE for fast and convinient web development. Simple case - lein can autoreload/autocompile code for ClojureScript but how about a project? These are all documentation issues. It's not that documentation doesn't exist, but I think one consolidated location telling telling the entire story of Clojure web development would be extremely helpful for people looking to answer the questions you have listed. And still if Noir is like Sinatra for not too big sites and projecst and Rails is like a pro maybe there should be something like a pro at Clojure. I think this is really an issue of combining the right existing components, and knowing what those right components are for a given situation. On Fri, Sep 28, 2012 at 12:30 PM, goracio felix...@gmail.com wrote: lein new noir my-app cd my-app lein run Yes i already made pull request to update README file with this. Well there are many usefull libs for web development you can choose this and that combine them and get something. But from newbie perspective it's kind of a difficult question where to start from, what to use, what good practice is. What lib to use for persistance with Mysql, Postgre, for Mongo, is there alternative to Backbone here, how make site reactive, how to use ajax, is there MVC pattern or there is no any and so on. How can i test my app, what best libs for that and what best practices. How can i deploy my app, what tools i can use for that. What debbuging tools can i use. Is there any special IDE or plugin to existing IDE for fast and convinient web development. Simple case - lein can autoreload/autocompile code for ClojureScript but how about a project? So examples and good updated guides/online book does matter. There should be clear point about why Clojure and Clojure applied to web better then others, how it can solve problems better then others. How can i recommend others to use Clojure and how i answer the question So what about clojure is there any good framework to start with and what i can do with that ? I am not talking about absence of any guides and recommendations about web dev in Clojure there are couple good examples but they are outdated. And still if Noir is like Sinatra for not too big sites and projecst and Rails is like a pro maybe there should be something like a pro at Clojure. пятница, 28 сентября 2012 г., 19:37:05 UTC+4 пользователь Sean Corfield написал: The lein-noir plugin works with lein2 so you can just say: lein new noir my-app cd my-app lein run The webnoir.org website seems to provide reasonable documentation on getting started. If you have suggestions to improve the documentation, I'm sure Chris would be happy to receive them (I suspect the webnoir.org site is also a repo on github so you can send pull requests). I ported my web framework FW/1 from CFML to Clojure for my own use but feel free to check that out too. Again, the simple lein2 approach works: lein new fw1 my-app cd my-app lein run (or PORT=8123 lein run to use a different port) Documentation is minimal because it's deliberately a simple framework but there's an example app, also ported from the CFML version, and more docs on the CFML version's github repo - plus a fairly large user community for the CFML version :) I don't really thinks Rails-like frameworks fit with the Clojure way of thinking. As Chas said, we're more inclined to combine a number of libraries to help build an application than to use frameworks. FW/1 uses Ring and Enlive and provides just a thin convention-based veneer over those to achieve most of what the CFML version has offered for three years :) Sean On Friday, September 28, 2012, goracio wrote: Hi So i'd like to point to the problem here. Clojure web framework in google get these results, at least for me 1. noir 2. stackoverflow question 2008 year 3. stackoverflow question 2010 year 4. joodo ( outdated thing developed by one person) 5. Compojure ( routing dsl) So there is no popular framework these days for clojure. Noir is mostly Chris Granger thing. As he make Lighttable today Noir developed by some other people ( or may be on person not sure). Main site instructions are nice but already outdated ( lein2). No news, no blog, no new features, no examples, no infrastructure. Lein new project, insert noir
Re: Question: Looking at Noir code - hey, are those singletons?
If I'm right then defining your 'globals' (for lack of a better word) like this would mean, among other things, that you really can't have two independent Noir apps defined/running in the same project - is that a correct assessment? Just out of curiosity, could you expand on what you mean here? What types of situations would you need/want multiple independent Noir apps defined/running in the same project? On Wed, Sep 12, 2012 at 10:30 AM, the80srobot a...@ingenious.cz wrote: Hello, So I've been working on a project at work, that required me to code a simple web interface. I considered going with Noir, and while reading the code, I noticed a pattern that seems to repeat throughout most of the code that Chris Granger has published in Clojure. This is what I'm referring to: ; these are at the top level in (ns noir.core) (defonce noir-routes (atom {})) (defonce route-funcs (atom {})) (defonce pre-routes (atom (sorted-map))) (defonce post-routes (atom [])) (defonce compojure-routes (atom [])) Now, I am new to Clojure, but I am not new to (functional) programming and I'd like to think that I know a singleton when I see one. Is that really what these are? If I'm right then defining your 'globals' (for lack of a better word) like this would mean, among other things, that you really can't have two independent Noir apps defined/running in the same project - is that a correct assessment? Can someone more experienced shed some light on why it's done this way? My experience in functional programming has taught me to always limit my scope - I would think that either using thread-local bindings (and then rebinding them to child threads) or relying on lexical scope would be preferable to polluting the global state. Is this a Clojure best practice? Thanks. I'm looking to use Clojure a lot at work, and I'm trying to really understand the language before I throw it our production problems. ~Adam -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Question: Looking at Noir code - hey, are those singletons?
One of the great advantages of Ring (and other purely functional bits that stack on top, like Compojure, Bishop, etc) is that its handlers are readily composable. Among other things, this means that way you compose handlers from two different namespaces in the same app is fundamentally no different than the way you compose handlers from N different applications (which can come from different projects, maintained by different teams, etc). Combined with something like Compojure's nested routes[1], this is a simple and powerful way to build modular web apps and services by default. I presume the same can be done with two Noir apps as well, but something would need to be done to translate or remap each app's routes so that they're not stepping on each other's toes? I suspect the same would apply to anything that Noir adds imperatively to such global maps, like middleware. Thanks for expanding, Chas. I couldn't quite see what Adam was describing. Most of what you describe is doable in Noir, though I see your point...its handling of contexts and coupling of app to middleware can make some of that difficult. - Mark On Thu, Sep 13, 2012 at 12:56 PM, Chas Emerick c...@cemerick.com wrote: On Sep 13, 2012, at 11:57 AM, Mark Rathwell wrote: If I'm right then defining your 'globals' (for lack of a better word) like this would mean, among other things, that you really can't have two independent Noir apps defined/running in the same project - is that a correct assessment? Just out of curiosity, could you expand on what you mean here? What types of situations would you need/want multiple independent Noir apps defined/running in the same project? One of the great advantages of Ring (and other purely functional bits that stack on top, like Compojure, Bishop, etc) is that its handlers are readily composable. Among other things, this means that way you compose handlers from two different namespaces in the same app is fundamentally no different than the way you compose handlers from N different applications (which can come from different projects, maintained by different teams, etc). Combined with something like Compojure's nested routes[1], this is a simple and powerful way to build modular web apps and services by default. I presume the same can be done with two Noir apps as well, but something would need to be done to translate or remap each app's routes so that they're not stepping on each other's toes? I suspect the same would apply to anything that Noir adds imperatively to such global maps, like middleware. Cheers, - Chas [1] https://github.com/weavejester/compojure/wiki/Nesting-routes -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: function parameters were working, and now I suddenly get a cast error
See [1]. Valid ServerSocket constructors: ServerSocket() ServerSocket(int) ServerSocket(int,int) ServerSocket(int,int,InetAddress) Your code is trying: ServerSocket(int,string) [1] http://docs.oracle.com/javase/1.4.2/docs/api/java/net/ServerSocket.html On Tue, Aug 28, 2012 at 8:25 PM, larry google groups lawrencecloj...@gmail.com wrote: I apologize about the beginner questions. I am new to Clojure. If I do this: (defn run-server [port what-to-do] (let [server-socket (ServerSocket. port localhost)] (while (not (. server-socket isClosed)) (listen-and-respond server-socket what-to-do (defn -main [ args] (let [port (Integer/parseInt (first args)) service (symbol (second args))] (println Server is starting) (println port: port) (println (second args)) (println (symbol (second args))) (println service: service) (run-server port service))) And on the command line I call it like: java -jar who-is-logged-in-1.0-standalone.jar 3456 who-is-here-now This prints out: Server is starting port: 3456 who-is-here-now who-is-here-now service: who-is-here-now but then I get this error: Exception in thread main java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number at who_is_logged_in.core$run_server.invoke(core.clj:27) Line 27 is: (defn run-server [port what-to-do] The only way I can read the error message is to think that the code is trying to assign the value of what-to-do to the (integer) port. What have I done wrong? On Tuesday, August 28, 2012 12:47:44 PM UTC-4, larry google groups wrote: Command line arguments that are not strings need to be converted prior to use by your main function. That makes sense, I need to cast it to a symbol, yes? I have a problem with that though. At the REPL I tried something like this: (def hey (resolve (symbol what-to-do))) which worked great at the REPL, but in my code I get nil returned from resolve. If I do this: (defn -main [ args] (let [port (Integer/parseInt (first args)) service (resolve (symbol (second args)))] (println Server is starting) (println port: port) (println (second args)) (println (symbol (second args))) (println service: service) (run-server port service))) And call it like this: java -jar who-is-logged-in-1.0.0-**SNAPSHOT-standalone.jar 3456 who-is-here-now Everything looks correct till the final line when I get nil: Server is starting port: 3456 who-is-here-now who-is-here-now service: nil On Tuesday, August 28, 2012 6:53:24 AM UTC-4, Jon_Boone wrote: Command line arguments that are not strings need to be converted prior to use by your main function. Look at the code for the port number and do the same for the service. --jon On Aug 28, 2012, at 2:42, larry google groups lawrenc...@gmail.com wrote: So, this started when I read Keith Swallow's article on a simple web server: http://keithcelt.com/a-simple-**web-server-in-clojurehttp://keithcelt.com/a-simple-web-server-in-clojure I took his code and ran lein new to create a new project and I copy and pasted his code to core.clj and made some minor adjustments, adding gen-class and main so I could run this from the command line. My main function looked like this: (defn -main [ args] (let [port (Integer/parseInt (first args))] (println Server is starting) (run-server port echo))) Which called his function: (defn run-server [port service] (let [server-socket (create-socket port)] (while (not (. server-socket isClosed)) (listen-and-respond server-socket service I compiled that and ran lein uberjar and then ran it from the command line and it worked great. Then, to make it slightly more flexible, I wanted to hand in the name of the service from the command line. So I made a minor change: (defn run-server [port what-to-do] (let [server-socket (ServerSocket. localhost port)] (while (not (. server-socket isClosed)) (listen-and-respond server-socket what-to-do (defn -main [ args] (let [port (Integer/parseInt (first args)) service (second args)] (println Server is starting) (println port: port) (println service: service) (run-server port service))) I compiled this and ran it. And now this line: (defn run-server [port what-to-do] Gets this error: Exception in thread main java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number at who_is_logged_in.core$run_**server.invoke(core.clj:27) I'm calling it from the command line with: java -jar who-is-logged-in-1.0.0-**SNAPSHOT-standalone.jar 3456 who-is-here-now I also tried putting the service name in quotes: java -jar who-is-logged-in-1.0.0-**SNAPSHOT-standalone.jar 3456 who-is-here-now Can anyone tell me what is wrong? Why does Clojure think I'm trying to cast who-is-here-now to a number?
Re:
In your has22 definition, (by-pairs [a]) should be (by-pairs a) On Sun, Jul 29, 2012 at 9:07 AM, John Holland jbholl...@gmail.com wrote: I'm doing some exercises in coding that are meant for Java but I'm doing them in Clojure. I'm stuck on this one. The goal is to return true if an array of ints contains two consecutive 2s. I figured I'd use Stuart Halloway's by-pairs function to turn the sequence into pairs of numbers and check for a pair that is 2,2. This code in has22 below works if pasted into the REPL and evaluated but as a function it always returns false. If anyone can explain my error to me it'd be great. ( defn by-pairs [coll] (let [take-pair (fn [c] (when (next c) (take 2 c)))] (when-let [pair (seq (take-pair coll))] (lazy-seq (cons pair (by-pairs (rest coll))) (defn has22 [a] (if (some true? (map #(= 2 (first %) (nth % 1)) (by-pairs [a]))) true false)) user (some true? (map #(= 2 (first %) (nth % 1)) (by-pairs [1 2 2 2 ]))) true user (has22 [1 2 2 2]) false John Holland -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Experiences developing a crowdfunding site for open source projects in Clojure (from a Python background)
I haven't setup the naked domain, as heroku advises against that. Perhaps I should? Usually you can setup a 301 redirect from the naked domain to www with your registrar. On Fri, Jul 27, 2012 at 4:06 PM, Aaron Lebo aaron.m.l...@gmail.com wrote: It is http://www.kodefund.com. I haven't setup the naked domain, as heroku advises against that. Perhaps I should? On Friday, July 27, 2012 2:37:51 PM UTC-5, Vinzent wrote: Very cool! Thanks for sharing. It's interesting to read such a detailed report about experience with the language. Unfortunately, I can't access your site: http://kodefund.com/ **gives me The domain name you have requested isn't available. The idea sounds good though, and I'll definitely try kodefund once domain issues will be resolved. About something like PEP8: there is clojure style guide somewhere on dev.clojure.org, but I think we need more than that. Ideally, there should be a community wiki where everyone would be able to publish common tips-and-trick and gotchas. I bet many beginners would find such a thing useful. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Experiences developing a crowdfunding site for open source projects in Clojure (from a Python background)
I haven't setup the naked domain, as heroku advises against that. Perhaps I should? Usually you can setup a 301 redirect from the naked domain to www with your registrar. Should have said, where ever you are hosting DNS, but most registrars provide this capability if you are using them for DNS. On Fri, Jul 27, 2012 at 4:10 PM, Mark Rathwell mark.rathw...@gmail.com wrote: I haven't setup the naked domain, as heroku advises against that. Perhaps I should? Usually you can setup a 301 redirect from the naked domain to www with your registrar. On Fri, Jul 27, 2012 at 4:06 PM, Aaron Lebo aaron.m.l...@gmail.com wrote: It is http://www.kodefund.com. I haven't setup the naked domain, as heroku advises against that. Perhaps I should? On Friday, July 27, 2012 2:37:51 PM UTC-5, Vinzent wrote: Very cool! Thanks for sharing. It's interesting to read such a detailed report about experience with the language. Unfortunately, I can't access your site: http://kodefund.com/ gives me The domain name you have requested isn't available. The idea sounds good though, and I'll definitely try kodefund once domain issues will be resolved. About something like PEP8: there is clojure style guide somewhere on dev.clojure.org, but I think we need more than that. Ideally, there should be a community wiki where everyone would be able to publish common tips-and-trick and gotchas. I bet many beginners would find such a thing useful. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Experiences developing a crowdfunding site for open source projects in Clojure (from a Python background)
Yes, I actually just set it up. Very easy. Thank you. Not sure how you are specifying the redirect url, but if you have a trailing slash, you may want to try removing it. kodefund.com/about redirects to http://www.kodefund.com//about/ Also, completely nitpicking here, but you might also want to redirect from http to https for the login page. I don't know if Heroku provides a way to do that at the web server level, otherwise it has to be done in code. Otherwise, nice looking site, and idea, hope it does well. - Mark On Fri, Jul 27, 2012 at 4:15 PM, Aaron Lebo aaron.m.l...@gmail.com wrote: Yes, I actually just set it up. Very easy. Thank you. Vincent thanks for pointing that out. On Friday, July 27, 2012 3:12:02 PM UTC-5, Mark Rathwell wrote: I haven't setup the naked domain, as heroku advises against that. Perhaps I should? Usually you can setup a 301 redirect from the naked domain to www with your registrar. Should have said, where ever you are hosting DNS, but most registrars provide this capability if you are using them for DNS. On Fri, Jul 27, 2012 at 4:10 PM, Mark Rathwell mark.rathw...@gmail.com wrote: I haven't setup the naked domain, as heroku advises against that. Perhaps I should? Usually you can setup a 301 redirect from the naked domain to www with your registrar. On Fri, Jul 27, 2012 at 4:06 PM, Aaron Lebo aaron.m.l...@gmail.com wrote: It is http://www.kodefund.com. I haven't setup the naked domain, as heroku advises against that. Perhaps I should? On Friday, July 27, 2012 2:37:51 PM UTC-5, Vinzent wrote: Very cool! Thanks for sharing. It's interesting to read such a detailed report about experience with the language. Unfortunately, I can't access your site: http://kodefund.com/ gives me The domain name you have requested isn't available. The idea sounds good though, and I'll definitely try kodefund once domain issues will be resolved. About something like PEP8: there is clojure style guide somewhere on dev.clojure.org, but I think we need more than that. Ideally, there should be a community wiki where everyone would be able to publish common tips-and-trick and gotchas. I bet many beginners would find such a thing useful. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: why does this anonymous function work with 'map' but not 'apply'?
Arguments are implicit with the #(...) form, if you want explicit arguments you can use (fn [ e] (println (first e))). But, in that case, there is no reason for apply. apply turns this: (apply str [a b c]) into this: (str a b c) If you want to use all elements in a collection as individual args to one function call, that is what apply is for. If you want to call a function once for every item in a collection and get back a collection containing the results of all of those calls, that is what map is for. Sent from my iPhone On Jul 22, 2012, at 12:39 PM, larry google groups lawrencecloj...@gmail.com wrote: Hmm, okay, so if apply unpacks all the arguments and feeds them all to my anonymous function, then this should work: (apply #([ everything] println first everything) @visitors) but instead I get: Unable to resolve symbol: in this context [Thrown class java.lang.RuntimeException] Please note, I ask this only out of intellectual curiosity. In my code I'll always use map in this circumstance. But I want to understand what apply really does, and I'm clearly missing something. On Tuesday, July 17, 2012 3:13:04 PM UTC-4, Mark Rathwell wrote: your apply will end up doing sometihng like this: (#(println %1) stu mary lawrence) since apply takes @visitors as a collection and passes each item as an argument to the function you give it. In other words, apply essentially unpacks the collection and passes the items as individual arguments to the specified function. str takes any number of arguments, so it works well with apply in your case. Your anonymous function is a one-argument function, but apply sends all items in your collection as arguments, and if your collection contains more than one element then that will be the wrong number of arguments. map is mapping the specified function to each element in the collection, one at a time, and returning a collection of the results. apply is calling the function once, but with all elements in the collection as the arguments and returning the result of that one function call. On Tue, Jul 17, 2012 at 2:35 PM, Jack Moffitt j...@metajack.im wrote: So far, everything is working as I thought. But I also thought that apply let me run a function on everything in a sequence. Other than str, I could not get this to work: user (apply #(println %1) @visitors) I think you are looking for direct invocation: (#(println %1) @visitors) your apply will end up doing sometihng like this: (#(println %1) stu mary lawrence) since apply takes @visitors as a collection and passes each item as an argument to the function you give it. jack. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Redefining vars
partial returns a closure, closing over a at the time b is defined. On Wed, Jul 18, 2012 at 7:18 AM, Alice dofflt...@gmail.com wrote: I'm reading Clojure Programming from O'Reilly. (defn a [b] (+ 5 b)) ;= #'user/a (def b (partial a 5)) ;= #'user/b (b) ;= 10 (defn a [b] (+ 10 b)) ;= #'user/a (b) ;= 10 Redefining a has no effect. But, (defn foo [] 1) ;= #'user/foo (defn bar [] (foo)) ;= #'user/bar (bar) ;= 1 (defn foo [] 2) ;= #'user/foo (bar) ;= 2 Shouldn't this also be the same? Why does (bar) evaluates 2 instead of 1 this time? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: why does this anonymous function work with 'map' but not 'apply'?
your apply will end up doing sometihng like this: (#(println %1) stu mary lawrence) since apply takes @visitors as a collection and passes each item as an argument to the function you give it. In other words, apply essentially unpacks the collection and passes the items as individual arguments to the specified function. str takes any number of arguments, so it works well with apply in your case. Your anonymous function is a one-argument function, but apply sends all items in your collection as arguments, and if your collection contains more than one element then that will be the wrong number of arguments. map is mapping the specified function to each element in the collection, one at a time, and returning a collection of the results. apply is calling the function once, but with all elements in the collection as the arguments and returning the result of that one function call. On Tue, Jul 17, 2012 at 2:35 PM, Jack Moffitt j...@metajack.im wrote: So far, everything is working as I thought. But I also thought that apply let me run a function on everything in a sequence. Other than str, I could not get this to work: user (apply #(println %1) @visitors) I think you are looking for direct invocation: (#(println %1) @visitors) your apply will end up doing sometihng like this: (#(println %1) stu mary lawrence) since apply takes @visitors as a collection and passes each item as an argument to the function you give it. jack. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: How to use third-party libraries with Leiningen that are not found in Clojars or Maven
Depending on who else you are wanting to share the dependency with, you may find Phil Hagelberg's s3-wagon-private useful: https://github.com/technomancy/s3-wagon-private On Mon, May 14, 2012 at 4:23 PM, Sean Corfield seancorfi...@gmail.com wrote: Check out lein-localrepo - a way to install arbitrary JARs in your local Maven repo cache. On Sat, May 12, 2012 at 9:36 AM, Mads Andreas Elvheim mads.elvh...@gmail.com wrote: I have a few issues which are all related. I'll do my best to explain them one by one. I'd like to use the latest version of the jOGL library with Clojure 1.3 / Leiningen 1.7.1 / OpenJDK 1.6. After getting the jars from joGL's website, how can I get the library exposed to leiningen and Clojure in the most convenient way? I see no obvious way to set extra classpaths for a leiningen project, but I might have missed something obvious. Also, leiningen happily ignores the $CLASSPATH environment variable. And besides repacking jOGL and make it available in Maven or Clojars, what is the best approach for distributing the extra jOGL dependency? jOGL is a JRI library, and I assume that's why the existing opengl/jogl 2.0-rc3 package in Clojars appears to be broken. Roughly from what I've read elsewhere, Maven repos don't like platform-specific dependencies, so that probably leaves lein-localrepo out of the picture as well. You'll have to excuse my ignorance. I'm both new to Clojure and Java, but any pointers and reading suggestions will humbly be taken with open arms. My background is C++ and various assembly dialects. I'd love to get OpenGL 3.3 and Swing working in Clojure :-) - Mads Elvheim / Madsy -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: how to get good at clojure?
1. does anyone have advice on getting somewhat competent for a newb? (alternatively, how did you get good?) - Think of some (smaller) project you've had on your mind for a while, and try to implement it using clojure - Read all of the incoming questions on this list, or StackOverflow if you prefer. Read the questions, and before reading the answers try to see if you can figure out the problem first, then compare your solution to the responses. As you get more confident, try answering some questions yourself. if i have no interest in java, should a learn at least some fundamentals? would that be helpful? It can only help, learning a little bit about Java (the language, the jvm, and the periphery) won't hurt you. Same goes for learning more about Javascript for ClojureScript, .NET for ClojureCLR, etc. On Mon, May 7, 2012 at 8:48 PM, toan kidn...@gmail.com wrote: Hi folks, I've been trying to learn clojure for a while. I've read the clojure section of seven languages... and currently trying to get through joy of clojure. I've been practicing with the prompt a bit and trying to learn emacs that came with clojurebox. I have 2 questions, 1. does anyone have advice on getting somewhat competent for a newb? (alternatively, how did you get good?) 2. if i have no interest in java, should a learn at least some fundamentals? would that be helpful? TIA! toan -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Socket Library in Clojure
Depending on what you are trying to do, you will probably also want to have a look at pallet [1], clj-ssh [2], and clojure-control [3]. [1] http://palletops.com/ [2] https://github.com/hugoduncan/clj-ssh [3] https://github.com/killme2008/clojure-control On Fri, Apr 27, 2012 at 6:15 AM, Baishampayan Ghose b.gh...@gmail.com wrote: I was looking for socket libraries in clojure. The requirement is to connect via telnet to a mainframe based system and run commands on it. Can't you use JVM interop directly? There is an example here - http://nakkaya.com/2010/02/10/a-simple-clojure-irc-client/ Regards, BG -- Baishampayan Ghose b.ghose at gmail.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: Help with clojurescript code for google charts
Try this: (defn add-rows [] (let [data (js/google.visualization.DataTable.)] (.addColumn data string Topping) (.addColumn data number slices) (.addRows data (clj-js [[Mushrooms 3] [Onions 1] [Olives 1]])) data)) (defn chart-options [] (clj-js {:title How much Pizza i ate last night :width 400 :height 300})) (defn get-chart [] (js/google.visualization.PieChart. (.get ($ div.container div#content) 0))) (defn draw-chart [] (let [data (add-rows) options (chart-options) chart (get-chart)] (.draw chart data options))) (.load js/google visualization 1.0 (clj-js {:packages [corechart]})) (.setOnLoadCallback js/google draw-chart) On Fri, Apr 27, 2012 at 11:15 AM, Murtaza Husain murtaza.hus...@sevenolives.com wrote: Hi, I am trying to use google charts from clojurescript, however cant get it working. I have included both the js code from google's site and my clojurescript conversion. Any help in figuring out the problem will be appreciated. Thanks, Murtaza JS Code - script type=text/javascript src=https://www.google.com/jsapi;/script script type=text/javascript // Load the Visualization API and the piechart package. google.load('visualization', '1.0', {'packages':['corechart']}); // Set a callback to run when the Google Visualization API is loaded. google.setOnLoadCallback(drawChart); // Callback that creates and populates a data table, // instantiates the pie chart, passes in the data and // draws it. function drawChart() { // Create the data table. var data = new google.visualization.DataTable(); data.addColumn('string', 'Topping'); data.addColumn('number', 'Slices'); data.addRows([ ['Mushrooms', 3], ['Onions', 1], ['Olives', 1], ['Zucchini', 1], ['Pepperoni', 2] ]); // Set chart options var options = {'title':'How Much Pizza I Ate Last Night', 'width':400, 'height':300}; // Instantiate and draw our chart, passing in some options. var chart = new google.visualization.PieChart(document.getElementById('chart_div')); chart.draw(data, options); } /script CLJS code - ;;clj-js and $ are functions from jayq (defn add-rows [] (let [data (js/google.visualization.DataTable.)] (.addColumn data string Topping) (.addColumn data number slices) (.addRows data [[Mushrooms 3] [Onions 1] [Olives 1]]) data)) (defn chart-options [] (clj-js {:title How much Pizza i ate last night :width 400 :height 300})) (defn get-chart [] (js/google.visualization.PieChart. ($ div.container div#content))) (defn draw-chart [] (fn [] (let [data (add-rows) options (chart-options) chart (get-chart)] (.draw chart data options (.load js/google visualization 1.0 {packages [corechart]}) (.setOnLoadCallback js/google draw-chart) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 alternatives to Esper
I would start with storm: https://github.com/nathanmarz/storm On Apr 23, 2012, at 9:51 AM, Rogier Peters rogier.pet...@gmail.com wrote: Hi, For a java project I have been looking at Esper (esper.codehaus.org), a component for complex event processing: Complex event processing (CEP) delivers high-speed processing of many events across all the layers of an organization, identifying the most meaningful events within the event cloud, analyzing their impact, and taking subsequent action in real time (source:Wikipedia). Esper offers a Domain Specific Language (DSL) for processing events. The Event Processing Language (EPL) is a declarative language for dealing with high frequency time-based event data. Some typical examples of applications are: Business process management and automation (process monitoring, BAM, reporting exceptions, operational intelligence) Finance (algorithmic trading, fraud detection, risk management) Network and application monitoring (intrusion detection, SLA monitoring) Sensor network applications (RFID reading, scheduling and control of fabrication lines, air traffic) tl;dr: My question is: is there an alternative for this in the clojure ecosystem (since clojure seems like a good fit for this), and if not, what kind of clojure components/libraries would be a good starting point to implement someting similar -- Rogier Peters rogier@twitter, flickr, delicious -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Code shared between clj and cljs
The main options for sharing Clojure and ClojureScript code at this point are: 1. Use lein-cljsbuilds crossover feature [1] 2. Kevin Lynagh's cljx [2] 3. Symlink your .clj source as a .cljs file [1] https://github.com/emezeske/lein-cljsbuild/blob/0.1.8/doc/CROSSOVERS.md [2] https://github.com/lynaghk/cljx On Thu, Apr 19, 2012 at 1:02 AM, Mark Engelberg mark.engelb...@gmail.com wrote: What is an appropriate workflow for building underlying logic code that needs to be incorporated into both clojure code and clojurescript code? If the code is written in such a way that it would work under both Clojure and Clojurescript, what is the right way to name it and organize it in directories so that both the clojure code and clojurescript code can see it? Thanks, Mark -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Tornado-like async (web) server framework?
https://github.com/ztellman/aleph On Sun, Apr 15, 2012 at 9:51 PM, Stefan Arentz ste...@arentz.ca wrote: There is a lovely little web server for Python called Tornado. Tornado is an async server that also includes an async http client that plugs right in the server's event loop. This makes it really simple to build scalable web services that call other web services, which is what I mostly use it for. I would love to do the same in Clojure but I have no idea where to start. Ideally I would use an async server or framework in the style of Tornado or Twisted. But since Java has excellent thread support I guess I could also use an http lib that allows me to run requests in parallel. Who has some hints or pointers? S. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Clojurescript standards to integrate other libraries
Hi, Below are some good resources for the questions you have. Just a note, you can advanced compile your own code that calls out to jQuery, and others, you just can't compile those libraries in. So, there are existing extern files for jQuery, and for other libraries you might be using, you can create your own extern files. jayq (ClojureScript jQuery wrapper): https://github.com/ibdknox/jayq closure compiler extern files: http://code.google.com/p/closure-compiler/source/browse/#svn%2Ftrunk%2Fcontrib%2Fexterns Using Javascript Libraries in ClojureScript: http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html using jQuery plugins: https://groups.google.com/forum/#!msg/clj-noir/HPeQl5jn4V8/WdP10stY8GYJ On Wed, Apr 11, 2012 at 8:55 PM, Prasanna Gautam prasannagau...@gmail.com wrote: I'm quite new to clojurescript and I'm working on using clojurescript with some other javascript libraries - most notably I would like to get jQuery and Highcharts to work right now. Are there any established patterns or projects that make it easier to write wrappers for libraries that aren't compatible with Google Closure Advanced mode? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: noir response
See [1] for this morning's response to a very similar question ;) There is also a group for Noir-specific questions at [2]. [1] https://groups.google.com/forum/#!msg/clj-noir/mT8L2hnMnNg/jRJ2UdOqKuQJ [2] https://groups.google.com/forum/#!forum/clj-noir On Fri, Apr 13, 2012 at 11:10 AM, Rups rupstare2...@gmail.com wrote: My download code is like this which reads file from mongodb. but it not downloaded original file. (defpage [:get /download] {:as values} (let [f (fetch-one-file :test3) stream (stream-from :test3 f) data (slurp stream)] (resp/content-type (:contentType f) data) )) On Fri, Apr 13, 2012 at 6:56 PM, Rups rupstare2...@gmail.com wrote: Hi... I am using a noir, I like to download a file on click event. I have a file object in binary formate. How i write code for response for download file in its original formate. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Multiple ClojureScript (sub)projects with shared CLJS libraries per single clojure project
I haven't tried yet, but lein-cljsbuild [1] is meant to support multiple builds, and I believe something like the below config would be what you are looking for: :cljsbuild { :builds [{:source-path src/cljs/project1 :compiler {:output-to resources/public/cljs/script1.js :externs [externs/jquery.js] :optimizations :advanced :pretty-print true}} {:source-path src/cljs/project2 :compiler {:output-to resources/public/cljs/script2.js :externs [externs/jquery.js] :optimizations :advanced :pretty-print true}}]} [1] https://github.com/emezeske/lein-cljsbuild - Mark On Fri, Mar 30, 2012 at 12:16 PM, Tom Krestle tom.kres...@gmail.com wrote: Hi, The project I envision would consist of multiple completely independent conglomerates of CLJS scripts compiled into several separate final production .js with one single Clojure server. The reason for that is: 1. Smaller size of .js to load at each stage 2. Each time a browser transitions from one such a conglomerate to another one, it has a chance to reset its memory. 3. Better management of the overall project and easier sharing of components across projects. Do you think this approach makes sense overall? Every single lein plugin and tools I encountered (including ClojureScript One) support single .JS out of all CLJS scripts in src/. Is there an easy way to leverage this? Or I'll have to build my own support of separate compilation of CLJS subfolders into separate production .JS files (and support for shared CLJS libraries)? Thank you, Tom -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Frustrations in being moderated
I'm sure that some level of moderation is necessary to keep the list clean, but does it have to be so draconian? Hmm, I didn't even know the list was moderated (beyond first post moderation which I'd assume was the norm on Google Groups). Perhaps Clojure/core can comment on what the actual moderation policy is? And maybe they can appoint some more moderators to help ease the burden? I think it used to be 5 posts, or something like that, until you were automatically moved to unmoderated, but that was a couple years ago. I did have to ask Stuart H. to manually unmoderate me though. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: How I can use InteractionEvent in clojure?
You are trying to call method GetTransform on an instance of vtk.vtkTransform, and this method does not exist (you are probably wanting to call that method on boxWidget, not t). On Thu, Mar 8, 2012 at 12:32 AM, Antonio Recio amdx6...@gmail.com wrote: You are right. I have capitalized InteractionEvent and now callback it is called and it prints invoke. The application runs but the boxWidget still doesn't work, and I obtain an error message: Exception in thread main java.lang.IllegalArgumentException: No matching field found: GetTransform for class vtk.vtkTransform at clojure.lang.Reflector.getInstanceField(Reflector.java:285) at clojure.lang.Reflector.invokeNoArgInstanceMember(Reflector.java:314) at example$myCallback.invoke(cone.clj:15) at clojure.lang.AFn.run(AFn.java:24) at vtk.vtkRenderWindowInteractor.Start_5(Native Method) at vtk.vtkRenderWindowInteractor.Start(vtkRenderWindowInteractor.java:32) at example$main.invoke(cone.clj:54) at example$eval21.invoke(cone.clj:58) at clojure.lang.Compiler.eval(Compiler.java:6488) at clojure.lang.Compiler.load(Compiler.java:6929) at clojure.lang.Compiler.loadFile(Compiler.java:6889) at clojure.main$load_script.invoke(main.clj:283) at clojure.main$script_opt.invoke(main.clj:343) at clojure.main$main.doInvoke(main.clj:427) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.lang.Var.invoke(Var.java:415) at clojure.lang.AFn.applyToHelper(AFn.java:161) at clojure.lang.Var.applyTo(Var.java:532) at clojure.main.main(main.java:37) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Pretty print defn
If you are just printing it to the screen, print or println will do what you want. There shouldn't be a need for a pretty printer, the source is already formatted exactly as it was written. On Tue, Mar 6, 2012 at 1:02 AM, Nikem gni...@gmail.com wrote: Thank you for your help! :) I managed to get repl/source-fn to read source from external namespace. But print gives me (defn buy? [today]\n (and\n (not (nil? today))\n Everything on one line with \n instead of new lines. Shouldn't pretty print handle this? Best wishes Nikem On Tuesday, March 6, 2012 12:32:28 AM UTC+2, Phil Hagelberg wrote: Nikem gni...@gmail.com writes: java -jar lib/clojure-1.3.0.jar user= (defn qw [] (inc 2)) #'user/qw user= (use 'clojure.repl) nil user= (clojure.repl/source-fn qw) ClassCastException user$qw cannot be cast to clojure.lang.Symbol clojure.core/ns-resolve (core.clj:3879) user= (clojure.repl/source-fn 'qw) nil user= (println (clojure.repl/source-fn 'qw)) nil nil user= What am I doing wrong? source will only check for definitions on disk; you need serializable-fn for something like this to work. -Phil -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Pretty print defn
(clojure.repl/source-fn 'qw) will give you the source. On Fri, Mar 2, 2012 at 10:32 AM, Nikem gni...@gmail.com wrote: Hi. Is it possible to pretty print a source code of the function defined with defn? I have tried the following: (defn qw [] (inc 2)) (with-pprint-dispatch code-dispatch (pprint qw)) And got #user$qw user$qw@4743bf3d. But I would like to get at least (inc 2). Is it possible at all? Nikem -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 in Python
Not sure how many people have seen this, looks interesting though: https://github.com/halgari/clojure-py -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 in Python
Currently we have about half of core.clj ported from JVM clojure to python clojure. I know it's early, but have there been any thoughts/plans around interop and dependency management, possibly providing some sort of bridge between lein and pip/easy_install/virtualenv? And is performance the main drive here? On Wed, Feb 29, 2012 at 6:42 PM, Timothy Baldridge tbaldri...@gmail.com wrote: Not sure how many people have seen this, looks interesting though: https://github.com/halgari/clojure-py The core.clj file is probably the best way to get an idea of how clojure-py differs and is similar to clojure: https://github.com/halgari/clojure-py/blob/master/clojure/core.clj Currently we have about half of core.clj ported from JVM clojure to python clojure. Timothy (halgari) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: ClojureScript use statement not working
You must (:use ... :only ...) with ClojureScript On Sat, Feb 25, 2012 at 3:31 PM, Chris McBride cmm7...@gmail.com wrote: I have a namespace statement like this: (ns alephtest.websocket (:require [alephtest.js-utils :as util])) If I change this to: (ns alephtest.websocket (:use alephtest.js-utils)) I get this stack trace from the cljsbuild plugin (it took me a while to figure what was causing this): java.lang.UnsupportedOperationException: nth not supported on this type: Symbol RT.java:835 clojure.lang.RT.nthFrom RT.java:785 clojure.lang.RT.nth compiler.clj:820 cljs.compiler/eval1118[fn] core.clj:2432 clojure.core/map[fn] LazySeq.java:42 clojure.lang.LazySeq.sval LazySeq.java:60 clojure.lang.LazySeq.seq RT.java:466 clojure.lang.RT.seq core.clj:133 clojure.core/seq core.clj:600 clojure.core/apply core.clj:2459 clojure.core/mapcat RestFn.java:423 clojure.lang.RestFn.invoke compiler.clj:820 cljs.compiler/eval1118[fn] protocols.clj:64 clojure.core.protocols/fn protocols.clj:11 clojure.core.protocols/fn[fn] core.clj:5995 clojure.core/reduce compiler.clj:831 cljs.compiler/eval1118[fn] MultiFn.java:177 clojure.lang.MultiFn.invoke compiler.clj:1040 cljs.compiler/analyze-seq compiler.clj:1093 cljs.compiler/analyze compiler.clj:1086 cljs.compiler/analyze compiler.clj:1153 cljs.compiler/compile-file* compiler.clj:1191 cljs.compiler/compile-file compiler.clj:1251 cljs.compiler/compile-root closure.clj:350 cljs.closure/compile-dir closure.clj:382 cljs.closure/eval1687[fn] closure.clj:261 cljs.closure/eval1618[fn] closure.clj:396 cljs.closure/eval1674[fn] closure.clj:261 cljs.closure/eval1618[fn] closure.clj:830 cljs.closure/build core.clj:71 cljsbuild.core/compile-cljs core.clj:183 cljsbuild.core/run-compiler NO_SOURCE_FILE:1 user/eval2057[fn] core.clj:158 cljsbuild.core/in-threads[fn] core.clj:1817 clojure.core/binding-conveyor-fn[fn] AFn.java:18 clojure.lang.AFn.call FutureTask.java:303 java.util.concurrent.FutureTask $Sync.innerRun FutureTask.java:138 java.util.concurrent.FutureTask.run ThreadPoolExecutor.java:886 java.util.concurrent.ThreadPoolExecutor $Worker.runTask ThreadPoolExecutor.java:908 java.util.concurrent.ThreadPoolExecutor $Worker.run Thread.java:662 java.lang.Thread.run Are use statements support in ClojureScript? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Bret Victor - Inventing on Principle
On Fri, Feb 24, 2012 at 2:25 PM, Jay Fields j...@jayfields.com wrote: On Fri, Feb 24, 2012 at 2:12 PM, Cedric Greevey cgree...@gmail.com wrote: On Fri, Feb 24, 2012 at 2:06 PM, gaz jones gareth.e.jo...@gmail.com wrote: Are you Ken Wesson with a new account? Who? Wait. Surely you don't think that it's not possible for more than one person to prefer text to video as a way of disseminating verbal information over the internet, given all of text's advantages in such areas as bandwidth, cost, and tool support? Surely it's possible that you've never heard of Ken Wesson, he disappeared right before you joined, you respond to emails in the same manner, you share the same opinions. Seems legit, Ken. If it is you, Ken, welcome back ;) I'm no doubt in the minority, but I've actually kind of missed your postings. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: lazyness
Try this (you need to wrap the return val of helper in lazy-seq also): (defn pair-sequences-by ([seq-1 seq-2 f1 f2] s1 and s2 are guaranteed to be strictly monotonically increasing whith respect to f1 and f2 as keys respectively. The return value is pairs of elements e1 from s1 and e2 from s2 such that (= (f1 e1) (f2 e2)) is true (let [helper (fn helper [s1 s2] (loop [[x xs :as wx] s1 [y ys :as wy] s2] (when (and x y) (let [[xk yk] (map #(%1 %2) [f1 f2] [x y])] (let [cval (compare xk yk)] (cond ( cval 0) (recur xs wy) (= cval 0) (cons [x y] (lazy-seq (helper xs ys))) ( cval 0) (recur wx ys)))] (lazy-seq (helper seq-1 seq-2 ([seq-1 seq-2 f] (pair-sequences-by seq-1 seq-2 f f))) On Fri, Feb 24, 2012 at 11:36 PM, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Hi Everybody, Can somebody comment if the following piece of code is truely lazy? (defn pair-sequences-by ([seq-1 seq-2 f1 f2] s1 and s2 are guaranteed to be strictly monotonically increasing whith respect to f1 and f2 as keys respectively. The return value is pairs of elements e1 from s1 and e2 from s2 such that (= (f1 e1) (f2 e2)) is true (let [helper (fn helper [s1 s2] (loop [[x xs :as wx] s1 [y ys :as wy] s2] (when (and x y) (let [[xk yk] (map #(%1 %2) [f1 f2] [x y])] (let [cval (compare xk yk)] (cond ( cval 0) (recur xs wy) (= cval 0) (cons [x y] (helper xs ys)) ( cval 0) (recur wx ys)))] (lazy-seq (helper seq-1 seq-2 ([seq-1 seq-2 f] (pair-sequences-by seq-1 seq-2 f f))) https://gist.github.com/e9f6c0ad9bbe535d2d54 I am running out of ram when I use this.. so any help would be greatly appreciated. Thanks, Sunil. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: options for a function
I don't know that there is necessarily a recommended way to offer options. Sometimes people want keyword options, sometime the want to take options as a map, sometimes they need to do it one way or another for various reasons, sometime they do it one way and later learn of a better way. To take options in the way you have specified, you can use destructuring to simplify: (defn write-csv [writer data {:as opts}] ...) - or - (defn write-csv [writer data {:keys [separator quote ...]}] ...) - or - (defn write-csv [writer data {:keys [separator quote ...] :as opts}] ...) On Wed, Feb 22, 2012 at 3:47 PM, Michael michael-a...@db.com wrote: clojure.data.csv has options for the following: (defn write-csv Writes data to writer in CSV-format. Valid options are :separator (Default \\,) :quote (Default \\\) :guote? (A predicate function which determines if a string should be quoted. Defaults to quoting only when necessary.) :newline (:lf (default) or :cr+lf) [writer data options] (let [opts (into {} options) separator (or (:separator opts) \,) quote (or (:quote opts) \) quote? (or (:quote? opts) #(some #{separator quote \return \newline} %)) newline (or (:newline opts) :lf)] snip Since (into {} options) is used to get the options into a map, it seems that you need to specify options in this (write-csv writer data [:separator \;] [:newline :lf+cr]). Is this the recommended way to offer options? I was expecting (write- csv writer data :separator \; :newline :lf+cr). -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Print only by clojure code
It's logging, and assuming the logging implementation it is using log4j, you can specify the logging properties in a properties file, as system properties, or set the properties in code. The easiest way is to place a file called log4j.properties on the classpath (in the resources directory of your project) containing the following: # set root logger level to OFF (OFF, FATAL, ERROR, WARN, INFO, DEBUG, TRACE, ALL) log4j.rootLogger=OFF On Wed, Feb 8, 2012 at 1:49 PM, Simone Mosciatti mweb@gmail.com wrote: Hi guys, I have developed a very very little application in clojure that use an external lib in java that i prefer do not touch. The problem is that this lib for some weird reason (debug i guess) print at video a bunch of information useless for me, there is any way to avoid this problem, i mean can i just print what the clojure code actually print and not what also the lib in java print ? I'm sorry for my English... -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Print only by clojure code
Tassilo: I don't know it , but it is the most likely probability. One would hope that if a library is dumping to the console, or anywhere, it is done through a standard logging lib configurable by the client. If it turned out not to be the case, it would be evident quickly, and then try other possibilities. Sent from my iPhone On Feb 8, 2012, at 3:15 PM, Tassilo Horn tass...@member.fsf.org wrote: Mark Rathwell mark.rathw...@gmail.com writes: It's logging, and assuming the logging implementation it is using log4j, Why do you know that from the information given? Just in case the java lib in fact uses System.out/err directly, one can redirect standard out and error to something else. (with-open [w (clojure.java.io/writer /dev/null)] (binding [*out* w, *err* w] (.noisyJavaCall1 1 2 3) (.noisyJavaCall2 3 2 1))) Of course, /dev/null is somewhat platform specific. Bye, Tassilo -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: ClojureScript {:optimizations :advanced}
In short, yes, if you stick to gClosure, advanced compilation will work fine. Closure advanced compilation is an optimizing compilation that minifies names and removes dead (unused, uncalled) code. Trying to use jQuery without special effort will result in calls to jQuery being unaddressable. There is a nice writeup on including external javascript with ClojureScript and the Closure compiler at [1]. Also, jayq has an externs file for advanced compilation with jQuery 1.7 at [2]. [1] http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html [2] https://github.com/ibdknox/jayq/blob/master/resources/externs/jquery.js On Sun, Feb 5, 2012 at 11:39 AM, Thomas Heller th.hel...@gmail.com wrote: Hey, I'm starting to get the hang of Clojure(Script) and I'm really enjoying it. I'd love to use it for a project but I have one major concern: How reliable is {:optimizations :advanced}? Advanced Compilation basically wins the whole argument for clojurescript but I managed to break it on a very simple project. I assume it broke because I tried to use jQuery and didnt stick to the closure library. The only reason I wanted to jQuery is because I'm very familiar with it (and javascript itself for that matter) and basically know nothing about closure, but I did some (rtfm closure) and managed to get it working without jQuery. Turns out you really dont need it. So is it a fair assumption that as long as I stick to Closure Library + any ClojureScript itself I'm good on the :advanced part? I'm not interested in node.js as a :target, only the Browser. Falling back to {:optimizations :simple} really is not an option since the resulting javascript is way too big. Cheers, /thomas PS: My Experiments with jQuery: http://www.zilence.net/cljs/index-dev.html http://www.zilence.net/cljs/index-simple.html http://www.zilence.net/cljs/index-advanced.html https://github.com/thheller/cljs-experiments/blob/master/src-jquery/jqtest/app.cljs The App is pointless and only tested in Chrome (firefox/ie dont like input[type='range']) but it should update the the input when you move the slider and update the slider when you change the input. dev/simple work fine, advanced breaks with some undebuggable error. I assume because the compiler optimized something away. The Closure Version: http://www.zilence.net/cljs/index-closure-advanced.html https://github.com/thheller/cljs-experiments/blob/master/src-closure/ctest/app.cljs Basically the same amount of code, so no reason to use jQuery. But I'd still be interested to know why the jQuery version breaks. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: How to use goog.dom.query
You can look at how Pinot does it, some links to get you started: https://github.com/ibdknox/pinot https://github.com/ibdknox/pinot/blob/master/project.clj https://github.com/ibdknox/pinot/blob/master/src/pinot/dom.cljs https://groups.google.com/forum/#!msg/clj-noir/x5x9vcI-T4E/FaCfb8jhDXoJ On Tue, Jan 24, 2012 at 12:35 PM, Jonas jonas.enl...@gmail.com wrote: Hi all I was wondering if it's possible to use goog.dom.query[1] from ClojureScript or ClojureScript One? It's a third party module but it's bundled with the Closure version which is downloaded by scripts/bootstrap. I've tried (:require [goog.dom.query :as query]) but that doesn't work out of the box for me. Looking at the source code[2] I can see it referenced several times which makes me hopeful that I should get it working. It seems that maybe I should add :libs [closure/library/third_party/closure] or something similar to my build options but still no luck. [1]: http://closure-library.googlecode.com/svn/docs/closure_third_party_closure_goog_dojo_dom_query.js.html [2]: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/closure.clj#L555 -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 doesn't find java class
1. Does the mahout-collections jar contain compiled classes? Or only java source? 2. Is the mahout-collections jar making it to the lib directory when you run `lein deps`? On Mon, Jan 16, 2012 at 7:24 PM, joachim joachim.de.be...@gmail.com wrote: Hello all, I am trying to use the mahout math sparse vector implementation (see http://search-lucene.com/jd/mahout/math/org/apache/mahout/math/RandomAccessSparseVector.html and http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/RandomAccessSparseVector.java?view=markup)m but I can't get it to work. Here is what I did: * I downloaded the mahout-0.6-SNAPSHOT, mahout-math-0.6-SNAPSHOT and mahout-collections-1.0 sources and did a mvn install to a local (file) repository. * I added the appropriate dependencies in my project.clj and import the RandomAccessSparseVector class in my core.cls file and ran lein deps. * When I then do (RandomAccessSparseVector. 10), I get: org/apache/mahout/math/map/OpenIntDoubleHashMap [Thrown class java.lang.NoClassDefFoundError] * However, the missing class is part of the mahout-collections jar, Apparently it is not found. I can not import it either. What am I doing wrong? Thanks, Joachim. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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] ClojureScript One - Getting Started with ClojureScript
Thank you for this! It looks to be very cohesive and comprehensive, very nice work. On Wed, Jan 11, 2012 at 2:27 PM, Brenton bashw...@gmail.com wrote: Today we are releasing ClojureScript One. A project to help you get started writing single-page applications in ClojureScript. http://clojure.com/blog/2012/01/11/announcing-clojurescript-one.html http://clojurescriptone.com/ https://github.com/brentonashworth/one This project is the result of a lot of hard work from the people at Relevance. Thanks everyone. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 list syntax sugar: f(x) notation
The thing about lisps, though, is that code and data are represented with the same structure. Adding sugar that makes them appear to be different things would not help anyone, especially the beginner. It will make grasping macros, among other things, much more difficult down the road. Getting used to the syntax is, for practical reasons, a necessary, and short, process, and giving new users a way to bypass that would hurt more than it helps. (Not to mention the effect on experienced users of having to now deal with this additional syntax in code in the wild.) That said, don't let me stop you from having fun and learning with this little experiment ;) On Thu, Dec 29, 2011 at 11:35 AM, Louis Yu Lu louisy...@gmail.com wrote: Agree on looking from the angle of data structure and their internal presentation. But conceptually, [] and {} are just syntax sugars: [x y] - (vector x y) {x y} - (hash-map x y) #{x y} - (hash-set x y) The 2 element structures are all become 3 element lists. Louis On Dec 29, 7:03 am, James Reeves jree...@weavejester.com wrote: On 29 December 2011 04:49, Louis Yu Lu louisy...@gmail.com wrote: Instead of using overloaded (), may be f[x] will cause less trouble, and more inline with clojure's syntax as [ ] already being used for defining the arguments of the function. I think you need to look at this from a slightly different angle. In Clojure, as in all Lisps, code is represented by data structures. In Clojure, (x y) is a linked list of two elements, [x y] is a vector, and {x y} a map. You need to think about Clojure code in terms of the data structures beneath. So you're proposing that x[y] be considered a two-element list. This is an unusual syntax for defining a list in any language I know, and looks confusingly similar to a single element followed by a vector. Try not to ask the question, What syntax is good for representing a function call? and instead ask, What syntax is good for representing a linked list of elements? - 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: same ns multiple file
in-ns and load are what you are looking for: ;; foo.clj (ns my.foo ... ... (load foo_a) ;; foo_a.clj (in-ns 'my.foo) ... On Mon, Dec 19, 2011 at 11:37 AM, FD du...@hotmail.com wrote: Hello, In lisp, one can define functions within a package in multiple file. Files have just to start with (in-package ...). Is it possible to do it in clojure? I made several attempts with - load-file but I can't use a (declare xxx ...) in one file and (defn xxx ...) in an other file - a 'cascade' of namespaces Ex: File1 (ns one (:use used-ns)) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Clojurescript, is it ready yet?
Is clojurescript ready for wide water? It's getting there. +1 How far i can only see obscure compilation env and low level ops on html elemnts. I find the compilation environment is quite nice, if there's something you find confusing you should discuss it. I don't think that ClojureScript should offer much in the way of manipulating the DOM. That's for libraries. So the question is - Is anybody already building gwt for clojurescript? Bye! Not that I'm aware of, but that does sounds like something people would be interested in. Though there is nothing exactly comparable to UIBinder, with the combination of Pinot [1] and Noir [2], the Closure library [3], and client/server templates like Closure [4] or Mustache [5][6], you can get much of the benefit of GWT. [1] https://github.com/ibdknox/pinot [2] https://github.com/ibdknox/noir [3] http://closure-library.googlecode.com/svn/docs/index.html [4] http://code.google.com/closure/templates/ [5] https://github.com/fhd/clostache [6] https://github.com/janl/mustache.js -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: help with webserver
Generally, in production, jetty or tomcat would be fronted by a web server like nginx or apache httpd, and those would be setup to serve your static files. In development, or if you just don't want to set that up, with Compojure you can use compojure.route/files to serve static files [1]. Or, as Chris said, Noir might make your life easier. [1] http://weavejester.github.com/compojure/compojure.route-api.html On Wed, Dec 14, 2011 at 3:46 PM, labwor...@gmail.com wrote: I'm using a combination of clojure, enlive and jetty. I want to be able to serve arbitrary files. Can somebody show me an example? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Are reader macros and regular macros handled differently by the compiler?
Reader macros are expanded by the reader, regular macros are expanded by the compiler. The reader is what translates the text strings that you have typed into Clojure data structures, the compiler translates those data structures into executable code. Clojure does not allow you to define custom reader macros currently, but as you may be able to see with the builtin reader macros, these are what would allow you to change that actual core syntax of the language. Compiler macros, while extremely powerful, operate on Clojure data structures, and do not allow you to change the actual syntax of the language in the way that reader macros do. On Thu, Dec 1, 2011 at 7:02 PM, Julien Chastang julien.c.chast...@gmail.com wrote: Are reader macros and regular macros handled differently by the compiler? If possible, please give some contrasting details about what the compiler is doing in each 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 -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: keyword arguments
You can use the :pre and :post assertions on functions. Something like the following would do what you are asking: (defn myfun [ {:keys [arg1 arg2 arg3] :or {arg1 default-value} :as args}] {:pre [(every? #{:arg1 :arg2 :arg3} (keys args))]} (println arg1 arg2 arg3 args: args)) Also, another way to take keyword arguments is: (defn foo [ opts] (let [opts (apply hash-map opts)] (println opts))) - Mark On Sun, Nov 27, 2011 at 5:57 AM, Razvan Rotaru razvan.rot...@gmail.com wrote: Hi, This may be a question without hope, but I'm thinking that asking never hurts. So here goes: The closest thing to keyword arguments that I have found is destructuring with a map: (defn myfun [ {:keys [arg1 arg2 arg3] :or {arg1 default-value} :as args}] ...) When I call myfun without specifying value for arg2 or arg3 I get an error, which is great. However, when I do this: (myfun :arg2 2 :arg3 3 :arg15 15) I don't get an error, because of the rest () thing. Do you know if this can be achieved with a nice syntax, and not check args in the code (i.e. checking should be done when evaluating/creating the function, and not when executing). Thanks, Razvan -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: keyword arguments
Yeah, laziness on my part, I was just trying to show that everything after '' comes in as a list, and you can be creative if you need to be. I use this on occasion for macros with multiple different types of optional arguments. On Sun, Nov 27, 2011 at 6:45 PM, Alan Malloy a...@malloys.org wrote: On Nov 27, 8:43 am, Mark Rathwell mark.rathw...@gmail.com wrote: Also, another way to take keyword arguments is: (defn foo [ opts] (let [opts (apply hash-map opts)] (println opts))) This is what already happens internally with the {:keys ...} notation. You can actually be rather more concise if you write: (defn foo [ {:as opts}] (println opts)) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: start-process-shell-command: Spawning child process: invalid argument
Do I need Cygwin at all for Clojure work on Windows/Emacs/Swank/clojure-mode/lein? I don't think so. If lein.bat is on your path and is working, and if emacs and clojure-mode are working, that's really all you need. There are utilities and tools out there that you may want to use at some point, though, that do assume a unixy environment. And are these two functionally equivalent? clojure-jack-in lein swank and slime-connect Basically, yes. They both start a swank server, connect emacs to it, and give you a repl. clojure-jack-in is meant to simplify that process and hide any complexity. On Thu, Nov 17, 2011 at 9:50 AM, Andrew ache...@gmail.com wrote: Thanks Do I need Cygwin at all for Clojure work on Windows/Emacs/Swank/clojure-mode/lein? Or can I remove Cygwin from my machine? And are these two functionally equivalent? clojure-jack-in lein swank and slime-connect -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Change var in other namespace
You rebind dynamic vars with binding, so your use would look something like this: (binding [*logger-factory* (log-impl/log4j-factory)] (do-stuff-with-the-logger-factory-rebound)) On Thu, Nov 17, 2011 at 5:17 PM, vitalyper vitaly...@yahoo.com wrote: clojure.tools.logging defines *logger-factory* and initializes it with first logger implementation on the class path (def ^{:doc An instance satisfying the impl/LoggerFactory protocol. Used internally to obtain an impl/Logger. Defaults to the value returned from impl/ find-factory. :dynamic true} *logger-factory* (impl/find-factory)) In my own namespace I want to redefine *logger-factory* to log4j one. Tried different variations (def, set!, etc) in 1.3.0 with no avail. (ns my.foo (:gen-class) (:use [clojure.tools.logging :only (*logger-factory* info debug)]) (:require [clojure.string :as s1] [clojure.tools.logging.impl :as log-impl]) ) (defn init-logging Force log4j factory for core tools logging [] (def *logger-factory* (log-impl/log4j-factory))) ; CompilerException java.lang.IllegalStateException: *logger-factory* already refers to: #'clojure.tools.logging/*logger-factory* in namespace: infrared.common -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: start-process-shell-command: Spawning child process: invalid argument
Andrew, I don't have access to a Windows machine at the moment, but sidestepping clojure-jack-in for a minute, does using 'lein swank' and M-x slime-connect work? (in an eshell buffer that is in the project directory, run 'lein swank', that should start a swank server on port 4005, then M-x slime-connect should connect you and give you a repl). - Mark On Wed, Nov 16, 2011 at 4:15 PM, Andrew ache...@gmail.com wrote: Having trouble setting up Clojure/Emacs on Windows again. Earlier Mark Rathwell helped me by pointing out a recipe for Windows that resolved an issue with sh. After having the setup work for a while, I botched something while trying to upgrade clojure-mode. So I tried to start from scratch using the same recipe and now I see this when I try M-x clojure-jack-in start-process-shell-command: Spawning child process: invalid argument Other notes: The value of inferior-lisp-program is lein repl. If I start eshell and type lein repl, I see a repl start up. If I start eshell and type sh and answer the prompt with lein repl, I also see a repl start up. lein is in my windows path c:/emacs and c:/emacs/bin are both in my path so sh.bat can be found the swank-clojure 1.3.3 plugin is installed How do I find out what the invalid argument is? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: start-process-shell-command: Spawning child process: invalid argument
I think there is some path issue in your setup between Cygwin and Windows that will take some work to diagnose. You might try installing everything from scratch, or maybe try a Linux vm with VirtualBox (free) or VMWare. Either way, you can use lein swank and slime-connect in the meantime. On Wed, Nov 16, 2011 at 8:55 PM, Andrew ache...@gmail.com wrote: The attempt revealed the need to install the slime package. After that, the two commands succeed. However, M-x clojure-jack-in still fails in a fresh emacs session with the same error. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Re: java logging properties and lein
I put a logging.properties file in the resources directory of the project but it does not seem to pick it up. Do I have to do something else to override the default logging from the java library I am using? You still need to load the properties and tell the logger to use them. Assuming it is using log4j, something like the following should do that (completely untested though): ... (:require [clojure.java.io :as io]) ... (with-open [s (io/input-stream (io/resource logging.properties))] (org.apache.log4j.PropertyConfigurator/configure (doto (java.util.Properties.) (.load s On Mon, Nov 14, 2011 at 4:19 PM, labwor...@gmail.com wrote: I put a logging.properties file in the resources directory of the project but it does not seem to pick it up. Do I have to do something else to override the default logging from the java library I am using? On , Phil Hagelberg p...@hagelb.org wrote: On Mon, Nov 14, 2011 at 9:22 AM, joegallo joega...@gmail.com wrote: You could drop it into the root of src, or you can add a :resources-path etc in your project.clj and then put it in the root of that. Some purists would probably argue that the latter is better, but the former should work just fine, too. Actually if the resources/ dir exists in the project root you don't have to add anything to project.clj; it will use it by default. -Phil -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Re: java logging properties and lein
You still need to load the properties and tell the logger to use them. Assuming it is using log4j, something like the following should do that (completely untested though): ... (:require [clojure.java.io :as io]) ... (with-open [s (io/input-stream (io/resource logging.properties))] (org.apache.log4j.PropertyConfigurator/configure (doto (java.util.Properties.) (.load s I should have noted: Unless the library you're using is already checking for and loading a resource called logging.properties, in which case it should work just by dropping in the properties file in the resources directory. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Including java classes using lein
J2SE is available by default (since it is included with the JVM). I believe java.lang.* is accessible without importing, and anything else needs to be imported before using, can't remember for sure though. So, (Math/sqrt 25) should just work. On Tue, Nov 8, 2011 at 1:33 PM, megabite afo...@tibox.com.br wrote: I'm trying to use Math/sqrt using clojure 1.3.0 and lein but for some reason I can't get it to work. What do I need to put in the project.clj file and what needs to go into the (ns ...) statement in the core.clj file in order to get this work? It should be fairly straightforward but there don't seem to be any examples of this online. The only examples use [org.clojure/ clojure-contrib 1.2.0] which causes Maven to dump a bunch of errors. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: using sqlite3
Haven't tested, but seems like this should get you started with korma: lein: [korma 0.2.1] [sqlitejdbc 0.5.6] korma [1]: (defdb mydb {:classname org.sqlite.JDBC :subprotocol sqlite :subname db/mydb.sqlite3});; Location of the db [1] http://sqlkorma.com/ On Tue, Nov 8, 2011 at 3:47 PM, loonster tbur...@acm.org wrote: After searching long and hard, there really isn't any good documentation for using sqlite3 with clojure 1.3. Any help connecting to an existing sqlite3 db and performing selects and updates greatly appreciated. Tim -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: appengine-magic + servlets
You can't feed the servlet to appengine-magic, and you can't serve that servlet with appengine-magic.core/serve, you can only serve an appengine-magic app (created from a ring handler). I was talking about deployment to app engine. If you have a Java servlet, why not just run it in a Tomcat instance running on some other port, while developing your appengine-magic app. It seems like maybe you are wanting to create an app with an existing Java servlet, then somehow sprinkle on some functionality to that. This is not something that you can do with appengine-magic, and it wouldn't really make sense. If you want to reuse the servlet in this way, pull out the code you want to use into reusable library code, jar that up, add it as a dependecy to your project, and do interop as normal, but replace the actual servlet front with a ring handler in clojure. On Mon, Nov 7, 2011 at 5:07 AM, Razvan Rotaru razvan.rot...@gmail.com wrote: Yes, I tried that but did not work. appengine-magic/serve expects an appengine-application, which is a map that among others contains the ring handler. The serve function turns this handler into a servlet and maps it to the root path / (or /*, I haven't figured that out yet). Whatever i write in web.xml is apparently overwritten by appengine-magic/serve, or web.xml does not matter at all when starting the server with appengine-magic/serve. I have only one servlet, which is in the external jar. I don't have a ring handler or a second servlet. I just want to feed this servlet to appengine-magic. Thanks, Razvan On Nov 6, 10:43 pm, Mark Rathwell mark.rathw...@gmail.com wrote: I'm still having trouble figuring out what it is you are wanting to do, but if you have an existing Java servlet that will handle some url pattern, and you want to write an appengine-magic app that will create a servlet to handle some other url pattern, and use both servlets in one app engine app, then you should be able to add the jar as a dependency to your project such that the jar ends up in war/WEB-INF/lib, and setup that servlet and url pattern in web.xml just as you normally would, and setup the appengine-magic servlet to handle some other desired url pattern. On Sun, Nov 6, 2011 at 3:24 PM,RazvanRotaru razvan.rot...@gmail.com wrote: The servlet is coming from an external jar, which is written in Java. I need appengine-magic for the other services, like datastore. Razvan On Nov 6, 7:45 pm, Mark Rathwell mark.rathw...@gmail.com wrote: I'm still not quite following. What appengine-magic does is provides Clojure wrappers for many of the App Engine for Java service APIs, and from a ring handler creates a servlet suitable for deployment to App Engine. If you already have the servlet, I'm not sure why you need appengine-magic. Where is this servlet coming from? And what are you wanting to do with it once you have integrated it with appengine-magic? - Mark On Sun, Nov 6, 2011 at 11:41 AM,RazvanRotaru razvan.rot...@gmail.com wrote: I want integration of servlet in appengine-magic. Documentation describes that you use a ring handler to call def- appengine-app: (appengine-magic.core/def-appengine-app my-app #'my-ring-handler) I have a servlet and want to build an application, something like: (appengine-magic.core/def-appengine-servlet-app my-app #'my-servlet) Razvan On Nov 6, 4:32 pm, Mark Rathwell mark.rathw...@gmail.com wrote: I'm not using ring, I have a servlet which I need to feed to appengine-magic. Not sure what you mean by this, could you expand on it a little more? You have an existing Java servlet that you want to handle some url pattern, and you want to integrate that into your appengine-magic app? On Sun, Nov 6, 2011 at 5:08 AM,RazvanRotaru razvan.rot...@gmail.com wrote: Hi, appengine-magic (https://github.com/gcv/appengine-magic) uses ring- handlers to turn into servlets that are accepted by GAE. Does anybody know how to use servlets directly with appengine-magic? I'm not using ring, I have a servlet which I need to feed to appengine-magic. Thanks, Razvan -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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
Re: appengine-magic + servlets
I'm not using ring, I have a servlet which I need to feed to appengine-magic. Not sure what you mean by this, could you expand on it a little more? You have an existing Java servlet that you want to handle some url pattern, and you want to integrate that into your appengine-magic app? On Sun, Nov 6, 2011 at 5:08 AM, Razvan Rotaru razvan.rot...@gmail.com wrote: Hi, appengine-magic (https://github.com/gcv/appengine-magic) uses ring- handlers to turn into servlets that are accepted by GAE. Does anybody know how to use servlets directly with appengine-magic? I'm not using ring, I have a servlet which I need to feed to appengine-magic. Thanks, Razvan -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: appengine-magic + servlets
I'm still not quite following. What appengine-magic does is provides Clojure wrappers for many of the App Engine for Java service APIs, and from a ring handler creates a servlet suitable for deployment to App Engine. If you already have the servlet, I'm not sure why you need appengine-magic. Where is this servlet coming from? And what are you wanting to do with it once you have integrated it with appengine-magic? - Mark On Sun, Nov 6, 2011 at 11:41 AM, Razvan Rotaru razvan.rot...@gmail.com wrote: I want integration of servlet in appengine-magic. Documentation describes that you use a ring handler to call def- appengine-app: (appengine-magic.core/def-appengine-app my-app #'my-ring-handler) I have a servlet and want to build an application, something like: (appengine-magic.core/def-appengine-servlet-app my-app #'my-servlet) Razvan On Nov 6, 4:32 pm, Mark Rathwell mark.rathw...@gmail.com wrote: I'm not using ring, I have a servlet which I need to feed to appengine-magic. Not sure what you mean by this, could you expand on it a little more? You have an existing Java servlet that you want to handle some url pattern, and you want to integrate that into your appengine-magic app? On Sun, Nov 6, 2011 at 5:08 AM, Razvan Rotaru razvan.rot...@gmail.com wrote: Hi, appengine-magic (https://github.com/gcv/appengine-magic) uses ring- handlers to turn into servlets that are accepted by GAE. Does anybody know how to use servlets directly with appengine-magic? I'm not using ring, I have a servlet which I need to feed to appengine-magic. Thanks, Razvan -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: appengine-magic + servlets
I'm still having trouble figuring out what it is you are wanting to do, but if you have an existing Java servlet that will handle some url pattern, and you want to write an appengine-magic app that will create a servlet to handle some other url pattern, and use both servlets in one app engine app, then you should be able to add the jar as a dependency to your project such that the jar ends up in war/WEB-INF/lib, and setup that servlet and url pattern in web.xml just as you normally would, and setup the appengine-magic servlet to handle some other desired url pattern. On Sun, Nov 6, 2011 at 3:24 PM, Razvan Rotaru razvan.rot...@gmail.com wrote: The servlet is coming from an external jar, which is written in Java. I need appengine-magic for the other services, like datastore. Razvan On Nov 6, 7:45 pm, Mark Rathwell mark.rathw...@gmail.com wrote: I'm still not quite following. What appengine-magic does is provides Clojure wrappers for many of the App Engine for Java service APIs, and from a ring handler creates a servlet suitable for deployment to App Engine. If you already have the servlet, I'm not sure why you need appengine-magic. Where is this servlet coming from? And what are you wanting to do with it once you have integrated it with appengine-magic? - Mark On Sun, Nov 6, 2011 at 11:41 AM, Razvan Rotaru razvan.rot...@gmail.com wrote: I want integration of servlet in appengine-magic. Documentation describes that you use a ring handler to call def- appengine-app: (appengine-magic.core/def-appengine-app my-app #'my-ring-handler) I have a servlet and want to build an application, something like: (appengine-magic.core/def-appengine-servlet-app my-app #'my-servlet) Razvan On Nov 6, 4:32 pm, Mark Rathwell mark.rathw...@gmail.com wrote: I'm not using ring, I have a servlet which I need to feed to appengine-magic. Not sure what you mean by this, could you expand on it a little more? You have an existing Java servlet that you want to handle some url pattern, and you want to integrate that into your appengine-magic app? On Sun, Nov 6, 2011 at 5:08 AM, Razvan Rotaru razvan.rot...@gmail.com wrote: Hi, appengine-magic (https://github.com/gcv/appengine-magic) uses ring- handlers to turn into servlets that are accepted by GAE. Does anybody know how to use servlets directly with appengine-magic? I'm not using ring, I have a servlet which I need to feed to appengine-magic. Thanks, Razvan -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Empty list type
On Tue, Nov 1, 2011 at 7:33 PM, David Nolen dnolen.li...@gmail.com wrote: (isa? (type '(:foo :bar)) clojure.lang.IPersistentList) = true (isa? (type ()) clojure.lang.IPersistentList) = true (isa? (type (list)) clojure.lang.IPersistentList) = true (type ()) ;= clojure.lang.PersistentList$EmptyList EmptyList is an inner class in PesistentList, and is not directly derived from PersistentList. Though, as David shows, both PersistentList and PersistentList$EmptyList implement the interface IPersistentList. 2011/11/1 Sebastián Galkin paras...@gmail.com Can somebody explain the rationale behind this?: (isa? (type '(:foo :bar)) clojure.lang.PersistentList) = true (isa? (type ()) clojure.lang.PersistentList) = false (isa? (type (list)) clojure.lang.PersistentList) = false -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Confusion with doc macro
It uses (meta (var common/basic-logger)). On Mon, Oct 31, 2011 at 2:28 PM, Sean Devlin francoisdev...@gmail.com wrote: I'm a bit confused by what the doc macro is doing. Doesn't it simply work of the metadata of what is passed to it? I try this at the REPL: user= (doc common/basic-logger) - decorators.common/basic-logger nil nil nil For the following item: user= (meta common/basic-logger) {:ns #Namespace decorators.common, :name basic-logger, :file decorators/common.clj, :line 13, :arglists ([f]), :doc This is a very basic logging decorator.} Shouldn't I see something like this: user= (doc common/basic-logger) - decorators.common/basic-logger ([f]) This is a very basic logging decorator. nil Any help would be great. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Confusion with doc macro
def already adds metadata on the symbol as metadata on the var. Did you need more than this (below)? user (def ^{:doc foo} x [1 2 3]) #user/x user (meta (var x)) {:ns #Namespace user, :name x, :doc foo, :line 1, :file NO_SOURCE_FILE} user (doc x) - user/x foo nil user (defn ^{:doc foo foo} xx [] (println hello)) #'user/xx user (meta (var xx)) {:arglists ([]), :ns #Namespace user, :name xx, :doc foo foo, :line 1, :file NO_SOURCE_FILE} user (doc xx) - user/xx ([]) foo foo nil On Mon, Oct 31, 2011 at 4:08 PM, Sean Devlin francoisdev...@gmail.com wrote: Okay, then I need a hand with something then. I'm trying to come up with a macro that does the following: (defmacro def-with-meta ...) - You supply this (def-with-meta symbol init) (= (meta (var symbol)) (meta init)) - True Any suggestions folks? Sean Devlin On Oct 31, 2:59 pm, Mark Rathwell mark.rathw...@gmail.com wrote: It uses (meta (var common/basic-logger)). On Mon, Oct 31, 2011 at 2:28 PM, Sean Devlin francoisdev...@gmail.com wrote: I'm a bit confused by what the doc macro is doing. Doesn't it simply work of the metadata of what is passed to it? I try this at the REPL: user= (doc common/basic-logger) - decorators.common/basic-logger nil nil nil For the following item: user= (meta common/basic-logger) {:ns #Namespace decorators.common, :name basic-logger, :file decorators/common.clj, :line 13, :arglists ([f]), :doc This is a very basic logging decorator.} Shouldn't I see something like this: user= (doc common/basic-logger) - decorators.common/basic-logger ([f]) This is a very basic logging decorator. nil Any help would be great. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Confusion with doc macro
No, I'm looking for a copy meta routine. The mysterious defmeta macro does this, in one call. (defmeta a map) (= (meta (var a)) (meta map)) This will do what you want, but I would not advise using it: (defmacro def-with-meta [symbol init] `(let [m# (meta ~init)] (def ~symbol ~init) (reset-meta! (var ~symbol) m#) (var ~symbol))) Then: (= (meta (var symbol)) (meta init)) ;= true (= (meta (var symbol)) (meta symbol)) ;= true On Oct 31, 4:20 pm, Mark Rathwell mark.rathw...@gmail.com wrote: def already adds metadata on the symbol as metadata on the var. Did you need more than this (below)? user (def ^{:doc foo} x [1 2 3]) #user/x user (meta (var x)) {:ns #Namespace user, :name x, :doc foo, :line 1, :file NO_SOURCE_FILE} user (doc x) - user/x foo nil user (defn ^{:doc foo foo} xx [] (println hello)) #'user/xx user (meta (var xx)) {:arglists ([]), :ns #Namespace user, :name xx, :doc foo foo, :line 1, :file NO_SOURCE_FILE} user (doc xx) - user/xx ([]) foo foo nil On Mon, Oct 31, 2011 at 4:08 PM, Sean Devlin francoisdev...@gmail.com wrote: Okay, then I need a hand with something then. I'm trying to come up with a macro that does the following: (defmacro def-with-meta ...) - You supply this (def-with-meta symbol init) (= (meta (var symbol)) (meta init)) - True Any suggestions folks? Sean Devlin On Oct 31, 2:59 pm, Mark Rathwell mark.rathw...@gmail.com wrote: It uses (meta (var common/basic-logger)). On Mon, Oct 31, 2011 at 2:28 PM, Sean Devlin francoisdev...@gmail.com wrote: I'm a bit confused by what the doc macro is doing. Doesn't it simply work of the metadata of what is passed to it? I try this at the REPL: user= (doc common/basic-logger) - decorators.common/basic-logger nil nil nil For the following item: user= (meta common/basic-logger) {:ns #Namespace decorators.common, :name basic-logger, :file decorators/common.clj, :line 13, :arglists ([f]), :doc This is a very basic logging decorator.} Shouldn't I see something like this: user= (doc common/basic-logger) - decorators.common/basic-logger ([f]) This is a very basic logging decorator. nil Any help would be great. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: repl output for list seems inconsistent and a holdover from yesteryear
One clarification that might help is that traditionally the list has been the only structure in lisps, and other data representations were faked with lists. Clojure added other modern data structures to that traditional model (those are what are generally used for data purposes) and left the list as the core code/data structure. On Fri, Oct 28, 2011 at 1:16 AM, e evier...@gmail.com wrote: I think I understand more now though, everyone. Thanks. clojure chose lists for the data structure for code so lists sort of have a special place in the language. Thanks again. On Fri, Oct 28, 2011 at 1:13 AM, e evier...@gmail.com wrote: On Thu, Oct 27, 2011 at 8:26 PM, Mark Rathwell mark.rathw...@gmail.com wrote: Maybe it would be clearer if I proposed some other, lesser-used chars, like %(1 2 3 4) or even 1 2 3 4. That is, I'm not so much saying, this needs to be treated as data and not eval'd as I am simply saying, this is the 'list' data structure as opposed to some other. A list data structure and a list code structure are the same. why wasn't vector chosen for code? The only difference is that the programmer decides when one should not be evaluated. By creating separate syntax for a list data structure you are in essence creating a different structure for lists of data than lists of code, and you no longer have a straightforwardly homoiconic language. This seems like a hugely important thing for me to grock, but it is easier to grock in languages that, say, ONLY have lists. Otherwise it seems like code is arbitrarily ONE of the data structures and, therefore is NOT homoiconic with respect to any other data structure. Why is there an assumption that code as data means code as lists? Or is there? This is the key to everything. Code is data yes, fine. but data doesn't always mean list in *my* mind. But I'm starting to get that it was chosen to be the same thing in lisps. , data is code, they are the same structure. By treating a list of data (integers for example) differently than a list of code (function and args), you create a situation where code and data are no longer the same thing. no. code and lists are no longer the same thing. I see data as a generic concept . . .a superset, not a different set. code could be data that I haven't picked a data structure for, yet. That trait is a fundamental trait of lisps, and makes things like macros much simpler. I suspected this, too. ok. You don't have to call the structure a list, you can call it something else if you prefer, but whatever it is called, it must be the same structure that defines code and defines data. But, again, there are plenty of structures that define data differently then that which was chosen for code. So why not just have a code structure. Again, it already seems broken with respect to other structures. Here's some data. It's a vector. Here's *more* data. It's a chunk of code. Ah but it was arbitrarily decided (more from history and evolution) that *that* data is a list. Broken. On Thu, Oct 27, 2011 at 6:58 PM, e evier...@gmail.com wrote: On Oct 26, 2011 7:15 PM, Stuart Halloway stuart.hallo...@gmail.com wrote: checking out the Try Clojure: if you type the following, you get output that matches what you typed in every case except for lists. Vectors: -- [1 2 3 4] [1 2 3 4] Maps: -- {:foo bar 3 4} {:foo bar 3 4} Lists: -- '(1 2 3 4) (1 2 3 4) - *INCONSISTENT* why not render this as '(1 2 3 4) ... this would make much more sense to newbies. Sets: -- #{1 2 3 4} #{1 2 3 4} This is an interesting question. Consistency is important, but consistency with what? Your mental model for what happens at the REPL needs to keep the R, E, and P steps clearly separate. Working backward: the P (Print) prints things in a way that they can be read back, where possible: (read-string [1 2 3 4]) = [1 2 3 4] (read-string (1 2 3 4)) = (1 2 3 4) (read-string #{1 2 3 4}) = #{1 2 3 4} (read-string {1 2 3 4}) = {1 2, 3 4} If the P part of the REPL put a tick in front of lists, they would not read back correctly: (read-string '(1 2 3 4)) = (quote (1 2 3 4)) INCONSISTENT I see the problem that token ' is already taken to be short hand for quote so to be truly consistent, I might be compelled to argue that (read-string '(1 2 3 4)) should, seeing some hypothetical list start multi-char token '( just like set-start is #{ , be: = '(1 2 3 4). You'd need two single quotes: ''(1 2 3 4) to get quote '(1 2 3 4) ... Wheras (1 2 3 4) means call 1 with ... I'll have to reread the explanation about the repl phases, but maybe I'm wondering if things don't have to be quoted if lists had the syntax I describe, and requests for function invocation had a simple paren. Then you are not saying, treat this as data, do
Re: repl output for list seems inconsistent and a holdover from yesteryear
Maybe it would be clearer if I proposed some other, lesser-used chars, like %(1 2 3 4) or even 1 2 3 4. That is, I'm not so much saying, this needs to be treated as data and not eval'd as I am simply saying, this is the 'list' data structure as opposed to some other. A list data structure and a list code structure are the same. The only difference is that the programmer decides when one should not be evaluated. By creating separate syntax for a list data structure you are in essence creating a different structure for lists of data than lists of code, and you no longer have a straightforwardly homoiconic language. Why is there an assumption that code as data means code as lists? Or is there? This is the key to everything. Code is data, data is code, they are the same structure. By treating a list of data (integers for example) differently than a list of code (function and args), you create a situation where code and data are no longer the same thing. That trait is a fundamental trait of lisps, and makes things like macros much simpler. You don't have to call the structure a list, you can call it something else if you prefer, but whatever it is called, it must be the same structure that defines code and defines data. On Thu, Oct 27, 2011 at 6:58 PM, e evier...@gmail.com wrote: On Oct 26, 2011 7:15 PM, Stuart Halloway stuart.hallo...@gmail.com wrote: checking out the Try Clojure: if you type the following, you get output that matches what you typed in every case except for lists. Vectors: -- [1 2 3 4] [1 2 3 4] Maps: -- {:foo bar 3 4} {:foo bar 3 4} Lists: -- '(1 2 3 4) (1 2 3 4) - *INCONSISTENT* why not render this as '(1 2 3 4) ... this would make much more sense to newbies. Sets: -- #{1 2 3 4} #{1 2 3 4} This is an interesting question. Consistency is important, but consistency with what? Your mental model for what happens at the REPL needs to keep the R, E, and P steps clearly separate. Working backward: the P (Print) prints things in a way that they can be read back, where possible: (read-string [1 2 3 4]) = [1 2 3 4] (read-string (1 2 3 4)) = (1 2 3 4) (read-string #{1 2 3 4}) = #{1 2 3 4} (read-string {1 2 3 4}) = {1 2, 3 4} If the P part of the REPL put a tick in front of lists, they would not read back correctly: (read-string '(1 2 3 4)) = (quote (1 2 3 4)) INCONSISTENT I see the problem that token ' is already taken to be short hand for quote so to be truly consistent, I might be compelled to argue that (read-string '(1 2 3 4)) should, seeing some hypothetical list start multi-char token '( just like set-start is #{ , be: = '(1 2 3 4). You'd need two single quotes: ''(1 2 3 4) to get quote '(1 2 3 4) ... Wheras (1 2 3 4) means call 1 with ... I'll have to reread the explanation about the repl phases, but maybe I'm wondering if things don't have to be quoted if lists had the syntax I describe, and requests for function invocation had a simple paren. Then you are not saying, treat this as data, do not eval. You are just saying, see my single quote paren token? That's for lists. Maybe it would be clearer if I proposed some other, lesser-used chars, like %(1 2 3 4) or even 1 2 3 4. That is, I'm not so much saying, this needs to be treated as data and not eval'd as I am simply saying, this is the 'list' data structure as opposed to some other. Now, if you ever need to read in a program and treat it like data, well, what structure would you like to put it in? A list? A vector? A string? This is, indeed, where I am fuzzy on lisps, but it seems like you parse it as desired and put it where/how you like it. Why is there an assumption that code as data means code as lists? Or is there? Now to the R (Reader) part. If, as you suggest, the tick were part of the reader syntax for lists, you could fix the inconsistency above: ;; hypothetical Clojure with '(...) list literals (read-string ' '(1 2 3 4)) = (1 2 3 4) Finally, consider the poor E (Evaluator) in this scenario. The evaluator must (1) evaluate lists except (2) *not* evaluate lists that are protected by quote. But now that the tick is part of the syntax you have two challenges: (1) Since the tick no longer prevents evaluation, you have to spell out the quote (and still use the tick!) ;; hypothetical literal list (quote '(1 2 3)) (2) Since the tick is required as part of list syntax, your programs have to be written with ticks everywhere like this: '(defn hello-world [] '(println hello) You have to understand R, E and P as separate steps to understand the REPL. As a side note, it is worth mentioning that the REPL is composed of three simple parts, and that interactive shells that do not have this factoring are much less useful. Imagine if your language didn't separate reading and evaluating. You would need JSON or something to serialize data... Stu Stuart Halloway Clojure/core
Re: repl output for list seems inconsistent and a holdover from yesteryear
The point to think about here is that functions are also lists, the same as your list of integers. The difference is that one is evaluated, the other is not. That is what the quote is saying: don't evaluate me. The quote is not actually a part of the list. It's just the way you tell the reader not to evaluate the list that follows. So the question is should all unevaluated forms be preceded with a quote in the repl output? To me that would be more confusing. On Wed, Oct 26, 2011 at 5:34 PM, e evier...@gmail.com wrote: long long time since I last looked a clojure, but I've never lost interest and I'm trying to find the time again. for the short version see *INCONSISTENT*, in the example at the end. I know what the answer will be here. Something like you will get used to it. or it's not important. or no one hardly uses lists anymore, anyway, since vectors are not purely contiguous. But, if you can make things better and it's easy, then why not? So here's the deal: I still think the following is only inconsistent because that's how it was in older lisps. Specifically, lists had to be quoted so the first argument wouldn't be called as a function. I asked long ago (here and in person) why, then regular functions couldn't require the quote so the paren could be reserved for the list data structure, and Rich answered that it'd simply be a pain to have to quote every function call. Well, my mind moves slowly. I'm just now realizing to ask, Ok, then how about making the list really be defined using the single quote as part of it just like sets include the sharp to distinguish them from maps?. That's a much simpler explanation than saying, you have to escape them, etc, etc. I realize this is a small matter since all I am talking about is how lists are represented as text. checking out the Try Clojure: if you type the following, you get output that matches what you typed in every case except for lists. Vectors: -- [1 2 3 4] [1 2 3 4] Maps: -- {:foo bar 3 4} {:foo bar 3 4} Lists: -- '(1 2 3 4) (1 2 3 4) - *INCONSISTENT* why not render this as '(1 2 3 4) ... this would make much more sense to newbies. Sets: -- #{1 2 3 4} #{1 2 3 4} -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: repl output for list seems inconsistent and a holdover from yesteryear
'(1 2 3) is a list that is not evaluated. No loss of generality. it's a special type of list. One that's not evaluated. as opposed to a special indicator to the repl. That would essentially be a new data structure, filling a role mostly already filled by vectors. And you would still need the core structure used for code and data (the list), and you would still need a way to tell the reader when you don't want to evaluate that structure. Then we're back to the current situation but with different characters. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: [ClojureScript]: Breaking change coming WRT object property access syntax
In the original discussion in this list, a couple alternatives similar to the following were suggested for property access to remain closer to the Clojure situation: (set! (.:id foo) my-css-id)) (set! (.:fillStyle ctxt) rgb(255, 150, 0)) Were those thrown out for being too ugly? I didn't see any inappropriate posts elsewhere, so in case it was this post that was misinterpreted: I was in no way attempting to complain, and apologize if it may have been taken that way. In a previous discussion [1], Rich had mentioned the (.:slot target) syntax as a possibility for property access. Just wondered if this was considered and rejected, or was forgotten about, or is still being considered. Not a big deal, I was just curious what the state was, sometimes those of us not in the inner circle don't have access to the most recent information. [1] http://groups.google.com/group/clojure/browse_thread/thread/8fb8078491cfe561/69ed3e1e5475cb07 Thanks. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: newbie, installation problem
I don't know how to install CLOJURE on Windows but i have installed it on Ubuntu Should i have to learn Java first? You don't need to know Java, you just need to have it installed already. Have another look at the Clojure getting started wiki page that Phil linked [1]. Linked from that page are installation instructions and tutorials for Clooj and Leiningen. Those are generally where you will want to start if you are not familiar with emacs or any of the big Java IDEs. [1] http://dev.clojure.org/display/doc/Getting+Started+for+Beginners Sagar, I had trouble on Windows until Mark Rathwell suggested following the instructions at http://sourceforge.net/apps/wordpress/codesounding/tag/emacs Those instructions are for getting swank-clojure working with emacs on windows. If you want to use emacs as your editor, the workaround presented there may help. On Fri, Oct 14, 2011 at 9:24 AM, Andrew ache...@gmail.com wrote: -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: lein not configured properly
Are you behind a firewall or proxy that would be blocking .zip files? lein search first makes sure it has an updated index from those repositories, and if not tries to download and unzip those index files: http://repo1.maven.org/maven2/.index/nexus-maven-repository-index.zip http://clojars.org/repo/.index/nexus-maven-repository-index.zip Can you download those files in a browser? (Also, there is a lein specific group at http://groups.google.com/group/leiningen ) - Mark On Fri, Oct 14, 2011 at 1:55 PM, Bruce Gordon brucebgor...@gmail.com wrote: I first followed the directions at http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html , but then abandoned that effort thanks to irc advice. I then started following the http://dev.clojure.org/display/doc/Getting+Started+with+Leiningen directions. However I suspect I am not configured properly since the search isn't working-see below. bruce@mepis1:~/bin$ lein search hadoop Warning: couldn't download index for http://repo1.maven.org/maven2 Warning: couldn't download index for http://clojars.org/repo/ bruce@mepis1:~/bin$ lein version Leiningen 1.6.1.1 on Java 1.6.0_26 Java HotSpot(TM) 64-Bit Server VM Next I backed out my explicit install of ant and maven via apt-get remove ant and apt-get remove maven2 but lein still yields the same result. Should I uninstall lein (how?), and start over? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: lein not configured properly
Run 'lein repl', then copy in and run the code below. Post back whether you get an error (and what it is), or if it finishes without a problem (this is downloading a 50MB file, so give it a few minutes). (import 'java.io.File) (import 'java.net.URL) (require '[clojure.java.io :as io]) (def u (URL. http://repo1.maven.org/maven2/.index/nexus-maven-repository-index.zip;)) (defn download-index [url] (with-open [stream (.openStream url)] (println Downloading index from - url ... this may take a while.) (let [tmp (java.io.File/createTempFile lein index)] (try (io/copy stream tmp) (println copied stream to tmp: tmp) (finally (.delete tmp)) (download-index u) On Fri, Oct 14, 2011 at 2:26 PM, Bruce Gordon brucebgor...@gmail.com wrote: I am in a VirtualBox VM (running SimplyMepis) hosted in Windows Vista. From within the vm I can download those files from a browser. On Oct 14, 2:17 pm, Mark Rathwell mark.rathw...@gmail.com wrote: Are you behind a firewall or proxy that would be blocking .zip files? lein search first makes sure it has an updated index from those repositories, and if not tries to download and unzip those index files: http://repo1.maven.org/maven2/.index/nexus-maven-repository-index.ziphttp://clojars.org/repo/.index/nexus-maven-repository-index.zip Can you download those files in a browser? (Also, there is a lein specific group athttp://groups.google.com/group/leiningen) - Mark On Fri, Oct 14, 2011 at 1:55 PM, Bruce Gordon brucebgor...@gmail.com wrote: I first followed the directions athttp://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html , but then abandoned that effort thanks to irc advice. I then started following thehttp://dev.clojure.org/display/doc/Getting+Started+with+Leiningen directions. However I suspect I am not configured properly since the search isn't working-see below. bruce@mepis1:~/bin$ lein search hadoop Warning: couldn't download index forhttp://repo1.maven.org/maven2 Warning: couldn't download index forhttp://clojars.org/repo/ bruce@mepis1:~/bin$ lein version Leiningen 1.6.1.1 on Java 1.6.0_26 Java HotSpot(TM) 64-Bit Server VM Next I backed out my explicit install of ant and maven via apt-get remove ant and apt-get remove maven2 but lein still yields the same result. Should I uninstall lein (how?), and start over? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: [ClojureScript]: Breaking change coming WRT object property access syntax
Now compare to the proposed change: (set! (. foo :id) my-css-id)) (set! (. ctxt :fillStyle) rgb(255, 150, 0)) In the original discussion in this list, a couple alternatives similar to the following were suggested for property access to remain closer to the Clojure situation: (set! (.:id foo) my-css-id)) (set! (.:fillStyle ctxt) rgb(255, 150, 0)) Were those thrown out for being too ugly? - Mark On Fri, Oct 14, 2011 at 9:19 PM, David Nolen dnolen.li...@gmail.com wrote: Sorry I didn't copy my perspective over here from clojure-dev as someone who's been working as a JavaScript dev for the past 6 years - The proposed change is not optimal and I think it clashes with the realities of JavaScript interop. (.property foo) Currently gives us a notion of place, that means we can set it: (set! (.property foo) bar) This convention is quite common in many JavaScript APIs, for example pretty everything in the browser: (set! (.id foo) my-css-id)) (set! (.fillStyle ctxt) rgb(255, 150, 0)) Now compare to the proposed change: (set! (. foo :id) my-css-id)) (set! (. ctxt :fillStyle) rgb(255, 150, 0)) I don't see any win. Any proposed change should account for the fact that getters / setters are not a convention in JS and many, many APIs expect direct field access. David On Fri, Oct 14, 2011 at 9:15 PM, Jack Moffitt j...@metajack.im wrote: Thoughts? I like it. +1 to it going in sooner rather than later. jack. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: unable to resolve symbol: doc
In 1.3 doc was moved to the clojure.repl namespace. So, at the repl, you can: (use 'clojure.repl) and (doc foo) should work again. On Fri, Sep 30, 2011 at 3:12 PM, Andrew ache...@gmail.com wrote: When I do M-x clojure-jack-in on one project.clj which uses clojure 1.2.1, I'm able to evaluate (doc map). But with another project.clj which uses clojure 1.3.0-RC0, the repl is unable to resolve symbol: doc. I also changed it to use clojure 1.3.0, ran lein deps... M-x clojure-jack-in repl user (doc map) ... unable to resolve symbol: doc What do I need to do differently? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Does macros evaluates its arguments before?
And in this case Closure compiler behave itself also unpredictably and quite the contrary: Where it must evaluate a symbol (like in this case), it doesn't. Symbols need to be namespace resolved in order to be evaluated properly. This is something you need to be aware of, but it is not unpredictable or contrary to any documentation. And again, in this case, the evaluation of the plus symbol does not happen at macro expansion, it happens at run time. The behavior here is the same inside of and outside of a macro: user= (def e '(5 + 2)) #'user/e user= (eval `((nth '~e 1) (nth e 0) (nth e 2))) 2 user= (eval `((nth (list ~@e) 1) (nth e 0) (nth e 2))) 7 Where it mustn't evaluate a symbol (argument of macro), it does. This has already been shown in several responses, the argument is not being evaluated in macro expansion, it is being evaluated at runtime. Using macroexpand will help you to see what the expanded forms look like and what namespace symbols are resolved to. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Does macros evaluates its arguments before?
Use macroexpand-1 to expand a call to this macro, and it should be clear what is going on. The expanded code tries to call 5 as a function. What you are probably trying to do here is make (5 + 2) a list, not a function call. ;; (note the unquote splicing of e) (defmacro infix [e] `(let [[x# f# y#] (list ~@e)] (f# x# y#))) 2011/9/26 Aaron Cohen aa...@assonance.org: 2011/9/26 ru soro...@oogis.ru That's exactly means evaluation of argument that's contradict to mentioned above documentation! On 26 сен, 18:18, Tassilo Horn tass...@member.fsf.org wrote: Ok, this is working! But, what's the difference? Your code: user= (defmacro infix [e] `(let [[x# f# y#] ~e] (f# x# y#))) The ~e evaluates the given form, which looks like a function but is not. In other words, your version of infix expands to approximately: (let [x_1 f_2 y_3] (5 + 4)] (f_2 x_1 y_3)) and the destructuring in let is what causes the problem at runtime. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: can't see the error
(let [rand (new java.util.Random) nextInt (fn [a] (.nextInt rand))] ((map (print) (iterate ((nextInt dummy) 0) extra parenthesis in three places, and the first argument to iterate is a function, not a long: (let [rand (new java.util.Random) nextInt (fn [a] (.nextInt rand))] (map print (iterate nextInt 0))) On Sun, Sep 25, 2011 at 3:51 PM, Dennis Haupt d.haup...@googlemail.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 (let [rand (new java.util.Random) nextInt (fn [a] (.nextInt rand))] ((map (print) (iterate ((nextInt dummy) 0) the error is: java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn (NO_SOURCE_FILE:0) why does it want to cast my 0 to a function? and how can i get rid of the dummy parameter [a]? -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.14 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJOf4ZIAAoJENRtux+h35aG19UP/1tWgqcQifwUI5zHdkKWTcY8 iY9vXGEr3IvTC2nB1yXJESJ6T/4OTpGhUT9ctX+6xGxPHFC9OPUdvnp5gGUOjCFQ Qa9G8Qc6Za1uc0HFzbWYxP9yi8TAPg1WVA3RF046kKuS/m9X8uUMtCulSJH8y6m4 VmREcGlyQNjgCDMSRmMX5Y7vVuU2e6KoV6VjSopBHzX/sXBsMd0AZcnCRokBUKre 7J1PyK3YKBmRLZ6gdvnOTz4kDBoKE7yrbh2gpIsQciqsawZ0wWYlBou7JceSxtN3 Zwzm64YLxW8f6DjaRL7ZUAwTVMBkIru86hgm2bMK5pFX5f8bzBcmx09eIgd1fgLV c3bHtFYWzVrCRAGA+7iqeedQiFmkX2aK6yIcEma8KvoPXRlU5XhTiTN4B4sfPrpC qHM0U30WVIV05qs9E8rW2JDmpm1X7RpkZ9P3PEQXgYV1yJaSjPPyxRC1R0wi7f0o KUEXu+WO0egLyh3d8kfD1GMR/ztRGlS0UbJ3htqso710uD+R4GzFvRcitF99bQtm cOgz7sLB0hJTS3AblNhRzwt0CRdsPjHfBixrqbxGbXcLvkXFyoZMebuJwMZNcpzY wFhgEGyVxShXQASNub3dzNS8peU5fgoAGLexHh46e02K8a1YWjK3OOokZ3W9uCpt ghqI1/wkly1r9F/FroFo =+5YI -END PGP SIGNATURE- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: aquamacs, slime and clojure on OS X
Intentionally avoiding leiningen on ideological grounds will make things more difficult and frustrating for yourself. If you do want to try it out, there are links below to get you started below. You can realistically be up and running with emacs and slime in less than an hour. lein: https://github.com/technomancy/leiningen lein tutorial: https://github.com/technomancy/leiningen/blob/1.x/doc/TUTORIAL.md swank-clojure: https://github.com/technomancy/swank-clojure On Thu, Sep 22, 2011 at 8:46 PM, Jake Penton jakepen...@gmail.com wrote: Sorry to raise something that has probably been asked and answered umpteen times. I have been looking forward to trying clojure for quite some time. I appreciate that clojure and its ecosystem is undergoing rapid development. However, I have spent the last day and a half trying to get either aquamacs or gnu emacs working with slime and clojure, with no success. BTW, I have used aquamacs with slime and Common Lisp (ccl, sbcl) for a long time now. I know those are older, more stable languages, but good golly - I had aquamacs+slime+ccl set up in about an hour. Is their a reliable set of instructions to set up slime with clojure somewhere? I have followed instructions from a half dozen different web pages. They are rich in magic incantations which fail (possibly because I'm dense). I think I followed the instructions on the Getting Started with Emacs page linked to from the clojure site, but - it did not work. Perhaps my attitude is wrong, but the user comments on the Getting Started page basically demolished my confidence in the information there. I won't post error messages yet, although it may come to that shortly. I would prefer to use aquamacs, but would settle for GNU Emacs. What I want to start with is the simplest set of things that will give me a clojure REPL in aquamacs/emacs. In the absence of reliable installation instructions (or perhaps even preferable to them), is there a description somewhere of the final target state that my system should be in? That is, I actually do NOT really want to use any of the following, unless absolutely required: an Emacs Starter Kit a development version of GNU Emacs, i.e. v.24 any kind of package manager for Emacs any kind of project build system for clojure, i.e. leiningen All of the above appear to me to be well-intended help, any or all of which have broken on me as I tried this. Instead I would prefer to know what files I need in what locations. But then, who am I to boss y'all around on how to help me ;-) My setup: Snow Leopard 10.6.8 aquamacs 2.3a GNU Emacs 24 clojure and clojure-contrib from macports, whatever their latest is Slime-related jar files and elisp files littered all over the place that didn't do me any good TIA. - Jake - -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: clojars question
Anyone can create their own account on clojars and publish their own forks to their own group name. There are 22 forks of enlive on github, the original is by Chrisotphe Grand [1], [2]. His most recent version published to clojars is 1.0.0. Generally, people try not to publish their own forks to clojars unless they have good reason (e.g. the original is no longer maintained, or will not accept desired patches, or doesn't publish quickly enough, etc.). Unless there is something in one of the forked versions that you want, I would use the original: [enlive 1.0.0]. You may, however, want to post to the enlive group [3] to see if maybe there is a reason to use one of the other versions. [1] https://github.com/cgrand/enlive [2] http://clojars.org/enlive [3] http://groups.google.com/group/enlive-clj On Wed, Sep 21, 2011 at 5:12 PM, labwor...@gmail.com wrote: I'm confused on what version to obtain from clojars for enlive. I see 1.2.0-alpha1 dated yesterday but I also see 2.00 dated from August. Which one should I pick? are there several versions? Please enlighten me. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Is there a reason that def- isn't part of the core lib?
A previous discussion on the topic can be found here [1]. You can easily add the private metadata yourself: Clojure 1.2: (def ^{:private true} size 25) Clojure 1.3: (def ^:private size 25) I think probably the reason against it is that generally there is not as much reason to use a constant, for example, outside of its namespace as there is with functions, and therefore more need for marking functions meant only for internal use as such (but that is just guessing at other peoples' thought processes). [1] http://groups.google.com/group/clojure/browse_thread/thread/80d873ef625221ac/243a0ad490150d3e?lnk=gstq=def-#243a0ad490150d3e On Sat, Sep 17, 2011 at 10:54 AM, Rob Lally rob.la...@gmail.com wrote: Hi all, Whilst trying to minimise the visible surface areas of namespaces, I've often felt the need for a def- function/macro that marks a def'ed var with :private metadata. An analog of defn-, if you will. Is there a reason that I shouldn't do this or a reason that it doesn't seem to be a member of the core lib? In the spirit of Hunt Thomas' Select isn't broken, when I encounter something this trivial, useful and absent I tend to conclude that I'm the one who's got things wrong. Thanks in advance, 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 -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: ^long vs (long arg)
The distinction is that you type hint function parameters to tell the compiler that this function parameter will always be of the specified type. You coerce something that may or may not be of a desired type, but is known to cleanly convert to that type. So: (defn add-two [^long x] (+ x 2)) ;= #'user/add-two (add-two (long 1.2)) ;= 3 On Wed, Sep 14, 2011 at 2:03 PM, Sergey Didenko sergey.dide...@gmail.com wrote: What is the intended difference between type hinting like ^long and type coercing like (long arg)? For example my gut feeling for this case is to use ^long but it is forbidden: (loop [^long x 0] ...) Can't type hint a local with a primitive initializer So I use (loop [x (long 0)] ...) But not quite sure if it's right. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: ^long vs (long arg)
On Wed, Sep 14, 2011 at 2:21 PM, Mark Rathwell mark.rathw...@gmail.com wrote: The distinction is that you type hint function parameters to tell the compiler that this function parameter will always be of the specified type. You coerce something that may or may not be of a desired type, but is known to cleanly convert to that type. So: (defn add-two [^long x] (+ x 2)) ;= #'user/add-two (add-two (long 1.2)) ;= 3 Should have noted that obviously calling 'add-two' with 1.2 would coerce to long, but the point is about what the code is saying (if it could talk). On Wed, Sep 14, 2011 at 2:03 PM, Sergey Didenko sergey.dide...@gmail.com wrote: What is the intended difference between type hinting like ^long and type coercing like (long arg)? For example my gut feeling for this case is to use ^long but it is forbidden: (loop [^long x 0] ...) Can't type hint a local with a primitive initializer So I use (loop [x (long 0)] ...) But not quite sure if it's right. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: lambda function returning a constant?
How about this: (#(true)), is this not calling a function that has no arguments and returns true? But it still gives same exception This actually is trying to call 'true' as if it were a function, not a constant. The thing I think you're missing here is: when a symbol is butted up against an opening parenthesis, it is treated as a function call, with the remaining elements in the list as arguments (unless the list is quoted, in which case it is not evaluated and treated as just a list). #(true) says call 'true' as a function with no arguments. #(%) says call the argument passed to this anonymous function as a function, and if, for example you were mapping a vector of numbers to this anonymous function, then each number would be called as a function. As you've already seen, if you just want the original value returned from a function, you can call the 'identity' function with that something as an argument, as in #(identity %) or #(identity true), etc. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: lambda function returning a constant?
As you've already seen, if you just want the original value returned from a function, you can call the 'identity' function with that something as an argument, as in #(identity %) or #(identity true), etc. I should have also made clear here that you would never actually use this in real code, just for learning. See the other responses for the actual ways to do what you are trying to do. On Wed, Sep 7, 2011 at 8:24 AM, Mark Rathwell mark.rathw...@gmail.com wrote: How about this: (#(true)), is this not calling a function that has no arguments and returns true? But it still gives same exception This actually is trying to call 'true' as if it were a function, not a constant. The thing I think you're missing here is: when a symbol is butted up against an opening parenthesis, it is treated as a function call, with the remaining elements in the list as arguments (unless the list is quoted, in which case it is not evaluated and treated as just a list). #(true) says call 'true' as a function with no arguments. #(%) says call the argument passed to this anonymous function as a function, and if, for example you were mapping a vector of numbers to this anonymous function, then each number would be called as a function. As you've already seen, if you just want the original value returned from a function, you can call the 'identity' function with that something as an argument, as in #(identity %) or #(identity true), etc. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: An open call to the community: Let's prepare for 1.3
Huh, interesting. I assumed ^:foo meta syntax was new to 1.3, and wouldn't compile at all in 1.2. But now I see that in 1.2 it's equivalent to ^{:tag :foo} - not useful, but not damaging either. I guess I'll start using ^:dynamic myself. Actually, it causes compiler errors, when the compiler tries to use the keyword as a typehint. Unfortunately, this occurs in a pseudo-randomly when compiling code that uses the hinted var and leads to really cryptic error messages. java.lang.RuntimeException: java.lang.IllegalArgumentException: Unable to resolve classname: :dynamic Sorry, trying to clarify, we're saying don't use ^:dynamic if you want to be compatible with 1.2? Instead use the full form ^{:dynamic true}? Thanks. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: An open call to the community: Let's prepare for 1.3
I prefer to use ^{:dynamic true} instead of ^:dynamic, unless you're recommending intentionally breaking compatibility with 1.2 so as to encourage people to move to 1.3. What is meant by breaking compatibility? I haven't noticed any issues using ^:dynamic with 1.2, am I missing something? Thanks. On Sat, Sep 3, 2011 at 4:13 PM, Alan Malloy a...@malloys.org wrote: I prefer to use ^{:dynamic true} instead of ^:dynamic, unless you're recommending intentionally breaking compatibility with 1.2 so as to encourage people to move to 1.3. On Sep 3, 12:27 pm, Chris Granger ibdk...@gmail.com wrote: Hey Folks, With the release of 1.3 growing ever nearer, it's time that we as a community do everything we can to make the migration smooth. In general, this means relatively simple changes to the libs under your control, but I also think we should take this opportunity to do some house cleaning. If you maintain a clojure library (even if library just means some random thing up on github that a few people use), please consider doing the following over the next few weeks: - *Try migrating your lib to 1.3* - Create a 1.3 branch - Remove earmuffs around any non-rebound vars - Add earmuffs to any vars that are rebound using thread-level binding - Add ^:dynamic to these vars - If you rely on the built in Numerics, check to see if the new changeshttp://dev.clojure.org/display/doc/Documentation+for+1.3+Numericsin 1.3 affect you. - *Do some house cleaning* - If you are no longer maintaining this library, simply note so at the top of your Readme. If the reason is that a better alternative has spring up, link to it. - Take a look at your dev dependencies and determine if any of them should remain in light of the ability to globally install leiningen plugins. *If you have swank-clojure as a dependency, please remove it*: this has been the source of numerous issues. None of these are complicated or particularly time consuming, and the impact they will have as people try to migrate forward will be tremendous. Also, don't fall into the trap of thinking no one could possibly be using this tiny project - I bet they are and bet they'll want to continue to :) If I've missed some steps, please reply with them. Are there more house cleaning things we should do? Have you run into any other issues migrating to 1.3 (the steps listed here were purely what was necessary for me and the few others I've talked to)? Cheers, Chris. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: ClojureScript and lein?
The sole alternative to an additional machine in that case is to perform major surgery on an existing one, involving a hard drive repartitioning VirtualBox is free: http://www.virtualbox.org/ On Tue, Aug 30, 2011 at 12:57 PM, Ken Wesson kwess...@gmail.com wrote: On Mon, Aug 29, 2011 at 9:09 PM, Eric Lavigne lavigne.e...@gmail.com wrote: I'm also a Mac user and probably in home all this howto will work, but in company where we all are using Windows there is no chance to get it working easily. There are people at your workplace who program in Clojure, or who are willing to try it, but aren't willing to try developing on Linux or Mac? This surprises me. If all they have are Windows PCs, they'd have to buy a whole additional machine to develop on Mac. It's one thing to get coders to experiment and quite another to get management to release several hundred dollars of funds to support that experiment. The same almost goes for Linux. The sole alternative to an additional machine in that case is to perform major surgery on an existing one, involving a hard drive repartitioning. The coders that are willing to experiment and the IT admins with the root passwords for the PCs may not be the same people, and no repartitioning and dual-boot OS installs would take place without the cooperation of the latter. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: What are the advantages of clojurescript over straight-forward javascript?
On Tue, Aug 30, 2011 at 6:06 PM, Mike S mike73...@gmail.com wrote: Two question: 1. Can I use clojurescript with dojo? You should be able to use the advanced compile option with Dojo, it is the only library other than Google Closure to meet the Closure compiler requirements for the advanced compilation option. It will take some tinkering, though, to get it all working, I'm sure. 2. what are the advantages of clojurescript compared to just writing the code in javascript? I can see why clojure would be useful for java/ jvm (dynamic/interactive development rather than compilation cycle, it does away with much java boilerplate code, simplified concurrency... ). Javascript already has dynamic/interactive that's only complicated by an additional compilation from clojurescript, It's code, when using a modern library, is almost boilerplate-free, it has quircks but those are well documented and easily avoided. What does clojurescript bring to the table? The reasons are much the same as the reasons for CoffeeScript, Cappuccino, etc. One big reason being you get to write Clojure, end to end. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Web Services with Clojure
You can have a look at Compojure [1], Noir[2], and Conjure[3], but if you want the enterprise standard, you will probably need to wrap one of the Java frameworks that do that stuff well. [1] https://github.com/weavejester/compojure [2] https://github.com/ibdknox/noir [3] https://github.com/macourtney/Conjure - Mark On Wed, Aug 24, 2011 at 9:21 AM, Michael Jaaka michael.ja...@googlemail.com wrote: Beside this is there any framework for dynamic WebServices in clojure? I would like to achive usage scenario like. (declare webservice with its details (define method with signature of input output parameters types) (define another method and so on)) What is required from WS stack is ability to generate WSDL in runtime programatically. Attaching invocation handler to published end point. The authentication and attachments could be made with threads vars. Do you know already such solution? It would give good flexibility to the potential system. The reference example usage scenario would look like: (with-web-service { :wsdl myservice.wsdl :url http://someurl/; :name myservice } (^String someQueryFunction[ ^String a ^List b ] (str Hello world a (interpose , b))) (^Map someQueryFunction[ ^Integer a ^Integer b ^Map m ] (assoc m a (+ b (get m a ) Any suggestions? RESTful seems to be how far the only options ;-( But I would like to achieve enterprise standard. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: is there some gotchas with the contains? function and strings?
See the doc below. What (contains? [1 2] 1) is testing is whether [1 2] has a value at index 1 (the key value for numerically indexed collections). It does, so it returns true. What you are probably looking for is the Java method .contains of the vector: (.contains [a b] a) ;= true (.contains [1 2 5] 5) ;= true user (doc contains?) - clojure.core/contains? ([coll key]) Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'. On Wed, Aug 24, 2011 at 4:57 PM, Andrew Xue and...@lumoslabs.com wrote: the below seems odd user= (contains? [1 2] 1) true user= (contains? [a b] a) false am i missing something? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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