Re: clojure vs scala
My wish: There are easy-to-understand examples in API doc. From another thread I see that the api doc is being automated, so maybe this presents an opportunity to include a new meta tag such as :eg or :example (to allow them to be viewed separately from :doc - or if this is not a good idea maybe just appended to :doc) In the meantime this may be helpful: http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Examples#-.3E Tom if I can help in any way please consider this a volunteerment :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this 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 vs scala
On 26 Aug 2009, at 07:06, Vagif Verdi wrote: I fail to see how macros can be contrasted to static typeng. They are orthogonal. That is true in principle, but integrating Lisp-style macros and compulsory static typing (as opposed to optional type hints) into the same language does require some careful thought. I haven't seen such a combination yet, and... Here's and example of statically typed language (liskell) with lisp syntax and full blown lisp macros: http://blog.clemens.endorphin.org/2009/01/liskell-standalone.html ...this site is down at the moment. One aspect to think about is the type of s-expressions. It needs to be defined as an algebraic data type with variants s-expression, symbol, string, number and perhaps more. Typed s-expressions will certainly change the style of macros, and without having seen it done in practice I wouldn't dare predict if it becomes, simpler, more difficult, or just different. The other obvious aspect is the syntax of type definitions and type specifications, and the interaction of type infererence with macro expansion. I'd expect a lots of subtleties that need to worked out in detail. For example, what happens if a macro expands into code that requires type inference to be correctly interpreted, but in a particular situation the compiler doesn't have enough information to infer all the types? The resulting error message could be quite a challenge to understand. Konrad. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: advice needed about macro for proxy with argument
On Aug 25, 9:54 pm, Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 25.08.2009 um 20:09 schrieb rb: Here is what I've done for now: (defmacro deflistener [ interfaces trigger-args body] `(proxy [ ~...@interfaces ] [] (trigger [...@trigger-args] ~...@body)) ) Which can be used like this: ( deflistener (Signal1$Listener) (mouse-event) (.setText result-text (.getText line-edit)) )) I would rewrite it as follows: (defmacro create-listener [interfaces args body] `(proxy ~interfaces [] (trigger ~args ~...@body))) First the macro doesn't def something global. So it should not be called deflistener. Compare with create-struct and defstruct. Then with the above changes the call looks like (create-listener [inter faces] [a b c] (do-stuff a b c)) This is more idiomatic Clojure. (Effectively you can specify a vector in your version also, but seems like waste to define vector which is thrown away just to define another vector with the same contents. I find this not very elegant) It takes as arguments * the list of interfaces it implements (currently necessary for http://www.assembla.com/spaces/clojure/tickets/181) ?? You always have to specify the interfaces, no? What I meant is that if I always implement SignalX$Listener, I could even get rid of the interfaces list as argument to the macro as it can be derived from the number or arguments that will be passed to trigger. I could write (create-listener [a1 a2 a3] ( do-stuf a b c ) ) and know that this has to proxy Signal3$Listener. However, the bug linked makes that impossible for now as all nested interfaces have the same name. Thanks for your remarks! Raphaël * the list of arguments passed to the trigger method implemented * the body of the implementation of trigger Here are the questions that arise: * I thought I could and should do away with trigger-args, but if I use gensyms in the macro to define the arguments received by trigger, how can I get to the argument values in the code of the method? You cannot get rid of the argument vector. * if it implements SignalX$Listener, trigger takes X arguments. How can implement that with one macro, and still have access to these arguments in the forms I pass as body of trigger? You could pass the body as a fn. (defmacro create-listener [x f] (let [args (take x (repeatedly gensym))] `(proxy [~(symbol (str Signal x $Listener))] [] (trigger [...@args] (~f ~...@args) And call it like (create-listener 2 (fn [a b] ...)) Whether this is better than the above I would prefer the first solution. Hope this helps. Sincerely Meikel smime.p7s 2KViewDownload --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: advice needed about macro for proxy with argument
It takes as arguments * the list of interfaces it implements (currently necessary for http://www.assembla.com/spaces/clojure/tickets/181) ?? You always have to specify the interfaces, no? What I meant is that if I always implement SignalX$Listener, I could even get rid of the interfaces list as argument to the macro as it can be derived from the number or arguments that will be passed to trigger. I could write (create-listener [a1 a2 a3] ( do-stuf a b c ) ) Here is the macro I came up with: (defmacro create-listener [ args body] (let [argsnum# (count args)] `(proxy [ ~(symbol (str Signal argsnum# $Listener)) ] [] (trigger ~args ~...@body --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this 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 vs scala
2009/8/26 Konrad Hinsen konrad.hin...@fastmail.net: On 26 Aug 2009, at 07:06, Vagif Verdi wrote: [...] Here's and example of statically typed language (liskell) with lisp syntax and full blown lisp macros: http://blog.clemens.endorphin.org/2009/01/liskell-standalone.html ...this site is down at the moment. I know pretty much nothing about liskell besides having heard the name. I can get to the above page. If you can't, try google cache: http://74.125.95.132/search?q=cache:jYcV-llDETQJ:blog.clemens.endorphin.org/2009/01/liskell-standalone.html liskell.org appears to be broken, but I found this in google cache too: http://74.125.95.132/search?q=cache:e0Ff03kCmRIJ:liskell.org/fifteen-minute-tour -- Michael Wood esiot...@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 -~--~~~~--~~--~--~---
Re: clojure vs scala
On Tue, Aug 25, 2009 at 10:43 PM, npowellnathan.pow...@gmail.com wrote: On Aug 25, 4:36 pm, Christian Vest Hansen karmazi...@gmail.com wrote: I think he misrepresents both Scala and Clojure. ... Not a super helpful assessment. I'd like to hear more. What do you disagree with and why? Listed as a downer for Scala: Functional programming can be difficult to understand for a Java developer - same can be said for Clojure, so I think it is a similarity but he presents it as a difference. Another Scala downer: Scala is very powerful, some developers might shoot themselves into the foot - I don't see how this applies more to Scala than Clojure. If we want to talk about foot-shooting, we could talk about macros. There are some common mistakes that people with weak macro-fu do. Granted we can argue that people learn not to do these mistakes, but this learning still has to take place, and since the article is about which language to learn, I assume that this learning has yet to happen to these mentioned some developers. I would also like to mention the age-old dynamic vs. static typing debate because there's a twist to it here I'd like to point out: This is an assumption because I don't know Scala that well, but; I think it is harder to reason about performance and write fast code in Clojure than it is in Scala. I don't buy the no objects argument against Clojure. He links to Halloways rifle-programming article that presents object oriented using multimethods, so I presume he means no objects as in no ability to define classes and interfaces, but that is what gen-class, gen-interface and proxy are for. And new-new, at some point. I think Scala an advantage in this regard with native syntax for these concepts. I think the comparisons are inevitable, and knowing more about both helps developers make good choices. Your ideas about how to represent both languages would be valuable. They are at least provided above. I mean, I didn't think the article was terribly in depth, but a real, evenhanded comparison would be enlightening. I'm no position to do an evenhanded (objective?) comparison - I don't know the languages well enough to do that. -- Venlig hilsen / Kind regards, Christian Vest Hansen. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this 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 vs scala
Quick aside: There is now a doc directory in contrib, specifically for usage docs. There should be more examples coming in the future. On Aug 26, 1:18 am, ngocdaothanh ngocdaoth...@gmail.com wrote: I think there are a lot of people who need to choose between Clojure and Scala to study as a new language. I must say that both are bad: * Clojure doc is hard to understand. * Scala grammar is complicated. I prefer Clojure. I think Clojure feature at this time is OK, thus the decisive point to draw people to Clojure is doc. I wonder if the doc at this time is obvious for LISP people, but comming from C/C++, Java, Ruby, and Erlang (Erlang doc is bad, but it is paradise compared to that of Clojure :D) and even after reading the Clojure book, I must say that I can't understand 99% of the doc of both clojure and clojure- contrib. For example, what does the following mean? - (- x form) (- x form more) Macro Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc. - My wish: There are easy-to-understand examples in API doc. Rails is easy to use largely because there are examples in doc of every API function. On Aug 26, 12:37 pm, Alan Busby thebu...@gmail.com wrote: On Wed, Aug 26, 2009 at 5:43 AM, npowell nathan.pow...@gmail.com wrote: I mean, I didn't think the article was terribly in depth, but a real, evenhanded comparison would be enlightening. Reducing it further, I'd be interested just to hear more about the contrast of static typing versus macros. Which is more beneficial for different situations and why? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: duck-streams example?
On Tue, Aug 25, 2009 at 5:51 PM, Michael Kohlcitizen...@gmail.com wrote: The main problem is that I can't seem to figure out how to use duck-streams to achieve what I want... #clojure for the rescue. replaca pointed me to the documentation of clojure.contrib.http.agent which has a nice example for what I wanted to do. Here's the solution: (defn fetch-enclosures [urls] Fetches the files provided in an URL list (doseq [url urls] (let [[name] (re-find #(\w|[-.])+$ url)] (http-agent url :handler (fn [agnt] (with-open [w (writer name)] (copy (stream agnt) w))) Thanks, Michael --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this 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 vs scala
On Wed, Aug 26, 2009 at 12:18 AM, ngocdaothanhngocdaoth...@gmail.com wrote: I think there are a lot of people who need to choose between Clojure and Scala to study as a new language. I must say that both are bad: * Clojure doc is hard to understand. Have you seen http://ociweb.com/mark/clojure/article.html? * Scala grammar is complicated. I prefer Clojure. I think Clojure feature at this time is OK, thus the decisive point to draw people to Clojure is doc. I wonder if the doc at this time is obvious for LISP people, but comming from C/C++, Java, Ruby, and Erlang (Erlang doc is bad, but it is paradise compared to that of Clojure :D) and even after reading the Clojure book, I must say that I can't understand 99% of the doc of both clojure and clojure- contrib. -- R. Mark Volkmann Object Computing, Inc. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: ANN: clojure-contrib automatic documentation system complete
On Tue, Aug 25, 2009 at 4:39 PM, Tom Faulhabertomfaulha...@gmail.com wrote: Rich: Glad to help, thanks for the kind words. For Clojure core, mostly what I need to do is refactor and parameterize a bunch of stuff. I'll just make a fork and start playing. When I have something, we can discuss and fine tune. Should it be similar to what we have now with all the namespaces on a single API page? Or would you like to go to something more like what I have for contrib where each namespace has it's own page? The latter seems much nicer, thanks! Rich --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: clojure vs scala
In the meantime this may be helpful: http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Example... Thank you, this is very helpful. * Clojure doc is hard to understand. Have you seen http://ociweb.com/mark/clojure/article.html? Yes I have, this may be the best Clojure doc on the Internet. I mean people are more attracted to Clojure than Scala if the Clojure doc is improved, and it is greatly improved if there are examples in the API doc (http://clojure.org/api). An example is worth a thousand words. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Jwt from Clojure?
On Aug 17, 6:17 pm, Adrian Cuthbertson adrian.cuthbert...@gmail.com wrote: Hi Raphaël, If you're going to drive your app (and server) from clojure, then you can use Compojure's jetty.clj module. This allows you to create a Thanks Adiran for this information. It has allowed me to get it running quite easily. I've posted notes of what I've learned, including a first macro to facilitate development, at http://www.nsa.be/index.php/eng/Blog/Using-Jwt-yes-it-s-a-J-with-Clojure Feedback and comments welcome! Raphaël servlet holder (in which you can add an instantiatedJwtservlet on a jetty url path). Compojure also supports the Ring protocol, so you can also then use it for other webapp functionality. You could also use the Ring library, but (afaik) it uses a Jetty AbstractHander (which is a higher abstraction of the Http connection than a servlet). You would need to add some logic to create a Jetty ServletHolder class yourself (check out the Jetty api). If you're hooking into an existing server, then you can just create a webapp/war with theJwtservlet and add your clojure (comporure/ring) apps in their own servlet using gen-class. There is an example of doing this on the compojure wiki. There are also some other frameworks that have been announced in this group - perhaps others will chip in, or search the group for previous posts on web frameworks. (Jwtlooks interesting, I'm going to take a good look at it as well.) Hth, Adrian. On Mon, Aug 17, 2009 at 5:07 PM, rbraphi...@gmail.com wrote: HI, Jwt(http://www.webtoolkit.eu/jwt) is a java translation of the C++ web toolkit (http://www.webtoolkit.eu/wt) I'd like to develop a web app in clojure based onJwt, butJwtapps need to run in a servlet container. What's the best path to follow in that case? Is developing a Ring adapter which would then allow me to run the app with Jetty the way to go? Every pointer will be welcome! :-) Thanks Raphaël --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this 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 vs scala
On Aug 26, 5:29 am, Christian Vest Hansen karmazi...@gmail.com wrote: Another Scala downer: Scala is very powerful, some developers might shoot themselves into the foot - I don't see how this applies more to Scala than Clojure. If we want to talk about foot-shooting, we could talk about macros. There are some common mistakes that people with weak macro-fu do. Yes, we could talk about macros. The most common mistake that people make with macros (accidental symbol capture) is prevented by clojure fully qualifying names inside of syntax quote and preventing you from let 'ing a fully qualified name; a simple built-in syntax for auto- gensyms makes this easy to work with. IMHO, this is the best of both worlds between Scheme and Common Lisp macros. I think these language vs language discussions are mostly useful for finding out what the writer _doesn't_ know about the languages in question, myself included. For instance, after having read odersky's Scala book. . . if you like static typing and are looking for a new language, I don't see why you would choose Scala over Haskell unless you have a strong investment in java or really like the Lift web framework. Unrestricted use of vars, for instance, seems like a step backwards from the kind of guarantees a purely functional language gives you. On the other hand, if you like dynamic typing and lisp, Clojure has some distinct advantages over both Scheme and Common Lisp, eg macro example noted above. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this 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 vs scala
I didn't find that article particularly helpful, especially since I was facing the exact same decision just a year ago. For me, the difficulty of the language was the ultimate criteria I made me go with Clojure. Relative to Scala, Clojure is quite a bit easier to pickup. It has less syntax rules. I think most people wouldn't disagree with this. So the question was, does Scala's static typing with its more rigid syntax buy me something worthwhile? Do I see my productivity greatly improving as a result of Scala's static typing? For me the answer was no. So in the end, I decided the effort needed to understand Scala fully would not be worthwhile. -Patrick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Getting .NET Version of Clojure to run
On Sat, Aug 15, 2009 at 8:36 AM, David Miller dmiller2...@gmail.com wrote: Clojure.Compile is just for AOT-compilation. It will compile whatever libs are on the command line. As you state, it is used to bootstrap, i.e. compile core.clj and the rest of the bootstap clojure code into assemblies, which can then be loaded quickly by Clojure.Main. If you follow all the directions on the wiki, specifically, http://wiki.github.com/richhickey/clojure-clr/installing-clojureclr http://wiki.github.com/richhickey/clojure-clr/compiling-clojureclr http://wiki.github.com/richhickey/clojure-clr/running-clojureclr you should get up-and-running. David, I wrote a post-build event script for Clojure.Compile that automates everything in compiling-clojureclr. If you're interested, I'll contribute it. The downside is that in order to copy files in a hierarchy with limited extensions (clj, dll, pdb) I used robocopy.exe, which is standard on Vista but not XP. Or: - I could port it to xcopy to make it more portable (not hard--just requires several xcopy commands for one robocopy) - Developers on XP could install the Resource Kit that includes robocopy - Developers on XP could manually copy the files around as before Shawn --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: we offer cheap sport shoes men's shoe(www.salegood8.com) casual shoe fashion shoe
On Tue, Aug 25, 2009 at 11:42 AM, Chouser chou...@gmail.com wrote: On Tue, Aug 25, 2009 at 10:36 AM, John Harropjharrop...@gmail.com wrote: What the hell? The group actually gets a steady stream of spam, but it usually gets deleted instead of being sent to everyone. On this one I accidentally clicked the wrong button. Sorry about that. I'd have thought you'd have set up an automatic filter for the shoe spammer. The messages should after all be very easy to identify with automation. There are plenty of people on an auto-accept list; this one, at least, seems to cry out for an auto-reject list. :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: On the reader macro #=
On Wed, Aug 26, 2009 at 1:13 PM, John Harrop jharrop...@gmail.com wrote: This is important to know about for security reasons, also. Specifically, if you are receiving Clojure data structures in text form over the network, and don't set *read-eval* to false, you're vulnerable to a Clojure injection attack. Someone could send you (+ 5 #=(System/exit 0)) as a denial-of-service attack, just for starters. Interesting result from testing this: user= (read-string (System/exit 0)) (System/exit 0) user= (read-string #=(System/exit 0)) ClassNotFoundException: System user= (read-string #=(java.lang.System/exit 0)) REPL is disconnected. Strange that java.lang is not apparently imported in whatever environment the EvalReader uses. Doesn't stop it being a security hole if accessible over the network 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: On the reader macro #=
This is important to know about for security reasons, also. Specifically, if you are receiving Clojure data structures in text form over the network, and don't set *read-eval* to false, you're vulnerable to a Clojure injection attack. Someone could send you (+ 5 #=(System/exit 0)) as a denial-of-service attack, just for starters. I doubt there's a way to make it safe. There's probably no way to force those expressions to run in an applet sanbox, at least without massive kludging. You'd have to vet the strings first, using some non-Clojure-reader parser. Easier to use the Clojure reader and then walk the resulting data structures looking for, say, special sentinel keywords that should be substituted with other things, or that flag something about the following item (say, that it should be converted to a SortedMap). For storing stuff locally the EvalReader should be safe, unless your program runs with elevated privileges compared to the user who runs it (unix setuid or equivalent). In that event though there's a possibility of it being exploited for local privilege escalation. Arbitrary Clojure and Java code could be submitted to be run at the higher privilege level. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this 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 vs scala
On Wednesday 26 August 2009 08:35:49 Konrad Hinsen wrote: On 26 Aug 2009, at 07:06, Vagif Verdi wrote: I fail to see how macros can be contrasted to static typeng. They are orthogonal. That is true in principle, but integrating Lisp-style macros and compulsory static typing (as opposed to optional type hints) into the same language does require some careful thought. I haven't seen such a combination yet... I'm not sure what you regard as Lisp-style macros but you may be interested in OCaml's untyped Camlp4 macros and Template Haskell's typed macros. -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this 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 vs scala
On Wednesday 26 August 2009 04:37:58 Alan Busby wrote: On Wed, Aug 26, 2009 at 5:43 AM, npowell nathan.pow...@gmail.com wrote: I mean, I didn't think the article was terribly in depth, but a real, evenhanded comparison would be enlightening. Reducing it further, I'd be interested just to hear more about the contrast of static typing versus macros. Which is more beneficial for different situations and why? Both are used in OCaml but static typing is, of course, far more common there because it is a core feature of the language. They really solve completely different problems. Static typing is used to improve performance, catch errors, provide a form of machine-verified documentation and convey information to the programmer in the IDE or REPL. Macros are used to extend the syntax of the language either for adding missing general features or for creating DSL. Additionally, OCaml's macro system is often used for general lexing and parsing or arbitrary syntaxes. -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
A little help needed in understnding anonymous functions
Hi, I'm new to clojure and came from a Lisp background. While learning I clojure I came accross the two different ways of creating anonymous functions ((fn ...) and #(...)). I tried to construct the accumulator function in clojure using these forms and this is what I wrote (this might seem naive but I'm just a beginner :) 1. (defn foo [n] (let [r (ref n)] (fn [i] (dosync (alter r + i) @r And it works fine: user (def f (foo 10)) #'user/f user (f 1) 11 user (f 1) 12 2. (defn foo2 [n] (let [r (ref n)] #((dosync (alter r + %) @r This does not work: user (def f (foo2 10)) #'user/f user (f 1) ; Evaluation aborted. java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn (NO_SOURCE_FILE:0) [Thrown class clojure.lang.Compiler$CompilerException] However, another different function defined below just works: user (defn bar [n] #(+ n %)) #'user/bar user (def b (bar 10)) #'user/b user (b 1) 11 Obviously I might be missing something... Please help. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: On the reader macro #=
On Wed, Aug 26, 2009 at 1:13 PM, John Harropjharrop...@gmail.com wrote: This is important to know about for security reasons, also. Specifically, if you are receiving Clojure data structures in text form over the network, and don't set *read-eval* to false, you're vulnerable to a Clojure injection attack. Someone could send you (+ 5 #=(System/exit 0)) as a denial-of-service attack, just for starters. I doubt there's a way to make it safe. There's probably no way to force those expressions to run in an applet sanbox, at least without massive kludging. I'm pretty sure clojurebot in the #clojure channel does exactly this kind of sandboxing for both read and eval. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: A little help needed in understnding anonymous functions
Hi, Am 26.08.2009 um 20:40 schrieb Sourav: (defn foo2 [n] (let [r (ref n)] #((dosync (alter r + %) @r One pair of parentheses too much... (defn foo2 [n] (let [r (ref n)] #(dosync (alter r + % What you wrote is #((foo)) which translates to (fn [] ((foo))). foo returns in your case an integer. You get eg. ((foo)) = (5). So you try to call an integer like a function. This can't work and hence you get the exception you described. Removing one pair of parentheses fixes the problem: #(foo) = (fn [] (foo)) and thus (foo) = 5. Hope this helps. Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature
Re: clojure vs scala
On Tuesday 25 August 2009 21:43:56 npowell wrote: On Aug 25, 4:36 pm, Christian Vest Hansen karmazi...@gmail.com wrote: I think he misrepresents both Scala and Clojure. ... Not a super helpful assessment. I'd like to hear more. What do you disagree with and why? I think most of the article was vacuous, consisting mainly of verbatim quotes of contentless propaganda. Some of the statements are absurd, such as Clojure and Scala have big momentum. Java has big momentum. Clojure and Scala are struggling to reach the first rung on the ladder. For example, Scala has around 0.02% share of the job market here in the UK (!): http://www.itjobswatch.co.uk/jobs/uk/scala.do I don't want to rain on anyone's parade but that is not big momentum by any stretch of the imagination. What does Very clever immutable datastructures mean? How are Clojure's any more clever than the next implementation? What about [Scala has a] very powerful type system? Sounds like C++ has a Turing complete type system to me. Powerful != good when it comes to type systems. I have explained why I dislike Scala's type system (particularly its very poor type inference) before: http://groups.google.com/group/jvm-languages/msg/b7edd5f9e6ed0361 The biggest promise of Scala nevertheless is power and terseness. Compared to OCaml, Scala is verbose because it requires all of those unnecessary type definitions and annotations. Finally, the article failed to mention what is perhaps the single biggest concern about Scala: it is an academic language. Consequently, Scala will always be developed toward what is novel and not what is useful. At least for me, that is seriously off-putting. -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: A little help needed in understnding anonymous functions
(defn foo2 [n] (let [r (ref n)] #(dosync (alter r + %) @r))) Something went wrong, I am resending the code. Regards, Emeka --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: A little help needed in understnding anonymous functions
On Wed, Aug 26, 2009 at 6:40 PM, Sourav soura.ja...@gmail.com wrote: Hi, I'm new to clojure and came from a Lisp background. While learning I clojure I came accross the two different ways of creating anonymous functions ((fn ...) and #(...)). I tried to construct the accumulator function in clojure using these forms and this is what I wrote (this might seem naive but I'm just a beginner :) 1. (defn foo [n] (let [r (ref n)] (fn [i] (dosync (alter r + i) @r And it works fine: user (def f (foo 10)) #'user/f user (f 1) 11 user (f 1) 12 2. (defn foo2 [n] (let [r (ref n)] #((dosync (alter r + %) @r (defn foo2 [n] (let [r (ref n)] #(dosync (alter r + %) @r Try the above. The difference between #() and (fn ...) was not the root of your problem. You had an extra paren before dosync. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this 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 vs scala
On Wed, Aug 26, 2009 at 3:37 PM, Jon Harropj...@ffconsultancy.com wrote: What does Very clever immutable datastructures mean? How are Clojure's any more clever than the next implementation? My guess is that he was referring to how the data structures in Clojure are immutable and persistent (meaning that one can efficiently create new ones that represent modifications to existing ones where the new and old data structures share memory). The implementation of that, especially for hash maps, could be considered clever. -- R. Mark Volkmann Object Computing, Inc. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this 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 about write clojure code like python mode?
On Aug 24, 11:23 pm, wangzx wangzaixi...@gmail.com wrote: I think clojure may mix both the parenthese and python-like indent together. This has been attempted about every six months ever since Lisp was invented. It never caught on. -SS --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Getting .NET Version of Clojure to run
This can be done by MSBuild directly without involving an external tool like xcopy or robocopy using Item groups and built-in MSBuild tasks. We do this to deliver final artifacts in our build system. I should have some time in the next day or two to dig into the build for ClojureCLR, I will post back the required mojo in a reply here (unless somebody beats me to it :) to do this without using anything other than what comes with VS. On Aug 26, 11:50 am, Rich Hickey richhic...@gmail.com wrote: On Aug 26, 11:42 am, Shawn Hoover shawn.hoo...@gmail.com wrote: On Sat, Aug 15, 2009 at 8:36 AM, David Miller dmiller2...@gmail.com wrote: Clojure.Compile is just for AOT-compilation. It will compile whatever libs are on the command line. As you state, it is used to bootstrap, i.e. compile core.clj and the rest of the bootstap clojure code into assemblies, which can then be loaded quickly by Clojure.Main. If you follow all the directions on the wiki, specifically, http://wiki.github.com/richhickey/clojure-clr/installing-clojureclr http://wiki.github.com/richhickey/clojure-clr/compiling-clojureclr http://wiki.github.com/richhickey/clojure-clr/running-clojureclr you should get up-and-running. David, I wrote a post-build event script for Clojure.Compile that automates everything in compiling-clojureclr. If you're interested, I'll contribute it. The downside is that in order to copy files in a hierarchy with limited extensions (clj, dll, pdb) I used robocopy.exe, which is standard on Vista but not XP. Or: - I could port it to xcopy to make it more portable (not hard--just requires several xcopy commands for one robocopy) - Developers on XP could install the Resource Kit that includes robocopy - Developers on XP could manually copy the files around as before I would greatly prefer that everything related to ClojureCLR worked on stock XP. Rich --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Getting .NET Version of Clojure to run
I'll also execute a CA and contribute back the require build script changes as well :) On Aug 26, 3:26 pm, rodgertq rodge...@gmail.com wrote: This can be done by MSBuild directly without involving an external tool like xcopy or robocopy using Item groups and built-in MSBuild tasks. We do this to deliver final artifacts in our build system. I should have some time in the next day or two to dig into the build for ClojureCLR, I will post back the required mojo in a reply here (unless somebody beats me to it :) to do this without using anything other than what comes with VS. On Aug 26, 11:50 am, Rich Hickey richhic...@gmail.com wrote: On Aug 26, 11:42 am, Shawn Hoover shawn.hoo...@gmail.com wrote: On Sat, Aug 15, 2009 at 8:36 AM, David Miller dmiller2...@gmail.com wrote: Clojure.Compile is just for AOT-compilation. It will compile whatever libs are on the command line. As you state, it is used to bootstrap, i.e. compile core.clj and the rest of the bootstap clojure code into assemblies, which can then be loaded quickly by Clojure.Main. If you follow all the directions on the wiki, specifically, http://wiki.github.com/richhickey/clojure-clr/installing-clojureclr http://wiki.github.com/richhickey/clojure-clr/compiling-clojureclr http://wiki.github.com/richhickey/clojure-clr/running-clojureclr you should get up-and-running. David, I wrote a post-build event script for Clojure.Compile that automates everything in compiling-clojureclr. If you're interested, I'll contribute it. The downside is that in order to copy files in a hierarchy with limited extensions (clj, dll, pdb) I used robocopy.exe, which is standard on Vista but not XP. Or: - I could port it to xcopy to make it more portable (not hard--just requires several xcopy commands for one robocopy) - Developers on XP could install the Resource Kit that includes robocopy - Developers on XP could manually copy the files around as before I would greatly prefer that everything related to ClojureCLR worked on stock XP. Rich --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: ANN: clojure-maven-plugin 1.0 released and in maven central
ngocdaothanh napisał(a): I'm new to Maven. Thank you for the explanation. Using git-submodules and sourceDirectories is a good idea. Prior to using your plugin, I use clojure and clojure-contrib with Maven like this: 1. Manually download from GitHub and compile clojure and clojure- contrib. 2. Install them to the local Maven repository: mvn install:install-file -DgroupId=org.clojure -DartifactId=clojure - Dversion=SNAPSHOT -Dpackaging=jar -Dfile=clojure.jar mvn install:install-file -DgroupId=org.clojure -DartifactId=clojure- contrib -Dversion=SNAPSHOT -Dpackaging=jar -Dfile=clojure-contrib.jar 3. Add clojure and clojure-contrib and other dependencies that my project uses in pom.xml: ... dependencies dependency groupIdorg.clojure/groupId artifactIdclojure/artifactId versionSNAPSHOT/version /dependency dependency groupIdorg.clojure/groupId artifactIdclojure-contrib/artifactId versionSNAPSHOT/version /dependency ... /dependencies ... 4. Use Exec Maven Plugin (http://mojo.codehaus.org/exec-maven-plugin/) to run my Clojure file: mvn exec:java -Dexec.mainClass=clojure.main -Dexec.args=path/to/my/ clojure/file.clj I want to ask is there a better way to use clojure and clojure-contrib and running Clojure file with Maven? Actually I managed to make a little bit more useful pom-template.xml (from clojure git repository) and now I'm able to install clojure in local maven repository just using this commands: $ git pull $ ant init-version $ mvn install I'm going to change pom.xml in clojure-contrib in the same way. Needed XMLs look as follows: # clojure-jar.xml - assembly descriptor assembly formats formatjar/format /formats includeBaseDirectoryfalse/includeBaseDirectory fileSets fileSet directory${build}/directory outputDirectory/outputDirectory includes include**/*.class/include /includes /fileSet fileSet directory${cljsrc}/directory outputDirectory/outputDirectory includes include**/*.clj/include includeclojure/version.properties/include /includes /fileSet /fileSets /assembly # slim-jar.xml - assembly descriptor assembly formats formatjar/format /formats includeBaseDirectoryfalse/includeBaseDirectory fileSets fileSet directory${build}/directory outputDirectory/outputDirectory includes includeclojure/asm/**/include includeclojure/lang/**/include includeclojure/main.class/include /includes /fileSet fileSet directory${cljsrc}/directory outputDirectory/outputDirectory includes include**/*.clj/include includeclojure/version.properties/include /includes /fileSet /fileSets /assembly # pom-template.xml ?xml version=1.0 encoding=UTF-8? project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; modelVersion4.0.0/modelVersion groupIdorg.clojure/groupId artifactIdclojure-lang/artifactId nameclojure-lang/name version@clojure-version@/version urlhttp://clojure.org//url packagingpom/packaging descriptionClojure core environment and runtime library./ description licenses license nameEclipse Public License 1.0/name urlhttp://opensource.org/licenses/eclipse-1.0.php/url distributionrepo/distribution /license /licenses properties srcsrc/src testtest/test jsrc${src}/jvm/jsrc cljsrc${src}/clj/cljsrc buildclasses/build clojure_jarclojure-${project.version}/clojure_jar slim_jarclojure-slim-${project.version}/slim_jar /properties repositories repository idtapestry-snapshots/id urlhttp://tapestry.formos.com/maven-snapshot-repository// url /repository /repositories distributionManagement repository idreleases/id namerelease/name urlhttp://localhost:8081/nexus/content/repositories/releases/ /url /repository snapshotRepository idsnapshots/id namesnapshot/name urlhttp://localhost:8081/nexus/content/repositories/ snapshots//url /snapshotRepository /distributionManagement build sourceDirectory${jsrc}/sourceDirectory outputDirectory${build}/outputDirectory plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId configuration debugtrue/debug source1.5/source target1.5/target /configuration executions execution idcompile-java/id phasecompile/phase goals
Re: How about write clojure code like python mode?
they didn't know it was impossible so they did it :) 2009/8/26 Stuart Sierra the.stuart.sie...@gmail.com On Aug 24, 11:23 pm, wangzx wangzaixi...@gmail.com wrote: I think clojure may mix both the parenthese and python-like indent together. This has been attempted about every six months ever since Lisp was invented. It never caught on. -SS --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Why doesn't regex implement ifn?
Okay, I'm sure this has come up before. I was just wondering if anyone knew why the regex literal doesn't implement IFn? At first glance it seems like the following would be useful: user=(#\d{3} 123) true This is defined as... user=(not (nil? (re-matches #\d{3} 123))) true What am I missing? Sean --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this 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 about write clojure code like python mode?
its not impossible, it just isn't terribly useful. On Aug 26, 6:04 pm, Laurent PETIT laurent.pe...@gmail.com wrote: they didn't know it was impossible so they did it :) 2009/8/26 Stuart Sierra the.stuart.sie...@gmail.com On Aug 24, 11:23 pm, wangzx wangzaixi...@gmail.com wrote: I think clojure may mix both the parenthese and python-like indent together. This has been attempted about every six months ever since Lisp was invented. It never caught on. -SS --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this 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 doesn't regex implement ifn?
On Aug 26, 2009, at 9:17 PM, Sean Devlin wrote: Okay, I'm sure this has come up before. I was just wondering if anyone knew why the regex literal doesn't implement IFn? At first glance it seems like the following would be useful: user=(#\d{3} 123) true This is defined as... user=(not (nil? (re-matches #\d{3} 123))) true What am I missing? The # form produces Java Pattern objects: user= (class #foo) java.util.regex.Pattern user= ...which of course aren't IFns. - Chas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Newbie Eclipse REPL question
On Aug 24, 12:22 pm, Laurent PETIT laurent.pe...@gmail.com wrote: There's a simpler way : just invoke Run as clojure REPL on the project node in the project explorer, and you will have a new Launch configuration created with the name of the project (and it will, obviously, be launched as well and available in the Console). Thanks. That works. I'm hoping there's something simple I've overlooked, ... --a call to short terminate REPL processing, ie, go back to listening to the Eclipse Console, (end-of-readable-file) or some such to pause Run As-Clojure REPL before it tries to run buggier code. I'd move s-expr that test OK, up above the (end-of-readable-file) Sorry, I don't understand this one, could you explain again ? Something that interrupts the REPL processing like the (assert false) below. However, (assert false) produces a problem / error marker. (println this will work) (println (str this will probably work)) (assert false) ;; stop REPL here to allow manual, line by line eval debugging (println (+ 1 a)) Thanks again. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this 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 doesn't regex implement ifn?
java.util.regex.Pattern I imagine a wrapper class could be returned instead that implemented IFn and Pattern, but which function would it call? (re-find m) (re-find re s) (re-groups m) (re-matcher re s) (re-matches re s) (re-pattern s) (re-seq re s) I don't think there is a clear implicit choice - so explicitly choosing seems necessary here. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Getting .NET Version of Clojure to run
Having this in hand would be awesome. -David On Aug 26, 3:29 pm, rodgertq rodge...@gmail.com wrote: I'll also execute a CA and contribute back the require build script changes as well :) On Aug 26, 3:26 pm, rodgertq rodge...@gmail.com wrote: This can be done by MSBuild directly without involving an external tool like xcopy or robocopy using Item groups and built-in MSBuild tasks. We do this to deliver final artifacts in our build system. I should have some time in the next day or two to dig into the build for ClojureCLR, I will post back the required mojo in a reply here (unless somebody beats me to it :) to do this without using anything other than what comes with VS. On Aug 26, 11:50 am, Rich Hickey richhic...@gmail.com wrote: On Aug 26, 11:42 am, Shawn Hoover shawn.hoo...@gmail.com wrote: On Sat, Aug 15, 2009 at 8:36 AM, David Miller dmiller2...@gmail.com wrote: Clojure.Compile is just for AOT-compilation. It will compile whatever libs are on the command line. As you state, it is used to bootstrap, i.e. compile core.clj and the rest of the bootstap clojure code into assemblies, which can then be loaded quickly by Clojure.Main. If you follow all the directions on the wiki, specifically, http://wiki.github.com/richhickey/clojure-clr/installing-clojureclr http://wiki.github.com/richhickey/clojure-clr/compiling-clojureclr http://wiki.github.com/richhickey/clojure-clr/running-clojureclr you should get up-and-running. David, I wrote a post-build event script for Clojure.Compile that automates everything in compiling-clojureclr. If you're interested, I'll contribute it. The downside is that in order to copy files in a hierarchy with limited extensions (clj, dll, pdb) I used robocopy.exe, which is standard on Vista but not XP. Or: - I could port it to xcopy to make it more portable (not hard--just requires several xcopy commands for one robocopy) - Developers on XP could install the Resource Kit that includes robocopy - Developers on XP could manually copy the files around as before I would greatly prefer that everything related to ClojureCLR worked on stock XP. Rich --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Why doesn't regex implement ifn?
On Aug 26, 2009, at 9:46 PM, Timothy Pratley wrote: java.util.regex.Pattern I imagine a wrapper class could be returned instead that implemented IFn and Pattern, Pattern is a final concrete class, so that's not possible. ...I'm counting down until I see an all-clojure regex implementation announcement. ;-) - Chas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: clojure vs scala
On Wed, Aug 26, 2009 at 1:18 AM, ngocdaothanh ngocdaoth...@gmail.comwrote: I think there are a lot of people who need to choose between Clojure and Scala to study as a new language. I must say that both are bad: * Clojure doc is hard to understand. * Scala grammar is complicated. I prefer Clojure. I think Clojure feature at this time is OK, thus the decisive point to draw people to Clojure is doc. I wonder if the doc at this time is obvious for LISP people, but comming from C/C++, Java, Ruby, and Erlang (Erlang doc is bad, but it is paradise compared to that of Clojure :D) and even after reading the Clojure book, I must say that I can't understand 99% of the doc of both clojure and clojure- contrib. For example, what does the following mean? - (- x form) (- x form more) Macro Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc. - That's funny! I picked on this exact one a bunch of times! I can't agree more. Thank you. On the other hand, are those forums as helpful as this one is? But going back to it, what's even funnier is that, once folks explained what this arrow thing did, it REALLY put me over the top for giving the language a break for a while. I'd say it's not for beginners. It's frustrating to have so many ways to do things all at once when all you want at first is ANY way that works. And the whole point is that there's only one thing to have to know, thanks to the parentheses. And then they invent this arrow thing? Fugetaboutit! No, seriously, I agree, but I think the philosophy seems to be that eventually you will learn it by asking people and/or trying stuff out, and then you can pass on what you learn to others. The community will get big and many people will write nice books and nice docs. You also, sort of, have to be a lisper to gain entry with some of the idioms. Like it seems like some things are held onto because they are the lisp way -- example: with-. That barely ever means anything to me. My wish: There are easy-to-understand examples in API doc. Rails is easy to use largely because there are examples in doc of every API function. On Aug 26, 12:37 pm, Alan Busby thebu...@gmail.com wrote: On Wed, Aug 26, 2009 at 5:43 AM, npowell nathan.pow...@gmail.com wrote: I mean, I didn't think the article was terribly in depth, but a real, evenhanded comparison would be enlightening. Reducing it further, I'd be interested just to hear more about the contrast of static typing versus macros. Which is more beneficial for different situations and why? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this 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 doesn't regex implement ifn?
On Aug 26, 9:46 pm, Timothy Pratley timothyprat...@gmail.com wrote: java.util.regex.Pattern I imagine a wrapper class could be returned instead that implemented IFn and Pattern, Unfortunately, Pattern is a final class. Rich --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: clojure vs scala
Listed as a downer for Scala: Functional programming can be difficult to understand for a Java developer - same can be said for Clojure, so I think it is a similarity but he presents it as a difference. Wow. All the more reason for a Java developer to mess with it then! After all, Java doesn't (in general) preclude using a functional style so that would imply many Java programmers are missing an important tool in their arsenal. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this 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 doesn't regex implement ifn?
Well, with a statically typed language this would be a problem. What if we used duck-typing to get around this? Granted, this wouldn't work for anything that gets passed to Java, but the following gist would be a start. http://gist.github.com/176032 Now, We'd still have to address Mr. Pratley's issue of which fn to implement, but now we have an option. Thoughts? Sean On Aug 26, 10:01 pm, Rich Hickey richhic...@gmail.com wrote: On Aug 26, 9:46 pm, Timothy Pratley timothyprat...@gmail.com wrote: java.util.regex.Pattern I imagine a wrapper class could be returned instead that implemented IFn and Pattern, Unfortunately, Pattern is a final class. Rich --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: clojure vs scala
For instance, after having read odersky's Scala book. . . if you like static typing and are looking for a new language, I don't see why you would choose Scala over Haskell unless you have a strong investment in java or really like the Lift web framework. Unrestricted use of vars, for instance, seems like a step backwards from the kind of guarantees a purely functional language gives you. If one likes Haskell over Scala and needs Java, is this a fine option? http://docs.codehaus.org/display/JASKELL/Home http://jaskell.codehaus.org/Using+Jaskell http://jaskell.codehaus.org/ or maybe http://jhaskell.sourceforge.net/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Connection pool with clojure.contrib.sql
Hi. As I understand clojure.contrib.sql's with-connection opens DB connection at the beginning and closes it at the end of each call. How do I create a connection pool so that with-connection can reuse connections? Thanks, Ngoc. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this 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 doesn't regex implement ifn?
Granted, this wouldn't work for anything that gets passed to Java, but the following gist would be a start. http://gist.github.com/176032 You already have a getPattern method for those cases. Which suggests another solution: (defn re-fn Uses ss to construct a java.util.Pattern. Returns a function which returns the Pattern if called with no arguments, and calls re-seq if called with a string argument. [ss] (let [pp (re-pattern ss)] (fn re ([] pp) ([s] (re-seq pp s) user= ((re-fn 2.) 12324251) (23 24 25) user= ((re-fn 2.)) #2. If #X created a (re-fn X) then all the re functions could accept a function and call it in order to avoid having to do (re-find (pp) s). The previous signature could be retained so that they would work with either type of arguments if that were desirable. The downside is trying to explain that in the docs might be confusing - so a wrapper seems more obvious for that. Oh - it seems like re-seq does the most work so perhaps that is the best candidate? Regards, 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 -~--~~~~--~~--~--~---
Re: clojure vs scala
We looked at Scala in summer 2008... we were very tired of data typing in general and OOP (specifically Java). We did not find any comfort in Scala regarding these aspects. Concurrencent processing in Scala did not enthusiast us either. We wanted a significant code compression factor compared to equivalent Java code, Scala provided some improvements compared to Java but we gave more value to a Lisp like macro implementation, it's more flexible and allows us to compress our code at will and give any form we want. When we found Clojure, we tossed Scala away with no after thoughts. Absence of data typing, a good macro implementation and ease of use of concurrency made us very happy at the time and we are still happy today about our decision. All of the above may be a matter of taste, at some point in my professional life, I would like to work with tools of my choice that fit with my mood than wearing straight jackets to please my customers... Luc Préfontaine Armageddon was yesterday, today we have a real problem... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---