Re: Why isn't there a fold-right?
Hello. 2012/6/11 Yoshinori Kohyama : > If clojure's implementation of reverse don't consume stack, how does it do? `reduce1` is a recursive function using `recur`, explicit tail recursion with optimization. So it doesn't. > The source of 'reverse' says it uses 'reduce1' and commented "Not lazy". Yes. `reverse` must be strict, because all elements must be realized (the value is computed) when you reverse a sequence. > The source of 'reduce1' says it uses 'chunk-seq?', '.reduce', 'chunk-first' > and 'chunk-next'. > What are these? See clojure.lang.{IChunk,IChunkedSeq}. > And is there any lazy solution? Probably no. Both `fold-right` and `reverse` must be strict IMHO. -- OGINO Masanori http://twitter.com/omasanori -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: [PATCH] RFC: Add Functions `tabify` And `untabify`
Hello. > Please don't misinterpret my comments as saying you're wasting time. > By all means, keep working on this. `tabify` and functions like it > could be useful to others, I just don't know yet. I see. > If you can demonstrate an improvement to clojure.repl by adding these > functions, then I think that's enough justification to add them -- > maybe first as private fns in clojure.repl. Later on, if they seem > generally useful, we can incorporate them into clojure.string. Yes, I'll post a patch for clojure.repl when I finish. Many thanks to all suggestions and questions! -- OGINO Masanori http://twitter.com/omasanori -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: [PATCH] RFC: Add Functions `tabify` And `untabify`
Hello. Thank you for sparing your time for my proposal. There are many negative votes for the proposal and the main doubt is "do you need to make them in closure.string?" My opinion is, "perhaps I don't but I'm unsure until reading your replies". At first I wrote some codes to improve clojure.repl/doc (two weeks ago I wrote "I'll post" but I haven't yet), but expanding tabs seems a normal string transformation. I'm unsure which is better; a) writing an internal function or b) adding to a library for string handling and using it from clojure.repl. That is why I wrote a pair of functions in clojure.string and send a proposal. However, Stuart Sierra told me that they are "fairly specialized function"s and almost all people in this thread agreed with him, so I think adding them should not be done. I'm sorry. Probably it's a waste of time for you... -- OGINO Masanori http://twitter.com/omasanori -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: [PATCH] RFC: Add Functions `tabify` And `untabify`
What I mean in "they are not used anytime" is "they are _not always_ used."... I'm sorry. -- OGINO Masanori http://twitter.com/omasanori -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
[PATCH] RFC: Add Functions `tabify` And `untabify`
Hello. I wrote functions for converting tabs from/to spaces. They are not used anytime, so they may be irrelevant to include core. Anyway I'd like to show them and hear your opinions. I want to use untabify in clojure.repl for formatting docstrings correctly (I'll post about that later), so it's not very important to include them in clojure.string (by adding it as private function in clojure.repl or defining it by letfn). It's my first contribution (I hope), so I'm anxious to make a ticket in JIRA immediately. Any suggestions would be appreciated. Regards, OGINO Masanori Signed-off-by: OGINO Masanori --- src/clj/clojure/string.clj | 28 test/clojure/test_clojure/string.clj | 19 +++ 2 files changed, 47 insertions(+) diff --git a/src/clj/clojure/string.clj b/src/clj/clojure/string.clj index 188b518..8f5ca0a 100644 --- a/src/clj/clojure/string.clj +++ b/src/clj/clojure/string.clj @@ -166,6 +166,34 @@ Design notes for clojure.string: [^CharSequence s] (.. s toString toLowerCase)) +(defn ^String tabify + "Converts all n spaces (\\space, U+0020) at the beginning of lines + to a tab (\\t, U+0009). By default, 8 spaces are used." + {:added "1.5"} + ([^CharSequence s] + (tabify s 8)) + ([^CharSequence s n] + (join + (map (fn [[_ indent body eol]] + (str (replace (str indent) +(join (repeat n \space)) "\t") + body eol)) +(re-seq #"(?m)^([ \t]+)?([^\n]*)(\n)?" s) + +(defn ^String untabify + "Converts all tabs (\\t, U+0009) at the beginning of lines to n + spaces (\\space, U+0020). By default, 8 spaces are used." + {:added "1.5"} + ([^CharSequence s] + (untabify s 8)) + ([^CharSequence s n] + (join + (map (fn [[_ indent body eol]] + (str (replace (str indent) +"\t" (join (repeat n \space))) + body eol)) +(re-seq #"(?m)^([ \t]+)?([^\n]*)(\n)?" s) + (defn split "Splits string on a regular expression. Optional argument limit is the maximum number of splits. Not lazy. Returns vector of the splits." diff --git a/test/clojure/test_clojure/string.clj b/test/clojure/test_clojure/string.clj index d6f6469..3bdde54 100644 --- a/test/clojure/test_clojure/string.clj +++ b/test/clojure/test_clojure/string.clj @@ -118,3 +118,22 @@ (is (vector? result))) (is (= (list "foo") (s/split-lines "foo" +(deftest t-tabify + (is (= "a" (s/tabify "a"))) + (is (= " " (s/tabify " "))) + (is (= "\t" (s/tabify ""))) + (is (= "\t " (s/tabify " "))) + (is (= "\ta" (s/tabify "a"))) + (is (= "\t\n\t" (s/tabify "\n"))) + (is (= "\t\n\t\n" (s/tabify "\n\n"))) + (is (= "\t" (s/tabify " " 2 + +(deftest t-untabify + (is (= "a" (s/untabify "a"))) + (is (= " " (s/untabify " "))) + (is (= "" (s/untabify "\t"))) + (is (= " " (s/untabify " \t"))) + (is (= "a\t" (s/untabify "\ta\t"))) + (is (= "\n" (s/untabify "\t\n\t"))) + (is (= "\n\n" (s/untabify "\t\n\t\n"))) + (is (= " " (s/untabify "\t" 2 -- 1.7.9.5 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Migration to 1.3 for mortals
I partly agree with Jan at: > Problem is, none of those pages help with my problem However, > there are bugs in 1.2 contrib which only get fixed in the 1.3 > version, which I won't be able to use. AFAIK new contrib is not only for 1.3 (for now). In http://dev.clojure.org/display/doc/Clojure+Contrib : > compatible with Clojure 1.2 and Clojure 1.3 So you can use new one when your version is 1.2 or later. > I think issues like that are fundamentally important if Clojure is to > be adopted for production work. +1 -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: How to view the doc of a ns in 1.3-beta3?
Hello. I posted same problem in July, but at that time that is not fixed. http://groups.google.com/group/clojure/browse_thread/thread/c3ef89e6019732d/d363823049808c2c Shall we run back over that? -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: JSON library for clojure 1.3
> FWIW, many functions from c.c.string were migrated to the core clojure.string > namespace starting in Clojure v1.2.0 Indeed but others aren't there yet. Will the rest be migrated in clojure.string until 1.3 release date? If not, probably we need modular c.c.string for performance-sensitive codes, or less (apply str ...string manipulation...) without getting rid of seq abstraction. Thanks. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: JSON library for clojure 1.3
> Similar question: where is clojure.contrib.string for 1.3? +1 http://dev.clojure.org/display/design/Contrib+Library+Names c.c.string is not included in this list. Is there any plans to go to modular contrib (string.incubator, tools.string, etc.)? -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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.contrib.command-line
> no reason other than its a small lib with a handful of functions... I see. Thanks. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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.contrib.command-line
Well, README and tests are very good. I withdrew into REPL and overlooked them stupidly. I'm very sorry. BTW some functions seems not to be public API though they are public. Why they are not separated by defn- or specific namespace like clojure.tools.cli.internals? -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: Java 7 is out!
>From http://www.oracle.com/technetwork/java/hotspotfaq-138619.html : --- I would like java to default to -server. I have a lot of scripts which I cannot change (or do not want to change). Is there any way to do this? Since Java SE 5.0, with the exception of 32-bit Windows, the server VM will automatically be selected on server-class machines. The definition of a server-class machine may change from release to release, so please check the appropriate ergonomics document for the definition for your release. For 5.0, it's Ergonomics in the 5.0 Java[tm] Virtual Machine. Are both -client and -server VM modes available in 64-bitJava? Currently only the Java HotSpot Server VM supports 64-bit operation, and the -server option is implicit with the use of -d64. This is subject to change in a future release. --- So 32-bit Windows JRE matters, right? -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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.contrib.command-line
(defn -main [& args] (with-command-line args "Get csv file name" [[in-file-name ".csv input file name" "resultset.csv" ]] (println "in-file-name:", in-file-name))) The second vector of vector seems unnecessary. Or tools.cli way: (ns foo.main (:gen-class) (:use [clojure.tools.cli :only (cli optional)])) (defn parse-opts [args] (cli args (optional ["--in-file-name" ".csv input file" :default "resultset.csv"] identity))) (defn -main [& args] (let [opts (parse-opts args)] (println "in-file-name:" (:in-file-name opts It might be verbose but I think it is more descriptive than with-command-line one. However, I'd like more documents and examples about tools.cli. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: Java 7 is out!
AFAIK using InvokeDynamic *requires* Java7, so I think it will be done if Java7 gets default and it fits for Clojure. However, for example, new HotSpot gains more performance then Clojure may also gain if you use Java7... (but you can't force everyone to use Java7 of course.) Also, you can call new libraries even if they are not used Clojure itself. (You may tell users your code works with Java7) -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: passing value to functions
Laurent's way and Alan's way have different surfaces, but same mean. (-> word fix-ou fix-ize) (fix-ize (fix-ou word)) You can check it using clojure.walk/macroexpand-all. user=> (macroexpand-all '(-> "labour" fix-ou fix-ize)) (fix-ize (fix-ou "labour")) Indeed you can choose only one way, I suggest considering two ways. Sometimes using -> is easy to read, and sometimes it is hard to do. (Readability is the matter in this case, right?) -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: protocols and records -- use when?
Many thanks, abp and Alex. Additionally I think this post (and original discussion here) is also worth reading: http://kotka.de/blog/2011/07/Separation_of_concerns.html though the conclusion is not the community consensus (for now). -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: passing value to functions
http://clojure.org/state may help you to know Clojure's "value". ; AFAIK Java's string is also immutable...isn't it? -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: Code structure/design problems
I agree with Oskar. We can separate codes into state managers and others and move something to the latter if we find its state is unnecessary. After all, it is good enough--it might be not best, but good enough--if it seems that state managers are small enough, IMO. Of course, if there is no state without great difficulty, it is also OK. (comment However, probably I need to spend a bit of time diving into methods unfamiliar to me: purely FP, logic programming, constraint programming, etc. I guess some problems may have been solved with them simply. ) -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: The Number of Clojure (Was: Alright, fess up, who's unhappy with clojurescript?)
And I should have posted about the spec separately, right? ;; or all I have to do is to forbid myself to post anything... -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: problem with take-while
"filter will hung up with infinite sequences." is incorrect. Sorry. filter may hung if you request something impossible. For (silly) example, (second (filter even? (range))) returns 2. However (second (filter zero? (range))) goes in search of the second zero in natural numbers... -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: problem with take-while
Because take-while takes while (= (mod 20 %) 0) and (= (mod 20 3) 0) returns false. Use filter, but be careful filter will hung up with infinite sequences. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: The Number of Clojure (Was: Alright, fess up, who's unhappy with clojurescript?)
Oops, I wrote a footnote not to forget giving a supplement but I forgot it. The number two was the number of Rich's Clojure implementations AFAIK. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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
The Number of Clojure (Was: Alright, fess up, who's unhappy with clojurescript?)
I have no opinion to add to mainline of this thread, but I could answer one question. Before the NYC meetup, there are two [1] "Clojure": Clojure on JVM and Clojure on CLI/CLR. Is Clojure on JVM "the true Clojure" and that on CLI/CLR is an poor imitation? (in Ruby: Is MRI the true Ruby and JRuby, Rubinius, MacRuby, ...(snip)) Now we have three "Clojure". I think we can categorize programming languages into three groups by the number of implementations. 1. Zero; the language is in the design stage. 2. One; here you are, this is *the* implementation! 3. Many; well, which implementation I should use? where is the spec? Clojure *was* 3. before the meetup and *is* 3. now, right? If so, the problem was there and is still there. It doesn't change. So...may I ask where is the spec? :-P 2011/7/25, cassiel : > Clojure newcomer here, but here's the thought that's frontmost in my > mind about ClojureScript... > > I'm used to Clojure as a language that's solidly spot-welded to the > JVM and the Java libraries. Just as "[1 2 3]" is legal portable > Clojure code, so is "(.start (Thread. #(...)))" despite it being a > blatant set of calls into Java, and so are the various Java-leaning > reflection features. > > I think ClojureScript is a great piece of work, but I'm not sure what > this means for language standardisation or portability. Is it still > "real" Clojure? Clearly I can write programs, or distribute libraries, > which run on one but not the other. Similarly, I'm sure there are > common chunks of functionality (although I'm not enough of a JS > programmer to suggest any) which are pretty crucial to some programs > written in either Clojure but implemented differently. ClojureScript > is still missing key parts of Clojure (e.g. agents) making even non- > Java-ish programs non(-yet)-portable. > > I guess I'm interested in the road map, if any: are things heading > towards some kind of common "ClojureCore" specification with > ClojureJava and ClojureScript both supersets of this? What are the > ramifications for library distribution? Or are "Clojure Classic" and > ClojureScript different systems for different environments? In which > case, what mileage is there in identifying and specifying the > overlapping and identical areas and transparently developing for both? > > Sorry if the questions are stupid... I'm looking forward to having a > good solid session with ClojureScript in a browser near me soon. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: :require farms in Clojure?
Hello. Is (:require ...) better than (:use [... :only (...)])? Though I've never worked on "large Clojure program", sometimes I want to know something like "namespaces using the function foo". When I move functions to better place, when I add a new arity and search somewhere suitable with new one, when I mark something "duplicated", ... With :require, I grep "awesome/foo", but there may be "a/foo", or, if there required two a*, "aw/foo". I also can grep :require clause, but :require clause don't tell me whether foo is used or not. With :use+:only, I grep a pattern like "awesome :only \(.*\s?foo\s?.*\)" (actually I may consider multi-lines). Of course there may be (:use [another.awesome :only (foo)]), but I read around the matched line and then I know the answer. Moreover, when I open other's code, on top of screen :require tells me "something in awesome is used. In order to know what is used, read below." In contrast, :use+:only tells me "foo in awesome is used." Any thoughts? Thanks. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: Namespace Docstrings?
I search on JIRA, but as far as I know there is no issue discussed in this thread. Is it an issue that (resolve 'clojure.core) throws an exception? Thanks. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: Error running Clojure 1.3 in Eclipse
Hello. > Warning: *print-detail-on-error* not declared dynamic and thus is not > dynamically rebindable, but its name suggests otherwise. Please either > indicate ^:dynamic *print-detail-on-error* or change the name. Since 1.3, the default behavior of vars is non-dynamic/un-rebindable. So, when you (or its developers if it comes from libraries) define a dynamic var, you have to write: (def ^{:dynamic true} *print-detail-on-error* ) [1.2-compatible form] (def ^:dynamic *print-detail-on-error* ) [simplified form for 1.3 and latter] "... change the name" means that the name *foo* suggests it's dynamic by convention, so if you added stars for emphasis, you should remove them. Thanks. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: Namespace Docstrings?
Hello. Thank you for giving your opinion, Rasmus. Indeed, (doc doc) says, "I am for a var or special form." However, according to (source doc), there is some code for namespace, and this code won't be used since (ns-resolve) breaks its promise. Moreover, with 1.2.1, (doc) uses (print-namespace-doc) internally! And... I hesitate to say but... (print-namespace-doc) seems to be removed in 1.3. So I think we also should update docstring of (doc), right? Thanks. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: Namespace Docstrings?
Well, with my solution, namespace's docstring is shown when the same name exists both in vars and namespaces. So it seems better to remain (doc) and wrap the body of (ns-resolve) by (try ... (catch Exception e nil)) because (ns-resolve) docstring says "else nil", though it actually throws an exception! Thanks. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: Namespace Docstrings?
Hello. MHOOO, thank you. Sorry, for long time I haven't used 1.2, so I forgot checking 1.2.1! Yes, I use 1.3b1. Sorry for my unkindness. Since I haven't sent a CA yet, maybe it's not time to send a patch. However, IMO it's not an issue of (resolve), because (resolve) throws even if 1.2.1 and (resolve) can resolve classes. (resolve 'String) So all we should do is put (find-ns) pair before (resolve) pair, I think. Could any developer review? Or already fixed in master? Thanks. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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
Namespace Docstrings?
Hello. What is the right way to display namespace docstrings? One day, as usual, I typed: (doc 'clojure.core) ; or other namespace Then the REPL said "clojure.lang.Cons cannot be cast to clojure.lang.Symbol." I thought "Ah, I know, the message means "(quote clojure.core) cannot be cast to the symbol clojure.core." I'm wrong." and typed: (doc clojure.core) Then the REPL said "ClassNotFoundException clojure.core." I thought "Indeed, clojure.core seems to be an class name... Precisely, can (doc) display namespace docstrings?" and typed: (source doc) Oh, (doc) uses (find-ns), so (doc) should display namespace docstrings. But how? Finally I wrote (:doc (meta (the-ns 'clojure.core))) but I know this is a wrong way. When I forget this ad-hoc solution, I'll repeat above. I determined to ask it because I have repeated again just now and I'm annoyed. Any thought? Thanks. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: rand-nth throwing an exception
Hello. (nth [] 0) also throws an exception, so it is not so surprising. As Andreas shows, rand-nth has no not-found, (rand-int 0) always returns 0, and (nth [] 0) throws it. (rand-int n) returns a integer between 0 (inclusive) and n (exclusive), but (m in N && 0 <= m < 0) doesn't exists. rand-nth throws it only if (= (count coll) 0), so not-found is if-coll-is-empty, but is it valid to choose anything from empty? Where is true error? Thanks. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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.contrib.math's Docstring Seems Broken
Thank you, Mark. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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
clojure.contrib.math's Docstring Seems Broken
Hello. I found that the namespace docstring of clojure.contrib.math (in <= 1.2 place. What it will be named in modular contrib?) seems broken because quotation marks around the word "remainder" are not escaped. Incidentally, comments before ns macro may be able to be simplified: most of them are repetitions of docstring. However, similar thing is also in other libraries. Is there any reasonable logic? Thanks. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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
Proposal: Ensure that c.c.lazy-xml/emit outputs XML
Hello. In clojure-contrib 1.2, lazy-xml/emit outputs XML in most cases. However, if it gets HTML or similar format data, the output format is switched to HTML. That makes some differences at least on OpenJDK6. 1. In XML mode, output doesn't contain any extra \n if :indent is skipped. In HTML mode, it contains. 2. In HTML mode, the XML declaration is skipped. 3. In HTML mode, extra is inserted automatically. I think that really harmful thing is only 3. because the output is always invalid XML with unnecessary data, but all of them surprise me, anyway. Is this an intended behavior? If not, inserting (.setOutputProperty trans "method" "xml") around 144-156 may fix it. I'm sorry if it is already fixed on the repository. Thank you. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: 1.3 (inc alpha4)?
Hello. I understand what it means. Thank you. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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
1.3 (inc alpha4)?
Hello. According to mailing list archives, alpha 3 is released in November 2010. Also, alpha 4 is done in December 2010. Can I ask where web pages describing the status of alpha 4+1 (alpha 5, beta 1 or RC 1?) works exist? I saw JIRA Release.Next, but I don't know whether "Next" means 1.2.1 or next milestone of 1.3. Thank you. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: better error messages > smaller stack traces
Hello. There is an interesting model about error reporting: Clang, one of C-family languages compiler which uses LLVM. For example, if you mistake names, Clang searches similar names which really exist in current environment. And then Clang illustrates line, column and actual code. If you want to get more informations, see [1]. Of course, they needs more works and error reporting may slow down. Also, Clojure has non-preprocessor macro and JVM exception handling, so we can't reproduce Clang truly. However, we can learn some from Clang, I think. Thank you. [1] http://blog.llvm.org/2010/04/amazing-feats-of-clang-error-recovery.html -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: Struct vs. Record: Now and Future
Hello. Sorry for miss-operation resulting in meaningless post. > Extending your record to IFn is easy, just add the invoke method. Oh, it's really easy. It seems ugly for someone using them like function frequently, but cool for someone using them like function rarely. I also read Ken's code, and I feel it powerful. (and complex, a little) Then, I realize that "code as data" is great :-) Thank you. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: Struct vs. Record: Now and Future
Hello. Well, record lacks some features in struct for now, I see. And "defstructs implement IFn" means that we can use struct in the places need callbacks but record can't, right? Thank you. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: Struct vs. Record: Now and Future
2011/1/27, Lee Spector : > > There was a recent thread on this. Some of the issues that were raised (and > for which workarounds were presented) were slot defaults, keyword args to > struct-map, and the fact that defstructs implement IFn. I had also found it > more elegant to write a macro or two to expand into struct-related code than > into record-related code. I do think that decent workarounds were presented > for all of the issues that were raised, but they were workarounds and the > built-in features of records don't yet include the struct features that were > raised. > > -Lee > > > On Jan 27, 2011, at 9:18 AM, Meikel Brandmeyer wrote: > >> Hi, >> >> On 27 Jan., 14:47, Nick Zbinden wrote: >> >>> Structs are nicer to work with. We should get all the nice stuff you >>> can do with structs to records then we can mark structs as dublicated. >> >> What in particular do you find lacking with records? >> >> 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 > > -- > Lee Spector, Professor of Computer Science > Cognitive Science, Hampshire College > 893 West Street, Amherst, MA 01002-3359 > lspec...@hampshire.edu, http://hampshire.edu/lspector/ > Phone: 413-559-5352, Fax: 413-559-5438 > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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
Struct vs. Record: Now and Future
Hello. I have two questions: 1. Is there any reason why we should use struct rather than record in new code without support for old Clojure? 2. If there is nothing, will struct be marked as duplicated someday? Thank you. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: Why no def- ?
Hello. If def- remains for historical reason, def- may be marked as duplicated and will be moved, for example, in 1.4, 2.0 or so? Thank you. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: Why no def- ?
Hello. > And if you really want to be consistent you would probably > also want defmulti-, defmacro-, defstruct-, defprotocol-, etc. In my opinion, if defn- is not in core but in contrib, I feel "be consistent". By the way, defstruct- and defmacro- is in contrib consistently :-) > If we really wanted to make it easy to write private functions, > variables, etc, I would personally prefer a macro like (private) for > which all forms inside would be made private. Like > (private > (def my-private-foo (...)) > (defn my-private-bar [] (...))) I like this macro and I'm ashamed that I've never hit on such idea! Thank you. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: api doc for clojure/libraries
Hello. If you have REPL, you can get any documentation via "doc" and "find-doc" functions. (doc reduce) ; print the documentation of reduce (find-doc "append") ; search documentations including word "append" "doc" function can be used with almost all things documented: variable, function, namespace, etc. However, of course, you can't get what you want if you type (doc java.math.BigDecimal) clojure.contrib.javadoc/javadoc or clojure.java.javadoc/javadoc (version specific) does well. API documentation web pages may be generated automatically, but I don't know how to do. (could anyone teach me?) Thank you. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: Why no def- ?
Hello. Sorry to cut in, but I agree with Ken, too. If defn- should be in core and def- shouldn't, it seems asymmetric. Showing why there is asymmetric design may leads to positive discussion, I think. Thank you. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: Maven vs Ivy (or Leiningen)
Hello. Thank you for responses, faenvie, Meikel and Stuart. Yes, of course, we can use each favorite management software for own Clojure project. (if teammates agree with :)) I asked if non-Maven stuffs can be used for Clojure itself officially or not. And then, as Stuart says, Maven may be good with this situation and which is not so surprising. clojuresque sounds good, so I'll see it. Although they abuses XML, I often use Ant + Ivy and I have never hate Maven. Also I like Leiningen but sometimes I'm confused with it because of my ignorance. On other languages, I use CMake, Rake, Autotools, MSBuild, etc. I've never see the ultimate solution, but I write code and I want to build it, so I (and you?) use them. Anyway, I know that Clojure will use Maven surely. Thank you. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: Maven vs Ivy (or Leiningen)
Hello. Thank you for responses, faenvie, Meikel and Stuart. Yes, of course, we can use each favorite management software for own Clojure project. (if teammates agree with :)) I asked if non-Maven stuffs can be used for Clojure itself officially or not. And then, as Stuart says, Maven may be good with this situation and which is not so surprising. clojuresque sounds good, so I'll see it. Although Ant -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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
Maven vs Ivy (or Leiningen)
Hello. Clojure will use both Ant and Maven 2. (Maven 3 may be used in the future?) However, if we see management software world widely, there is Ivy. Could I ask you whether Ivy is well enough or not? ; Yes, there is another notable thing, Leiningen written in Clojure. ; It sounds interesting that "Clojure uses Clojure itself in build process" but I can't consider if possible or not. Here are some useful pages: http://dev.clojure.org/display/design/Common+Contrib+Build http://dev.clojure.org/pages/viewpage.action?pageId=950842 http://ant.apache.org/ivy/m2comparison.html Thank you. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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: How to Build "Slim" Version of clojure-contrib
Hello. Thank you for response, Stuart Sierra. I'm looking forward to complete new build configuration work and I'll use little build script for a while :-) Thank you. 2010/12/30, Stuart Sierra : > Currently, clojure-contrib's pom.xml is configured to build source-only JARs > for all libraries except those four that require ahead-of-time compilation. > > We are in the process of developing a unified build configuration for > clojure-contrib projects, including new libraries such as core.unify and > tools.nrepl. See http://dev.clojure.org/display/design/Common+Contrib+Build > for details. I will see if we can make "slim" JARs an available target in > this new configuration. > > In the mean time, you can manually construct a "slim" JAR by calling > `compile` at the REPL and packaging up the resultant .class files yourself. > > -Stuart Sierra > clojure.com > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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
How to Build "Slim" Version of clojure-contrib
Hello. I want to build the "slim" version of clojure-contrib which includes only .class files if they can be compiled ahead on time. "mvn package" makes the full version and .clj files won't be compiled unless they use gen-class, isn't it? I know that the slim version is less functional, for example, it isn't good with clojure.contrib.repl-utils/source. However, in return, it may reduce footprint. Can I get the slim version with the standard build system? If not at the moment, will clojure-contrib have the way to build the slim version someday? Thank you. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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.contrib.[duck-streams io]
Thank you. I try to use use function and it works, too. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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
clojure.contrib.[duck-streams io]
Hello. I built master branch of clojure and clojure-contrib and then I found that there is no duck-streams. io exists. Can I write a code on both 1.1 and master using duck-streams/io? FYI, I want something like this Python code in Clojure: try: from clojure.contrib.io import reader, writer except ImportError: from clojure.contrib.duck-streams import reader, writer Thanks. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@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