What is the idiomatic way to compare data structures with BigDecimal instances
;; BigDecimal comparisons do not appear to work as I ;; would have expected them to: (= 2e+3M 2000M) ;; -> false ;; Looking at the definition of '=', I can see that ;; it defers to clojure.lang.Util/equiv, which ;; compares them as Object, by reference. Fine. ;; I thought I could use equals, but that one is incorrect too: (.equals 2e+3M 2000M) ;; -> false ;; because the "scale" of these two objects is ;; different, and BigDecimal requires the scale to be ;; the same: (map #(.scale %) [2e+3M 2000M]) ;; -> (-3 0) ;; Fine then; I'll use compare: (= 0 (compare 2e+3M 2000M)) ;; -> true ;; This still leaves me with a problem: what I really ;; want to do is compare data structures which ;; contain instances of BigDecimal: (= {:USD 2e+3M} {:USD 2000M}) ;; -> false, for the same reasons as above (compare {:USD 2e+3M} {:USD 2000M}) ;; PersistentArrayMap is not Comparable ;; What is the idiomatic way to do this, in general? ;; Should I just give up and define a comparison ;; method that will work ONLY for the data structures ;; I'm expecting to see? (e.g. "maps with values that ;; are all Comparable") -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Emulating inheritance on protocols in ClojureScript.
Hi, I want to set a default behavior on a protocol. The following article describes how to implement inheritance in Clojure by using `extend`, but `extend` doesn't exist in ClojureScript. Is there a way to set a default behavior on a protocol in ClojureScript? (david-mcneil.com :blog), Implementation "inheritance" in Clojure http://david-mcneil.com/post/1475458103/implementation-inheritance-in-clojure Thanks. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: is there some way to extract the parameter list from a function
Something like (:arglists (meta #'my-func)) ? Regards, BG On Sat, Jan 14, 2012 at 12:01 PM, Andrew Xue wrote: > given something like > > (defn my-func [a b c] (str a b c)) > > is there something like (extract-parameters my-func) which returns (a > b c)? > > thanks, > andy > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
is there some way to extract the parameter list from a function
given something like (defn my-func [a b c] (str a b c)) is there something like (extract-parameters my-func) which returns (a b c)? thanks, andy -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: 4Clojure exersice question
I responded to this earlier, but I accidentally hit the 'reply to author' button instead of 'reply to post', and thus it went directly to Cedric rather than to the group. I'll respond here and quote the previous emails: On Fri, Jan 13, 2012 at 8:57 PM, Anthony Grimes wrote: > 4Clojure uses clojail for sandboxing behind the scenes. I didn't realize > that you may not be aware of that. On Friday, January 13, 2012 at 8:12 PM, Cedric Greevey wrote: > Indeed I wasn't, and I doubt much of the rest of its user base is either. On top of that, the *reason* for this is that it's an implementation detail. Implementation details do not excuse incorrect user-visible > behavior in an application. Figuring out how to make the application > do what it should, from the user's perspective, and how best to > implement it to do so is part of the developer's responsibility. Sandboxing is hard. Sacrifices have to be made. This is *not* just an implementation detail. Users are running their code inside of a sandbox. This can't be really be hidden. That said, you are absolutely correct. It is the developer's responsibility to make sure that all of this is as clean and easy as possible. I think Jack's suggestion below is a nice middleground. As a matter of fact, given a small patch to add a little pre-processing step to clojail (optional, of course), clojail could even throw a nice error message when a user tries to use 'for'. How does something like that sound to you? Would that be an okay compromise? There isn't much more that can be done beyond actually providing reasonable error messages for these failures. There are limitations to what can be done. On Friday, January 13, 2012 6:44:11 PM UTC-6, Cedric Greevey wrote: > > On Fri, Jan 13, 2012 at 6:47 PM, Anthony Grimes > wrote: > > Clojail errs on the side of safety and not on the side of "Oh, well > maybe he > > wasn't trying to break the sandbox. Let's allow it anyway.". Treating > macros > > as opaque is just another hole in what is already difficult sandboxing. > > Macros are not even remotely close to functions. They *create* code. That > > code, just like any other explicitly written in your application, needs > to > > be sandboxed. It is much easier and safer to sandbox dangerous functions. > > The fact that expanded macro code that uses those functions is also > affected > > is less of a bug and more of a feature. > > You seem to be confused. We were discussing 4Clojure's rules, where > the stakes are at worst letting a person "cheat" slightly, not a > server security system or something, where the stakes would be > allowing hacking of some sort. Your concern is immensely out of > proportion to the consequences of someone cheating at 4Clojure's > learning game. > > > That said, of course it is unfortunate that things like this occur in > > 4Clojure for things as simple as for. But clojail and 4clojure are > separate > > projects. clojail is focused on being as safe as possible, which may > > sometimes clash with what would be most convenient in 4Clojure. > > Unclear here is what the two have to do with one another. There's no > obvious relevance of clojail's requirements for 4Clojure. Indeed, as > you seem to have realized, the requirements are distinct and sometimes > would conflict. > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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.data diff question
On Fri, 2012-01-13 at 09:03 -0800, vitalyper wrote: > Clojure> (diff ["a" "b" "c"] ["c" "d"]) > [["a" "b" "c"] ["c" "d"] nil] > > Looks like the result doesn't match documentation: > "Recursively compares a and b, returning a tuple of > [things-only-in-a things-only-in-b things-in-both]." It does match the detail, which refines the above: > * All sequential things are treated as associative collections > by their indexes, with results returned as vectors. > In other words, diffing is key-sensitive, and seqs have keys 0, 1, ... Compare: user=> (diff ["a" "b" "c"] ['q 'q "c" "d"]) [["a" "b"] [q q nil "d"] [nil nil "c"]] (With nils because you can't skip 0 to get to 1, etc.) -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Help! Migrating to 1.3.0
On Fri, Jan 13, 2012 at 11:47 AM, wrote: > Warning: *default-encoding* not declared dynamic and thus is not dynamically > rebindable, but its name suggests otherwise. Please either indicate More indirectly, stop using clojure-contrib and move to http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go . In the selected example, duck-streams was replaced with the included clojure.java.io in Clojure 1.2. -- Stephen Compall "^aCollection allSatisfy: [:each | aCondition]": less is better than -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: 4Clojure exersice question
On Jan 13, 2012, at 4:47 PM, Anthony Grimes wrote: > Clojail errs on the side of safety and not on the side of "Oh, well maybe he > wasn't trying to break the sandbox. Let's allow it anyway.". Treating macros > as opaque is just another hole in what is already difficult sandboxing. > Macros are not even remotely close to functions. They *create* code. That > code, just like any other explicitly written in your application, needs to be > sandboxed. It is much easier and safer to sandbox dangerous functions. The > fact that expanded macro code that uses those functions is also affected is > less of a bug and more of a feature. > > That said, of course it is unfortunate that things like this occur in > 4Clojure for things as simple as for. But clojail and 4clojure are separate > projects. clojail is focused on being as safe as possible, which may > sometimes clash with what would be most convenient in 4Clojure. I happened to run into the same issue on the same problem, and it drove me absolutely nuts. Luckily, I was able to ask Sean Corfield to take a look at it, and he realized that _for_ was using count under the hood. Was it frustrating? Yes, it was. But was it a learning experience? Yes. Absolutely. Sometimes learning experiences just aren't fun. Oh well. 4Clojure is a fantastic resource, in spite of the few idiosyncrasies (I don't consider it a "bug", YMMV). Yes, I had Sean to turn to. The OP had this list to turn to. I don't think anybody's walked away from the language in frustration due to hitting this particular issue. _Could_ it be addressed? Maybe. That might even be an interesting and frustrating learning experience for whoever chooses to undertake that particular task :) But as it stands, let's just figure anybody who is that upset over 4Clojure not recognizing that a particular function call was actually made from a macro will promptly be refunded the $ they spent to access the site :) Thanks, Anthony! (My $0.02 as a n00b) Charlie -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: destructing a map with a vector of keys?
On Fri, Jan 13, 2012 at 7:49 PM, Andrew Xue wrote: > trying do something like this > > (def my-keys [a b c]) > > (defn my-func [m] (let [{:keys my-keys} m] (prn a b c))) > > (my-func {:a 1 :b 2 :c 3}) > > > tried '[a b c], ['a 'b 'c], and ["a" "b" "c"] for my-keys but they all > give a Don't know how to create ISeq from: clojure.lang.Symbol error > > thanks > andy You'd need to use a macro that expands into the desired defn form, rather than trying to pass in the keys at runtime. Or, manually extract values from the map at the start of your function, if the keys are not actually known at runtime. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: 4Clojure exersice question
An alternative solution to trying to make macros opaque is just to disallow the macros which depend on disallowed functions. It should be a relatively simple matter to generate this list programmatically from clojure.core source. So instead of just saying "You can't use count." It would say "You can't use count or for." That at least would solve the cognitive dissonance that happens now where you submit an answer that doesn't violate the rules directly. Although it doesn't perhaps introduce a much lesser one which is why is this unrelated function disallowed? I think perhaps this is just waiting on someone to submit a patch :) jack. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
destructing a map with a vector of keys?
trying do something like this (def my-keys [a b c]) (defn my-func [m] (let [{:keys my-keys} m] (prn a b c))) (my-func {:a 1 :b 2 :c 3}) tried '[a b c], ['a 'b 'c], and ["a" "b" "c"] for my-keys but they all give a Don't know how to create ISeq from: clojure.lang.Symbol error thanks andy -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: 4Clojure exersice question
On Fri, Jan 13, 2012 at 6:47 PM, Anthony Grimes wrote: > Clojail errs on the side of safety and not on the side of "Oh, well maybe he > wasn't trying to break the sandbox. Let's allow it anyway.". Treating macros > as opaque is just another hole in what is already difficult sandboxing. > Macros are not even remotely close to functions. They *create* code. That > code, just like any other explicitly written in your application, needs to > be sandboxed. It is much easier and safer to sandbox dangerous functions. > The fact that expanded macro code that uses those functions is also affected > is less of a bug and more of a feature. You seem to be confused. We were discussing 4Clojure's rules, where the stakes are at worst letting a person "cheat" slightly, not a server security system or something, where the stakes would be allowing hacking of some sort. Your concern is immensely out of proportion to the consequences of someone cheating at 4Clojure's learning game. > That said, of course it is unfortunate that things like this occur in > 4Clojure for things as simple as for. But clojail and 4clojure are separate > projects. clojail is focused on being as safe as possible, which may > sometimes clash with what would be most convenient in 4Clojure. Unclear here is what the two have to do with one another. There's no obvious relevance of clojail's requirements for 4Clojure. Indeed, as you seem to have realized, the requirements are distinct and sometimes would conflict. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: [ANN] ClojureScript One - Getting Started with ClojureScript
Brenton writes: > Today we are releasing ClojureScript One. A project to help you get > started writing single-page applications in ClojureScript. The "script/run" script does not work on cygwin. Here is a patch to fix it. -- Dimitre Liotev -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=endiff --git a/script/setup_classpath.sh b/script/setup_classpath.sh index a3df95d..3dd7fca 100644 --- a/script/setup_classpath.sh +++ b/script/setup_classpath.sh @@ -6,3 +6,7 @@ for next in 'src/clj' 'src/cljs' 'test/cljs'; do done CLJSC_CP=$CLJSC_CP':lib/domina/src/cljs:src/app/clj:src/app/cljs:src/app/cljs-macros:src/lib/clj:src/lib/cljs:test:templates' + +if [[ `uname` == CYGWIN* ]]; then + CLJSC_CP=`cygpath -mp ${CLJSC_CP}` +fi
Re: 4Clojure exersice question
Clojail errs on the side of safety and not on the side of "Oh, well maybe he wasn't trying to break the sandbox. Let's allow it anyway.". Treating macros as opaque is just another hole in what is already difficult sandboxing. Macros are not even remotely close to functions. They *create* code. That code, just like any other explicitly written in your application, needs to be sandboxed. It is much easier and safer to sandbox dangerous functions. The fact that expanded macro code that uses those functions is also affected is less of a bug and more of a feature. That said, of course it is unfortunate that things like this occur in 4Clojure for things as simple as for. But clojail and 4clojure are separate projects. clojail is focused on being as safe as possible, which may sometimes clash with what would be most convenient in 4Clojure. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 clr files ?????
When I run leiningen , I can execute lein within any folder. For instance I have a folder c:\projects, i run lein new abc. I then have a folder "abc" that is created ,and all the projects files are stored within folder "abc". I installed clojure clr in a folder "clr". I can run clojure.main.exe located in c:\clr\ Do have to create ui.clj in the same folder as is clr ? I thought i would have a place that is designated for clojureclr Do I set clr in my path: so I can execute from within any folder? - Original Message - From: "Jeff Dik" To: Sent: Friday, January 13, 2012 2:43 PM Subject: Re: clojure clr files ? On Fri, Jan 13, 2012 at 2:21 PM, jayvandal wrote: I have installed clr in a folder called "clr" and have net installed. I can click on main exe and get the clr to give me a repl . When I get ready to create the ui. file in the example where am i storing files In leiningen i create a folder for the project all the files are stored in the project folder. In creating a "UI with Windows Forms", do i have other files I don't really understand the question, but perhaps this helps? http://www.myclojureadventure.com/2012/01/intro-to-clojure-clr-creating-ui-with.html -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Is this a bug? extending protocol on js/Object
Now I understand...that makes sense - thanks, D -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Struggling in making a sub-process work in an interactive way
I replied a bit too fast, I didn't realized you wanted to such an advanced thing It is probably more a JVM question than a Clojure question then. On Fri, Jan 13, 2012 at 3:42 AM, jaime wrote: > Well actually I also tried commons-exec but it's the same as > clojure.java.shell - they run system command directly, after execution > they return and terminate. That's not the way I want > > On Jan 13, 2:42 am, Denis Labaye wrote: > > Hi, > > > > In Java you would do it with common-exec:http://commons.apache.org/exec/ > > > > So add the deps to your project.clj : > > > > :dependencies [[org.apache.commons/commons-exec "1.1"]] > > > > And use Clojure's Java interop. > > > > Keep us posted, I will need to do the same thing soon :) > > > > Denis > > > > > > > > > > > > > > > > On Wed, Jan 11, 2012 at 4:05 AM, jaime wrote: > > > I didn't read your code carefully yet but I think you're meaning to > > > copy streams between my Clojure code and the sub-process, actually > > > I've tried this but this is probably not what I want. > > > I might not make myself clear. So here I go again: > > > 1. I writing a program which will open an OS shell (that means "cmd" > > > under Windows and "bash" under Linux) as sub-process > > > 2. this "shell" thing will not terminate while my code is still > > > running, all system commands such as dir/ls/cat etc. will be thrown > > > into the shell's input-stream to execute and the result is pulled > > > from shell's output-stream/err-stream > > > 3. because when the shell will finish its execution is > > > unpredictable, I chained an "echo stop-sign" command to original > > > command so that the program can get the sign when execution done. E.g. > > > for command "dir", I will throw "dir &echo stop-sign" to the shell, > > > when a stop-sign is captured then it knows the execution finished > > > 4. it works well so far but when the system command is interactive > > > one such as 'time' (in Windows), the program will hang; if there are > > > ways to know when to require user input then I can resolve this in the > > > code, but the answer is NO. I didn't find a way to detect this > > > 5. thus I tried to find out any workarounds but failed. I also tried > > > the way you mentioned here, it can work in an interactive way but in > > > this case I cannot get the control back. > > > > > That's all the things I'm struggling on... > > > > > On Jan 10, 4:54 pm, Alan Malloy wrote: > > > > On Jan 9, 9:24 pm, Phil Hagelberg wrote: > > > > > > > jaime writes: > > > > > > Later on I tried to add code that can make this possible but I > found > > > > > > there's no way to detect if a command requires user's input and > thus > > > I > > > > > > have to find another way to make it work - but I didn't success > and > > > > > > have been struggling for a workaround for a long while > > > > > > > > anyone has any idea? > > > > > > > As far as I know this is impossible to do without bringing in > > > > > third-party libraries; this is just a (rather serious) shortcoming > of > > > > > the JDK. I haven't looked into it enough to know which libraries > would > > > > > offer it though. > > > > > > This should be possible if you don't mind suiciding your own > process's > > > > stdin/stdout, by blindly forwarding all your input and output through > > > > the child. But if you send the child some input it didn't need, and > it > > > > terminates, and then later you need your own stdin again, some pieces > > > > will be missing. > > > > > > I was going to attach a simple proof of concept to this, but I can't > > > > seem to get it right. So instead, here's what I was trying to do, and > > > > if someone wants to take it up this might be something useful to work > > > > from: > > > > > > (ns fork.core > > > > (:require [clojure.java.io :as io]) > > > > (:import (java.io PipedReader PipedWriter)) > > > > (:gen-class)) > > > > > > (defn -main [& args] > > > > (println "Start typing, I'll cat it back atcha!") > > > > (let [child (-> (Runtime/getRuntime) (.exec "/bin/cat")) > > > > cin (.getInputStream child) > > > > cout (.getOutputStream child) > > > > > > in-pipe-in (PipedReader.) > > > > in-pipe-out (PipedWriter. in-pipe-in) > > > > > > out-pipe-in (PipedReader.) > > > > out-pipe-out (PipedWriter. out-pipe-in) > > > > > > in *in*, out *out*] ;; avoid dynamic-binding issues > > > > (future (io/copy in in-pipe-out)) ;; read my stdin... > > > > (future (io/copy in-pipe-in cout)) ;; write it to child's stdin > > > > > > (future (io/copy cin out-pipe-out)) ;; read child's stdout... > > > > @(future (io/copy out-pipe-in out)) ;; write it to my stdout, and > > > > wait for it to finish > > > > (let [exit-code (.waitFor child)] > > > > (println "Child process finished with exit code" exit-code) > > > > exit-code))) > > > > > -- > > > You received this message because you are subscribed to the Google > > >
Re: Help! Migrating to 1.3.0
Add meta data in your definitions as in (def ^{:dynamic true} *earmuff* Luc > I have a few issues. What do the following warnings mean and what should I > do about them? > > user=> (require 'mypackage) > Warning: *default-encoding* not declared dynamic and thus is not > dynamically rebindable, but its name suggests otherwise. Please either > indicate ^:dynamic *default-encoding* or change the name. > Warning: *buffer-size* not declared dynamic and thus is not dynamically > rebindable, but its name suggests otherwise. Please either indicate > ^:dynamic *buffer-size* or change the name. > Warning: *byte-array-type* not declared dynamic and thus is not dynamically > rebindable, but its name suggests otherwise. Please either indicate > ^:dynamic *byte-array-type* or change the name. > Warning: *append-to-writer* not declared dynamic and thus is not > dynamically rebindable, but its name suggests otherwise. Please either > indicate ^:dynamic *append-to-writer* or change the name. > nil > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- Softaddicts sent by ibisMail! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 clr files ?????
On Fri, Jan 13, 2012 at 2:21 PM, jayvandal wrote: > I have installed clr in a folder called "clr" and have net installed. > I can click on main exe and get the clr to give me a repl . When I get > ready to create the ui. file in the example where am i storing files > In leiningen i create a folder for the project all the files are > stored in the project folder. > In creating a "UI with Windows Forms", do i have other files I don't really understand the question, but perhaps this helps? http://www.myclojureadventure.com/2012/01/intro-to-clojure-clr-creating-ui-with.html -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojurescript One: (def fiv 5) compiles to ".fiv = 5;\n" ?
I have Emacs 24 with and clojure-mode, etc. packages from marmelade under Mac OS 10.6.8. I followed the instructions for Emacs: https://github.com/brentonashworth/one/wiki/Emacs ("For this example, we will start the Clojure REPL ...") When I get to the point, where I have both a Clojure and a Clojurescript repl, I open up the dev view of one and test it with (js/alert "!"). So far so good. (in-ns one.sample.model) still works, the fun starts when I issue @state If I go down the script/cljs-repl way, it works like a charm. Here is the stacktrace for reference: http://pastebin.com/WvF8WkXa 2012/1/13 David Nolen > On Fri, Jan 13, 2012 at 12:16 PM, László Török wrote: > >> funny, if I start the cljs repl via script/cljs-repl it works >> >> I will look into it, maybe it's Emacs >> >> thx >> > > Out of curiosity, how were you starting it before? > > David > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -- László Török Skype: laczoka2000 Twitter: @laczoka -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: ANN: ClojureScript property access syntax
FYI: You can see my changes to ClojureScript One at https://github.com/brentonashworth/one/tree/props and those to Domina at https://github.com/fogus/domina/commit/cc2ee723b28fd3de6023156cab23b86daaa72210 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: ANN: ClojureScript property access syntax
Notes from the trenches. I successfully migrated both ClojureScript One and Domina to the new syntax in about ~35 minutes (including tests). I had an unfair advantage having worked on the ClojureScript change, but for your own purposes the following techniques for migration should help: - length and innerHTML properties are prevalent and should all change to -length and -innerHTML outright - Using the aforementioned warning messages displayed by the ClojureScript compiler will help to pinpoint possible old-style property accesses. It will not always be accurate in identifying a prop lookup, but it helps to double check. - Calls to set! take a "place" as their first argument. These are often property slots of the form (set! (. an-obj -aprop) 42). These "places" should be double checked. - As a sanity check I checked every dot macro call [1] and just made sure that a property access was formed properly. And that's it. Enjoy [1]: i.e. I searched for "(\." in Emacs and looked at the found code. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: `extends?`, `class` and `type` on ClojureScript
On Fri, Jan 13, 2012 at 3:36 PM, Shantanu Kumar wrote: > Hi, > > I noticed that `extends?`, `class` and `type` are not implemented on > ClojureScript (yet) – will they eventually be implemented? Is there a > way beside these to determine if a reified object implements a certain > protocol? > > Shantanu > class is a Java-ism, probably doesn't make sense. There's a branch with type defined in it waiting on more feedback. extends? would probably need to be a macro. David -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
`extends?`, `class` and `type` on ClojureScript
Hi, I noticed that `extends?`, `class` and `type` are not implemented on ClojureScript (yet) – will they eventually be implemented? Is there a way beside these to determine if a reified object implements a certain protocol? Shantanu -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Map/Reduce Performance Question
> pmap creates a future for every > element of the sequence you give it, and that is significantly more > computation work (allocating, initializing, and invoking future objects) > than your function that simply returns 1 regardless of the value of its > argument. Makes perfect sense. Thanks for clarifying this. > I realize your example is probably a practice one intended to try out a > map/reduce style of coding, but you would probably get even further speedup > by using (count file-handle) in place of your reduce call. Yup, just a dummy practice problem. Still a good tip though. Thanks for taking the time to answer my question. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Map/Reduce Performance Question
If I am reading your example correctly, that pmap is simply being used to iterate over the characters of a line read into a string, then yes, you are using pmap in a very inefficient way. pmap creates a future for every element of the sequence you give it, and that is significantly more computation work (allocating, initializing, and invoking future objects) than your function that simply returns 1 regardless of the value of its argument. pmap is best used for parallelizing function invocations that do significantly more work than that. I realize your example is probably a practice one intended to try out a map/reduce style of coding, but you would probably get even further speedup by using (count file-handle) in place of your reduce call. Andy On Fri, Jan 13, 2012 at 11:47 AM, tmountain wrote: > Wow, just by changing pmap to map, the same code runs to completion in > 1 minute 35 seconds. I'm guessing this means that context switching > caused a huge performance penalty in this case since the "work" being > executed was so miniscule? > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from 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: Map/Reduce Performance Question
Wow, just by changing pmap to map, the same code runs to completion in 1 minute 35 seconds. I'm guessing this means that context switching caused a huge performance penalty in this case since the "work" being executed was so miniscule? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Map/Reduce Performance Question
I'm playing around with a basic map/reduce pattern with the following code: (ns read-lines.core (:gen-class) (:use [clojure.java.io :only (reader)])) (defn -main [& args] (with-open [rdr (reader "/tmp/mydata.txt")] (let [file-handle (line-seq rdr)] (println (reduce (fn [m x] (inc m)) (pmap (fn [_] 1) file- handle)) Running that to completion on 2.7G of data took 28 minutes. Looking at my system resources, I saw a pretty even balance between disk utilization and CPU utilization. I'm wondering if there's anything obvious I'm missing that could speed this up? I'm going to try again without pmap to see if context switching hurt performance since I only have two cores. On the upside, the memory usage was constant, so that's great for large datasets. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 clr files ?????
I have installed clr in a folder called "clr" and have net installed. I can click on main exe and get the clr to give me a repl . When I get ready to create the ui. file in the example where am i storing files In leiningen i create a folder for the project all the files are stored in the project folder. In creating a "UI with Windows Forms", do i have other files -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: 4Clojure exersice question
On Thu, Jan 12, 2012 at 3:31 AM, markus wrote: > Computers don't accuse, they process data. And they are not (yet?) > capable of reading a user's intentions. Technically no, but it's doubtful that a user using a macro like "for" intends to "cheat", so from the *programmer's* standpoint it's not clear why it doesn't treat macros as opaque. In any event, when a computer program is placed in the role of acting like a referee of any kind, it behooves the developer to make sure it errs on the side of "innocent until proven guilty". If the user is forbidden from using specific symbols that are enumerated, then unless the user's typing actually contains one of those symbols, it's highly unlikely that anything nefarious was intended. If the object is to implement things like "count" in a way that cannot be circular, then that may seem to clash with the above recommendation. However, just explicitly forbidding a few other things, such as "for", that internally use "count" would suffice. Also, it occurs to me that though it can object to using a macro implemented to *emit* count it can't presumably detect using a function that calls count, or a macro that *calls* count (without emitting it), as things stand anyway, so avoiding that sort of circularity would still require adding things to the ban-list anyway. So it might as well treat macros as opaque and then from the user's standpoint when it comes to the ban-list what he sees is what he gets. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Is this a bug? extending protocol on js/Object
On Fri, Jan 13, 2012 at 1:32 PM, Jozef Wagner wrote: > How about using (extend-type default ...) ? Is it safe to use it? The question is how to implement that efficiently. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Literate Programming in Emacs?
Andrew writes: > Eric asks: The only function ob-clojure uses from swank-clojure is > swank:interactive-eval-region' (used with `slime-eval') in the > org-babel-execute:clojure' function. Which function would now be used > to evaluate a region of clojure code? Would `slime-eval-region' > suffice? Yes, clojure-test-mode uses both slime-eval and slime-eval-async; he should pick one of these like so: (defun clojure-test-eval (string &optional handler) (slime-eval-async `(swank:eval-and-grab-output ,string) (or handler #'identity))) (defun clojure-test-eval-sync (string) (slime-eval `(swank:eval-and-grab-output ,string))) Actually swank:interactive-eval-region and friends are not elisp functions; they are Clojure functions. -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
Re: Is this a bug? extending protocol on js/Object
How about using (extend-type default ...) ? Is it safe to use it? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
ANN: ClojureScript property access syntax
I've just merged to ClojureScript master the new property lookup syntax as outlined in the ticket http://dev.clojure.org/jira/browse/CLJS-89 and the design page at http://dev.clojure.org/display/design/Unified+ClojureScript+and+Clojure+field+access+syntax. This is a potentially *breaking* change to existing ClojureScript apps. To help mitigate moving to the new syntax, the ClojureScript compiler will print a warning any time it encounters a dot call in the form of (.foo obj) or (. obj foo). This is a temporary warning and due for removal sometime before ClojureScript comes out of alpha. For those curious, the change is summarized as follows: (.p o) ;=> a method call (.m o );=> a method call (. o p) ;=> a method call (. o p ) ;=> a method call (. o (m));=> a method call (. o (m )) ;=> a method call (. o -p) ;=> a property access (.-p o) ;=> a property access ClojureScript will now stick strictly to these semantics. As an added bonus the latest Clojure alpha release (1.4.0-alpha4) contains a *non- breaking* addition to Clojure to allow the same kind of property- specific access syntax. Nothing else regarding Clojure's dot interop form has changed. I will take it on myself to update the ClojureScript One source code to see if there are any further complications to migration that I might have missed. I will report my findings in this thread. Thanks -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: ClojureScriptOne HelloWorld problem
Right. I had several tabs open, and I was reading the Clojure One tutorial and the same thing happened. Then I switched to the tab with the Development page and then when I ran alert, I saw it there and it returns. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojurescript One: (def fiv 5) compiles to ".fiv = 5;\n" ?
On Fri, Jan 13, 2012 at 12:16 PM, László Török wrote: > funny, if I start the cljs repl via script/cljs-repl it works > > I will look into it, maybe it's Emacs > > thx > Out of curiosity, how were you starting it before? David -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojurescript One: (def fiv 5) compiles to ".fiv = 5;\n" ?
funny, if I start the cljs repl via script/cljs-repl it works I will look into it, maybe it's Emacs thx 2012/1/13 Brenton > I can't reproduce this problem. What you are showing here should work. > > The following steps work for me: > > script/cljs-repl > ClojureScript:cljs.user> (in-ns 'one.sample.view) > ClojureScript:one.sample.view> (def fiv 5) > (def fiv 5) > 5 > > On Jan 13, 9:36 am, László Török wrote: > > Hi, > > > > first of thank you putting this together. As I'm working my way through > the > > documentation, I'm experiencing a strange error. > > > > I have a Clojurescript REPL up and running in Emacs (tested with > (js/alert > > "..")) and I try > > > > ClojureScript:one.sample.view> (def fiv 5) > > > > I get this: > > > > (def fiv 5) > > "Error evaluating:" (def fiv 5) :as ".fiv = 5;\n" > > > > and a long stacktrace. > > > > Similarly, this works: > > > > ClojureScript:one.sample.model> @one.sample.model/state > > > > this doesn't: > > > > ClojureScript:one.sample.model> @state > > > > So it seems every unqualified (local) symbol gets a leading . (dot). What > > am I doing wrong? > > > > Thanks! > > > > -- > > László Török > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- László Török Skype: laczoka2000 Twitter: @laczoka -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Help! Migrating to 1.3.0
On Fri, Jan 13, 2012 at 17:47, wrote: > I have a few issues. What do the following warnings mean and what should I > do about them? Did you read them? "*default-encoding* not declared dynamic and thus is not dynamically rebindable" ;; wont' work: (binding [*default-encoding* some-value] (do-something-that-uses *default-encoding*)) "but it's name suggests otherwise" *ear-muffs* are lisp convention for dynamically bindable global variable names. Using that convention is misleading if the variable isn't actually dynamically bindable. "Please either indicate ^:dynamic *buffer-size*" (def ^:dynamic *buffer-size ...) Starting with Clojure 1.3, you need to declare when a variable should be dynamically bindable. This is because performance is better for vars that are not dynamically bindable, so you are encouraged to use ^:dynamic only where it's actually needed. "or change the name." If you're not (binding [...]) the var in question rename it. // Ben -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Help! Migrating to 1.3.0
Have seen this as well. For efficiency sake 1.3.0 requires :dynamic meta for convention based ear-muffed vars (intended for rebinding). The warning actually is quite descriptive if you think about it. See more in-depth discussion at http://blog.japila.pl/2011/03/cant-dynamically-bind-non-dynamic-var-in-clojure-1-3/ HTH On Jan 13, 11:47 am, labwor...@gmail.com wrote: > I have a few issues. What do the following warnings mean and what should I > do about them? > > user=> (require 'mypackage) > Warning: *default-encoding* not declared dynamic and thus is not > dynamically rebindable, but its name suggests otherwise. Please either > indicate ^:dynamic *default-encoding* or change the name. > Warning: *buffer-size* not declared dynamic and thus is not dynamically > rebindable, but its name suggests otherwise. Please either indicate > ^:dynamic *buffer-size* or change the name. > Warning: *byte-array-type* not declared dynamic and thus is not dynamically > rebindable, but its name suggests otherwise. Please either indicate > ^:dynamic *byte-array-type* or change the name. > Warning: *append-to-writer* not declared dynamic and thus is not > dynamically rebindable, but its name suggests otherwise. Please either > indicate ^:dynamic *append-to-writer* or change the name. > nil -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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.data diff question
Clojure> (use 'clojure.data) nil Clojure> (doc diff) - clojure.data/diff ([a b]) Recursively compares a and b, returning a tuple of [things-only-in-a things-only-in-b things-in-both]. Comparison rules: * For equal a and b, return [nil nil a]. * Maps are subdiffed where keys match and values differ. * Sets are never subdiffed. * All sequential things are treated as associative collections by their indexes, with results returned as vectors. * Everything else (including strings!) is treated as an atom and compared for equality. nil Clojure> (diff ["a" "b" "c"] ["c" "d"]) [["a" "b" "c"] ["c" "d"] nil] Looks like the result doesn't match documentation: "Recursively compares a and b, returning a tuple of [things-only-in-a things-only-in-b things-in-both]." -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Help! Migrating to 1.3.0
I have a few issues. What do the following warnings mean and what should I do about them? user=> (require 'mypackage) Warning: *default-encoding* not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise. Please either indicate ^:dynamic *default-encoding* or change the name. Warning: *buffer-size* not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise. Please either indicate ^:dynamic *buffer-size* or change the name. Warning: *byte-array-type* not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise. Please either indicate ^:dynamic *byte-array-type* or change the name. Warning: *append-to-writer* not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise. Please either indicate ^:dynamic *append-to-writer* or change the name. nil -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojurescript One: (def fiv 5) compiles to ".fiv = 5;\n" ?
I can't reproduce this problem. What you are showing here should work. The following steps work for me: script/cljs-repl ClojureScript:cljs.user> (in-ns 'one.sample.view) ClojureScript:one.sample.view> (def fiv 5) (def fiv 5) 5 On Jan 13, 9:36 am, László Török wrote: > Hi, > > first of thank you putting this together. As I'm working my way through the > documentation, I'm experiencing a strange error. > > I have a Clojurescript REPL up and running in Emacs (tested with (js/alert > "..")) and I try > > ClojureScript:one.sample.view> (def fiv 5) > > I get this: > > (def fiv 5) > "Error evaluating:" (def fiv 5) :as ".fiv = 5;\n" > > and a long stacktrace. > > Similarly, this works: > > ClojureScript:one.sample.model> @one.sample.model/state > > this doesn't: > > ClojureScript:one.sample.model> @state > > So it seems every unqualified (local) symbol gets a leading . (dot). What > am I doing wrong? > > Thanks! > > -- > László Török -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: ClojureScriptOne HelloWorld problem
The ClojureScript REPL will hang if it is not connected to the browser. Make sure you are on the development page of ClojureScript One, which is the only page that will allow a REPL connection. If you are already there then just refresh the page. The best way to start a ClojureScript REPL is described here: https://github.com/brentonashworth/one/wiki/Quick-Start Brenton On Jan 13, 9:51 am, Huft wrote: > Ah - RTFM - difference between Clojure- and Clojurescript- REPLs - > thanks > > So now I have the Clojurescript REPL running; but entering '(js/alert > "hello")' just causes the REPL to hang [doesn't return] > > On Jan 13, 2:41 pm, László Török wrote: > > > > > > > > > Hi, > > > you're probably still in the Clojure REPL, read "Manually starting a > > ClojureScript REPL" > > > and then refresh the development view in your browser and you're all set. > > > L > > > 2012/1/12 Huft > > > > Hi, > > > > New to Clojure, excited to take a peek at ClojureScriptOne. Installed > > > it, now running script/run; repl appears, application visible at > > > localhost:8080, clicked 'Development'. Now trying to enter forms at > > > the repl, as per > > > >https://github.com/brentonashworth/one/wiki/Getting-started > > > > However if I type: > > > > (js/alert "hello") > > > > at the repl, I get: > > > > CompilerException java.lang.RuntimeException: No such namespace: js, > > > compiling:(NO_SOURCE_PATH:1) > > > > Apologies for n00b question, but can anyone help me out ? > > > > Thanks. > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Clojure" group. > > > To post to this group, send email to clojure@googlegroups.com > > > Note that posts from new members are moderated - please be patient with > > > your first post. > > > To unsubscribe from this group, send email to > > > clojure+unsubscr...@googlegroups.com > > > For more options, visit this group at > > >http://groups.google.com/group/clojure?hl=en > > > -- > > László Török > > > Skype: laczoka2000 > > Twitter: @laczoka -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: ClojureScript One - "No such namespace" error when following "Getting Started" instructions
You are trying to evaluate ClojureScript in a Clojure REPL. The easiest way to get a ClojureScript REPL is to run: script/cljs-repl If you start a ClojureScript REPL manually then you always need to load/reload the development page afterwords to establish the connection. On Jan 12, 5:07 pm, utel wrote: > The amount of effort that's gone into ClojureScript One initiative is > very impressive! > > Just one question. I've tried following the instructions on the > page:https://github.com/brentonashworth/one/wiki/Getting-started > > All goes well until the step where I evaluate the expression (js/alert > "hello") > > Then I get the following error: > CompilerException java.lang.RuntimeException: No such namespace: js, > compiling:(NO_SOURCE_PATH:1) > > I've tried it on both Linux and OS X 10.7 (both with jdk 1.6.0_29) > and in both cases get the error above. > > It may be that I've missed something obvious! > > Any help appreciated. > > Thanks. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: ClojureScriptOne HelloWorld problem
Ah - RTFM - difference between Clojure- and Clojurescript- REPLs - thanks So now I have the Clojurescript REPL running; but entering '(js/alert "hello")' just causes the REPL to hang [doesn't return] On Jan 13, 2:41 pm, László Török wrote: > Hi, > > you're probably still in the Clojure REPL, read "Manually starting a > ClojureScript REPL" > > and then refresh the development view in your browser and you're all set. > > L > > 2012/1/12 Huft > > > > > > > > > > > Hi, > > > New to Clojure, excited to take a peek at ClojureScriptOne. Installed > > it, now running script/run; repl appears, application visible at > > localhost:8080, clicked 'Development'. Now trying to enter forms at > > the repl, as per > > >https://github.com/brentonashworth/one/wiki/Getting-started > > > However if I type: > > > (js/alert "hello") > > > at the repl, I get: > > > CompilerException java.lang.RuntimeException: No such namespace: js, > > compiling:(NO_SOURCE_PATH:1) > > > Apologies for n00b question, but can anyone help me out ? > > > Thanks. > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en > > -- > László Török > > Skype: laczoka2000 > Twitter: @laczoka -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: ClojureScriptOne HelloWorld problem
Oops! Need to refresh the browser. Works - thanks. On Jan 13, 2:41 pm, László Török wrote: > Hi, > > you're probably still in the Clojure REPL, read "Manually starting a > ClojureScript REPL" > > and then refresh the development view in your browser and you're all set. > > L > > 2012/1/12 Huft > > > > > > > > > > > Hi, > > > New to Clojure, excited to take a peek at ClojureScriptOne. Installed > > it, now running script/run; repl appears, application visible at > > localhost:8080, clicked 'Development'. Now trying to enter forms at > > the repl, as per > > >https://github.com/brentonashworth/one/wiki/Getting-started > > > However if I type: > > > (js/alert "hello") > > > at the repl, I get: > > > CompilerException java.lang.RuntimeException: No such namespace: js, > > compiling:(NO_SOURCE_PATH:1) > > > Apologies for n00b question, but can anyone help me out ? > > > Thanks. > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en > > -- > László Török > > Skype: laczoka2000 > Twitter: @laczoka -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
ANN: Clojure 1.4.0-alpha4 release
Clojure relase 1.4.0-alpha4 has been uploaded to oss.sonatype.org and should be on Maven Central within 24 hours. Patches included in this alpha release: - CLJ-890: tagged reader literals (early draft) - toString caching - Only capture a shallow copy of the current Frame in binding-conveyor-fn, so that sends in agent actions don't built infinite Frame stacks. Fixes CLJ-898. - Fix CLJ-845: Ignoring namespace portion of symbols used to name methods in extend-type and extend-protocol. - CLJ-872: Added tests for prop lookup syntax - CLJ-872 Add support for prop lookup, refs CLJS-89 To get the latest release JARs in Lein/Maven before they hit Central, see http://dev.clojure.org/display/doc/Maven+Settings+and+Repositories -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: ClojureScriptOne HelloWorld problem
Hi, you're probably still in the Clojure REPL, read "Manually starting a ClojureScript REPL" and then refresh the development view in your browser and you're all set. L 2012/1/12 Huft > Hi, > > New to Clojure, excited to take a peek at ClojureScriptOne. Installed > it, now running script/run; repl appears, application visible at > localhost:8080, clicked 'Development'. Now trying to enter forms at > the repl, as per > > https://github.com/brentonashworth/one/wiki/Getting-started > > However if I type: > > (js/alert "hello") > > at the repl, I get: > > CompilerException java.lang.RuntimeException: No such namespace: js, > compiling:(NO_SOURCE_PATH:1) > > Apologies for n00b question, but can anyone help me out ? > > Thanks. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- László Török Skype: laczoka2000 Twitter: @laczoka -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Clojurescript One: (def fiv 5) compiles to ".fiv = 5;\n" ?
Hi, first of thank you putting this together. As I'm working my way through the documentation, I'm experiencing a strange error. I have a Clojurescript REPL up and running in Emacs (tested with (js/alert "..")) and I try ClojureScript:one.sample.view> (def fiv 5) I get this: (def fiv 5) "Error evaluating:" (def fiv 5) :as ".fiv = 5;\n" and a long stacktrace. Similarly, this works: ClojureScript:one.sample.model> @one.sample.model/state this doesn't: ClojureScript:one.sample.model> @state So it seems every unqualified (local) symbol gets a leading . (dot). What am I doing wrong? Thanks! -- László Török -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Literate Programming in Emacs?
I was able to get org-babel evaluation working with Clojure. Requires latest versions of Clojure mode, Org mode, and Lein. Check out my dotfiles repo for examples. https://github.com/stuartsierra/dotfiles -S -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: replace-first bug in clojure.string ?
Known bug, fix forthcoming. http://dev.clojure.org/jira/browse/CLJ-753 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: [ANN] ClojureScript One - Getting Started with ClojureScript
Thank you very much! This is earthshaking stuff. And me too hope to contribute 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
Re: 4Clojure exersice question
Computers don't accuse, they process data. And they are not (yet?) capable of reading a user's intentions. On 11 Jan., 19:02, Cedric Greevey wrote: > It seems dubious to me that it accuses users of cheating when they > clearly had no intent to cheat. Is this intended behavior of 4Clojure > or a bug? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
ClojureScriptOne HelloWorld problem
Hi, New to Clojure, excited to take a peek at ClojureScriptOne. Installed it, now running script/run; repl appears, application visible at localhost:8080, clicked 'Development'. Now trying to enter forms at the repl, as per https://github.com/brentonashworth/one/wiki/Getting-started However if I type: (js/alert "hello") at the repl, I get: CompilerException java.lang.RuntimeException: No such namespace: js, compiling:(NO_SOURCE_PATH:1) Apologies for n00b question, but can anyone help me out ? Thanks. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
ClojureScript One - "No such namespace" error when following "Getting Started" instructions
The amount of effort that's gone into ClojureScript One initiative is very impressive! Just one question. I've tried following the instructions on the page: https://github.com/brentonashworth/one/wiki/Getting-started All goes well until the step where I evaluate the expression (js/alert "hello") Then I get the following error: CompilerException java.lang.RuntimeException: No such namespace: js, compiling:(NO_SOURCE_PATH:1) I've tried it on both Linux and OS X 10.7 (both with jdk 1.6.0_29) and in both cases get the error above. It may be that I've missed something obvious! Any help appreciated. Thanks. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
replace-first bug in clojure.string ?
Clojure> (require '(clojure [string :as string])) nil Clojure> (string/replace-first "a" #"b" "c") "a" Clojure> (string/replace-first "a" #"b" (comp str last)) nil when pass a pattern and a function to the replace-first function, and the pattern doesn't match the string (first argument), replace-first will return nil rather than the original string. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Is this a bug? extending protocol on js/Object
It could create interop problems with other JavaScript libraries (including Google Closure). extending Object modifies its prototype. The problem is that objects are used as maps in JavaScript and these new properties will appear if someone tries to iterate through the keys with for..in. It's unfortunate since this means we can't currently use js/Object to provide default protocol implementations as we do in Clojure w/o fear of conflicts with JavaScript libraries. I'd be less worried about the other native types. David On Fri, Jan 13, 2012 at 9:06 AM, Dave Sann wrote: > Ok, > > I had assumed from this > > https://groups.google.com/d/topic/clojure/KQ6AM-nxlTQ/discussion > > that I could > > Is there anything else not safe to extend? > > Cheers > > D > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Is this a bug? extending protocol on js/Object
Ok, I had assumed from this https://groups.google.com/d/topic/clojure/KQ6AM-nxlTQ/discussion that I could Is there anything else not safe to extend? Cheers D -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en