Cambridge (UK) Clojure user group
The Cambridge (UK) Clojure group used to meet monthly, but has recently lost momentum. I'm trying to turn that around and get us back on track with a regular monthly meet-up. If you are in the Cambridge area and might be interested in attending these meet-ups, please take a few minutes to complete our short survey: http://www.surveymonkey.com/s/5BRRCZX. Ray. -- -- 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/groups/opt_out.
Re: representing clojure source code as data?
On Fri, Jun 21, 2013 at 6:08 PM, Brandon Bloom brandon.d.bl...@gmail.comwrote: You've outlined 2 out of the 3 interesting (to me) shapes: 1) raw data structures and 2) datoms. I think that the 3rd interesting one is a map/vector tree, like the CLJS analyzer output. By raw data structures, you mean the concrete implementing classes, a la clojure.lang.PersistentVector? What I had in mind was more like #3, a map/vector tree, but you're right theres an extra interesting shape there. Here's a minimal design for what I'm talking about: (quote 1) - {:head :list :body [quote 1]} '1 - {:head :quote :body [1]} #{1 2 3} - {:head :set :body [1 2 3]} All syntax is turned into first class representations. Reader macros and datastructure literals are indexed by special keywords; primitives stand for themselves without extra wrapping. The original structure of the source is preserved 100%. You would then have an EDN-to-in-memory-raw-datastructures reader to read from this into live running code. (this is basically the EDN-ified form of Mathematica expressions, and its particularly well suited to symbolic manipulation and pattern matching) One can then go from this, in a series of passes, into an AST (this is the convert to normal form and add semantics step) and then into compiled code. And have a chance at mapping exceptions back to the original source, and do analysis between the source, the AST, and the error. The two languages to describe are EDN and Clojure. You can further break Clojure down by host platform, and even potentially further (for example: pre and post macro expansion variants of the language). I think I understand what you mean, though lemme try to rephrase it: Clojure code is EDN data + a set of non-EDN constructs; doing with with 100% EDN is the problem I'm trying to solve. When attempting to output EDN data, a different but related set of non-EDN constructs messes things up. I definitely agree that's also a problem, TLs are one case and definitely agree with the direction there, though what about the other cases? Random java objects and whatnot. Those should be output in an EDN way, though its unclear what they would mean when read. Would there be any attempt to convey their contents or characteristics? Issues around this are a big headscratcher for Session, so I'd be happy with some standard solution here. As for the Code variant, the tools.analyzer library and CLJS compilers have an internal AST representation that should eventually be standardized. The important thing there for me is that we differentiate fundamental properties of AST nodes and synthesized/derived attributes that are attached to each node. The datomic representation is particularly interesting for this. Every program that computes from the source code can just add its results as new attributes. This includes both the traditional compiler passes, as well as additional testing analysis, or even the results of running the code. So there is a single source of truth about the source code and its consequences, and different layers have access to the big picture. -- -- 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/groups/opt_out.
Re: Clojure 1.6 API: clojure.lang.IFn and clojure.api.API
Hi Joerg, I am not sure I understand your question. The API class is for intraprocess communication, not interprocess. All API does is provide a public, supported entry point for the kinds of things people are already doing with Var. The latter is undesirable because using Var makes it way too easy to marry implementation detail. Stu On Sat, Jun 22, 2013 at 6:01 AM, Jörg Winter jwin1...@gmail.com wrote: So these APIs are new in 1.6-SNAPSHOT and from what I understand provide an integration api between Java and Clojure-Runtime (symbols and their invocation). Apart from limitations which probably exist, what is the mode of execution for these API-calls ? For example if a tool/IDE starts a (REPL) _process_ by calling ClojureUtils.CLOJURE_MAIN, how am I supposed to call API.var(clojure.core, +); ? How would I get the JVMs class-instance of API if I don't add some kind of inter-process communication ? Any known projects using this new API already ? Joerg -- -- 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/groups/opt_out. -- -- 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/groups/opt_out.
[GSOC] expressions, rules and a cool transformation
Hi, In the first week I concentrated on the core datastructures of expresso. How to construct an expression, a rule and specify a transformation ? I wrote about it here http://kimavcrp.blogspot.de/2013/06/gsoc-expressions-rules-and-first.html please comment whether the user interface goes in the right direction or if you have other questions or comments. -- -- 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/groups/opt_out.
Re: Clojure 1.6 API: clojure.lang.IFn and clojure.api.API
Can you please provide an example for such a usw cause? Thanks Las On Jun 23, 2013 1:38 PM, Stuart Halloway stuart.hallo...@gmail.com wrote: Hi Joerg, I am not sure I understand your question. The API class is for intraprocess communication, not interprocess. All API does is provide a public, supported entry point for the kinds of things people are already doing with Var. The latter is undesirable because using Var makes it way too easy to marry implementation detail. Stu On Sat, Jun 22, 2013 at 6:01 AM, Jörg Winter jwin1...@gmail.com wrote: So these APIs are new in 1.6-SNAPSHOT and from what I understand provide an integration api between Java and Clojure-Runtime (symbols and their invocation). Apart from limitations which probably exist, what is the mode of execution for these API-calls ? For example if a tool/IDE starts a (REPL) _process_ by calling ClojureUtils.CLOJURE_MAIN, how am I supposed to call API.var(clojure.core, +); ? How would I get the JVMs class-instance of API if I don't add some kind of inter-process communication ? Any known projects using this new API already ? Joerg -- -- 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/groups/opt_out. -- -- 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/groups/opt_out. -- -- 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/groups/opt_out.
Re: representing clojure source code as data?
On Jun 23, 2013 1:43 AM, kovas boguta kovas.bog...@gmail.com wrote: what about the other cases? Random java objects and whatnot. Those should be output in an EDN way, though its unclear what they would mean when read. Would there be any attempt to convey their contents or characteristics? Aren't you only worried about representing the structure of the source code? If so, doesn't Java interop just break down into lists of symbols, the dot special form, and maybe a special thing for .methodOrField syntax? Or do you have something other than interop in mind when you talk about random Java objects? It doesn't sound to me like you're interested in representing runtime values. -- -- 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/groups/opt_out.
multimethods for non constant values?
i found example that i can do (defmethod x 5 [y] (do stuff)) but can i do (defmethod #( % 10) [y] (do stuff)) somehow? like in a pattern match of haskell/scala? -- -- 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/groups/opt_out.
Re: multimethods for non constant values?
you need a dispatch functions that produces discrete dispatch values using your example: (defmulti x #(cond ( % 10) :less-than-10 ;;... further conditions producing different dispatch values )) ;; dispatch on the dispatch values (defmethod x :less-then-10 [x] (do )) Hope it helps Las 2013/6/23 Dennis Haupt d.haup...@gmail.com i found example that i can do (defmethod x 5 [y] (do stuff)) but can i do (defmethod #( % 10) [y] (do stuff)) somehow? like in a pattern match of haskell/scala? -- -- 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/groups/opt_out. -- László Török -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- 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/groups/opt_out.
Is it possible to parameterize proxy macro with defmacro?
Hi, After I got your help last week to get my Macro working :) I tried to expand it more: I'm trying to parameterizing my object creation (I'm using clojure.core.match). Source class offers multiple constructors: (defmacro source [source-name constructor-args meths] (match [constructor-args] [{}] `(def ~source-name (proxy [Source] [] ~@(for [meth meths] (let [[method-name args body] meth camel-case-method-name (hyphenated-camel-case method-name)] `(~camel-case-method-name ~args ~@body) [{:method _ :resource _}] (let [^Method meth (:method constructor-args) ^Reference reference (:resource constructor-args)] `(def ~source-name (proxy [Source] [^Method meth ^Reference reference] ~@(for [meth meths] (let [[method-name args body] meth camel-case-method-name (hyphenated-camel-case method-name)] `(~camel-case-method-name ~args ~@body But when macroexpand, I notice the called proxy is the one with the empty constructor, not the one that takes two parameters. Am I missing something? Thanks for help and time. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- 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/groups/opt_out.
Re: multimethods for non constant values?
i see thx 2013/6/23 László Török ltoro...@gmail.com you need a dispatch functions that produces discrete dispatch values using your example: (defmulti x #(cond ( % 10) :less-than-10 ;;... further conditions producing different dispatch values )) ;; dispatch on the dispatch values (defmethod x :less-then-10 [x] (do )) Hope it helps Las 2013/6/23 Dennis Haupt d.haup...@gmail.com i found example that i can do (defmethod x 5 [y] (do stuff)) but can i do (defmethod #( % 10) [y] (do stuff)) somehow? like in a pattern match of haskell/scala? -- -- 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/groups/opt_out. -- László Török -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- 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/groups/opt_out. -- -- 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/groups/opt_out.
Lambda Jam ticket available
Due to unexpected expenses, I'm going to be unable to use my early bird ticket to Lambda Jam (July 8-10 in Chicago). I can't get a refund, but I can designate a substitute if anyone's interested. Please contact me off list if so. 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 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/groups/opt_out.
Re: representing clojure source code as data?
By raw data structures, you mean the concrete implementing classes, a la clojure.lang.PersistentVector? Yes. (quote 1) - {:head :list :body [quote 1]} You're not going far enough with this. Here's how my code is representing that: {:composite :list, :items [{:value quote} {:value 1}]} That approach encodes non-composite types into the concrete class of the :value field. However, you can encode that too. Here's an alternative: {:type :list, :items [{:type :symbol :value quote} {:type :long :value 1}]} All syntax is turned into first class representations. Reader macros and datastructure literals are indexed by special keywords; primitives stand for themselves without extra wrapping. The key benefit of going all the way with the maps is that all of your nodes always have space for :extra/keys Take a look at :op :constant in CLJS for an example of how useful this is for analysis. At minimum, you want to be able to store :line and :column and the like, but Keywords and numbers and such don't implement IMeta. Clojure code is EDN data + a set of non-EDN constructs; doing with with 100% EDN is the problem I'm trying to solve. Right. At this point, the Clojure reader is a superset of the EDN reader, but all of the Clojure-specific forms can be (and often are) encoded as both EDN forms and in-memory types objects. The notable exception being the lack of an in memory representation of tagged literals. Right now, the Clojure reader does some inline evaluation of Clojure-forms like unquote and unquote-splicing. In theory, the reader could return a '(clojure.core/unquote ...) list in memory, of a {:composite ...} AST node shape. I think that https://github.com/clojure/tools.reader could probably be made pluggable for returning the desired shapes. Random java objects and whatnot. Random java objects and whatnot can only enter into your forms as the result of tagged literal or macro functions. In both cases, there really needs to be a separation between the reading of the value and the construction of the value. CLJS is currently bugged for #inst literals with respect to quoting, since the reader is returning code instead of Date objects. If the literal's result is read by a macro, then you need a java date, but if it's read by runtime code you need a js date, so it's a tricky issue. Every program that computes from the source code can just add its results as new attributes. This includes both the traditional compiler passes, as well as additional testing analysis, or even the results of running the code. I've been thinking about this issue a bit. Datomic's model is absolutely great for the normalized core data of things, but I'm not convinced that it's ideal for the results of observations. I rather not get into this in this thread. I think that there's enough work at the reader level before we can even discuss the analysis level. -- -- 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/groups/opt_out.
Re: can't compile anything except def
plugin version is 0.5.286 Am 23.06.2013 00:25, schrieb Colin Fleming: Which version of the IntelliJ plugin are you using? You can see this by opening the settings, selecting plugins then selecting the La Clojure plugin. In recent versions the compiler has changed and I've had occasional problems with it. On 23 June 2013 02:29, Dennis Haupt d.haup...@gmail.com mailto:d.haup...@gmail.com wrote: it happens with both clojure 1.5.1 and 1.4.0. when intellij tries to compile clojure files, something strange happens. if i remove the option to compile the files (and instead just use clojure.main and run them) there is no problem 2013/6/22 Jim - FooBar(); jimpil1...@gmail.com mailto:jimpil1...@gmail.com On 22/06/13 15:21, Dennis Haupt wrote: clojure jvm, intellij's repl. i'll try to run the file via commandline and see what happens where did core.clr come from then? can you somehow see what version of clojure your intelliJ is using? I've got no experience with intelliJ really...it's just that your error you reported earlier is very weird... Jim -- -- 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 mailto: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+unsubscribe@__googlegroups.com mailto:clojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/__group/clojure?hl=en 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+unsubscribe@__googlegroups.com mailto:clojure%2bunsubscr...@googlegroups.com. For more options, visit https://groups.google.com/__groups/opt_out https://groups.google.com/groups/opt_out. -- -- 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 mailto: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 mailto: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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com mailto:clojure%2bunsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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/groups/opt_out. -- -- -- 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/groups/opt_out.
separate namespace for extra-special forms?
This strikes me as pretty odd: user (let [z 1 try 2 fn* 3] (try (let [x (fn* ([a b c] [a b c]))] (x z try fn*)) (catch Exception e e))) [1 2 3] -- Ben Wolfson Human kind has used its intelligence to vary the flavour of drinks, which may be sweet, aromatic, fermented or spirit-based. ... Family and social life also offer numerous other occasions to consume drinks for pleasure. [Larousse, Drink entry] -- -- 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/groups/opt_out.
Re: separate namespace for extra-special forms?
Special forms are special when used in a list. IMO it's a bad idea to use special forms as local names, a caveat which is surprisingly under-documented. Thanks, Ambrose On Mon, Jun 24, 2013 at 5:38 AM, Ben Wolfson wolf...@gmail.com wrote: This strikes me as pretty odd: user (let [z 1 try 2 fn* 3] (try (let [x (fn* ([a b c] [a b c]))] (x z try fn*)) (catch Exception e e))) [1 2 3] -- Ben Wolfson Human kind has used its intelligence to vary the flavour of drinks, which may be sweet, aromatic, fermented or spirit-based. ... Family and social life also offer numerous other occasions to consume drinks for pleasure. [Larousse, Drink entry] -- -- 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/groups/opt_out. -- -- 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/groups/opt_out.
Re: separate namespace for extra-special forms?
Well, when used as the first element of a list. (And I certainly wouldn't use them as local names, since that would be extremely confusing; I was trying to verify the correctness of some code I'm working on.) But I called these extra-special because, in my understanding of the term, special form generically just refers to something with non-normal evaluation order (or special evaluation semantics generally). when, in this definition, is a special form, as are fn and let (both of which are listed as special forms on http://clojure.org/special_forms). But neither fn nor let is special the way let*, fn*, do, or the other *extra*-special forms are: user (let [fn (fn [x] x)] (fn 4)) 4 user (let [let (fn [x] x)] (let 4)) 4 Thinking about it more, I suppose you're thinking of what's returned by clojure.lang.Compiler/specials, except several of them can be used just fine in this pattern: user (let [ (fn [x] x)] ( 1)) 1 The above also works for finally and catch. Anyway, I'm surprised one can establish local bindings for these guys at all. On Sun, Jun 23, 2013 at 2:46 PM, Ambrose Bonnaire-Sergeant abonnaireserge...@gmail.com wrote: Special forms are special when used in a list. IMO it's a bad idea to use special forms as local names, a caveat which is surprisingly under-documented. Thanks, Ambrose On Mon, Jun 24, 2013 at 5:38 AM, Ben Wolfson wolf...@gmail.com wrote: This strikes me as pretty odd: user (let [z 1 try 2 fn* 3] (try (let [x (fn* ([a b c] [a b c]))] (x z try fn*)) (catch Exception e e))) [1 2 3] -- Ben Wolfson Human kind has used its intelligence to vary the flavour of drinks, which may be sweet, aromatic, fermented or spirit-based. ... Family and social life also offer numerous other occasions to consume drinks for pleasure. [Larousse, Drink entry] -- -- 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/groups/opt_out. -- -- 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/groups/opt_out. -- Ben Wolfson Human kind has used its intelligence to vary the flavour of drinks, which may be sweet, aromatic, fermented or spirit-based. ... Family and social life also offer numerous other occasions to consume drinks for pleasure. [Larousse, Drink entry] -- -- 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/groups/opt_out.
Re: matching, assigning and branching in one form
or even without let: (condp re-find msg #^:(.*?)!.*PRIVMSG (.*) :(.*) : (fn [[_ from to message]] (true-form ...)) (false-form...)) On Saturday, June 22, 2013 11:26:35 PM UTC+12, Vincent wrote: What about using condp? (condp re-find msg #^:(.*?)!.*PRIVMSG (.*) :(.*) : #(let [[_ from to message] %] (logic...))) Vincent On Friday, 21 June 2013 17:43:50 UTC+2, Steven Arnold wrote: Hi, I am writing a simple IRC bot, pretty much just for fun, starting with a simple implementation originally posted by Nurullah Akkaya on his blog. It already does what it's supposed to, which is message a fortune from mod-fortune (shelling out) when someone asks it to. However, there's a bit of code I don't like. It looks like this: (cond (re-find #^:(.*?)!.*PRIVMSG (.*) :(.*) msg) (let [[_ from to message] (re-find #^:(.*?)!.*PRIVMSG (.*) :(.*) msg)] [...logic omitted...] What's happening is we're looking for a PRIVMSG, and if we find one, we scan the message again and pull out the chunks we're interested in, and use them in the logic part below. The problem is I don't like maintaining two regular expressions. I wish I could use it only once, and therefore change it only once if it needs to be modified. I'd prefer to see an expression that looks like this (for example): (cond (if-matched #^:(.*?)!.*PRIVMSG (.*) :(.*) msg [from to message] (true form) (optional false form))) The if-matched acts as a let block while pulling out groups and assigning to local variables at the same time. Also, it ignores the first match of re-find, which is the entire expression -- not generally useful to me. Maybe if-matched-groups would ignore the overall expression, and if-matched would include it. I suppose a macro might be the way to go to accomplish this, but I wonder if there are any Clojure tricks that could accomplish this short of a macro. Also, do any fellow Clojurians think a macro like this is a bad idea in general? Would you suggest taking a different tack to solve this problem? Thanks in advance! steven -- -- 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/groups/opt_out.