Re: Defs with %
thanks for the report, fixed On Wed, Jun 18, 2014 at 1:30 AM, Mike Thompson m.l.thompson...@gmail.com wrote: Colin, many thanks. Issue created: https://github.com/cgrand/sjacket/issues/19 On Wednesday, June 18, 2014 4:08:53 AM UTC+10, Colin Jones wrote: Yeah the latter version parses as 2 symbols in sjacket, whereas the defn version parses as a single list. user= (p/parser top%) #net.cgrand.parsley.Node{:tag :net.cgrand.sjacket.parser/root, :content [#net.cgrand.parsley.Node{:tag :symbol, :content [#net.cgrand.parsley.Node{:tag :name, :content [top]}]} #net.cgrand.parsley.Node{:tag :symbol, :content [#net.cgrand.parsley.Node{:tag :name, :content [%]}]}]} REPLy uses sjacket to split input expressions and send them each off to nREPL in sequence, IIRC so that you get all results back from stuff like: user= 1 2 3 1 2 3 So it treats the top% input basically the same as if there were intervening whitespace, like top %. From http://clojure.org/reader: - Symbols begin with a non-numeric character and can contain alphanumeric characters and *, +, !, -, _, and ? (other characters will be allowed eventually, but not all macro characters have been determined). '/' has special meaning, it can be used once in the middle of a symbol to separate the namespace from the name, e.g. my-namespace/foo. '/' by itself names the division function. '.' has special meaning - it can be used one or more times in the middle of a symbol to designate a fully-qualified class name, e.g. java.util.BitSet, or in namespace names. Symbols beginning or ending with '.' are reserved by Clojure. Symbols containing / or . are said to be 'qualified'. Symbols beginning or ending with ':' are reserved by Clojure. A symbol can contain one or more non-repeating ':'s. - So it looks to me like that function name is illegal, and it's an implementation detail that it currently is allowed to work. Usually parsing fixes for lein repl belong in sjacket ( https://github.com/cgrand/sjacket/issues), but I'm not 100% convinced the parser should say top% is a legitimate symbol. But I'm also not convinced it should ever be possible for 2 symbols to be right next to each other with no intervening whitespace. Not sure what the right thing to do is here. Let's discuss further in an issue on sjacket. Short-term workaround: `(do top%)`. On Tuesday, June 17, 2014 9:54:25 AM UTC-5, daveray wrote: I believe this is a problem with the Leiningen REPL. It works fine from the built-in REPL: $ java -jar ~/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar Clojure 1.5.1 user= (def top% 4) #'user/top% user= top% 4 Dave On Tue, Jun 17, 2014 at 1:32 AM, Mike Thompson m.l.tho...@gmail.com wrote: At the REPL ... user= (def top% 4) ;; an unusually named var #'user/top% But later, it I try to use this var, trouble ... user= top% CompilerException java.lang.RuntimeException: Unable to resolve symbol: top in this context, compiling:(Local\Temp\form- init6773082655831127234.clj:1:734) CompilerException java.lang.RuntimeException: Unable to resolve symbol: % in this context, compiling:(Local\Temp\form- init6773082655831127234.clj:1:734) Not sure what to make if this. Obviously % is a bit special. And it is certainly not a significant problem for me, at all. Just seemed odd that I'm allowed to successfully do the def, if it is just going to cause problems later. -- Mike -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@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+u...@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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. On Wednesday, June 18, 2014 4:08:53 AM UTC+10, Colin Jones wrote: Yeah the latter version parses as 2 symbols in sjacket, whereas the defn version parses as a single list. user= (p/parser top%) #net.cgrand.parsley.Node{:tag :net.cgrand.sjacket.parser/root, :content [#net.cgrand.parsley.Node{:tag :symbol, :content [#net.cgrand.parsley.Node{:tag :name, :content [top]}]} #net.cgrand.parsley.Node{:tag :symbol, :content [#net.cgrand.parsley.Node{:tag :name, :content [%]}]}]} REPLy uses sjacket to split input expressions and send them each off to nREPL in sequence, IIRC so that you get all results back from stuff like: user= 1 2 3 1 2 3 So it treats the top% input basically the same as if there were intervening whitespace, like top %. From http://clojure.org/reader: - Symbols begin with a
Re: Defs with %
I believe this is a problem with the Leiningen REPL. It works fine from the built-in REPL: $ java -jar ~/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar Clojure 1.5.1 user= (def top% 4) #'user/top% user= top% 4 Dave On Tue, Jun 17, 2014 at 1:32 AM, Mike Thompson m.l.thompson...@gmail.com wrote: At the REPL ... user= (def top% 4) ;; an unusually named var #'user/top% But later, it I try to use this var, trouble ... user= top% CompilerException java.lang.RuntimeException: Unable to resolve symbol: top in this context, compiling:(Local\Temp\form-init6773082655831127234.clj:1:734) CompilerException java.lang.RuntimeException: Unable to resolve symbol: % in this context, compiling:(Local\Temp\form-init6773082655831127234.clj:1:734) Not sure what to make if this. Obviously % is a bit special. And it is certainly not a significant problem for me, at all. Just seemed odd that I'm allowed to successfully do the def, if it is just going to cause problems later. -- Mike -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Defs with %
Yeah the latter version parses as 2 symbols in sjacket, whereas the defn version parses as a single list. user= (p/parser top%) #net.cgrand.parsley.Node{:tag :net.cgrand.sjacket.parser/root, :content [#net.cgrand.parsley.Node{:tag :symbol, :content [#net.cgrand.parsley.Node{:tag :name, :content [top]}]} #net.cgrand.parsley.Node{:tag :symbol, :content [#net.cgrand.parsley.Node{:tag :name, :content [%]}]}]} REPLy uses sjacket to split input expressions and send them each off to nREPL in sequence, IIRC so that you get all results back from stuff like: user= 1 2 3 1 2 3 So it treats the top% input basically the same as if there were intervening whitespace, like top %. From http://clojure.org/reader: - Symbols begin with a non-numeric character and can contain alphanumeric characters and *, +, !, -, _, and ? (other characters will be allowed eventually, but not all macro characters have been determined). '/' has special meaning, it can be used once in the middle of a symbol to separate the namespace from the name, e.g. my-namespace/foo. '/' by itself names the division function. '.' has special meaning - it can be used one or more times in the middle of a symbol to designate a fully-qualified class name, e.g. java.util.BitSet, or in namespace names. Symbols beginning or ending with '.' are reserved by Clojure. Symbols containing / or . are said to be 'qualified'. Symbols beginning or ending with ':' are reserved by Clojure. A symbol can contain one or more non-repeating ':'s. - So it looks to me like that function name is illegal, and it's an implementation detail that it currently is allowed to work. Usually parsing fixes for lein repl belong in sjacket (https://github.com/cgrand/sjacket/issues), but I'm not 100% convinced the parser should say top% is a legitimate symbol. But I'm also not convinced it should ever be possible for 2 symbols to be right next to each other with no intervening whitespace. Not sure what the right thing to do is here. Let's discuss further in an issue on sjacket. Short-term workaround: `(do top%)`. On Tuesday, June 17, 2014 9:54:25 AM UTC-5, daveray wrote: I believe this is a problem with the Leiningen REPL. It works fine from the built-in REPL: $ java -jar ~/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar Clojure 1.5.1 user= (def top% 4) #'user/top% user= top% 4 Dave On Tue, Jun 17, 2014 at 1:32 AM, Mike Thompson m.l.tho...@gmail.com javascript: wrote: At the REPL ... user= (def top% 4) ;; an unusually named var #'user/top% But later, it I try to use this var, trouble ... user= top% CompilerException java.lang.RuntimeException: Unable to resolve symbol: top in this context, compiling:(Local\Temp\form-init6773082655831127234.clj:1:734) CompilerException java.lang.RuntimeException: Unable to resolve symbol: % in this context, compiling:(Local\Temp\form-init6773082655831127234.clj:1:734) Not sure what to make if this. Obviously % is a bit special. And it is certainly not a significant problem for me, at all. Just seemed odd that I'm allowed to successfully do the def, if it is just going to cause problems later. -- Mike -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com javascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Defs with %
Colin, many thanks. Issue created: https://github.com/cgrand/sjacket/issues/19 On Wednesday, June 18, 2014 4:08:53 AM UTC+10, Colin Jones wrote: Yeah the latter version parses as 2 symbols in sjacket, whereas the defn version parses as a single list. user= (p/parser top%) #net.cgrand.parsley.Node{:tag :net.cgrand.sjacket.parser/root, :content [#net.cgrand.parsley.Node{:tag :symbol, :content [#net.cgrand.parsley.Node{:tag :name, :content [top]}]} #net.cgrand.parsley.Node{:tag :symbol, :content [#net.cgrand.parsley.Node{:tag :name, :content [%]}]}]} REPLy uses sjacket to split input expressions and send them each off to nREPL in sequence, IIRC so that you get all results back from stuff like: user= 1 2 3 1 2 3 So it treats the top% input basically the same as if there were intervening whitespace, like top %. From http://clojure.org/reader: - Symbols begin with a non-numeric character and can contain alphanumeric characters and *, +, !, -, _, and ? (other characters will be allowed eventually, but not all macro characters have been determined). '/' has special meaning, it can be used once in the middle of a symbol to separate the namespace from the name, e.g. my-namespace/foo. '/' by itself names the division function. '.' has special meaning - it can be used one or more times in the middle of a symbol to designate a fully-qualified class name, e.g. java.util.BitSet, or in namespace names. Symbols beginning or ending with '.' are reserved by Clojure. Symbols containing / or . are said to be 'qualified'. Symbols beginning or ending with ':' are reserved by Clojure. A symbol can contain one or more non-repeating ':'s. - So it looks to me like that function name is illegal, and it's an implementation detail that it currently is allowed to work. Usually parsing fixes for lein repl belong in sjacket ( https://github.com/cgrand/sjacket/issues), but I'm not 100% convinced the parser should say top% is a legitimate symbol. But I'm also not convinced it should ever be possible for 2 symbols to be right next to each other with no intervening whitespace. Not sure what the right thing to do is here. Let's discuss further in an issue on sjacket. Short-term workaround: `(do top%)`. On Tuesday, June 17, 2014 9:54:25 AM UTC-5, daveray wrote: I believe this is a problem with the Leiningen REPL. It works fine from the built-in REPL: $ java -jar ~/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar Clojure 1.5.1 user= (def top% 4) #'user/top% user= top% 4 Dave On Tue, Jun 17, 2014 at 1:32 AM, Mike Thompson m.l.tho...@gmail.com wrote: At the REPL ... user= (def top% 4) ;; an unusually named var #'user/top% But later, it I try to use this var, trouble ... user= top% CompilerException java.lang.RuntimeException: Unable to resolve symbol: top in this context, compiling:(Local\Temp\form-init6773082655831127234.clj:1:734) CompilerException java.lang.RuntimeException: Unable to resolve symbol: % in this context, compiling:(Local\Temp\form-init6773082655831127234.clj:1:734) Not sure what to make if this. Obviously % is a bit special. And it is certainly not a significant problem for me, at all. Just seemed odd that I'm allowed to successfully do the def, if it is just going to cause problems later. -- Mike -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@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+u...@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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. On Wednesday, June 18, 2014 4:08:53 AM UTC+10, Colin Jones wrote: Yeah the latter version parses as 2 symbols in sjacket, whereas the defn version parses as a single list. user= (p/parser top%) #net.cgrand.parsley.Node{:tag :net.cgrand.sjacket.parser/root, :content [#net.cgrand.parsley.Node{:tag :symbol, :content [#net.cgrand.parsley.Node{:tag :name, :content [top]}]} #net.cgrand.parsley.Node{:tag :symbol, :content [#net.cgrand.parsley.Node{:tag :name, :content [%]}]}]} REPLy uses sjacket to split input expressions and send them each off to nREPL in sequence, IIRC so that you get all results back from stuff like: user= 1 2 3 1 2 3 So it treats the top% input basically the same as if there were intervening whitespace, like top %. From http://clojure.org/reader: - Symbols begin with a non-numeric character and can contain alphanumeric characters and *, +,
Re: defs in Clojurescript REPL
I'd rather see something at the beginning or at the end of the statement. like ^:toss (def ...) or (def ...) ;; On Tue, May 15, 2012 at 6:50 AM, Michał Marczyk michal.marc...@gmail.com wrote: Workaround: (do (def foo (build-something-enormous)) nil) As for the reason for this behaviour -- probably non other than it's just the easiest thing for def in ClojureScript to do; it being to inherit the return value from the JavaScript assignment def compiles to. Sticking a void () around the assignment (so that (def foo ...) would do what (js* void (~{}) (def foo ...)) does currently) would be a straightforward way of suppressing the returned value. I can put together the (trivial) patch to do that in :statement context in the presence of a flag if this seems useful. The REPL could just set this flag by default. Sincerely, Michał On 15 May 2012 06:14, kovas boguta kovas.bog...@gmail.com wrote: I think this is a pretty valid feature request. The main question is, can this be done without having vars in clojurescript. One way to do it is to surpress output somehow, under certain conditions. Either as a token at the end of a repl input, or in the semantics of def itself. I don't have an ideal specific solution here, but I've noticed this problem as well and found it pretty annoying. There should be a way to solve it that is a reasonable compromise. On Mon, May 14, 2012 at 11:13 PM, Mark Engelberg mark.engelb...@gmail.com wrote: On Mon, May 14, 2012 at 4:41 PM, David Nolen dnolen.li...@gmail.com wrote: On Mon, May 14, 2012 at 7:27 PM, Mark Engelberg mark.engelb...@gmail.com wrote: (def tree (function-that-produces-an-enormous-tree 2)) Isn't doing this at the top level bad form? The purpose of a REPL is for interactive experimentation. I want to give names to the things I'm building so I can play with them in the REPL. Nothing bad form about that. Also I don't see how this isn't solved by modifying some habits. (defn test-tree [] (function-that-produces-an-enormous-tree 2)) (time (test-tree)) time prints out the value that is computed. The above example would suffer the same problem of printing out the tree at the REPL. You could do something like (time (do (test-tree) nil)) to suppress printing, but if you want to do further interactive manipulations to the tree, you'd end up recomputing it. So then, you get into workarounds involving delay. It starts to get ugly, I think. Clojure's ability to give names to things without printing the values is a feature I use every day in my interactive explorations. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: defs in Clojurescript REPL
That doesn't seem to free one from the need to take special care when assigning potentially large lazy values to names with def. If exercising special care on a case-by-case basis is not a problem, then it's already possible to say (do (def ...) nil) or similar, as mentioned above. You can also say (def toss (constantly nil)) and use (toss (def ...)). Sincerely, Michał On 16 May 2012 08:58, kovas boguta kovas.bog...@gmail.com wrote: I'd rather see something at the beginning or at the end of the statement. like ^:toss (def ...) or (def ...) ;; On Tue, May 15, 2012 at 6:50 AM, Michał Marczyk michal.marc...@gmail.com wrote: Workaround: (do (def foo (build-something-enormous)) nil) As for the reason for this behaviour -- probably non other than it's just the easiest thing for def in ClojureScript to do; it being to inherit the return value from the JavaScript assignment def compiles to. Sticking a void () around the assignment (so that (def foo ...) would do what (js* void (~{}) (def foo ...)) does currently) would be a straightforward way of suppressing the returned value. I can put together the (trivial) patch to do that in :statement context in the presence of a flag if this seems useful. The REPL could just set this flag by default. Sincerely, Michał On 15 May 2012 06:14, kovas boguta kovas.bog...@gmail.com wrote: I think this is a pretty valid feature request. The main question is, can this be done without having vars in clojurescript. One way to do it is to surpress output somehow, under certain conditions. Either as a token at the end of a repl input, or in the semantics of def itself. I don't have an ideal specific solution here, but I've noticed this problem as well and found it pretty annoying. There should be a way to solve it that is a reasonable compromise. On Mon, May 14, 2012 at 11:13 PM, Mark Engelberg mark.engelb...@gmail.com wrote: On Mon, May 14, 2012 at 4:41 PM, David Nolen dnolen.li...@gmail.com wrote: On Mon, May 14, 2012 at 7:27 PM, Mark Engelberg mark.engelb...@gmail.com wrote: (def tree (function-that-produces-an-enormous-tree 2)) Isn't doing this at the top level bad form? The purpose of a REPL is for interactive experimentation. I want to give names to the things I'm building so I can play with them in the REPL. Nothing bad form about that. Also I don't see how this isn't solved by modifying some habits. (defn test-tree [] (function-that-produces-an-enormous-tree 2)) (time (test-tree)) time prints out the value that is computed. The above example would suffer the same problem of printing out the tree at the REPL. You could do something like (time (do (test-tree) nil)) to suppress printing, but if you want to do further interactive manipulations to the tree, you'd end up recomputing it. So then, you get into workarounds involving delay. It starts to get ugly, I think. Clojure's ability to give names to things without printing the values is a feature I use every day in my interactive explorations. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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
Re: defs in Clojurescript REPL
Clojurescript doesn't have vars, so why not have def return the symbol ? Le 15 mai 2012 à 06:14, kovas boguta kovas.bog...@gmail.com a écrit : I think this is a pretty valid feature request. The main question is, can this be done without having vars in clojurescript. One way to do it is to surpress output somehow, under certain conditions. Either as a token at the end of a repl input, or in the semantics of def itself. I don't have an ideal specific solution here, but I've noticed this problem as well and found it pretty annoying. There should be a way to solve it that is a reasonable compromise. On Mon, May 14, 2012 at 11:13 PM, Mark Engelberg mark.engelb...@gmail.com wrote: On Mon, May 14, 2012 at 4:41 PM, David Nolen dnolen.li...@gmail.com wrote: On Mon, May 14, 2012 at 7:27 PM, Mark Engelberg mark.engelb...@gmail.com wrote: (def tree (function-that-produces-an-enormous-tree 2)) Isn't doing this at the top level bad form? The purpose of a REPL is for interactive experimentation. I want to give names to the things I'm building so I can play with them in the REPL. Nothing bad form about that. Also I don't see how this isn't solved by modifying some habits. (defn test-tree [] (function-that-produces-an-enormous-tree 2)) (time (test-tree)) time prints out the value that is computed. The above example would suffer the same problem of printing out the tree at the REPL. You could do something like (time (do (test-tree) nil)) to suppress printing, but if you want to do further interactive manipulations to the tree, you'd end up recomputing it. So then, you get into workarounds involving delay. It starts to get ugly, I think. Clojure's ability to give names to things without printing the values is a feature I use every day in my interactive explorations. -- 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: defs in Clojurescript REPL
Yeah, that is sort of what I was implying in changing the semantics of def Though I wasn't ready to totally committed to that, since I don't understand the properties of symbols in clojurescript. Like, how do go from the symbol to the javascript object we've just bound to the symbol? On Tue, May 15, 2012 at 2:26 AM, Laurent PETIT laurent.pe...@gmail.com wrote: Clojurescript doesn't have vars, so why not have def return the symbol ? Le 15 mai 2012 à 06:14, kovas boguta kovas.bog...@gmail.com a écrit : I think this is a pretty valid feature request. The main question is, can this be done without having vars in clojurescript. One way to do it is to surpress output somehow, under certain conditions. Either as a token at the end of a repl input, or in the semantics of def itself. I don't have an ideal specific solution here, but I've noticed this problem as well and found it pretty annoying. There should be a way to solve it that is a reasonable compromise. On Mon, May 14, 2012 at 11:13 PM, Mark Engelberg mark.engelb...@gmail.com wrote: On Mon, May 14, 2012 at 4:41 PM, David Nolen dnolen.li...@gmail.com wrote: On Mon, May 14, 2012 at 7:27 PM, Mark Engelberg mark.engelb...@gmail.com wrote: (def tree (function-that-produces-an-enormous-tree 2)) Isn't doing this at the top level bad form? The purpose of a REPL is for interactive experimentation. I want to give names to the things I'm building so I can play with them in the REPL. Nothing bad form about that. Also I don't see how this isn't solved by modifying some habits. (defn test-tree [] (function-that-produces-an-enormous-tree 2)) (time (test-tree)) time prints out the value that is computed. The above example would suffer the same problem of printing out the tree at the REPL. You could do something like (time (do (test-tree) nil)) to suppress printing, but if you want to do further interactive manipulations to the tree, you'd end up recomputing it. So then, you get into workarounds involving delay. It starts to get ugly, I think. Clojure's ability to give names to things without printing the values is a feature I use every day in my interactive explorations. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: defs in Clojurescript REPL
Returning the symbol seems odd at least to me. I think the best we could do is have a compiler flag so that defs can return nil for REPLs. On Tuesday, May 15, 2012, kovas boguta wrote: Yeah, that is sort of what I was implying in changing the semantics of def Though I wasn't ready to totally committed to that, since I don't understand the properties of symbols in clojurescript. Like, how do go from the symbol to the javascript object we've just bound to the symbol? On Tue, May 15, 2012 at 2:26 AM, Laurent PETIT laurent.pe...@gmail.com wrote: Clojurescript doesn't have vars, so why not have def return the symbol ? Le 15 mai 2012 à 06:14, kovas boguta kovas.bog...@gmail.com a écrit : I think this is a pretty valid feature request. The main question is, can this be done without having vars in clojurescript. One way to do it is to surpress output somehow, under certain conditions. Either as a token at the end of a repl input, or in the semantics of def itself. I don't have an ideal specific solution here, but I've noticed this problem as well and found it pretty annoying. There should be a way to solve it that is a reasonable compromise. On Mon, May 14, 2012 at 11:13 PM, Mark Engelberg mark.engelb...@gmail.com wrote: On Mon, May 14, 2012 at 4:41 PM, David Nolen dnolen.li...@gmail.com wrote: On Mon, May 14, 2012 at 7:27 PM, Mark Engelberg mark.engelb...@gmail.com wrote: (def tree (function-that-produces-an-enormous-tree 2)) Isn't doing this at the top level bad form? The purpose of a REPL is for interactive experimentation. I want to give names to the things I'm building so I can play with them in the REPL. Nothing bad form about that. Also I don't see how this isn't solved by modifying some habits. (defn test-tree [] (function-that-produces-an-enormous-tree 2)) (time (test-tree)) time prints out the value that is computed. The above example would suffer the same problem of printing out the tree at the REPL. You could do something like (time (do (test-tree) nil)) to suppress printing, but if you want to do further interactive manipulations to the tree, you'd end up recomputing it. So then, you get into workarounds involving delay. It starts to get ugly, I think. Clojure's ability to give names to things without printing the values is a feature I use every day in my interactive explorations. -- 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 r -- 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: defs in Clojurescript REPL
Workaround: (do (def foo (build-something-enormous)) nil) As for the reason for this behaviour -- probably non other than it's just the easiest thing for def in ClojureScript to do; it being to inherit the return value from the JavaScript assignment def compiles to. Sticking a void () around the assignment (so that (def foo ...) would do what (js* void (~{}) (def foo ...)) does currently) would be a straightforward way of suppressing the returned value. I can put together the (trivial) patch to do that in :statement context in the presence of a flag if this seems useful. The REPL could just set this flag by default. Sincerely, Michał On 15 May 2012 06:14, kovas boguta kovas.bog...@gmail.com wrote: I think this is a pretty valid feature request. The main question is, can this be done without having vars in clojurescript. One way to do it is to surpress output somehow, under certain conditions. Either as a token at the end of a repl input, or in the semantics of def itself. I don't have an ideal specific solution here, but I've noticed this problem as well and found it pretty annoying. There should be a way to solve it that is a reasonable compromise. On Mon, May 14, 2012 at 11:13 PM, Mark Engelberg mark.engelb...@gmail.com wrote: On Mon, May 14, 2012 at 4:41 PM, David Nolen dnolen.li...@gmail.com wrote: On Mon, May 14, 2012 at 7:27 PM, Mark Engelberg mark.engelb...@gmail.com wrote: (def tree (function-that-produces-an-enormous-tree 2)) Isn't doing this at the top level bad form? The purpose of a REPL is for interactive experimentation. I want to give names to the things I'm building so I can play with them in the REPL. Nothing bad form about that. Also I don't see how this isn't solved by modifying some habits. (defn test-tree [] (function-that-produces-an-enormous-tree 2)) (time (test-tree)) time prints out the value that is computed. The above example would suffer the same problem of printing out the tree at the REPL. You could do something like (time (do (test-tree) nil)) to suppress printing, but if you want to do further interactive manipulations to the tree, you'd end up recomputing it. So then, you get into workarounds involving delay. It starts to get ugly, I think. Clojure's ability to give names to things without printing the values is a feature I use every day in my interactive explorations. -- 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: defs in Clojurescript REPL
Do you have a more specific example of why this is a problem? On Monday, May 14, 2012, Mark Engelberg wrote: In Clojure, when you def a variable, the REPL prints the name of the variable rather than the value. In Clojurescript, when you def a variable, the REPL prints the value assigned to the variable. This is problematic when working with lazy values. Is there any particular reason the Clojurescript REPL is designed to behave in this way? Thanks, Mark -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.comjavascript:_e({}, 'cvml', '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 javascript:_e({}, 'cvml', 'clojure%2bunsubscr...@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: defs in Clojurescript REPL
(def tree (function-that-produces-an-enormous-tree 2)) Want do that in Clojurescript, and you'll be treated to tons and tons of nested tree data printed to the REPL. Want to time something that's supposed to be lazy, to make sure it's really lazy, and see how long it takes to produce the eager aspects? In Clojure, that's easy: (time (def result (lazy-function 10))) In Clojurescript, the REPL will produce the whole lazy sequence. That's bad. So there are a couple examples of things that are harder to do when your REPL prints the values that are attached to variables. But again, the real question here is, why does Clojurescript deviate on this point? I know that Clojurescript doesn't exactly match Clojure, but shouldn't all deviations be done for a reason? --Mark On Mon, May 14, 2012 at 5:06 AM, David Nolen dnolen.li...@gmail.com wrote: Do you have a more specific example of why this is a problem? On Monday, May 14, 2012, Mark Engelberg wrote: In Clojure, when you def a variable, the REPL prints the name of the variable rather than the value. In Clojurescript, when you def a variable, the REPL prints the value assigned to the variable. This is problematic when working with lazy values. Is there any particular reason the Clojurescript REPL is designed to behave in this way? Thanks, Mark -- 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: defs in Clojurescript REPL
On Mon, May 14, 2012 at 7:27 PM, Mark Engelberg mark.engelb...@gmail.comwrote: (def tree (function-that-produces-an-enormous-tree 2)) Isn't doing this at the top level bad form? So there are a couple examples of things that are harder to do when your REPL prints the values that are attached to variables. But again, the real question here is, why does Clojurescript deviate on this point? I know that Clojurescript doesn't exactly match Clojure, but shouldn't all deviations be done for a reason? --Mark There are a few good reasons to not reify things like vars and namespaces in ClojureScript - one of these is Google Closure Compiler. Also I don't see how this isn't solved by modifying some habits. (defn test-tree [] (function-that-produces-an-enormous-tree 2)) (time (test-tree)) 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: defs in Clojurescript REPL
On Mon, May 14, 2012 at 4:41 PM, David Nolen dnolen.li...@gmail.com wrote: On Mon, May 14, 2012 at 7:27 PM, Mark Engelberg mark.engelb...@gmail.comwrote: (def tree (function-that-produces-an-enormous-tree 2)) Isn't doing this at the top level bad form? The purpose of a REPL is for interactive experimentation. I want to give names to the things I'm building so I can play with them in the REPL. Nothing bad form about that. Also I don't see how this isn't solved by modifying some habits. (defn test-tree [] (function-that-produces-an-enormous-tree 2)) (time (test-tree)) time prints out the value that is computed. The above example would suffer the same problem of printing out the tree at the REPL. You could do something like (time (do (test-tree) nil)) to suppress printing, but if you want to do further interactive manipulations to the tree, you'd end up recomputing it. So then, you get into workarounds involving delay. It starts to get ugly, I think. Clojure's ability to give names to things without printing the values is a feature I use every day in my interactive explorations. -- 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: defs in Clojurescript REPL
I think this is a pretty valid feature request. The main question is, can this be done without having vars in clojurescript. One way to do it is to surpress output somehow, under certain conditions. Either as a token at the end of a repl input, or in the semantics of def itself. I don't have an ideal specific solution here, but I've noticed this problem as well and found it pretty annoying. There should be a way to solve it that is a reasonable compromise. On Mon, May 14, 2012 at 11:13 PM, Mark Engelberg mark.engelb...@gmail.com wrote: On Mon, May 14, 2012 at 4:41 PM, David Nolen dnolen.li...@gmail.com wrote: On Mon, May 14, 2012 at 7:27 PM, Mark Engelberg mark.engelb...@gmail.com wrote: (def tree (function-that-produces-an-enormous-tree 2)) Isn't doing this at the top level bad form? The purpose of a REPL is for interactive experimentation. I want to give names to the things I'm building so I can play with them in the REPL. Nothing bad form about that. Also I don't see how this isn't solved by modifying some habits. (defn test-tree [] (function-that-produces-an-enormous-tree 2)) (time (test-tree)) time prints out the value that is computed. The above example would suffer the same problem of printing out the tree at the REPL. You could do something like (time (do (test-tree) nil)) to suppress printing, but if you want to do further interactive manipulations to the tree, you'd end up recomputing it. So then, you get into workarounds involving delay. It starts to get ugly, I think. Clojure's ability to give names to things without printing the values is a feature I use every day in my interactive explorations. -- 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