Re: [ANN] Clojure 1.7.0-alpha5 now available
Do the failing projects require AOT compilation? we used to see a similar exception in eastwood when reloading core.cache and one of the AOT patches committed can cause some namespaces to be reloaded Il giorno 12/gen/2015 02:17, Sean Corfield s...@corfield.org ha scritto: I tried upgrading a few more apps and ran into this same problem in the absence of core.async - but in the presence of core.cache and core.memoize so I'm trying to create a small test case to isolate the issue. Sean On Jan 11, 2015, at 5:07 PM, Sean Corfield s...@corfield.org wrote: The full Caused by stacktrace is this: Caused by: java.lang.IllegalArgumentException: No implementation of method: :has? of protocol: #'clojure.core.cache/CacheProtocol found for class: clojure.core.memoize.PluggableMemoization at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:555) at clojure.core.cache$eval1710$fn__1773$G__1699__1780.invoke(cache.clj:20) at clojure.core.cache$through.invoke(cache.clj:53) at clojure.core.memoize$through_STAR_.invoke(memoize.clj:52) at clojure.lang.Atom.swap(Atom.java:65) at clojure.core$swap_BANG_.invoke(core.clj:2236) at clojure.core.memoize$build_memoizer$fn__12665.doInvoke(memoize.clj:134) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.lang.AFunction$1.doInvoke(AFunction.java:29) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.tools.analyzer.jvm$desugar_host_expr.invoke(jvm.clj:117) at clojure.tools.analyzer.jvm$macroexpand_1.invoke(jvm.clj:174) at clojure.tools.analyzer$fn__12389.invoke(analyzer.clj:281) at clojure.lang.MultiFn.invoke(MultiFn.java:238) at clojure.tools.analyzer$fn__12346.invoke(analyzer.clj:68) at clojure.lang.MultiFn.invoke(MultiFn.java:233) at clojure.tools.analyzer$analyze_let.invoke(analyzer.clj:505) at clojure.tools.analyzer$fn__12469.invoke(analyzer.clj:530) at clojure.lang.MultiFn.invoke(MultiFn.java:233) at clojure.tools.analyzer.jvm$fn__13956.invoke(jvm.clj:66) at clojure.lang.MultiFn.invoke(MultiFn.java:233) at clojure.tools.analyzer$fn__12389.invoke(analyzer.clj:283) at clojure.lang.MultiFn.invoke(MultiFn.java:238) at clojure.tools.analyzer$fn__12346.invoke(analyzer.clj:68) at clojure.lang.MultiFn.invoke(MultiFn.java:233) at clojure.tools.analyzer$fn__12389.invoke(analyzer.clj:284) at clojure.lang.MultiFn.invoke(MultiFn.java:238) at clojure.tools.analyzer$fn__12346.invoke(analyzer.clj:68) at clojure.lang.MultiFn.invoke(MultiFn.java:233) at clojure.tools.analyzer$fn__12392.invoke(analyzer.clj:295) at clojure.lang.MultiFn.invoke(MultiFn.java:233) at clojure.tools.analyzer.jvm$fn__13956.invoke(jvm.clj:66) at clojure.lang.MultiFn.invoke(MultiFn.java:233) at clojure.tools.analyzer$analyze_body.invoke(analyzer.clj:366) at clojure.tools.analyzer$analyze_let.invoke(analyzer.clj:520) at clojure.tools.analyzer$fn__12471.invoke(analyzer.clj:540) at clojure.lang.MultiFn.invoke(MultiFn.java:233) at clojure.tools.analyzer.jvm$fn__13956.invoke(jvm.clj:66) at clojure.lang.MultiFn.invoke(MultiFn.java:233) at clojure.tools.analyzer$fn__12389.invoke(analyzer.clj:283) at clojure.lang.MultiFn.invoke(MultiFn.java:238) at clojure.tools.analyzer$fn__12346.invoke(analyzer.clj:68) at clojure.lang.MultiFn.invoke(MultiFn.java:233) at clojure.tools.analyzer$fn__12389.invoke(analyzer.clj:284) at clojure.lang.MultiFn.invoke(MultiFn.java:238) at clojure.tools.analyzer$fn__12346.invoke(analyzer.clj:68) at clojure.lang.MultiFn.invoke(MultiFn.java:233) at clojure.tools.analyzer$fn__12392.invoke(analyzer.clj:295) at clojure.lang.MultiFn.invoke(MultiFn.java:233) at clojure.tools.analyzer.jvm$fn__13956.invoke(jvm.clj:66) at clojure.lang.MultiFn.invoke(MultiFn.java:233) at clojure.tools.analyzer$fn__12389.invoke(analyzer.clj:283) at clojure.lang.MultiFn.invoke(MultiFn.java:238) at clojure.tools.analyzer$fn__12346.invoke(analyzer.clj:68) at clojure.lang.MultiFn.invoke(MultiFn.java:233) at clojure.tools.analyzer$analyze.invoke(analyzer.clj:123) at clojure.tools.analyzer.jvm$analyze$fn__14085.invoke(jvm.clj:476) at clojure.lang.AFn.applyToHelper(AFn.java:152) at clojure.lang.AFn.applyTo(AFn.java:144) at clojure.core$apply.invoke(core.clj:626) at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1864) at clojure.lang.RestFn.invoke(RestFn.java:425) at clojure.tools.analyzer.jvm$analyze.invoke(jvm.clj:474) at clojure.tools.analyzer.jvm$analyze.invoke(jvm.clj:467) at clojure.core.async.impl.ioc_macros$state_machine.invoke(ioc_macros.clj:1062) at
Re: Default implementation for defprotocol
That's correct, the most specialized implementation is used. In the case where more there is no implementation more specialized than another (two interfaces are extended to a protocol and a class implements both) then an arbitrary implementation from the available ones will be selected. Extending a Object and nil to a protocol is a good way to provide a default impl. Another option is to wrap the protocol functions in another function and testing for satisfies?. Il giorno 17/nov/2014 10.49, pmf phil.fr...@gmx.de ha scritto: Is there a way to provide a default (fallback) implementation for a method defined in a defprotocol directive? I do realize that I could extend the protocol for type java.lang.Object, but this raises the question about how protocol implementations with extend are sorted, i.e. how specializations of types of the same hierarchy are resolved. Is the most specialized implementation used if I implement a protocol for a class as well as its parent class and if yes, is this independent of the order of definition for the protocol extensions? -- 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: thread-any macro %
Looks like I've been too fast in my reply, looking at the docstring I see that I'm wrong and you're right. I didn't realize as- could take more than one body On Sat, Nov 15, 2014 at 3:05 PM, Nicola Mometto brobro...@gmail.com wrote: as- only binds the specified expression rather than each result in step and only works from within - Timothy Baldridge writes: That was added to clojure.core in 1.6 and is known as as- https://clojuredocs.org/clojure.core/as-%3E On Sat, Nov 15, 2014 at 6:55 AM, Krzysiek Herod krzysiek.he...@gmail.com wrote: Guys, what do you think about new thread macro (I would call it thread-any and represent it as %), that would require you to always specify the position of the argument you want to pass to the function? This code: (defn csv-line-sql-line [table, line] (- line (str ) (str/split separator) (#(map csv-field-sql-field %)) (#(str/join , %)) (str/replace strings-wrapper \) (#(str INSERT INTO , table, VALUES( % ); would become: (defn csv-line-sql-line [table, line] (% line (str % ) (str/split % separator) (map csv-field-sql-field %) (str/join , %) (str/replace strings-wrapper % \) (str INSERT INTO , table, VALUES( % );))) Reasoning: - there are functions that are thread-first fiendly, and other that are thread-last friendly, by using thread-in you don't have to redefine functions only to change the order of the attributes - I find it easier to follow execution chain if the argument is passed explicitely PS. I'm a clojure newbie, still in the process of learning basics. For example I'm not sure how to implement such macro yet, so if you find something obviously wrong, or missing in my suggestion, please let me know. I'll be super happy to read about alternative solutions to achieve similar goal. -- 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. -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- -- 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: Question regarding tools.analyzer.jvm and the :tag, :o-tag, and :class entries
Hi, When using tools.analyzer.jvm you have to remember that its primary use-case is as a front-end for a compiler, in this case :tag and :o-tag serve to inform tools.emitter.jvm when to emit a cast thus might not always reflect the :tag meta of the expression :form. Regarding the :tag/:o-tag difference, :o-tag (you can read it as original tag) holds the static type of the node known at that point and might be either inferred by the :tag of some children nodes or from the class of the :form of the node in case it's a literal, :tag on the other hand can be either the same of :o-tag or hold the Class that node needs to be cast to, usually because of an explicit type-hint. For example, ^IPersistentCollection [] will have :o-tag PersistentVector and :tag IPersistentCollection. :class is an attribute of some nodes that deal with host interop forms, like :new, :instance-call and others and holds the Class that node deals with; for example it might hold the Class a :new node is going to instantiate, the Class an :instance-method belongs to etc. BTW, you don't need to roll your own `analyze` function providing those bindings, jvm/analyze already sets up the right bindings for you. I hope this helps, Nicola On Wed, May 21, 2014 at 10:00 AM, guns s...@sungpae.com wrote: Hello, This question is primarily addressed to Nicola Mometto, but I am sending it to the list so it may be helpful to other Clojure developers. Help is appreciated, regardless of the source. I am using tools.analyzer(.jvm) to build a Closeable resource linter, but I have run into the following problem: a function call's type hint is lost when an instance method is called on its output. For example, given the following setup: (alias 'ana 'clojure.tools.analyzer) (alias 'ast 'clojure.tools.analyzer.ast) (alias 'jvm 'clojure.tools.analyzer.jvm) (defn analyze [form] (binding [ana/macroexpand-1 jvm/macroexpand-1 ana/create-varjvm/create-var ana/parse jvm/parse ana/var? var?] (jvm/analyze form (jvm/empty-env (defn analyze-debug [form] (for [ast (ast/nodes (analyze form)) :let [{:keys [op form tag o-tag class]} ast]] (array-map :op op :form form :tag tag :o-tag o-tag :class class))) (defn ^java.io.FileInputStream fis [^String x] (java.io.FileInputStream. x)) I would like to detect that (fis x) returns a java.io.FileInputStream. If I call: (analyze-debug '(str (fis x))) I receive: ({:op :invoke, :form (str (fis x)), :tag java.lang.String, :o-tag java.lang.Object, :class nil} {:op :var, :form str, :tag clojure.lang.AFunction, :o-tag java.lang.Object, :class nil} {:op :invoke, :form (fis x), :tag java.io.FileInputStream, ; ◀ The desired metadata :o-tag java.lang.Object, :class nil} {:op :var, :form fis, :tag clojure.lang.AFunction, :o-tag java.lang.Object, :class nil} {:op :const, :form x, :tag java.lang.String, :o-tag java.lang.String, :class nil}) However, if I call: (analyze-debug '(.toString (fis x))) - ({:op :instance-call, :form (. (fis x) toString), :tag java.lang.String, :o-tag java.lang.String, :class java.lang.Object} {:op :invoke, :form (fis x), :tag java.lang.Object, ; ◀ The type hint is missing! :o-tag java.lang.Object, :class nil} {:op :var, :form fis, :tag clojure.lang.AFunction, :o-tag java.lang.Object, :class nil} {:op :const, :form x, :tag java.lang.String, :o-tag java.lang.String, :class nil}) The :tag of (fis x) is now java.lang.Object, and java.io.FileInputStream is not present in the node. Calling java.io.InputStream#markSupported sheds more light on the matter: (analyze-debug '(.markSupported (fis x))) - ({:op :instance-call, :form (. (fis x) markSupported), :tag boolean, :o-tag boolean, :class java.io.InputStream} {:op :invoke, :form (fis x), :tag java.io.InputStream, ; ◀ The instance method's class :o-tag java.lang.Object, :class nil} {:op :var, :form fis, :tag clojure.lang.AFunction, :o-tag java.lang.Object, :class nil} {:op :const, :form x, :tag java.lang.String, :o-tag java.lang.String, :class nil}) Finally, calling java.io.FileInputStream#getFD on (fis x) returns the expected :tag entry: (analyze-debug '(.getFD (fis x))) - (… {:op :invoke, :form (fis x), :tag java.io.FileInputStream, ; ◀ Also the instance method's class :o-tag java.lang.Object, :class nil} …) Is there a reliable way to retrieve the
Re: *data-readers* with clojure.tools.reader -- No reader function for tag id
(binding [clojure.tools.reader/*data-readers* *data-readers*] (clojure.tools.reader/read ..)) is probably what you want. On Tue, May 13, 2014 at 12:17 AM, Sarkis Karayan skara...@gmail.com wrote: Hi everyone, I am trying to use clojure.tools.reader to read from a file and also process datomic #db/id literals, but I am not sure how to pass in the *data-readers*? clojure.tools.reader.edn allows something like this: (edn/read reader false eof { :readers *data-readers* } ) Is there something equivalent with clojure.tools.reader? Thanks, Sarkis -- 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: clojure.edn/read-string exceptions = nil
What you want is currently not possible. If you need this functionality, I'll take a patch for tools.reader that adds a :nil-on-unreadable option to clojure.tools.reader.edn/read. Il giorno 16/gen/2014 11.05, t x txrev...@gmail.com ha scritto: Either you misunderstood my question or I misunderstood your answer. I don't want the entire expression to return nil. I only want the _unparsable_ part to return nil. Thus, the above answer should be {:tag :message :chan ni} rather than nil On Thu, Jan 16, 2014 at 1:47 AM, Luc Prefontaine lprefonta...@softaddicts.ca wrote: Wrap the read in a try catch just return nil in the catch clause for this specific exception and wrap it in a function for ease of use. You might want to throw up any other exceptions and only catch this one Luc P. I should add: this problem arises due to cljs / clojure talking over the network, so: (*) not using serialization is NOT an option (*) however, I don't have to use edn/read-string + pr-str (*) it's perfectly fine to use different encoding/decoding methods On Thu, Jan 16, 2014 at 12:11 AM, t x txrev...@gmail.com wrote: Hi, Right now if I do (clojure.edn/read-string ...) on a string with a unreadable part, I get an exception. Instead, I would like to just get nil. For example: ## code (clojure.edn/read-string (pr-str {:tag :message :chan (async/chan 10)})) ## currently returns java.lang.RuntimeException: Unreadable form at clojure.lang.Util.runtimeException (Util.java:219) ## instead, I would like: {:tag :message :chan :nil} Is there a way to make this happen? Thanks! -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- 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. -- Luc Prefontainelprefonta...@softaddicts.ca sent by ibisMail! -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- 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: [ANN] tools.analyzer(.jvm) 0.1.0-alpha1
It is definitely one goal of tools.analyzer/emitter to provide better error messages/info, tools.analyzer already provides some more analysis time checkes than Compiler.java and every exception thrown contins in its ex-data useful info. There's still plently of room for improvements on this side and right now development is focused on fixing bugs/implementing features rather than focusing on error messages but if you have specific error messages you'd like to see improved open a ticket or write it here and I'll try to improve it. Nicola Il giorno 15/gen/2014 15.28, bob wee@gmail.com ha scritto: It seems tools.analyzer is to copy the analyzer of compiler from clojure, actually it is time to improve the error message and so on. On Saturday, January 11, 2014 9:23:56 AM UTC+8, Nicola Mometto wrote: Today I released the first version of the tools.analyzer[1] and tools.analyzer.jvm[2] contrib libraries, here are the leiningen coordinates: [org.clojure/tools.analyzer 0.1.0-alpha1] [org.clojure/tools.analyzer.jvm 0.1.0-alpha1] Right now the only documentation for both those libraries is in the form of docstrings and can be found at http://clojure.github.io/tools.analyzer/ and http://clojure.github.io/tools.analyzer.jvm/ more extended documentation will be available before the first non-alpha release, hopefully very soon. While this is an alpha release, during the last months a big amount of bugs have been fixed thanks to the work of Andy Fingerhut who moved the Eastwood[3] linter from Ambrose's analyzer to tools.analyzer.jvm; thanks to this, the analyzer has been run with success on a large number of popular clojure libraries including almost all clojure contrib libraries and clojure's own namespaces, thus proving that it's effectively working. Please, try it out and if you find any bug report them in the Bug Tracker[4] (tools.analyzer and tools.analyzer.jvm share the same JIRA project) or if you have any questions, feel free to ask them and I'll do my best to answer them. Thanks, Nicola [1] https://github.com/clojure/tools.analyzer [2] https://github.com/clojure/tools.analyzer.jvm [3] https://github.com/jonase/eastwood [4] http://dev.clojure.org/jira/browse/TANAL -- -- 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: should contains? throw an exception on sorted maps?
Ops, I didn't see Andy already replied, sorry for the unnecessary mail. On Sat, Aug 3, 2013 at 7:10 PM, Nicola Mometto brobro...@gmail.com wrote: http://dev.clojure.org/jira/browse/CLJ-1242 Jay Fields writes: This: (contains? (sorted-map 1 2 3 4) :a) Results in this: ClassCastException java.lang.Long cannot be cast to clojure.lang.Keyword clojure.lang.Keyword.compareTo (Keyword.java:102) -- -- -- 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: [GSoC 2013] CinC
Actually, I would be interested in doing this if still available :) On Mon, Mar 4, 2013 at 6:53 PM, Aaron Cohen aa...@assonance.org wrote: On Mon, Mar 4, 2013 at 11:26 AM, abp abp...@gmail.com wrote: Is this work related? http://clojurewest.org/sessions#martin https://github.com/kanaka/clojurescript Nope, completely unrelated, though similar work. --Aaron -- -- 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: Understanding vars
If I remember correctly, this is a bug due to the fact that constant empty literals are handled in a special way from the compiler. Il giorno 19/mar/2013 08.49, Marko Topolnik marko.topol...@gmail.com ha scritto: The way speed is achieved for :const is that it is given the same treatment as Java's *compile-time constants*, so you're not even touching the var when you refer to it by name. Now, *meta* could be accepted as a special case, explicitly detected by the compiler, but that mechanism would once again be easily defeated. So I'd say it's not a bug, but a case of *you can't have your cake and eat it, too.* On second thought, I my be wrong since the meta is not on the var, but on the map object itself. Maybe it really is just a bug due to which the compiled-in value doesn't have metadata copied to it. -marko -- -- 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: Understanding vars
I remember finding out about it a few months ago. I don't know whether or not there is a jira ticket for it, I'll check out. If nobody can get a patch for this, I'll try and see if I can work out one in the next days Il giorno 19/mar/2013 09.02, Mark Engelberg mark.engelb...@gmail.com ha scritto: On Tue, Mar 19, 2013 at 12:57 AM, Bronsa brobro...@gmail.com wrote: If I remember correctly, this is a bug due to the fact that constant empty literals are handled in a special way from the compiler. Interesting. I see you are correct that the problem only occurs on metadata attached to an empty literal. So does that mean this is a known bug? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- 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: Namespaced symbols, and errors
Gary, ::foo/bar is valid syntax if foo is a valid namespace alias. Try: (alias 'foo 'clojure.core) ::foo/bar Il giorno 09/mar/2013 09.36, Gary Verhaegen gary.verhae...@gmail.com ha scritto: The reader basically transforms :: into :namespace/, which means that the remaining part must be an unqualified symbol (i.e. no / in it). The character / is not allowed in unqualified symbols. As the documentation [1] says : '/' 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. Your notation ::junk/junk, assuming your type in namespace my.namespace.junk, would result in the keyword :my.namespace.junk/junk/junk, which is invalid (two /'s). Hence the implied restriction that ::symbol cannot contain a / character. I'm not really sure what you mean about aliases. Keywords stand by themselves (they are literals that evaluate to themselves), they are not aliases for something else. [1] http://clojure.org/reader On 8 March 2013 16:56, nick rothwell n...@cassiel.com wrote: Typing the following at a REPL: (str ::junk/junk) (where there's no alias for junk) gives me: RuntimeException Invalid token: ::junk/junk clojure.lang.Util.runtimeException (Util.java:219) RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (Util.java:219) A couple of things: (i) Invalid token seems a bit curt: doesn't it mean something like no such namespace alias? (ii) A complete aside, but: the interactive REPL obviously isn't disregarding the rest of the line when it gets a token error. Another aside: why does Clojure require :: for aliases but only : for namespace-qualified keywords? Under what circumstance would I use :junk/junk in any way other than to mean ::junk/junk (or :my.namespace.junk/junk, given the appropriate alias)? -- -- 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: Performance issue with hashing records
2013/2/6 Christophe Grand christo...@cgrand.net Hi On Mon, Feb 4, 2013 at 2:29 PM, AtKaaZ atk...@gmail.com wrote: = (class {:x a :y 3}) clojure.lang.Persistent*Array*Map = (def m {:x a :y 3}) #'runtime.q/m = (class m) clojure.lang.Persistent*Hash*Map huh? that one I can't explain, I'll have to do some research. http://dev.clojure.org/jira/browse/CLJ-944 The second patch should adress this = (def m (let [] {:x a :y 3})) #'user/m = (class m) clojure.lang.PersistentArrayMap = (time (dotimes [n 1000] (hash m))) Elapsed time: 168.162927 msecs nil = (time (dotimes [n 1000] (hash m))) Elapsed time: 161.341094 msecs nil = (time (dotimes [n 1000] (hash m))) Elapsed time: 159.444025 msecs nil Since hash is cached and m doesn't change, more runs are just measuring the time to lookup the cache. There may be a sligt overhead due to m being a var. To properly isolate this you have to use locals: = (let [m (hash-map :x a :y 3)] (println (class m)) (time (dotimes [n 1000] (hash m clojure.lang.PersistentHashMap Elapsed time: 221.62 msecs nil = (let [m (hash-map :x a :y 3)] (println (class m)) (time (dotimes [n 1000] (hash m clojure.lang.PersistentHashMap Elapsed time: 214.624 msecs nil = (let [m (hash-map :x a :y 3)] (println (class m)) (time (dotimes [n 1000] (hash m clojure.lang.PersistentHashMap Elapsed time: 212.505 msecs nil = (let [m {:x a :y 3}] (println (class m)) (time (dotimes [n 1000] (hash m clojure.lang.PersistentArrayMap Elapsed time: 232.872 msecs nil = (let [m {:x a :y 3}] (println (class m)) (time (dotimes [n 1000] (hash m clojure.lang.PersistentArrayMap Elapsed time: 218.141 msecs nil = (let [m {:x a :y 3}] (println (class m)) (time (dotimes [n 1000] (hash m clojure.lang.PersistentArrayMap Elapsed time: 220.813 msecs nil No significant change -- hopefully since 1e7-1 times out od 1z7 we are measuring the cost of looking up a cache. Christophe -- On Clojure http://clj-me.cgrand.net/ Clojure Programming http://clojurebook.com Training, Consulting Contracting http://lambdanext.eu/ -- -- 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: Natively Compiled Clojure
It is also not longer actively mantained. https://github.com/bagucode/clj-native/issues/6#issuecomment-11930841 2013/1/21 Chouser chou...@n01se.net I'm pretty sure clj-native is more recent, faster, better, and more actively maintained. I ought to update clojure-jna to say all that. On Mon, Jan 21, 2013 at 2:21 PM, Philip Potter philip.g.pot...@gmail.comwrote: you might want to look at clj-native: https://github.com/bagucode/clj-native It's used, among other things, by overtone to interact with libscsynth, the supercollider synthesis library: https://github.com/overtone/overtone/blob/master/src/overtone/sc/machinery/server/native.clj I don't know how it compares to clojure-jna; clj-native also uses jna under the hood. Phil On 21 January 2013 17:25, octopusgrabbus octopusgrab...@gmail.com wrote: I've had no problems. I am just curious. What triggered this was this morning I saw something on stackoverflow.com about Clojure's possibly interacting with C code, and the natively compiled question just popped into my head. On Monday, January 21, 2013 12:19:27 PM UTC-5, tbc++ wrote: If you haven't found a performance problem, and it's working well for your needs, why are you interested in making the code run natively. What problems have you encountered that pique your intrest in this area? Timothy On Mon, Jan 21, 2013 at 9:29 AM, octopusgrabbus octopus...@gmail.com wrote: I use Clojure primarily as a very reliable tool to aid in data transformations, that is taking data in one application's database and transforming it into the format needed for another applications' database. So, my question is would a natively compiled Clojure make sense or turn the language into something that was not intended? In almost all instances I have not found a problem with Clojure's execution speed so my question is not about pro or anti Java. Thanks. -- 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 -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- 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 -- --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 -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: clojure defining a var with a dot in the name is accepted in clojure 1.5-RC1, but probably shouldn't?
2012/12/23 Stuart Sierra the.stuart.sie...@gmail.com On Saturday, December 22, 2012 3:34:52 PM UTC-5, Borkdude wrote: Clojure lets me define a var which name contains a dot, but I can't dereference it by name (because it is seen as a classname with a method or field). Clojure shouldn't let me let define it in the first place I think? It all depends on that magical little word should. Clojure has generally not gone out of its way to prevent you from doing things even if they don't make a lot of sense. Symbols with dots in them are certainly valid (namespace identifiers being a common example). One could argue that this is an unhandled edge case in the Clojure reader. Maybe the Clojure reader should not automatically assume that symbols with dots in them are classes and instead try to resolve them as Vars first. Actually it's clojure.lang.Compiler/maybeResolveIn responsable for that -S -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: [ANN] CJD 0.1.0, a documentation technology for Clojure programs
Awesome! 2012/12/18 greenh hhgr...@ieee.org I'd like to announce the availability of CJD 0.1.0. CJD is a technology for documenting Clojure programs which I devised to satisfy my idiosyncratic documentation-related propensities. It's mostly complete, so I thought I'd share it with the community just in case there are any fellow travelers with similar inclinations. CJD makes use of structured comments embedded in Clojure source code in a fashion inspired by Javadoc, to which it bears a superficial similarity. Like Javadoc, CJD comments support a simple form of markup that not only can add formatting detail but also provides a modicum of metadata that describes what's being documented. This allows CJD's processing facility to extract the documentation content from collections of Clojure namespaces and convert it into trees of consistently-formatted HTML documents. Thus, CJD comments represent a much more expressive alternative or supplement to docstrings. Ground zero for CJD is its home on GitHub https://github.com/greenh/CJD, which includes a FAQ http://greenh.github.com/CJD/doc/FAQ.html that provides a reasonably concise overview and rationale for CJD, and a user's guide http://greenh.github.com/CJD/doc/User.html that represents a first-pass attempt at describing the gory details. Needless to say, CJD uses CJD for its own program documentation. You can see the output of a representative namespace in your choice of light-background http://greenh.github.com/CJD/doc/light/cjd.exome.htmland dark-background http://greenh.github.com/CJD/doc/dark/cjd.exome.html(my favorite!) renderings, and the source from which it was generated here https://github.com/greenh/CJD/blob/master/src/clojure/cjd/exome.clj . Here's a few additional points about CJD. You'll get all these and more from the links above, but just in case your interest hasn't already been piqued… - Documentation comments generally consist largely of ordinary text, so they're easily readable in source form. Required additions for markup and escape sequences tend to be fairly minimal. - Markup is structured in terms of syntactically valid Clojure forms, allowing Clojure-aware editors to be used to good advantage. - A recursively-defined documentation syntax allows Clojure's recursively-defined data structures and functions to be documented to whatever depth is needful. - Structure-aware support for documenting core Clojure artifacts (vars, functions, macros, protocols, records, etc.) is available right out of the box. CJD also provides facilities for extensions that allow user-defined artifacts to be compatibly documented. - Recognizing the value of richly-linked documentation, CJD tries to make it easy to link to other artifacts' documentation, both within and external to a project. - What does and doesn't get documented, and to what extent, is entirely at the developer's discretion. No pressure, no complaints—CJD happily accepts whatever scraps of documentation you throw its way. And, it's available from Clojars https://clojars.org/cjd, it includes a plugin that works with both the 1.x and 2.x versions Leiningen, it runs from the REPL, and there's even support for all you command-line enthusiasts out there. Enjoy! --- Howard -- 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: Clojure contrib datalog
There's also https://github.com/fogus/bacwn 2012/12/10 Alexander Solovyov alexan...@solovyov.net Hi, I don't think it's maintained somewhere (at least I haven't seen anything), but at some point in past I extracted it from sources of clojure-contrib and put it on github (with few updates to code, nothing major): https://github.com/piranha/datalog On Sun, Dec 9, 2012 at 1:15 PM, Shantanu Kumar kumar.shant...@gmail.comwrote: Hi, I saw clojure-contrib datalog has not made it into modular contribs: https://github.com/clojure/clojure-contrib/tree/master/modules/datalog http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go http://dev.clojure.org/display/doc/Clojure+Contrib+Libraries Does anybody know if it's being maintained somewhere? Datomic supports datalog, so I wrongly presumed otherwise earlier. Shantanu -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- Alexander -- 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: Sorted Sets With Duplicate Elements
what about using = as sorting fuction? 2012/11/20 JvJ kfjwhee...@gmail.com First of all: I don't EXACTLY mean duplicate elements. I just mean duplicates in those parts of the elements which are compared. For instance, I recently tried to have a sorted set of 2-element vectors where the comparator was used on the second element, however, something like this happened: (sorted-set-by #( (second %) (second %2)) [:a 1] [:b 1] [:c 1]) == #{[:a 1]} Does anyone know how I could have a set that includes all of these elements? -- 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: [Ann] Kibit 0.0.6
it is not always true that using vec is equal to using into [] user= (require '[clojure.core.reducers :as r]) nil user= (r/map inc (range 2)) #reducers$folder$reify__407 clojure.core.reducers$folder$reify__407@1358d955 user= (into [] *1) [1 2] user= (vec *2) RuntimeException Unable to convert: class clojure.core.reducers$folder$reify__407 to Object[] clojure.lang.Util.runtimeException (Util.java:170) 2012/11/12 Andreas Liljeqvist bon...@gmail.com I would prefer the use of vec. If I am using an empty 'to' then I would always replace it with the type constructor. Feels more clean to me. You aren't logically taking an empty vector and filling it with stuff, you are converting your original coll. On Sun, Nov 11, 2012 at 5:04 PM, Jim - FooBar(); jimpil1...@gmail.comwrote: Kibit is probably looking for syntactic patterns not for types or anything like that... but still, why is it suggesting this? Jim On 11/11/12 15:58, Jim - FooBar(); wrote: Kibit says: Consider using: (vec (:children (game-tree dir b next-level))) instead of: (into [] (:children (game-tree dir b next-level))) why is that? Does it make a difference if '(:children (game-tree dir b next-level))' returns a reducer? Jim On 11/11/12 15:08, Jonas wrote: Hi Today I released version 0.0.6 of Kibit[1]. Kibit is a simple code analysis tool. The purpose of the tool is to tell its users that Hey, There's already a function for that!. Kibit uses core.logic[2] to search for patterns of code which can be simplified. For example, if the analyzer finds `(apply concat (apply map ...)` It will notify its user about the availability of `mapcat`. For this release I have split the leiningen plugin part of kibit of into it’s own project (lein-kibit[3]). This was done in order for kibit to be able to read tagged literals (using the Clojure 1.5 `*default-data-reader-fn*` var). This release also includes several new rules contributed by the community -- Many thanks! I hope you enjoy Kibit Jonas [1] https://github.com/jonase/**kibit https://github.com/jonase/kibit [2] https://github.com/clojure/**core.logichttps://github.com/clojure/core.logic [3] https://github.com/jonase/**lein-kibithttps://github.com/jonase/lein-kibit -- 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/**group/clojure?hl=enhttp://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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/**group/clojure?hl=enhttp://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: unseq
What about using destructuring? (defn F [[a b c d]] (+ a b c d)) 2012/11/6 the80srobot a...@ingenious.cz If I understand this right, you're looking for something like Lua's unpack function. AFAIK you will not be able to do this in Clojure using functions, because Clojure functions can only return one argument. The only way to achieve this behavior would by by transforming your calls using reader macros and then eval. I do not recommend doing this. I understand that something like unpack is a more general case of apply, but I can't think of any scenario where apply isn't enough - out of interest, what are you trying to do? -Adam On Monday, November 5, 2012 5:45:46 AM UTC+1, cej38 wrote: Say you are given a vector A=[a1 a2 a3 a4] by some function/library/Java call/whatever. You want to use A in some function F that expects the values a1 a2 a3 a4 but not in the form of A; for example (defn F [w x y z] (+ w x y z)). Is there some function G that you can use on A such that (F (G A)) would give the correct answer? I now know ways of getting around this, for example in the overly simple problem I gave above I would use (eval (cons F [1 2 3 4])). But I have came across problems where I have had to spend a large amount of time trying to figure out how to do this correctly. I would think that there could be something to act as G. Is there something like this? It would definitely simplify things from time to 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 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: A Practical Optional Type System for Clojure
Hi Ambrose, great work! I found a typo on page 14, you wrote ... equivalent to [- (U nil String] in Typed Clojure 2012/10/25 Ambrose Bonnaire-Sergeant abonnaireserge...@gmail.com Hi, I have submitted my honours dissertation for marking, for those interested: https://github.com/downloads/frenchy64/papers/paper.pdf Corrections welcome! Thanks, Ambrose -- 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: Calling name on a keyword gives nil??
I've had this happening to me too. Couldn't figure out wtf was going on. Until somebody understands what's the problem is, you can(let [s (.sym ^clojure.lang.Keyword k)] ..) and call name on s 2012/10/22 JvJ kfjwhee...@gmail.com I'm getting a REALLY weird error. I'm trying to check if a set of keywords are all uppercase. When binding a value to 'res' in the let statement, I traverse a list of keywords. However, the calls to the name function on those keywords give nil. The debug print statement clearly shows that the class of k is a keyword, and yet its name is nil? I really don't get it. ;; Program (defn defrel-fn Adds a relation definition to the *relations* map. [name keys] (let [res (every? (fn [k] (println k: (name k) , (class k)) ;; Added for debugging (= (name k) (.toUpperCase (name k keys) ;; keys need to be all in uppercase letters! ;;_ (when-not res (throw (Exception. Error. All keys must be upper-case.))) kns (apply hash-map (mapcat vector keys (range))) ;; represents a map of keys to indices ] (swap! *relations* assoc name {:fields kns :unfields (vec keys) ;; A map of indices to keys is best represented as a vector }))) ;; Output from repl = (worldrep.core/defrel-fn 'mother [:SELF :CHILD]) k: nil , clojure.lang.Keyword NullPointerException clojure.lang.Reflector.invokeNoArgInstanceMember (Reflector.java:314) -- 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: [ANN] neurotic-0.2.1 and blind-0.2.2
I'm following clojure's LispReader implementation in blind, you should ask that question to clojure devs 2012/10/14 AtKaaZ atk...@gmail.com Hi! What would you do about this ? https://github.com/quil/quil/commit/d0312f0f119db066a8d613dec8803571b92bea39 Would you edit the file or change the reader? Thanks. On Sun, Oct 14, 2012 at 3:14 PM, Bronsa brobro...@gmail.com wrote: Neurotic is a library that implements a `deftrait` macro and support for implementing those traits in `deftype`/`defrecod` The purpose of this library is to provide a mechanism of code-reuse for those occasions when using a map and `extend` is not fast enough, or, in the case of java interfaces instead of clojure protcols, where `extend` would simply be impossible to use. https://github.com/Bronsa/neurotic Blind is a complete implementation of the clojure reader written in clojure, based on `clojure.lang.LispReader` and `cljs.reader` https://github.com/Bronsa/blind More informations and the documentation are available on the READMEs of the repositories. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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: [ANN] neurotic-0.2.1 and blind-0.2.2
In these days I've released a new version of neurotic To use it simply put on your project.clj [bronsa/neurotic 0.3.3] With the 0.3.3 release neurotic fully supports implementing deftrait from: deftype, defrecor, extend and extend-type. Error messages has also been improved. A new version of blind has also been released today, fixing a few bugs in syntax-quote implementation [bronsa/blind 0.2.4] Note that as of right now blind.reader is really slow, I'm pretty sure there's a bottleneck somewhere but I'm not too good at profiling. If somebody wants to give some help to speed things up, pull requests are welcome (suggestions too). 2012/10/14 Bronsa brobro...@gmail.com Neurotic is a library that implements a `deftrait` macro and support for implementing those traits in `deftype`/`defrecod` The purpose of this library is to provide a mechanism of code-reuse for those occasions when using a map and `extend` is not fast enough, or, in the case of java interfaces instead of clojure protcols, where `extend` would simply be impossible to use. https://github.com/Bronsa/neurotic Blind is a complete implementation of the clojure reader written in clojure, based on `clojure.lang.LispReader` and `cljs.reader` https://github.com/Bronsa/blind More informations and the documentation are available on the READMEs of the repositories. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
[ANN] neurotic-0.2.1 and blind-0.2.2
Neurotic is a library that implements a `deftrait` macro and support for implementing those traits in `deftype`/`defrecod` The purpose of this library is to provide a mechanism of code-reuse for those occasions when using a map and `extend` is not fast enough, or, in the case of java interfaces instead of clojure protcols, where `extend` would simply be impossible to use. https://github.com/Bronsa/neurotic Blind is a complete implementation of the clojure reader written in clojure, based on `clojure.lang.LispReader` and `cljs.reader` https://github.com/Bronsa/blind More informations and the documentation are available on the READMEs of the repositories. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: ANN: a Clojure docs site, and github organization
Starting two different projects at the same time with almost the same purpose seems a waste of efforts... Wouldn't it be better for readevalprintlove and clojuredocs to join forces from the beginning? 2012/10/4 Laurent PETIT laurent.pe...@gmail.com 2012/10/4 Paul deGrandis paul.degran...@gmail.com This is great to see. Along side efforts like Fogus' REPL love - http://readevalprintlove.fogus.me/ - we're well on our way fixing the documentation problems in our community. I could definitely see something like this migrating into docs.clojure.org once it reached maturity. Huge thanks to everyone involved in these efforts and responding the call to action. Sorry, I couldn't resist the temptation to remind you of this: http://www.ted.com/talks/derek_sivers_keep_your_goals_to_yourself.html Cheers, -- Laurent Also, thanks to Andy Fingerhut - who patched up the docs on contributing and helped to improve the ticket triage process. And thanks to Stu Halloway for taking some time off list to sort out some issues and help push some things forward. Paul // ohpauleez -- 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: problem 58 on 4clojure
check out clojure.core/comp, and it's source 2012/8/25 John Holland jbholl...@gmail.com This problem is really confusing me. I found a solution online, but I can't understand the solution. Can anyone explain to me why this works? The problem is stated as: Write a function which allows you to create function compositions. The parameter list should take a variable number of functions, and create a function applies them from right-to-left. (= [3 2 1] ((__ rest reverse) [1 2 3 4])) (= 5 ((__ (partial + 3) second) [1 2 3 4])) The examples would accept the solution replacing the . The solution I found is: (fn [x xs] (fn [ args] ((fn step [[f fs] a] (if fs (f (step fs a)) (apply f a))) (cons x xs) args))) This works, and baffles me when I try to understand it. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: problem 58 on 4clojure
its* 2012/8/25 Bronsa brobro...@gmail.com check out clojure.core/comp, and it's source 2012/8/25 John Holland jbholl...@gmail.com This problem is really confusing me. I found a solution online, but I can't understand the solution. Can anyone explain to me why this works? The problem is stated as: Write a function which allows you to create function compositions. The parameter list should take a variable number of functions, and create a function applies them from right-to-left. (= [3 2 1] ((__ rest reverse) [1 2 3 4])) (= 5 ((__ (partial + 3) second) [1 2 3 4])) The examples would accept the solution replacing the . The solution I found is: (fn [x xs] (fn [ args] ((fn step [[f fs] a] (if fs (f (step fs a)) (apply f a))) (cons x xs) args))) This works, and baffles me when I try to understand it. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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: anonymous fns won't work in seesaw...
this is because the #() checks for arguments used inside its body to infer its arity. in #(alert ..) you don't use any arg so it creates a function with no argument, such as doing (fn [] ..) Il giorno 17/ago/2012 11.50, Jim - FooBar(); jimpil1...@gmail.com ha scritto: Hi everyone, I was surprised to discover that anonymous functions will not work in seesaw...For example the following throws an exception (wrong number of args): (button :text Undo :listen [:action #(alert Not implemented!)]) but if i replace the anonymous fn with (fn [e] (alert Not implemented!)) it works just fine!!!the same is true for when defining an action like so: (action :handler (fn [e] (alert Not implemented!)) :name Save :tip Save a game to disk. :key menu S) If it was an anonymous fn it would throw an exception...This is very weird for me cos I know that anonymous fns take variable number of args so i don't see what the problem is...any explanations/suggestions? Most of the ssesaw docs show examples using (fn [e] (... ...)) but I'm sure I've seen snippets that use #(... ...). What is going on? 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 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.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/**group/clojure?hl=enhttp://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: assoc! order problem
because of performance reasons, hash-maps are not ordered. the fact that they are ordered for the first 32 elements is just an implementation detail you shouldn't rely on Il giorno 05/ago/2012 10.10, llj098 liulijin.w...@gmail.com ha scritto: thanks for reply, I know the sorted-map, but my question is : *why the map is not 'ordered' when size is larger than 32 ? * * * * * On Sunday, August 5, 2012 3:53:04 AM UTC+8, Jeff Heon wrote: You are using the map literal, which corresponds to the hash map. Use this if you want a sorted map: http://clojure.github.com/** clojure/clojure.core-api.html#**clojure.core/sorted-maphttp://clojure.github.com/clojure/clojure.core-api.html#clojure.core/sorted-map -- 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: assoc! order problem
Note that you can't use a sorted-map in a transient 2012/8/4 Jeff Heon jfh...@gmail.com You are using the map literal, which corresponds to the hash map. Use this if you want a sorted map: http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/sorted-map -- 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: Any downside of record compared to map
there's also the reader literal user= (defrecord foo [bar baz]) user.foo user= #user.foo{:baz 1 :bar 2} #user.foo{:bar 2, :baz 1} 2012/7/23 Takahiro Hozumi fat...@googlemail.com Baishampayan I didn't know `map-Foo`. Thank you for the infomation! On Monday, July 23, 2012 2:11:45 PM UTC+9, Baishampayan Ghose wrote: On Mon, Jul 23, 2012 at 10:37 AM, Takahiro Hozumi fat...@googlemail.com wrote: 2. The construction of record depends on an order of arguments. Sometimes, I feel that a lack of construction with key-value style is not convenient. (defrecord Foo ... will give you `-Foo` `map-Foo` for free. The second one accepts a map as input. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com On Monday, July 23, 2012 2:11:45 PM UTC+9, Baishampayan Ghose wrote: On Mon, Jul 23, 2012 at 10:37 AM, Takahiro Hozumi fat...@googlemail.com wrote: 2. The construction of record depends on an order of arguments. Sometimes, I feel that a lack of construction with key-value style is not convenient. (defrecord Foo ... will give you `-Foo` `map-Foo` for free. The second one accepts a map as input. 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 -- 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: Strange evaluation result of the quoted form on 1.3
you' are calling (apply 'foo '(1 2)), what you want is (apply foo '(1 2)) just call bar as (bar (list foo 1 2)) 2012/6/7 Alex Shabanov avshaba...@gmail.com I'm curious why the following form evaluates to 2: (defn foo [ more] (println foo( more ))) (defn bar [v] (apply (first v) (rest v))) (bar '(foo 1 2)) If the form (bar '(foo 1 2)) extended to, say, (bar '(foo 1 2 3 4)) the arity exception will be thrown. The behavior can be reproduced after picking another names for foo and/or bar functions. -- 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: Strange evaluation result of the quoted form on 1.3
yes, symbols like keywords lookup themselves into the second element, or return the third if they cannot find their value ('a {'a 1} 2) ;= 1 ('b {'a 1} 2} ;= 2 2012/6/7 Alex Shabanov avshaba...@gmail.com Oh, I see. This is because of the reader that interprets symbols from the quoted forms in different way it does for the unquoted ones (and this feature still strikes me as odd). To make matters more complicated the quoted symbols seems to have some meanings as functions for the clojure, since ('foo 1) - nil, ('foo 1 2) - 2, ('foo 1 2 3 4) - arity exception. четверг, 7 июня 2012 г., 20:05:43 UTC+4 пользователь Bronsa написал: you' are calling (apply 'foo '(1 2)), what you want is (apply foo '(1 2)) just call bar as (bar (list foo 1 2)) 2012/6/7 Alex Shabanov avshaba...@gmail.com I'm curious why the following form evaluates to 2: (defn foo [ more] (println foo( more ))) (defn bar [v] (apply (first v) (rest v))) (bar '(foo 1 2)) If the form (bar '(foo 1 2)) extended to, say, (bar '(foo 1 2 3 4)) the arity exception will be thrown. The behavior can be reproduced after picking another names for foo and/or bar functions. -- 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/**group/clojure?hl=enhttp://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: when function
or simply use `case` (case group-identifier ID1 (handle-id1 line) ID2 (handle-id2 line) ID3 (handle-id3 line)) 2012/5/21 Timothy Baldridge tbaldri...@gmail.com In this case I prefer either: (cond (= group-identifier ID1) (handle-id1 line) (= group-identifier ID2) (handle-id2 line) (= group-identifier ID3) (handle-id3 line)) Or just use core.match: (match [group-identifier] [ID1] (handle-id1 line) [ID2] (handle-id1 line) [ID3] (handle-id1 line)) But then again, I have this thing for pattern matching...it's so elegant. Timothy Baldridge On Mon, May 21, 2012 at 10:54 AM, Christian Guimaraes cguimaraes...@gmail.com wrote: Hi all, I'm struggling with when code structures and my imperative mindset. What is the better approach (or functional approach) to work with a code like the below? (defn parse-group [group-identifier line] (when (= group-identifier ID1) (handle-id1 line)) (when (= group-identifier ID2) (handle-id2 line)) (when (= group-identifier ID3) (handle-id3 line))) Thank you. -- christian -- 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 -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- 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: Disable name mangling for 'static'
This should fix it http://dev.clojure.org/jira/browse/CLJS-202 2012/4/24 Chris Granger ibdk...@gmail.com If I remember right, I did this as a workaround: (js/my.ns.express.static public) Cheers, Chris. On Apr 24, 12:33 pm, David Nolen dnolen.li...@gmail.com wrote: It's a known bug. We should not munge JS reserved words that appear in property access. Patch welcome. David On Tue, Apr 24, 2012 at 3:31 PM, Jonathan Fischer Friberg odysso...@gmail.com wrote: Hi, I want to create a (partially static) server with nodejs and express. I want to be able to write something like the following: (def app (.createServer express)) (.use app (.static express public)) (.listen app 8080) The problem here is that clojurescript seems to compile the name 'static' to 'static$'. No matter how I do it, this is the case. I have tried various tricks with js* and such, but all have been unsuccessful. Any ideas? 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 -- 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: Precondition asserts in macros
try with {:pre [(string? (eval bar))]} -- 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: (.containsKey {:one 1} :one) throws Exception
not sure why, but this works: user= (.containsKey ^clojure.lang.Associative {:one 1} :one) true 2012/3/3 Alf Kristian Støyle alf.krist...@gmail.com Hi guys, I am wondering why this does not work: (.containsKey {:one 1} :one) ;= ClassCastException clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.PersistentHashMap The map is a: (class {:one 1}) ;= clojure.lang.PersistentArrayMap And a PersistentArrayMap does have a containsKey method ( https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentArrayMap.java#L95 ). I can even find the method: (filter #(= containsKey (.getName %)) (.getMethods (class {:one 1}))) ;= (#Method public boolean clojure.lang.PersistentArrayMap.containsKey(java.lang.Object)) Should this not be a normal reflective method lookup, why do I get a ClassCastException? It does work if the map gets big enough: (.containsKey {1 1, 2 2, 3 3, 4 4, 5 5, 6 6, 7 7, 8 8, 9 9} 1) ;= true But at this point its a different collection: (class {1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9}) ;= clojure.lang.PersistentHashMap Cheers, Alf -- 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: Distributed transactions
maybe avout is what you're looking for? https://github.com/liebke/avout 2011/12/31 Michael Jaaka michael.ja...@googlemail.com Is there any attempt to make distributed transactions? The usage scenario is the same like in JEE apps. I mean, there is a web service call, the transaction is started, there are some changes to db, some jms sends and when there is no failure all is commited. Maybe someone is already using glassfish or spring from clojure? Some reference to github? -- 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: Really loving Clooj but..
you are invoking the function in the wrong way what you really want to do is this: user (min-1 2 1 3) 1 2011/12/29 Erlis Vidal er...@erlisvidal.com Hi guys, I've using Clooj and following the labrepl but I'm hitting a wall right now. How can I debug here? This the code I want to debug (defn min-1 [x more] (loop [min x more (seq more)] (if-let [x (first more)] (recur (if ( x min) x min) (next more)) min))) This is suppose to return the min value but it's not, It's returning me the same sequence I'm passing: student.dialect= (min-1 [1 2 3]) [1 2 3] Even if you find the problem, don't forget to let me know how can I debug here, so I can do it the next time Thanks Erlis -- 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: how to use record as a value
is it -record just a shortrand for record.? 2011/10/6 Aaron Bedra aaron.be...@gmail.com Assuming you want to do things with the record later, why not just create it in the let binding (let [foo (-car 1982 Mercedes)] ...) or (let [foo (car. 1982 Mercedes)] ...) or even (let [foo (map-car {:year 1982 :manufacturer Mercedes})] ...) or if you must (let [foo #user.car{:year 1982 :manufacturer Mercedes}] ...) Cheers, Aaron Bedra -- Clojure/core http://clojure.com On 10/06/2011 01:27 PM, Razvan Rotaru wrote: Hi, I want to instantiate a record, but having the record type as value at runtime. Example: (defrecord car [year manufacturere]) (defrecord bike [year manufacturere]) (defrecord boat [year manufacturer]) I want to do (new stuff 1982 Mercedes), but having the record type kept in the variable stuff. Something like: (let [stuff car] (new stuff 1982 Mercedes)) (let [stuff bike] (new stuff 1990 Harley Davidson)) Obviously new does not work. I'm gratefull for suggestions of how to do it best. Thanks, Razvan -- 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: clojure.core.logic.core/match usage
I *think* this is because when there are multiple matches, the most specialized matches and 1 is less generic than _ On Mon, Oct 3, 2011 at 12.39 PM, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: If I remove the line [{:a 1 :c _}] :a1 it returns :a-1 .. So, I guess it means that the behavior is undefined if there are multiple matches. Sunil. On Mon, Oct 3, 2011 at 3:57 PM, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Hello everybody, I was playing with core.match library and I notice the following behavior let [x {:a 1 :b 2 :c 10 :d 30}] (match [x] [({:a _ :b _ :c _ :d _} :only [:a :b :c :d])] :a-1 [({:a _ :b 2} :only [:a :b])] :a0 [{:a 1 :c _}] :a1 [{:c 3 :d _ :e 4}] :a2 :else [])) returns :a1 I was hoping to get :a-1 Am I using it wrong? Have I misunderstood as to how match is supposed to work? It looks like match assumes either that there is always a unique match or it does not guarantee that it will the try matches in the order specified. Can somebody help? Thanks, Sunil. -- 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: Does macros evaluates its arguments before?
or simply replace ~e with '~e -- 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: Does macros evaluates its arguments before?
oh, that's right 2011/9/26 Alan Malloy a...@malloys.org Noo, then you can't do, for example, (let [x 1] (infix (x + 1))). On Sep 26, 8:34 am, Bronsa brobro...@gmail.com wrote: or simply replace ~e with '~e -- 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: Re: lein repl newbie question
labwor...@gmail.com wrote: well, I was doing control+c which works too. How is control+d different? On , Islon Scherer islonsche...@gmail.com wrote: Have you tried control+d? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en ctrl-c sends a SIGINT while ctrl-d sends an EOF -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure embedded in a Java Application
The problem could be that #{} in clojure is a set literal, try using clojure.lang.PersistentHashSet/create Hi I'm new to Clojure so forgive me if this is a dumb question. I want to incorporate some Clojure into a Java application. String rule=(str key val label); String str = (ns test) + (defn foo [key val label] + rule + ); System.out.println(str); Compiler.load(new StringReader(str)); // Get a reference to the foo function. Var foo = RT.var(test, foo); // Call it! Object result = foo.invoke( hello,world,this is a test); The code works BUT if I try to pass in a map for example like so Object result = foo.invoke( hello,world,#{:a 1 :b 2}); I always get a ClassCastException. Am I doing something ridiculous here? Is it possible to pass in a Map from the Java world into the Clojure code? Also any comments on using Clojure within a Java app appreciated. Is it a good idea. I was thinking of allowing rules to be dynamically added to fields within a web application. -- 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: Deamons in Clojure (was Re: Clojure vs Scala - anecdote)
the lein-daemon plugin seems to do that Il giorno 07/set/2011 16.27, Marko Kocić marko.ko...@gmail.com ha scritto: While we are at this topic, how do you run Clojure deamons. Do you have some scripts to set it up how? Is there a simple way to daemonize lein project? Regards, Marko -- 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: help with some code
this is because in order to use ~ to evaluate the fn, you need to use the backtick ` instead of the single quote ' Il giorno 13/lug/2011 00.34, Paul Meehan paulm...@gmail.com ha scritto: Sorry to repoen the discussion, but I got this: = (def alist '(1 ~(fn [x y](+ x y #'user/alist = (apply (second alist) '(1 3)) #CompilerException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IFn (NO_SOURCE_FILE:0) On 07/12/2011 23:13, Benny Tsai wrote: Nice, yes, that works just as well :) On Tuesday, July 12, 2011 4:09:09 PM UTC-6, LaPingvino wrote: Didn't try, but shoudn't (def alist `(1 ~(fn [x y] (+ x y be better? Then you don't need the eval :) 2011/7/12 Benny Tsai benny...@gmail.com alist is missing parens around the fn, so it's really a list of 4 elements like so: (1, fn, [x y], (+ x y)) So (second alist) returns just the symbol 'fn. And when you apply a Symbol to a list, the result is the last item in the list (not sure why). To do what you want, alist should be defined like this: (def alist '(1 (fn [x y] (+ x y Also, it seems that the definition of the function needs to be eval'ed first to become an apply-able function. The following returns 4 in my REPL: (apply (eval (second alist)) '(1 3)) -- 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 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: Native compiler on Clojure
i think he means clojure in clojure Il giorno 11/lug/2011 12.12, Philipp Meier phme...@gmail.com ha scritto: On 11 Jul., 00:26, cran1988 rmanolis1...@hotmail.com wrote: Did anyone started creating native compiler for Clojure language ? Do you mean a compiler which emits native code or do you mean a compiler written in clojure emitting java byte code? -billy. -- 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