implement a shell in repl
Hi guys, I want to implement a shell on top of REPL but without any ideas on how to do it. Could you please suggest? What I want is something that can let user do things like: 1. in REPL, user enter (myshell) (or some other command name) 2. then a prompt string will show up so that user can interact with Clojure 3. built-in commands support is possible 4. prompt for user input is possible (I think this is the most import part that I want, but I don't know how I can make REPL prompts a user input...) 5. real Clojure form can be dispatch to REPL and the shell can show the result returned by REPL is there any project already on this, or is it possible to implement it in some kind of ways?? Thanks, Jaime -- 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 attach debugger on clojure's repl ?
I'm also looking forward the same thing.. On Sep 20, 12:24 am, cran1988 rmanolis1...@hotmail.com wrote: I am looking forward for a debugger like in CLISP , SBCL etc.. Is there any solution out there ? Are you going to develop such a tool and you need help ? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Twitter's Storm (complex event processing system) is now open source
See https://github.com/nathanmarz/storm also http://news.ycombinator.com/item?id=3014039 especially http://news.ycombinator.com/item?id=3014556 -- 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 attach debugger on clojure's repl ?
You can debug clojure code with a normal Java Debugger. When using Emacs, you can try http://georgejahad.com/clojure/swank-cdt.html -- __ Herwig Hochleitner -- 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
[newbie] filter confusion
I'm working through some puzzle problems to help get up to speed on clojure. Generally I've been able to pound on something for a while and get the moment of enlightenment but for some reason this seemingly simple item is stumping me. (FWIW, the puzzle in question is the crossing a bridge at night in pairs with one lantern problem). Here is The output that is confusing me: Using: (defn not-seen-already? [states state] (not (some #{state} states))) user= path [{:left [1 2 3], :lamp :left, :right []} {:lamp :right, :left (2 3), :right (1)}] user= next-steps ({:lamp :left, :right (), :left (1 2 3)}) user= next-steps2 [{:lamp :left, :right [], :left [1 2 3]}] user= (filter #(not-seen-already? path %) next-steps) ({:lamp :left, :right (), :left (1 2 3)}) user= (filter #(not-seen-already? path %) next-steps2) () user= (filter #(not-seen-already? path %) '({:lamp :left, :right (), :left (1 2 3)})) () user= (filter #(not-seen-already? path %) [{:lamp :left, :right [], :left [1 2 3]}]) () As you can see above, passing in the variable next-steps and next- steps2 above into my expression I get two different results (I was expecting the second result). When I pass the data structures in explicitly I get the same result for each. I'm assuming there is some obvious thing going on but after a few days of staring at this off and on, I'm not making any progress (though I'm half expecting a face palm when I understand the problem.) Thanks in advance for any help. dustin -- 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
Arithmetic Exception in 1.3
I've been experimenting with the numeric capabilities of Clojure and I encountered this: Clojure 1.2.1 user= (apply * (repeat 100 2)) 1267650600228229401496703205376 Clojure 1.3.0-RC0 user= (apply * (repeat 100 2)) ArithmeticException integer overflow clojure.lang.Numbers.throwIntOverflow (Numbers.java:1374) Is this really the intended behavior for version 1.3? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Exception: Can't define method not in interfaces: fly
Dear! Loading the file: (ns fly.bird) (defprotocol Fly (fly [this]) (fly [this x])) (defrecord Bird [nom species] Fly (fly [this] (str (:nom this) flies..)) (fly [this x] (str (:nom this) flies x))) got this error message: java.lang.IllegalArgumentException: Can't define method not in interfaces: fly (bird.clj:7) What's wrong with this file. Thanks in advance. Sincerely, Ru -- 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: implement a shell in repl
I had quite similar task, integrating custom shell with clojure repl, where all expressions between parenthesis were interpreted as clojure code and rest as custom shell programs. The best way to do this is to explore (clojure.main/repl) function. One of the parameters will be :eval function; there clojure repl will send all expressions for evaluation. It could look like this: (defn evaluate [expr] (if (re-find #^(.*)$ expr) (eval expr) ;; here you call some java code for executing system commands ;; like (.exec (Runtime/getRuntime) expr) or something like that ) ) (clojure.main/repl :eval evaluate) With clojure.main/repl you can do even more: write custom input, output and such. Feel free to explore it ;) Sanel On Sep 20, 9:38 am, jaime xiejianm...@gmail.com wrote: Hi guys, I want to implement a shell on top of REPL but without any ideas on how to do it. Could you please suggest? What I want is something that can let user do things like: 1. in REPL, user enter (myshell) (or some other command name) 2. then a prompt string will show up so that user can interact with Clojure 3. built-in commands support is possible 4. prompt for user input is possible (I think this is the most import part that I want, but I don't know how I can make REPL prompts a user input...) 5. real Clojure form can be dispatch to REPL and the shell can show the result returned by REPL is there any project already on this, or is it possible to implement it in some kind of ways?? Thanks, Jaime -- 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: google.visualization
Hello, I want to use clojurescript in my application and need some nice buttons, sortable grids [1] and filters [2] and so on. As far as I have seen in the samples, basic browser stuff like dom manipulation or XHR is implemented. The Google Clojure library provides buttons, autocomplete, tooltips ... I'm I right that I can't use them already with clojurescript? Can you provide me some links to information/samples where I can start from? Creating externs, mapping/using them to clojurescript? Thanks, Christoph [1] http://code.google.com/apis/ajax/playground/?type=visualization#simple_data_view [2] http://code.google.com/apis/ajax/playground/?type=visualization#numberrangefilter_control -- 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: Arithmetic Exception in 1.3
2011/9/19 PC pca...@gmail.com: (apply * (repeat 100 2)) Auto promotion has been turned off in favor of performance. Operations with auto-promoting behavior are available as primed functions. Try (apply *' (repeat 100 2)) also see http://dev.clojure.org/display/doc/Documentation+for+1.3+Numerics kind regards -- __ Herwig Hochleitner -- 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: Exception: Can't define method not in interfaces: fly
Try using this for the defprotocol form: (defprotocol Fly (fly [this] [this x])) I don't know whether your defprotocol form is supposed to be allowed. Either way, better error message(s) would be good. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: [newbie] filter confusion
On Mon, Sep 19, 2011 at 2:20 PM, qhfgva qhf...@gmail.com wrote: I'm working through some puzzle problems to help get up to speed on clojure. Generally I've been able to pound on something for a while and get the moment of enlightenment but for some reason this seemingly simple item is stumping me. (FWIW, the puzzle in question is the crossing a bridge at night in pairs with one lantern problem). Here is The output that is confusing me: Using: (defn not-seen-already? [states state] (not (some #{state} states))) user= path [{:left [1 2 3], :lamp :left, :right []} {:lamp :right, :left (2 3), :right (1)}] user= next-steps ({:lamp :left, :right (), :left (1 2 3)}) user= next-steps2 [{:lamp :left, :right [], :left [1 2 3]}] user= (filter #(not-seen-already? path %) next-steps) ({:lamp :left, :right (), :left (1 2 3)}) user= (filter #(not-seen-already? path %) next-steps2) () user= (filter #(not-seen-already? path %) '({:lamp :left, :right (), :left (1 2 3)})) () user= (filter #(not-seen-already? path %) [{:lamp :left, :right [], :left [1 2 3]}]) () As you can see above, passing in the variable next-steps and next- steps2 above into my expression I get two different results (I was expecting the second result). When I pass the data structures in explicitly I get the same result for each. I can't reproduce your results: user= (filter #(not-seen-already? path %) next-steps) () What does your REPL say if you: (= (first next-steps) (first path)) What version of Clojure are you using? --Chouser -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
2011 Clojure Conj 'Scholarship' fundraiser
I wanted to let the list know about a 'scholarship' fundraiser I've started for this year's Conj: About a year ago, I had the distinct privilege of having a front-row seat when the generosity of the Clojure community (and others!) helped Anthony Grimes (aka Raynes) attend the 2010 Clojure Conj. Witnessing the success of that process made me certain that I would attempt to coordinate another “scholarship” fundraising drive for this year’s Clojure Conj. Like Anthony last year, I wanted to help someone that: • had already contributed significantly to the Clojure community, • clearly has great potential, but • without some financial assistance, would not be able to attend the Conj and benefit from the meeting-of-the-minds that such conferences uniquely enable. Over the summer, it became clear to me that Ambrose Bonnaire-Sergeant was that someone. Click here to read more and help out: http://cemerick.com/2011/09/20/2011-clojure-scholarship-help-send-ambrose-to-the-conj/ Thanks! - Chas -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: How to attach debugger on clojure's repl ?
I am trying to figure out how abcl does it On Sep 20, 12:41 pm, Herwig Hochleitner hhochleit...@gmail.com wrote: You can debug clojure code with a normal Java Debugger. When using Emacs, you can tryhttp://georgejahad.com/clojure/swank-cdt.html -- __ Herwig Hochleitner -- 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
Storm
Yesterday I open-sourced Storm at Strange Loop. Storm is a distributed and fault-tolerant realtime computation system hosted at https://github.com/nathanmarz/storm Just want to preempt a few questions that I know people are wondering about the project: Is Storm mostly written in Java? If you look at the languages graph on Github, it says that Storm is 64% Java. However, this is inaccurate because those numbers include the Java code generated by the Thrift compiler. If you exclude the generated code, you'll find that Storm is over 50% Clojure in terms of line count. In terms of functionality though, Storm is around 98% Clojure. The Java code I wrote is mostly interfaces and small classes that a user of Storm would encounter in the public API (Java is, ahem, verbose). Why isn't Storm written completely in Clojure? I want Storm to be as accessible to as wide an audience as possible. A user's language preference or constraints shouldn't prevent them from being able to use Storm to solve their realtime computation problems. This is why I chose to define Storm's main interfaces in Java, and this is also why Storm supports using any language (including non-JVM ones) on top of Storm. That said, Storm has a Clojure DSL for programming topologies which is what I personally use for developing topologies. Clojure was a magnificent language to use to build Storm. Storm is a complex, intricate system, and Clojure helped a great deal in managing the complexity of the implementation. If you have any questions, I'd be happy to answer them. -Nathan -- 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: Arithmetic Exception in 1.3
Alternatively: (apply * (repeat 100 2N)) and allow BigInt contagion to work. On Tue, Sep 20, 2011 at 8:43 AM, Herwig Hochleitner hhochleit...@gmail.comwrote: 2011/9/19 PC pca...@gmail.com: (apply * (repeat 100 2)) Auto promotion has been turned off in favor of performance. Operations with auto-promoting behavior are available as primed functions. Try (apply *' (repeat 100 2)) also see http://dev.clojure.org/display/doc/Documentation+for+1.3+Numerics kind regards -- __ Herwig Hochleitner -- 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: Exception: Can't define method not in interfaces: fly
Thanks Simon, This form is working: (ns fly.bird) (defprotocol Fly (fly [this]) (fly2 [this x])) (defrecord Bird [nom species] Fly (fly [this] (str (:nom this) flies..)) (fly2 [this x] (str (:nom this) flies x))) So, we can't define the same method with different signatures in one protocol. Is it justifiably? -- 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: Exception: Can't define method not in interfaces: fly
Hi, Am 20.09.2011 um 18:47 schrieb ru: So, we can't define the same method with different signatures in one protocol. Is it justifiably? ??? You were shown the correct syntax: (defprotocol Fly (fly [x] [x y])). Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: filter confusion
On Sep 20, 7:02 am, Chouser chou...@gmail.com wrote: On Mon, Sep 19, 2011 at 2:20 PM, qhfgva qhf...@gmail.com wrote: I'm working through some puzzle problems to help get up to speed on clojure. Generally I've been able to pound on something for a while and get the moment of enlightenment but for some reason this seemingly simple item is stumping me. (FWIW, the puzzle in question is the crossing a bridge at night in pairs with one lantern problem). Here is The output that is confusing me: Using: (defn not-seen-already? [states state] (not (some #{state} states))) user= path [{:left [1 2 3], :lamp :left, :right []} {:lamp :right, :left (2 3), :right (1)}] user= next-steps ({:lamp :left, :right (), :left (1 2 3)}) user= next-steps2 [{:lamp :left, :right [], :left [1 2 3]}] user= (filter #(not-seen-already? path %) next-steps) ({:lamp :left, :right (), :left (1 2 3)}) user= (filter #(not-seen-already? path %) next-steps2) () user= (filter #(not-seen-already? path %) '({:lamp :left, :right (), :left (1 2 3)})) () user= (filter #(not-seen-already? path %) [{:lamp :left, :right [], :left [1 2 3]}]) () As you can see above, passing in the variable next-steps and next- steps2 above into my expression I get two different results (I was expecting the second result). When I pass the data structures in explicitly I get the same result for each. I can't reproduce your results: user= (filter #(not-seen-already? path %) next-steps) () What does your REPL say if you: (= (first next-steps) (first path)) What version of Clojure are you using? --Chouser Thanks for your response. Here you go: (with extra info as well) user= (first path) (first path) {:left [1 2 3], :lamp :left, :right []} user= (first next-steps) (first next-steps) {:lamp :left, :right (), :left (1 2 3)} user= (first next-steps2) (first next-steps2) {:lamp :left, :right [], :left [1 2 3]} user= (class path) (class path) clojure.lang.PersistentVector user= (class next-steps) (class next-steps) clojure.lang.LazySeq user= (class next-steps2) (class next-steps2) clojure.lang.PersistentVector user= (first path) (first path) {:left [1 2 3], :lamp :left, :right []} user= (first next-steps) (first next-steps) {:lamp :left, :right (), :left (1 2 3)} user= (first next-steps2) (first next-steps2) {:lamp :left, :right [], :left [1 2 3]} user= (filter #(not-seen-already? path %) next-steps) (filter #(not-seen-already? path %) next-steps) ({:lamp :left, :right (), :left (1 2 3)}) user= (= (first next-steps) (first path)) (= (first next-steps) (first path)) true user= *clojure-version* *clojure-version* {:interim true, :major 1, :minor 2, :incremental 0, :qualifier master} -- 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: implement a shell in repl
Wouldn't the simplest way be to simply use the REPL itself as the shell, with a few things defined like this? (def dir (atom (System/getProperty user.home))) (defn pwd [] @dir) (defn cd [dir] (reset! @dir dir)) (defn ... ) -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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: cheatsheet problem
There is definitely a particular width that it was made for the layout to work well. I'm not enough of an HTML guru to know whether there is a good way to make it automatically adjust to display at other screen widths, but if you or someone else is, you can download the Clojure program that generates the cheatsheet HTML here, generate it, look at the HTML, and suggest changes: http://clojure.org/file/view/cheatsheet-2.0.zip/251017652/cheatsheet-2.0.zip Andy On Tue, Sep 20, 2011 at 10:24 AM, Jonathan Fischer Friberg odysso...@gmail.com wrote: Hi, When minimizing the cheatsheet, the section starting with Concurrency appears below everything else, and the section starting with Multimethods is where Concurrency used to be. (see attachment) If I minimize even more, the alignment is correct again. Jonathan -- 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: advantage of dynamic typing
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 20.09.2011 05:43, schrieb Sean Corfield: On Mon, Sep 19, 2011 at 4:19 PM, Dennis Haupt d.haup...@googlemail.com wrote: an advantage i see is very, very concise code since you have no type annotations at all. the downside is that exactly this code might be unreadable - because you just have no idea what it uses and what it does without tests or documentation. I find Clojure code more readable because it is generic. Instead of some algorithm specialized by type, Clojure often deals with simpler generic algorithms that are applicable to a broader class of data structures which can also mean more reuse. Writing truly generic code in the presence of a strong type system is often harder word and tends to produce much more dense, more annotated code that I find harder to understand. Take a look at the documentation for the Scala collection library, for example (I'm not dissing Scala - I like Scala, but I don't think anyone will disagree that the auto-generated documentation based on the library type signatures is very hard to read, at least for the average developer). i tend to completely ignore all non-trivial type signatures and treat them as what constraints are in a database. rules that prevent me from doing things that are obviously wrong. for scala's collection framework, that is enough. i can use it perfectly well, i know exactly what it does - i just don't know *how* in detail they work. but the trivial stuff like this parameter must support method x or always returns an instance of type x really helps. - -- -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.14 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJOePUTAAoJENRtux+h35aGGHAP/j0gCcyJIBntewvQCTgaS1Xz lOj4WnrJAfMWKK/Z2r0IBgKBCI8lwqRCYvzqDMa0tVi/Lnfk8tMVMjU2x0KSX1sZ BRSoWaueQzHmnbqtCr83vfeIhz9XngmeY8b8vJ+8WjYylK2OyUlfq6I2LhR/fy1M Un8SIiMT3RtUypDdWgHBALMNXnWbw+ToHHLOKX+XpXv4FjP8G8q6g/H2vouIAt0i tCEPom2aVpGguf2f3V49jcIzU03hwKM2qfnyF4B4rejuS17kGbpBSlaavdSfQus0 sv/s14EpoIOKcIp5SQqRRE96GfmHlopshNuoB4oS3qt57oeSudI20pl/8K/zdI6y 7CajeZUA/Sl56syjTjbdq0bwOcUwWrXJVDJefJ4tgSYJu2hQnTST6NS0Op1+Mm71 nTFG4+SgEMzXoT20NGoE16wKtJn//XLkKHzQ0h/1FvSJ6pTRL/+o8hj/lDA5Y/FD qLBGaJl6z8jXB8Nltv4nTCS24ZUAn8eDOhv184OvtkTxXXu7MZnu/XPoVueRrbzP /AWLjqPwko3MdEp8/ApqtKSdZ23rW4cm5Yxo/zytCoGoDSDu7/8m5XiWKUU2Oa2R MY8EUPcRz+qawE4CaFIevzLb/EfMgJnbtvBZ9LD6VQApFweIMO1/Rc6J1rRavwps MJWJC58v8gH0AKzs0lv5 =Rlqq -END PGP SIGNATURE- -- 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: defn alert fails in browser repl
(defn alert [ xs] (js/alert (apply str xs))) works in cljsc compiled code but not in the browser repl. There I get ClojureScript:cljs.user (defn alert [ xs] (js/alert (apply str xs))) #function (var_args){ var xs = null; if (goog.isDef(var_args)) { xs = cljs.core.array_seq(Array.prototype.slice.call(arguments, 0),0); } return alert__delegate.call(this, xs); } ClojureScript:cljs.user (alert 1 2 3) Error evaluating: (cljs.core.pr-str (alert 1 2 3)) :as cljs.core.pr_str.call(null,cljs.user.alert.call(null,1,2,3));\n #RangeError: Maximum call stack size exceeded nil Can anyone reproduce/explain? Thanks, Scott -- 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: advantage of dynamic typing
Scala is a OO language with FP support, clojure is a functional language with OO support, they are very different. It's normal for someone with a OO background to think that every method receives a object of some kind and it's good to know it's type in advance, and if you want polymorphism you create a subclass or implement an interface but in clojure functions are polymorphic not classes. Let's take the function first as an example, if you give a String to first you'll get the first char, if you give a vector or list you'll get the first element, if you give a java array you'll get the element at index 0. In scala each collection class has a overriden first method so you can have a static and pre-defined return type, in clojure the first function is itself polymorphic so it doesn't make sense to say that the return type of first is Object because it depends on the parameter. You can code clojure's first function in scala but the parameter and return type would be Object, and you would have to typecast it anyway. (Maybe with scala's extremely fancy type system you can create a generic first function a la clojure but the type signature would make my eyes hurt :) With doc, source (the functions) and the repl, a static typing system would'n be that useful -- 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: advantage of dynamic typing
On Tue, Sep 20, 2011 at 1:55 PM, Islon Scherer islonsche...@gmail.com wrote: type would be Object, and you would have to typecast it anyway. (Maybe with scala's extremely fancy type system you can create a generic first function a la clojure but the type signature would make my eyes hurt :) oh boy. if you think you have to typecast it, then you are using scala very wrong! now, i'm not a big fan of all the ascii overhead in scala, so like you say yes the eyes being to hurt -- i'm not saying that it is easy for people to get into the scala mindset and to understand how to really use it. BUT please nobody think that scala is trying to force you to do runtime typecasing. noo way! sincerely. :-) -- 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: advantage of dynamic typing
+1 On Sep 20, 4:43 am, Sean Corfield seancorfi...@gmail.com wrote: On Mon, Sep 19, 2011 at 4:19 PM, Dennis Haupt d.haup...@googlemail.com wrote: an advantage i see is very, very concise code since you have no type annotations at all. the downside is that exactly this code might be unreadable - because you just have no idea what it uses and what it does without tests or documentation. I find Clojure code more readable because it is generic. Instead of some algorithm specialized by type, Clojure often deals with simpler generic algorithms that are applicable to a broader class of data structures which can also mean more reuse. Writing truly generic code in the presence of a strong type system is often harder word and tends to produce much more dense, more annotated code that I find harder to understand. Take a look at the documentation for the Scala collection library, for example (I'm not dissing Scala - I like Scala, but I don't think anyone will disagree that the auto-generated documentation based on the library type signatures is very hard to read, at least for the average developer). -- Sean A Corfield -- (904) 302-SEAN An Architect's View --http://corfield.org/ World Singles, LLC. --http://worldsingles.com/ Railo Technologies, Inc. --http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- 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: advantage of dynamic typing
Hello, The problem I see with using types is that imposing type X and type Y for the input arguments of method f is generally imposing too much constraint. Generally, the function just needs a subset of the types characteristics, and that's where genericity disappears. I would see no problem of e.g. having a way to explicitly declare, in the public interface of the function (as opposed to derived implicitly from the current implementation detail of the function) the necessary constraints on the function arguments. And the guarantees on the function's result. Those could then allow more checks at compile time, without sacrificing genericity of the code. Using interfaces in java is a way towards that goal, though since java does not allow to retrofit existing classes into new interfaces, this generally falls short of being generic enough. Using protocols in clojure, and with the property of protocols that they are implied to be more orthogonal than to form a hierarchy, seems interesting in this area. Finally, there will still be functions which are doing the specific jobs for specific types/records/whatever = so there's certainly still merits to be able to constrain some function arguments to specific types. HTH, -- Laurent 2011/9/20 Sean Corfield seancorfi...@gmail.com On Mon, Sep 19, 2011 at 4:19 PM, Dennis Haupt d.haup...@googlemail.com wrote: an advantage i see is very, very concise code since you have no type annotations at all. the downside is that exactly this code might be unreadable - because you just have no idea what it uses and what it does without tests or documentation. I find Clojure code more readable because it is generic. Instead of some algorithm specialized by type, Clojure often deals with simpler generic algorithms that are applicable to a broader class of data structures which can also mean more reuse. Writing truly generic code in the presence of a strong type system is often harder word and tends to produce much more dense, more annotated code that I find harder to understand. Take a look at the documentation for the Scala collection library, for example (I'm not dissing Scala - I like Scala, but I don't think anyone will disagree that the auto-generated documentation based on the library type signatures is very hard to read, at least for the average developer). -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- 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: advantage of dynamic typing
Another detail to remember for Clojure / other FP languagens, is that we don't have objects!, most of time we are using basic structures, and none of them has methods, in case, most of time we are expecting lists or hashes, in hashes, we most of time expect some keys to be present, and that's all... I really don't like to mix up clojure code with Java, when I really need Java, I always write some wrappers, so when I use it feels more Clojure. --- Wilker Lúcio http://about.me/wilkerlucio/bio Kajabi Consultant +55 81 82556600 On Tue, Sep 20, 2011 at 8:51 PM, Laurent PETIT laurent.pe...@gmail.comwrote: Hello, The problem I see with using types is that imposing type X and type Y for the input arguments of method f is generally imposing too much constraint. Generally, the function just needs a subset of the types characteristics, and that's where genericity disappears. I would see no problem of e.g. having a way to explicitly declare, in the public interface of the function (as opposed to derived implicitly from the current implementation detail of the function) the necessary constraints on the function arguments. And the guarantees on the function's result. Those could then allow more checks at compile time, without sacrificing genericity of the code. Using interfaces in java is a way towards that goal, though since java does not allow to retrofit existing classes into new interfaces, this generally falls short of being generic enough. Using protocols in clojure, and with the property of protocols that they are implied to be more orthogonal than to form a hierarchy, seems interesting in this area. Finally, there will still be functions which are doing the specific jobs for specific types/records/whatever = so there's certainly still merits to be able to constrain some function arguments to specific types. HTH, -- Laurent 2011/9/20 Sean Corfield seancorfi...@gmail.com On Mon, Sep 19, 2011 at 4:19 PM, Dennis Haupt d.haup...@googlemail.com wrote: an advantage i see is very, very concise code since you have no type annotations at all. the downside is that exactly this code might be unreadable - because you just have no idea what it uses and what it does without tests or documentation. I find Clojure code more readable because it is generic. Instead of some algorithm specialized by type, Clojure often deals with simpler generic algorithms that are applicable to a broader class of data structures which can also mean more reuse. Writing truly generic code in the presence of a strong type system is often harder word and tends to produce much more dense, more annotated code that I find harder to understand. Take a look at the documentation for the Scala collection library, for example (I'm not dissing Scala - I like Scala, but I don't think anyone will disagree that the auto-generated documentation based on the library type signatures is very hard to read, at least for the average developer). -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: advantage of dynamic typing
Dynamic typing just relax you at coding and compiling moment. The type interferacing is done at runtime. The pro is less formal coding especially on algorithms and cons that data structures must be documented outside the code unless language supports type specifing. Just read about haskell it will give you the wisdom (google learn haskell for great good), for example haskell is static typed but it also gives you power of algorithm eloquence like you would write in dynamic language, just at some point in code you must specify what types you are actually using in your solution. On 19 Wrz, 23:19, Dennis Haupt d.haup...@googlemail.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi community, clojure is dynamically typed, so i thought here i might find some good reasons for that. what can you do if you sacrifice compile time type safety? an advantage i see is very, very concise code since you have no type annotations at all. the downside is that exactly this code might be unreadable - because you just have no idea what it uses and what it does without tests or documentation. another advantage are macros or macro-like constructs at compile time, for example: resultset.columnname here, columnname could be translated to resultset.getObject(columnname). you could even go a step further and use the column names as local variables. again, conciseness to the max. what else is there? is it worth sacrificing type safety? and is there no way to combine both? - -- -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.14 (MingW32) Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJOd7HzAAoJENRtux+h35aGPfwP/iwwAdhTDfCmTzmMnp6QYnjf PEz+DDr7RxnCpTI/ptL73lSeFs2ctQGllzWgf6I2tZU+yB06ReGu/piIIZW/Z+sx 3TtIK+w9r3Jzz8lI0AljM5kfo+Zo/1OBgVaGkxon1NPbhZBnH0FpfeU43H7FnuhA 7bOu3HceOf8ju8fNNQmS+LLoueQJBEaRNn/tWkk5a/y1Ipg5hbETe/YL1+VnpAMg xyIRkfDFwtIlnZ8+0IMpdusI7PBOj+v9VINtSkAUkZptz9wvSFj4JghXU6Mw8dUp ATZSWGgdXZUrihNQ90K7OlIBG3xFrGiddSO5Gphe+PQFOwxaAf9x3z1opXVYJqt/ 7u64JHdqTQkBe4TUSEh5024CdgpLIRvXh54fthl84yjfGeodvibdEwCwg6NSF80o vl5XzeAuB/xaDkvlAE6aq2peh8+foJAxiiWoc+pKZOxYMm1lwKWTbYnnp0Slr8ym 6CB2dAX+vF/FIV3ctJvJJYcELX/ydTp0p3RoARtHD8QNebRjTlZ2VqLQqRdF1a4b Nc6tZUAmx1+zYLE+YavBIbgXwssw07MMtJfsyL4tIoX6+q7oQtsdPcVV+4/HvmcX 6d3bzdCHYod6lLcbZvBhm70DUUrxTMdF73VCvNMUwpPq9OvhRd650puMQwC+/zoK Pob2xj0YER0b1UHNKVFS =jV+l -END PGP SIGNATURE- -- 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 on repl.it?
Wouldn't it be nice to add ClojureScript to this list: http://repl.it/ Food for thought! -- 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: implement a shell in repl
Good point. I think I need to find out how to make the shell prompt for user input, e.g. when the user log into a system, the shell will prompt to ask for a password On Sep 20, 4:03 pm, Sanel Zukan san...@gmail.com wrote: I had quite similar task, integrating custom shell with clojure repl, where all expressions between parenthesis were interpreted as clojure code and rest as custom shell programs. The best way to do this is to explore (clojure.main/repl) function. One of the parameters will be :eval function; there clojure repl will send all expressions for evaluation. It could look like this: (defn evaluate [expr] (if (re-find #^(.*)$ expr) (eval expr) ;; here you call some java code for executing system commands ;; like (.exec (Runtime/getRuntime) expr) or something like that ) ) (clojure.main/repl :eval evaluate) With clojure.main/repl you can do even more: write custom input, output and such. Feel free to explore it ;) Sanel On Sep 20, 9:38 am, jaime xiejianm...@gmail.com wrote: Hi guys, I want to implement a shell on top of REPL but without any ideas on how to do it. Could you please suggest? What I want is something that can let user do things like: 1. in REPL, user enter (myshell) (or some other command name) 2. then a prompt string will show up so that user can interact with Clojure 3. built-in commands support is possible 4. prompt for user input is possible (I think this is the most import part that I want, but I don't know how I can make REPL prompts a user input...) 5. real Clojure form can be dispatch to REPL and the shell can show the result returned by REPL is there any project already on this, or is it possible to implement it in some kind of ways?? Thanks, Jaime -- 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: implement a shell in repl
This may not work the way I want...but yes I will give it a shot. :-) On Sep 21, 2:08 am, Ken Wesson kwess...@gmail.com wrote: Wouldn't the simplest way be to simply use the REPL itself as the shell, with a few things defined like this? (def dir (atom (System/getProperty user.home))) (defn pwd [] @dir) (defn cd [dir] (reset! @dir dir)) (defn ... ) -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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: Problem getting Browser Repl Env to Work
Hi everybody, I'm trying out the new browser repl-environment using both the tutorial (https://github.com/clojure/clojurescript/wiki/The-REPL-and- Evaluation-Environments) but so far am unable to get it to work. Using current (as of the writing of this mail) master from github, and following the Steps in the tutorial: 1. Starting up the repl works, leads me straight to the repl (i.e. allows me to enter an expression). I remember trying a previous version of the in-browser repl which worked for me, but in which i couldn't enter anything before the browser initiated a connection. The docs mention a wait for a browser connection being neccesary here ... 2. Setting up the XPC communication works, i.e. I see the initial GET request receiving sensible-looking javascript, and I see a POST of ready being answered by a goog.provide('user'). 3. That's it however - connection closed. Non-surprisingly, entering any expression only hangs the REPL. Using curl as per browser.clj: 1. Startting REPL works, as above 2. curl -v -d ready http://localhost:9000/ responds with HTTP/1.1 200 OK Server: ClojureScript REPL Content-Type: text/javascript; charset=utf-8 Content-Length: 26 * Connection #0 to host localhost left intact * Closing connection #0 goog.provide('cljs.user'); 3. Looking not too bad except for the closed connection, so entering (+ 1 1) hangs the REPL 4. curl -v -d 2 http://127.0.0.1:9000 then responds with the compiled javascript as far as I can tell: HTTP/1.1 200 OK Server: ClojureScript REPL Content-Type: text/javascript; charset=utf-8 Content-Length: 61 cljs.core.pr_str.call(null,cljs.core._PLUS_.call(null,1,1)); * Connection #0 to host localhost left intact * Closing connection #0 To me it seems that something is awry with keeping that connection really open on my system. I'm on Debian SID and tried with firefox 6 and 7-beta as well as with google-chrome. JDK is Oracle Java 1,6.0_26-b03, ClojureScript is as stated above a vanilla copy of current master, freshly bootstrapped. Reverting to select previous states of ClojureScript (i.e. right after clojure.browser was merged into master, and right before) yielded no better results, except that those didn't get me to a REPL prompt at all and were stuck at Server started The last and only time I had that working was with the clojure.browser branch from some time around August 26th. What am I doing wrong? Any hints? regards, Volker -- 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: Storm
Hi Nathan, On Tue, Sep 20, 2011 at 8:35 PM, nathanmarz nathan.m...@gmail.com wrote: Yesterday I open-sourced Storm at Strange Loop. Storm is a distributed and fault-tolerant realtime computation system hosted at https://github.com/nathanmarz/storm I would like to congratulate you on the release. Storm seems to be very interesting and apparently it has certain advantages that no other existing system seem to offer. ones) on top of Storm. That said, Storm has a Clojure DSL for programming topologies which is what I personally use for developing topologies. It would be great if the Clojure DSL is documented on the wiki (or did I miss it?). I am really keen on taking it for a test drive and I am sure others in the Clojure community would like to do so as well. Regards, BG -- 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