Re: Bug in clojure.contrib.core/-?> (improper quoting?)
Patch added. I'm unable to understand how I can do the following 2 actions that I should do, following the recipe in http://clojure.org/patches : a. please add the 'patch' tag. b. Please mark the ticket 'ready to test' by checking that option under Choose an action... Maybe a permissions problem ? 2010/12/8 Ken Wesson > On Wed, Dec 8, 2010 at 1:08 AM, Jason Wolfe wrote: > >> Posting a reply to someone that consists solely of a link that, when > >> accessed by that someone, throws up an access denied message in their > >> face, is an equivalent act to sending them an encrypted reply for > >> which they don't have the key, or handing them a locked briefcase for > >> which they don't know the combination. So, kind of silly, and > >> ineffective at actually communicating with them since they can't read > >> your reply. > >> > >> Hence my assumption that a mistake of some sort had been made. It > >> seems unlikely that someone would intentionally send me a reply I > >> can't actually read, so I figured they did not intend that effect, but > >> technical problems of some kind occurred or they simply misspelled the > >> URL. > >> > >> Now I'm simply confused. What, exactly, was intended? And if there's > >> nothing actually private-to-me about the attempted communication and > >> someone here is prviy to its contents, perhaps they could simply > >> repost those contents here? > > > > I apologize for my terseness; thanks for your contribution to the > > discussion. I was in a rush, and assumed the link was world- > > viewable; it certainly didn't look protected, and I knew that issues > > for Clojure (but I guess not C-C) were publicly browsable without an > > account from prior experience. Looks like Stuart has fixed this wart > > (thanks!). > > That's OK. Thanks. > > I can confirm that the link works now. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from 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: post your feedback on the conj
The rollout of videos has already started: http://twitter.com/clojure_conj/status/10324356836102144 Sam --- http://sam.aaron.name On 1 Dec 2010, at 18:39, PublicFarley wrote: > Yup. Count me in as another Clojurian thirsty for videos from the > conference. > > I'm definitely willing to fork over a couple of bucks for the pleasure > as well. > > - Farley > > On Nov 30, 10:22 pm, Brent Millare wrote: >> +1, I surprised a video from the conference hasn't been posted yet. >> Are there legal restrictions involved? >> >> On Nov 30, 3:42 pm, László Török wrote: >> >> >> >>> +1, there is an other popular conference called QCon and I many of us >>> appreciate the videos released on infoq.com. :) >> >>> 2010/11/30 cej38 >> I would also like to watch the videos of the presentations. Even if I had to pay for them. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from 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
every? and some .. shoule take a predicate and multiple collections like map does..
Hello everybody, I think "every?" and "some" should take multiple collections like map .. I know it is trivial to implement that ..but it would be nice to have it as part of the default behaviour of every? , some , not-any? and not-every? should take more than one collection as the default behaviour.. Sunil. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Bug in clojure.contrib.core/-?> (improper quoting?)
> Effective communication tip: Please preserve links in responses, so that when > somebody is trying to track down issues they don't have to work back through > the thread to find links. > Effective communication tip #2: Please don't top post, so that when somebody is trying to track down issues they don't have to work back from response to stimulus. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
newb q about quote
I was looking at quote. user=> (quote 1) 1 user=> (quote) nil user=> (quote quote) quote user=> ((quote quote) 1) nil It's the last result that confuses me. I would have expected the result to be "1" - e.g. the same as (quote 1). I figured I'd try quote on something other than itself, and it just got stranger: user=> ((quote +) 1 2) 2 I would have expected 3. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: newb q about quote
On Wed, Dec 8, 2010 at 2:40 PM, javajosh wrote: > I was looking at quote. > > user=> (quote 1) > 1 > user=> (quote) > nil > user=> (quote quote) > quote > user=> ((quote quote) 1) > nil > > It's the last result that confuses me. I would have expected the > result to be "1" - e.g. the same as (quote 1). I figured I'd try quote > on something other than itself, and it just got stranger: > > user=> ((quote +) 1 2) > 2 > > I would have expected 3. > 1) quote is a special form, so it's probably a bad symbol to be experimenting with in this way, let's use "+" instead. 2) This is kind of funny, (quote +) returns a symbol, not a ref holding the function. When you invoke it, you're actually calling the invoke method of the Fn implentation of the Symbol class, whose behavior is to look itself up in the first parameter (intended to be a collection), similar to how keywords look themselves up. This supports things like ('key {'key 'value}) which returns 'value. With two parameters, the third parameter is actually the "not found" value, which is what should be returned if the key isn't found in the collection. user=> ('+ {'+ "Plus"}) "Plus" user=> ('+ {} "Not Found") "Not Found" user=> (:name {:name "Aaron"}) "Aaron" user=> (:name {} "Not Found") "Not Found" Once you get a symbol, if you want to actually call it the way you were originally, try "resolve" amongst probably other ways. user=> (resolve '+) #'clojure.core/+ user=> ((resolve '+) 1 2) 3 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: newb q about quote
There are 2 kinds of lisps based on the meaning of a symbol. Symbols have structure "slots". The first kind of lisp has symbols with a "function slot" and a "value slot". The second kind of lisp has only the "value slot". This affects the meaning of a symbol when it is used in the first position of a list. In a lisp that has a function slot and a value slot you can set them independently. So consider We set the FUNCTION slot of A to the plus function (setf (symbol-fuction 'a) #'+) and we set the VALUE slot of A to be 3 (setf (symbol-value 'a) 3) So just typing A gives the value 3: a => 3 But using it as a function gives: (a a a) == (+ 3 3) ==> 6 since the FUNCTION slot of A is + and the VALUE slot is 3 In the second kind of lisp, with only the VALUE slot this will not work since there is only one place to put anything. There is also the second question of how the first slot of a list is evaluated. Does it only get evaluated once or does it continue to be evaluated until it gets a function? So ((quote +) 2 3) in a lisp that evaluates the first thing once becomes: (+ 2 3) but "+" is a symbol, not a function so you get an error. In a lisp that evaluates the first slot until it gets a function then ((quote +) 2 3) ==> (+ 2 3) ==> ( 2 3) ==> 5 Tim Daly On 12/8/2010 2:40 PM, javajosh wrote: I was looking at quote. user=> (quote 1) 1 user=> (quote) nil user=> (quote quote) quote user=> ((quote quote) 1) nil It's the last result that confuses me. I would have expected the result to be "1" - e.g. the same as (quote 1). I figured I'd try quote on something other than itself, and it just got stranger: user=> ((quote +) 1 2) 2 I would have expected 3. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: newb q about quote
Hi, Am 08.12.2010 um 22:06 schrieb Tim Daly: > There are 2 kinds of lisps based on the meaning of a symbol. > > Symbols have structure "slots". And then there is clojure where symbols are just symbols without any slots. When the compiler encounters a symbol it resolves it to a Var or let local or function argument, which holds the actual value. So while feeling like a Lisp with "value slot only"-symbols, Clojure works a little bit differently under the hood. Sincerely Meikel -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: easiest way to make a map out of a list?
On Mon, Dec 6, 2010 at 21:01, Alex Baranosky wrote: > Way I have [:a 1:b 2] and I want to convert it to {:a 1 :b 2} Minor quibble - [] is a Vector not a list. List is (). -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
String-friendly first/rest?
To help myself learn Clojure, I figured I would write a pattern matching / destructing macro to better look like languages I'm more familiar with; i.e., destructuring by [first|second|rest] instead of [first second & rest]. To do this I'm turning the aforementioned vector into a string (via str) and looking for / replacing the | character. However, this led to the following issue... (def test "abc") (first test) > \a (rest test) > (\b \c) (string? (rest test)) > false It would be really helpful if first/rest returned strings (or a character in the case of first), not lists, when given string input. Is there a design reason for the current behaviour and, if so, are there equivalent built-in functions that do the right thing for strings? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: String-friendly first/rest?
2010/12/8 Surgo > To help myself learn Clojure, I figured I would write a pattern > matching / destructing macro to better look like languages I'm more > familiar with; i.e., destructuring by [first|second|rest] instead of > [first second & rest]. To do this I'm turning the aforementioned > vector into a string (via str) and looking for / replacing the | > character. However, this led to the following issue... > > (def test "abc") > (first test) > > \a > (rest test) > > (\b \c) > (string? (rest test)) > > false > > It would be really helpful if first/rest returned strings (or a > character in the case of first), not lists, when given string input. > Is there a design reason for the current behaviour and, if so, are > there equivalent built-in functions that do the right thing for > strings? > (first "abc") gives you a character. (rest anything) returns a seq, by definition. It's not about Strings, it's the contract of rest. A String is not a seq, but it's viewable as a seq, in which case each element of the seq will be a character of the String. Note that this is not particular to String, but to almost any clojure datastructure : (rest [1 2 3]) doesn't return a vector either, but a seq: (2 3) etc. You seem to want to not use seq abstractions, but String manipulation abstractions, 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 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Lots of newbie clojure questions
> > Not really. (...) is a non-atomic s-expression. If it's evaluated > > unquoted, the first nested s-expression is evaluated and if it's not > > callable an exception is thrown. Macros, special forms (which are sort > > of like system-internal macros and are used to build all the other > > macros, and functions), Java constructors, Java methods, and functions > > are callable (and maps and keywords -- also vectors -- act as > > functions for this purpose). > > So, to paraphrase: "all of those things act like functions, parens > just call functions, so parens aren't overloaded." ..Which is about > two steps away from a tautology. :) It's not a tautology, though your paraphrase isn't necessarily wrong for the quote given. As a previous poster mentioned, all of the code is represented as a data structure. In Lisp this is traditionally the humble list; I am not sure about Clojure's internals but I think it puts vectors and possibly even maps in there as well as the list. Once you start thinking about that and feeling okay with that and what it means in terms of evaluation (compilation), trouble with parenthesis typically vanishes soon after. What do I mean by evaluation? Start typing in the REPL. When you put in something, it gets evaluated. What gets evaluated must either be an immediate value (symbol, bound variable, or classic "primitive type" but that's a simplified can of worms nobody wants to open), or a list. Then how is a list evaluated? The list's head is evaluated (as a lambda expression or special form), and given the tail as its arguments. Then the arguments get evaluated in the same way...they're either immediate values, symbols, or lists themselves. And so on. (Note that this is all simplified, and there's a whole hidden discussion here about what it means to evaluate a list lazy or eager or adshfddskjfds...I don't really know how Clojure does it, this is just a discussion of Lisp in general for illustrative purposes). So, an open parenthesis is merely the start of the list. And, in terms of evaluation, we know exactly what that means. It's either a lambda expression or special form (and the two aren't mutually exclusive -- let is just another way of saying lambda, after all). -- Morgon -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: String-friendly first/rest?
> (rest anything) returns a seq, by definition. It's not about Strings, it's > the contract of rest. A String is not a seq, but it's viewable as a seq, in > which case each element of the seq will be a character of the String. > > Note that this is not particular to String, but to almost any clojure > datastructure : > > (rest [1 2 3]) doesn't return a vector either, but a seq: (2 3) > > etc. > > You seem to want to not use seq abstractions, but String manipulation > abstractions, here. That's a fair criticism. I suppose that I'm not necessarily looking for specifically String manipulation abstractions (I can just do a (.substr "abc" 1) to get "bc" as a String after all), but rather looking for an abstraction that takes something that's addressable as a sequence and returns it in the same format or type instead of a seq. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: String-friendly first/rest?
Laurent is right. Best to use substring: > (.substring test 1 (count test)) "bc" On Dec 8, 12:43 pm, Surgo wrote: > To help myself learn Clojure, I figured I would write a pattern > matching / destructing macro to better look like languages I'm more > familiar with; i.e., destructuring by [first|second|rest] instead of > [first second & rest]. To do this I'm turning the aforementioned > vector into a string (via str) and looking for / replacing the | > character. However, this led to the following issue... > > (def test "abc") > (first test)> \a > (rest test) > > (\b \c) > > (string? (rest test)) > > > false > > It would be really helpful if first/rest returned strings (or a > character in the case of first), not lists, when given string input. > Is there a design reason for the current behaviour and, if so, are > there equivalent built-in functions that do the right thing for > strings? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
"batch" could be fun in clojure
another take on rpc/queries/services: www.odbms.org/download/2010-09-Batches-ICOODB.pdf apparently very preliminary, i can't find the java implementation referred to in the slides. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: String-friendly first/rest?
> (.substring test 1 (count test)) "bc" FYI: Clojure has "subs" -> (subs test 1 (count test)) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: String-friendly first/rest?
Hi, Am 08.12.2010 um 23:05 schrieb Surgo: > That's a fair criticism. I suppose that I'm not necessarily looking > for specifically String manipulation abstractions (I can just do a > (.substr "abc" 1) to get "bc" as a String after all), but rather > looking for an abstraction that takes something that's addressable as > a sequence and returns it in the same format or type instead of a seq. Namespaces to the rescue: (ns your.name.space (:refer-clojure :exclude (first rest))) (defprotocol MySeq (first [this]) (rest [this])) (extend-protocol MySeq String (first [this] (.charAt this 0)) (rest [this] (subs this 1)) Object (first [this] (clojure.core/first this)) (rest [this] (clojure.core/rest this))) Now use first and rest as normal. Here some examples: your.name.space=> (first "abc") \a your.name.space=> (rest "abc") "bc" your.name.space=> (first [1 2 3]) 1 your.name.space=> (rest [1 2 3]) (2 3) Sincerely Meikel -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: String-friendly first/rest?
(subs test 1) will work as well; the default behavior is to go to the end if no end position is specified. On Dec 8, 3:16 pm, Miki wrote: > > (.substring test 1 (count test)) > > "bc" > > FYI: Clojure has "subs" -> (subs test 1 (count test)) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: String-friendly first/rest?
2010/12/8 Surgo > > (rest anything) returns a seq, by definition. It's not about Strings, > it's > > the contract of rest. A String is not a seq, but it's viewable as a seq, > in > > which case each element of the seq will be a character of the String. > > > > Note that this is not particular to String, but to almost any clojure > > datastructure : > > > > (rest [1 2 3]) doesn't return a vector either, but a seq: (2 3) > > > > etc. > > > > You seem to want to not use seq abstractions, but String manipulation > > abstractions, here. > > That's a fair criticism. I suppose that I'm not necessarily looking > for specifically String manipulation abstractions (I can just do a > (.substr "abc" 1) to get "bc" as a String after all), but rather > looking for an abstraction that takes something that's addressable as > a sequence and returns it in the same format or type instead of a seq. > > No such builtin that I'm aware of. There are some "functor" things in clojure contrib, but I don't know them well. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: String-friendly first/rest?
On Dec 8, 2010, at 4:05 PM, Surgo wrote: > That's a fair criticism. I suppose that I'm not necessarily looking > for specifically String manipulation abstractions (I can just do a > (.substr "abc" 1) to get "bc" as a String after all), but rather > looking for an abstraction that takes something that's addressable as > a sequence and returns it in the same format or type instead of a seq. So something like an inverse to (seq)? You could write such a thing, though it would have to know about each type (seq) knows about. More importantly, it would have to somehow know what type the thing originally was, since there's no difference between e.g. (seq "abc") and (seq [\a \b \c]). You'd either have to store the type when calling (seq) and manually pass it when calling the inverse function, or else I suppose you could write a wrapper for (seq) that adds metadata about what type the thing originally was. Incidentally, while testing this last idea, I was surprised to find that :type metadata is treated specially: => (with-meta '() {:type (type [])}) [] I assume this means :type is used internally by Clojure somehow. I notice clojure.org says that metadata "is used to convey information to the compiler about types", but ought there be a list of "reserved" metadata? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: String-friendly first/rest?
2010/12/8 Michael Gardner > On Dec 8, 2010, at 4:05 PM, Surgo wrote: > > > That's a fair criticism. I suppose that I'm not necessarily looking > > for specifically String manipulation abstractions (I can just do a > > (.substr "abc" 1) to get "bc" as a String after all), but rather > > looking for an abstraction that takes something that's addressable as > > a sequence and returns it in the same format or type instead of a seq. > > So something like an inverse to (seq)? You could write such a thing, though > it would have to know about each type (seq) knows about. More importantly, > it would have to somehow know what type the thing originally was, since > there's no difference between e.g. (seq "abc") and (seq [\a \b \c]). You'd > either have to store the type when calling (seq) and manually pass it when > calling the inverse function, or else I suppose you could write a wrapper > for (seq) that adds metadata about what type the thing originally was. > > Well, to the contrary, I think it would be a different abstraction from seq. seq abstraction is for providing a "view" over things which are seqable, but not necessarily data structures: can be streams, etc. And some datastructures know how to present a seq "view" of them without placing an importance on the sequential aspect of this (the ordering of the elements of the seq). So this "new" abstraction would concern less input than seq. Only the input for which ordering is an information (Strings, vectors, etc.). Meikel showed the way, though it's different enough in semantics to deserve its own protocol and not override (in fact replace, in his example) existing concepts. Now I don't (really, I don't) know if there's interest in providing this, at this level of genericity. > Incidentally, while testing this last idea, I was surprised to find that > :type metadata is treated specially: > > => (with-meta '() {:type (type [])}) > [] > > I assume this means :type is used internally by Clojure somehow. I notice > clojure.org says that metadata "is used to convey information to the > compiler about types", but ought there be a list of "reserved" metadata? > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: newb q about quote
On 12/8/2010 4:26 PM, Meikel Brandmeyer wrote: Hi, Am 08.12.2010 um 22:06 schrieb Tim Daly: There are 2 kinds of lisps based on the meaning of a symbol. Symbols have structure "slots". And then there is clojure where symbols are just symbols without any slots. When the compiler encounters a symbol it resolves it to a Var or let local or function argument, which holds the actual value. So while feeling like a Lisp with "value slot only"-symbols, Clojure works a little bit differently under the hood. Sincerely Meikel Which is why I did not reply using Clojure. It is the "little bit differently" that puzzles me. I still do not have a deep understanding of the evaluation model in all cases. Which means that I do not know how to "say" the difference between lisps in "Clojure semantics". Lispers have spent dozens of years in debate over the exact semantics of evaluation and many models have been developed. One of my primary struggles with the "Clojure is Lisp" idea is that, in Lisp, the models are quite clear to me as they have been written up in great detail. So far I have not seen the same with Clojure. My only hope in some cases is to read the source code, but even there I struggle because I don't have the models. And every time I get close the code "wanders off into Java". I'd love to see books for Clojure like "Anatomy of Lisp" http://www.amazon.com/Anatomy-Lisp-McGraw-Hill-computer-science/dp/007001115X or "Lisp In Small Pieces" http://www.amazon.com/Lisp-Small-Pieces-Christian-Queinnec/dp/0521562473 both of which are, in my opinion, required reading for the serious lisper. Rich is doing great work and I have learned a lot from his talks, especially about the immutable issue and identity issue. I am glad to see someone with fresh thinking on lisp ideas. I just wish the models were more clearly stated. I want to be able to look at clojure code and KNOW what byte-code sequence will result. At that point I can claim to know clojure. Unfortunately, I'm not there yet. Those coming from the Java/XML background might find this interesting: http://www.jquigley.com/files/talks/aol.pdf Tim Daly -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: newb q about quote
On Dec 8, 12:05 pm, Aaron Cohen wrote: > On Wed, Dec 8, 2010 at 2:40 PM, javajosh wrote: > > I was looking at quote. > > > user=> (quote 1) > > 1 > > user=> (quote) > > nil > > user=> (quote quote) > > quote > > user=> ((quote quote) 1) > > nil > > > It's the last result that confuses me. I would have expected the > > result to be "1" - e.g. the same as (quote 1). I figured I'd try quote > > on something other than itself, and it just got stranger: > > > user=> ((quote +) 1 2) > > 2 > > > I would have expected 3. > > 1) quote is a special form, so it's probably a bad symbol to be > experimenting with in this way, let's use "+" instead. > > 2) This is kind of funny, (quote +) returns a symbol, not a ref > holding the function. When you invoke it, you're actually calling the > invoke method of the Fn implentation of the Symbol class, whose > behavior is to look itself up in the first parameter (intended to be a > collection), similar to how keywords look themselves up. That almost kinda sort makes sense to me. I'm not sure whether to be pleased or scared. > Once you get a symbol, if you want to actually call it the way you > were originally, try "resolve" amongst probably other ways. > > user=> (resolve '+) > #'clojure.core/+ > > user=> ((resolve '+) 1 2) > 3 Cool! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: String-friendly first/rest?
Hi, Am 08.12.2010 um 23:53 schrieb Laurent PETIT: > Meikel showed the way, though it's different enough in semantics to deserve > its own protocol and not override (in fact replace, in his example) existing > concepts. Well, this showed up the second time in two days, so I thought I'd write it up in an email. However: I strongly discourage doing such things. I would scratch a project working internally like that from my dependency list. (luckily the effects of such a protocol are limited to opt-in namespaces) Listen to Laurent! He is an experienced clojurian. This is a different thing. Name it differently! Handle it differently! As the way Clojure works: Listen to Rich! He has probably thought more about this, than anyone else ever will. If something is not the way you expect it to be or something is missing, then there is almost surely a reason for this fact. If you still think, that something should be changed, lobby for the change on the mailing list. Sincerely Meikel -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: String-friendly first/rest?
On Wed, Dec 8, 2010 at 2:00 PM, Laurent PETIT wrote: >> (def test "abc") >> (first test) >> > \a >> (rest test) >> > (\b \c) >> (string? (rest test)) >> > false >> >> It would be really helpful if first/rest returned strings (or a >> character in the case of first), not lists, when given string input. >> Is there a design reason for the current behaviour and, if so, are >> there equivalent built-in functions that do the right thing for >> strings? > > (first "abc") gives you a character. > > (rest anything) returns a seq, by definition. It's not about Strings, it's > the contract of rest. A String is not a seq, but it's viewable as a seq, in > which case each element of the seq will be a character of the String. This behaviour would be a lot easier to deal with if into worked with strings. -Phil -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Unable to run Clojure (jline is missing)
Hi, I downloaded Clojure 1.2 https://github.com/downloads/clojure/clojure/clojure-1.2.0.zip and extract it. I created CLOJURE_HOME and added $CLOJURE_HOME/script to my $PATH Upon trying clj or repl , I got this error: Exception in thread "main" java.lang.NoClassDefFoundError: jline/ ConsoleRunner Caused by: java.lang.ClassNotFoundException: jline.ConsoleRunner at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) Any idea what is going wrong? I'm on OS X 10.6 Thanks for help and time. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Unable to run Clojure (jline is missing)
Did you download jline and put it in a location where it can been accessed with the classpath? http://jline.sourceforge.net/ On Dec 8, 6:47 pm, HB wrote: > Hi, > I downloaded Clojure > 1.2https://github.com/downloads/clojure/clojure/clojure-1.2.0.zip > and extract it. > I created CLOJURE_HOME and added $CLOJURE_HOME/script to my $PATH > Upon trying clj or repl , I got this error: > > Exception in thread "main" java.lang.NoClassDefFoundError: jline/ > ConsoleRunner > Caused by: java.lang.ClassNotFoundException: jline.ConsoleRunner > at java.net.URLClassLoader$1.run(URLClassLoader.java:202) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:190) > at java.lang.ClassLoader.loadClass(ClassLoader.java:307) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) > at java.lang.ClassLoader.loadClass(ClassLoader.java:248) > > Any idea what is going wrong? > I'm on OS X 10.6 > > Thanks for help and time. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Unable to run Clojure (jline is missing)
I expect Clojure maintainers to provide a working distro but anyway, I checked clj script under the script directory: #!/bin/sh CLASSPATH=src/clj:test:test-classes:classes/:script/ jline-0.9.94.jar:../clojure-contrib/target/clojure-contrib-1.2.0- SNAPSHOT.jar if [ -z "$1" ]; then exec java -server jline.ConsoleRunner clojure.main else SCRIPT=$(dirname $1) export CLASSPATH=$SCRIPT/*:$SCRIPT:$CLASSPATH exec java -Xmx3G -server clojure.main "$1" "$@" fi I copied the jline jar to script directory but I still get the same error. On Dec 9, 3:54 am, Tim Robinson wrote: > Did you download jline and put it in a location where it can been > accessed with the classpath? > > http://jline.sourceforge.net/ > > On Dec 8, 6:47 pm, HB wrote: > > > > > Hi, > > I downloaded Clojure > > 1.2https://github.com/downloads/clojure/clojure/clojure-1.2.0.zip > > and extract it. > > I created CLOJURE_HOME and added $CLOJURE_HOME/script to my $PATH > > Upon trying clj or repl , I got this error: > > > Exception in thread "main" java.lang.NoClassDefFoundError: jline/ > > ConsoleRunner > > Caused by: java.lang.ClassNotFoundException: jline.ConsoleRunner > > at java.net.URLClassLoader$1.run(URLClassLoader.java:202) > > at java.security.AccessController.doPrivileged(Native Method) > > at java.net.URLClassLoader.findClass(URLClassLoader.java:190) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:307) > > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:248) > > > Any idea what is going wrong? > > I'm on OS X 10.6 > > > Thanks for help and time. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Lisp history
For those who were not around when the Common Lisp standard was being debated you might find this interesting: http://lisp.geek.nz/weekly-repl/ Common Lisp Standardization: The good, the bad, and the ugly by Peter Seibel -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Unable to run Clojure (jline is missing)
HB writes: > I checked clj script under the script directory: > > #!/bin/sh > > CLASSPATH=src/clj:test:test-classes:classes/:script/ > jline-0.9.94.jar:../clojure-contrib/target/clojure-contrib-1.2.0- > SNAPSHOT.jar > > if [ -z "$1" ]; then >exec java -server jline.ConsoleRunner clojure.main > else >SCRIPT=$(dirname $1) >export CLASSPATH=$SCRIPT/*:$SCRIPT:$CLASSPATH >exec java -Xmx3G -server clojure.main "$1" "$@" > fi That script looks simply broken. In the case where no arguments are supplied the classpath is not set at all (it'd need an "export CLASSPATH"). For those not used to the JVM, the CLASSPATH is where Java (and Clojure) search for classes and clj files. On unix it's a colon-separated list of directories and jar files. I suggest you completely ignore that script subdirectory, it looks to me like it contains personal debugging and benchmark scripts that have been included in the distribution by accident. To run a Clojure REPL, just type this: java -jar clojure.jar You can see more options: java -jar clojure.jar -h Most Clojure developers that I know normally use a build tool and/or IDE rather than working directly from the distribution though. Personally I use Leiningen: http://github.com/technomancy/leiningen http://github.com/technomancy/leiningen/blob/master/TUTORIAL.md If you come from a Java background you might be more used to a particular IDE or Maven. There's a nice list here: http://www.assembla.com/wiki/show/clojure/Getting_Started -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Unable to run Clojure (jline is missing)
I think it is unacceptable to provide broken, unpolished and not working scripts. I'm definitely respect the maintainers, I'm just annoyed because I spent a couple of hours trying to make it works. Thanks Alex, I owe you a huge mug of beer :) On Dec 9, 6:39 am, Alex Osborne wrote: > HB writes: > > I checked clj script under the script directory: > > > #!/bin/sh > > > CLASSPATH=src/clj:test:test-classes:classes/:script/ > > jline-0.9.94.jar:../clojure-contrib/target/clojure-contrib-1.2.0- > > SNAPSHOT.jar > > > if [ -z "$1" ]; then > > exec java -server jline.ConsoleRunner clojure.main > > else > > SCRIPT=$(dirname $1) > > export CLASSPATH=$SCRIPT/*:$SCRIPT:$CLASSPATH > > exec java -Xmx3G -server clojure.main "$1" "$@" > > fi > > That script looks simply broken. In the case where no arguments are > supplied the classpath is not set at all (it'd need an "export > CLASSPATH"). > > For those not used to the JVM, the CLASSPATH is where Java (and Clojure) > search for classes and clj files. On unix it's a colon-separated list > of directories and jar files. > > I suggest you completely ignore that script subdirectory, it looks to me > like it contains personal debugging and benchmark scripts that have been > included in the distribution by accident. > > To run a Clojure REPL, just type this: > > java -jar clojure.jar > > You can see more options: > > java -jar clojure.jar -h > > Most Clojure developers that I know normally use a build tool and/or IDE > rather than working directly from the distribution though. > > Personally I use Leiningen: > > http://github.com/technomancy/leiningenhttp://github.com/technomancy/leiningen/blob/master/TUTORIAL.md > > If you come from a Java background you might be more used to a > particular IDE or Maven. There's a nice list here: > > http://www.assembla.com/wiki/show/clojure/Getting_Started -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en