Re: Nested functions on #() reader
So you would introduce all of the functions first, then insert the body into the inside? Major issue that I can see is that it's very powerful and very useful only in very specific circumstances, but isn't extensible at all. Looks cool, though. Maybe you could write a macro that does something like this? - DAemon On Sun, Sep 16, 2012 at 2:16 PM, vhsmaia v...@viclib.com wrote: Hello. I'm new here, so, not sure if those were already posted. But why is this not used? An example would be: #(%a %%b %%%c) would be the same as (fn [a] (fn [b] (fn [c] (a b c))) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 translate this snippet from Scheme to Clojure
Would an idiomatic definition of ((A)) be (defn fnA [] #(A))? (defn a [] [:a :b]) (a) ; (a = fn) = [:a :b] (defn funcA [] #(a)) (funcA) ; (funcA = fn) ((funcA)) ; ((funcA)) = [:a :b] Where you define a function which, when invoked, returns a function which, when invoked, invokes A? This is a standard pattern that I've used for continuation-passing style, and for the construction of monadic values. The syntax isn't as clean as your example above, but I personally think it makes more sense. Unless I'm missing what you're trying to achieve. - DAemon On Fri, Aug 31, 2012 at 8:57 AM, Armando Blancas abm221...@gmail.comwrote: Let's take it case by case. (define A 1) is like (def A 1) in Clojure. (define (A) 1) is like (defn A [] 1) (define (A x y) (* x y)) as you'll expect, (defn A [x y] (* x y)) (define (A) 1) is the same as (define A (lambda () 1)) ;; defines procedure A (define ((A)) 1) is the same as (define (A) (lambda () 1));; defines procedure (A) On Thursday, August 30, 2012 2:48:39 PM UTC-7, Andy C wrote: I use Rocket Scheme. The question was inspired by Structure and Interpretation http://www.youtube.com/watch?**v=2Op3QLzMgSYhttp://www.youtube.com/watch?v=2Op3QLzMgSY at almost end of the video @ 1:11:11 I actually think that ((A)) is more just a symbol name since apparently you define A not a ((A))/ It is more like a recursive/nested symbol name. Very neat and simple concept I am seeking a formal explanation for. A. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Friend: an extensible authentication and authorization library for Clojure Ring webapps and services
Hi Chas, Was wondering whether there's been any work on extending Friend to OAuth stuff yet - I'm looking at implementing something that requires authentication with Twitter or Facebook, and haven't quite got my head around all the steps required to implement it myself... Thanks! - David On Thu, Apr 12, 2012 at 12:59 AM, Chas Emerick c...@cemerick.com wrote: For your consideration, a new library http://wp.me/p10OJi-d6: I’m hoping this can eventually be a warden/spring-security/everyauth /omniauth for Clojure; that is, a common abstraction for authentication and authorization mechanisms. Clojure has been around long enough that adding pedestrian things like form and HTTP Basic and $AUTH_METHOD_HERE to a Ring application should be easy. Right now, it’s not: either you’re pasting together a bunch of different libraries that don’t necessarily compose well together, or you get drawn into shaving the authentication and authorization yaks for the fifth time in your life so you can sleep well at night. Hopefully Friend will make this a solved problem, or at least push things in that direction. Read more here: http://wp.me/p10OJi-d6 Cheers, - Chas -- http://cemerick.com [Clojure Programming from O'Reilly](http://www.clojurebook.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: Avoid duplicate computation in commute?
Would some of this difficulty be ameliorated by calling memoize on the function that you use? That way, if it's an expensive function, and the value hasn't changed, it's just looked up rather than recalculated. - DAemon On Fri, May 18, 2012 at 6:28 AM, Stuart Sierra the.stuart.sie...@gmail.comwrote: I think the point with `commute` is to allow for more concurrency at the expense of more computation. If you want assurance that your function is only called once, you can use `alter`. Keep in mind that *any* code in a Ref transaction has the potential to be called more than once if there's a conflict. All this doesn't mean that it's impossible to avoid the duplicate computation on `commute`. The code to study would be here: https://github.com/clojure/clojure/blob/8fda34e4c77cac079b711da59d5fe49b74605553/src/jvm/clojure/lang/LockingTransaction.java#L459 -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: Avoid duplicate computation in commute?
The reason that comes to mind most easily for me is that of deciding which notion of equality to use for 'the value of Ref hasn't changed'. Also, short of keeping a counter on the Ref of the number of times it's been changed, and comparing on that, there's no other way to tell that no other thread has changed the Ref, as far as I know. Although I could be wrong, *throws question to the Gods of clojure* On Fri, May 18, 2012 at 8:03 AM, Warren Lynn wrn.l...@gmail.com wrote: Thanks and these are certainly workable solutions. But is there any particular reason why with commute the update function is ALWAYS called twice, even when no other thread changed the ref value at the commit time? That is what bothers me. On May 17, 5:46 pm, DAemon forsakendae...@gmail.com wrote: Would some of this difficulty be ameliorated by calling memoize on the function that you use? That way, if it's an expensive function, and the value hasn't changed, it's just looked up rather than recalculated. - DAemon On Fri, May 18, 2012 at 6:28 AM, Stuart Sierra the.stuart.sie...@gmail.comwrote: I think the point with `commute` is to allow for more concurrency at the expense of more computation. If you want assurance that your function is only called once, you can use `alter`. Keep in mind that *any* code in a Ref transaction has the potential to be called more than once if there's a conflict. All this doesn't mean that it's impossible to avoid the duplicate computation on `commute`. The code to study would be here: https://github.com/clojure/clojure/blob/8fda34e4c77cac079b711da59d5fe. .. -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 -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Avoid duplicate computation in commute?
Aren't alter and dosync just using LockingTransactions, which use the Java locking stuff under the hood? On Fri, May 18, 2012 at 9:28 AM, Warren Lynn wrn.l...@gmail.com wrote: But I thought for a ref, all the checking if an another thread has changed the value behind my back facility/logic is already there (otherwise how can dosync and alter work, right?). So why not using that? I did send the question to Rich but not sure he will have time to attend this. I am still learning Clojure and so far like it (especially compared to the bad experience with Common Lisp), but my perfectionist side pokes me sometimes. On May 17, 6:42 pm, DAemon forsakendae...@gmail.com wrote: The reason that comes to mind most easily for me is that of deciding which notion of equality to use for 'the value of Ref hasn't changed'. Also, short of keeping a counter on the Ref of the number of times it's been changed, and comparing on that, there's no other way to tell that no other thread has changed the Ref, as far as I know. Although I could be wrong, *throws question to the Gods of clojure* On Fri, May 18, 2012 at 8:03 AM, Warren Lynn wrn.l...@gmail.com wrote: Thanks and these are certainly workable solutions. But is there any particular reason why with commute the update function is ALWAYS called twice, even when no other thread changed the ref value at the commit time? That is what bothers me. On May 17, 5:46 pm, DAemon forsakendae...@gmail.com wrote: Would some of this difficulty be ameliorated by calling memoize on the function that you use? That way, if it's an expensive function, and the value hasn't changed, it's just looked up rather than recalculated. - DAemon On Fri, May 18, 2012 at 6:28 AM, Stuart Sierra the.stuart.sie...@gmail.comwrote: I think the point with `commute` is to allow for more concurrency at the expense of more computation. If you want assurance that your function is only called once, you can use `alter`. Keep in mind that *any* code in a Ref transaction has the potential to be called more than once if there's a conflict. All this doesn't mean that it's impossible to avoid the duplicate computation on `commute`. The code to study would be here: https://github.com/clojure/clojure/blob/8fda34e4c77cac079b711da59d5fe. .. -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 -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Nonprinting characters in string
Ah, thanks. It just seemed like there should be something that did this! - D On Mon, May 7, 2012 at 7:38 PM, David Powell djpow...@djpowell.net wrote: Clojure doesn't seem to explicitly escape non-printable characters in String literals when you try to print them. You could always do it yourself with something like: (require 'clojure.string) (defn escape-nonprintable [s] (clojure.string/join (map (fn [c] (if (Character/isISOControl c) (str \\ (format %03o (int c))) c)) s))) On Thu, May 3, 2012 at 11:49 AM, DAemon forsakendae...@gmail.com wrote: This seems like a really silly question, but if I have a string like abc\000def, how do I print it in such a way that it shows abc\000def? I've tried playing around with prn and *print-readably*, but that doesn't seem to do what I want. Thanks! - DAemon -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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
Nonprinting characters in string
This seems like a really silly question, but if I have a string like abc\000def, how do I print it in such a way that it shows abc\000def? I've tried playing around with prn and *print-readably*, but that doesn't seem to do what I want. Thanks! - DAemon -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Lack in the documentation
I feel that it should be pointed out that all three of Eclipse, Netbeans and IntelliJ IDEA are, under the covers, platforms for building IDEs, rather than just IDEs themselves. Oddly enough, out of the three, I had the simplest transition with IntelliJ - only had to install clojure and leiningen plugins once I'd installed the IDE and it worked really well! I had weird teething problems with both the other two. I would like to express a similar concern regarding the complexity of tools like Eclipse (my friends and I refer to them as GLIDEs, or General Language IDEs) when first learning a language. If we could get good syntax highlighting and code completion into something like clooj, I think that that would be a far easier way to start, or at least a REALLY stripped-back GLIDE that hid most of the functionality from view at first glance. I also feel like maybe you're advocating one solution for two different problems - yes, a GLIDE is going to be best when someone wants all the features that that allows, but that doesn't make a simpler tool any less useful for a newcomer. Anyway, that's my 2¢. http://www.eclipse.org/platform/ http://netbeans.org/features/platform/ http://www.jetbrains.org/pages/viewpage.action?pageId=983889 - DAemon On Sun, Feb 19, 2012 at 12:42 PM, abaitam abai...@gmail.com wrote: - This Clojure-IDE is actually Eclipse for Clojure (which integrates Clojure, Counterclockwise and lein libraries - not as external tools) Hang on, you were advocating Clojure for non-Java devs, yes? Yet you want to inflict Eclipse on them? I'm only half-joking here. Non-Java developers are going to want to use something lightweight and simple... that's not Eclipse (it's not Emacs either)... not sure what is the best route here (Clooj?). I suggested Eclipse for several reasons: - It is AFAIK an IDE to build IDEs and can be rebranded the way you want. - It is the shortest path to have an IDE instead of starting from scratch. Creating that IDE is a matter of integrating and repackaging since the tools are already there (CCW, lien, test frameworks). - I hope you didn't misunderstand what I said above. I am not against Java and I am aware the Java interop is one of Clojure's strength and eventually you will need an IDE that can deal with both languages and Eclipse is an IDE for both. A simpler IDE, like CLOOJ, might be good for a newcomer but when he has advanced in the language and needs both languages, the simpler IDE will have to provide the tools Eclipse (and VS) currently provide for the host language. That's why I think an Eclipse-based IDE is the better choice for an official IDE. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Looking for parser generator library
atto is 10^-18, and a parsec is 3.1×10^13 km, which is 3.1×10^16m, which is 3.1×10^18cm, so Cedric was right, from what I can see... Turns out I misread a 3 as a 5... lol *facepalm* On Thu, Feb 16, 2012 at 1:04 PM, Alan Malloy a...@malloys.org wrote: Roman Gonzalez: this library is a port of Haskell's attoparsec Despite: Haskell has a parser library named for a distance of approximately three centimetres? :) Not that it's pertinent, but a parsec is 31 trillion kilometers. Did you massively misplace a decimal? :) 1 attoParsec = 3.08568025 × 10-5 kilometers -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Looking for parser generator library
Not massively - I get about 3.1 metres. 10^-18x10^15x10^3x3.1m... On Thu, Feb 16, 2012 at 12:47 PM, Despite desp...@gmail.com wrote: Haskell has a parser library named for a distance of approximately three centimetres? :) Not that it's pertinent, but a parsec is 31 trillion kilometers. Did you massively misplace a decimal? :) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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
Gist script
Hey everyone, I've been playing around with Clojure, and came up with this little thing to allow you to easily pull scripts in from Gist and execute them. Thought it might be useful to someone! https://gist.github.com/1646223 - DAemon -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en