Re: separation of concerns w/o encapsulation
On Tuesday, May 12, 2015 at 4:29:22 AM UTC-7, Georgi Danov wrote: coding and designing defensively because you are concerned about your teammates is big waste of time. if this is the reality (in the enterprise it's the norm) Yes, it is the norm in the enterprise. In a decade of enterprise coding, encapsulation became a conditioned response. Anything exposed would be abused, guaranteed. It was impossible to enforce through documentation, due to the size of the organization. Requiring another team to read the docs, and respect API boundaries when committing, involved trying to persuade three layers of management that it was important enough to institute such a policy. From the VP perspective, shipping next week was always more important. Encapsulation was the only tool that worked. To some degree, it's the norm in other contexts as well. We see in popular languages w/o encapsulation that users invariably code to the internals, making it difficult or impossible to refactor libraries. http://ziade.org/2010/03/03/the-fate-of-distutils-pycon-summit-packaging-sprint-detailed-report/ When you have enough users, the cost of such breakage is quite high. Then they should have known better doesn't fly as an argument. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: contains? on String
I agree about the counter-intuitiveness. I'm only wondering whether the error message is a bit misleading contains? not supported on type: java.lang.String because of course (contains? hello 2) works fine. Shantanu On Wednesday, 13 May 2015 00:12:19 UTC+5:30, James Reeves wrote: contains? has always been a little counter-intuitive. It essentially only works on collections that allow for a constant or logarithmic lookup time, and often works on the keys of a collection, rather than its values. The only exception to this are sets, where the values are essentially keys as well. So: (contains? {:a 1} :a) = true (contains? {:a 1} 1) = false (contains? [:a] :a) = false (contains? [:a] 0) = true (contains? #{:a} :a) = true (contains? a \a) = error (contains? '(:a) :a) = error - James On 12 May 2015 at 19:25, Shantanu Kumar kumar.s...@gmail.com javascript: wrote: Hi, I notice the following in Clojure 1.7.0-beta2: user= (contains? hello 2) true user= (contains? hello \e) IllegalArgumentException contains? not supported on type: java.lang.String clojure.lang.RT.contains (RT.java:800) Is this just a case of misleading error message or am I missing something? Shantanu -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com javascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: contains? on String
On May 12, 2015, at 1:54 PM, Shantanu Kumar kumar.shant...@gmail.com wrote: I agree about the counter-intuitiveness. I'm only wondering whether the error message is a bit misleading contains? not supported on type: java.lang.String because of course (contains? hello 2) works fine. It seems odd that (contains? abc 2) works, at least to me. It's clearly intentional, from this line in RT.java: else if(key instanceof Number (coll instanceof String || coll.getClass().isArray())) { Can anyone comment on why Strings are explicitly supported here? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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.
[ANN] yada 0.4.0 - async REST web library
yada is a library for creating RESTful Ring handlers, similar(ish) to Liberator. The main difference is that yada fully supports async operation (provided by Zach Tellman's manifold library). It is a kind of reactive Clojure-based response to Java's ratpack.io or Scala's spray.io. yada is designed to be sufficiently terse to be used for both RESTful web APIs and content. For example, here's how to create a Ring handler providing HTML5 server-sent-events via a core.async channel :- (yada {:body (chan)}) yada is designed to complement bidi (a uri routing library). While both are separate libraries, yada's resource-maps combine with bidi's routes to define a full web API (providing sufficient information to publish a Swagger 2.0 specification if required). Naturally yada is new, still alpha-status and under active development. I wanted to let folks know about it and would be grateful for any help/feedback prior to any beta release. MIT licensed. Further information can be found in the docs which can be found both in the git repo (https://github.com/juxt/yada) and self-hosted at http://yada.juxt.pro -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: contains? on String
On 12 May 2015 at 19:54, Shantanu Kumar kumar.shant...@gmail.com wrote: I agree about the counter-intuitiveness. I'm only wondering whether the error message is a bit misleading contains? not supported on type: java.lang.String because of course (contains? hello 2) works fine. Oh, I see! Yes, that is a bit misleading. - James -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Probabilistic programming anyone?
Looks great. Could I use this to implement something like a Gibbs Sampler? On Tuesday, May 12, 2015 at 3:05:50 AM UTC-7, Frank Wood wrote: I'm a professor at Oxford and my group has been working on a new embedded language called Anglican: http://www.robots.ox.ac.uk/~fwood/anglican/ It can be used to do advanced machine learning in Clojure (Java, etc.) applications without having to know anything about inference or math. For example see: http://www.robots.ox.ac.uk/~fwood/anglican/examples/index.html My group would be very interested to get feedback on the language design and its usefulness to the community. Also, frankly, we could use your help in taking it forward, where help largely means writing queries and telling us what doesn't work. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Probabilistic programming anyone?
Another question: is there a particular reason why the code of Anglican is hosted on BitBucket with read only access for outsider, whereas the examples are on Github? Does that mean that you do not anticipate contributions to the language from the outside? I saw the license is GPL though. On Tuesday, May 12, 2015 at 3:05:50 AM UTC-7, Frank Wood wrote: I'm a professor at Oxford and my group has been working on a new embedded language called Anglican: http://www.robots.ox.ac.uk/~fwood/anglican/ It can be used to do advanced machine learning in Clojure (Java, etc.) applications without having to know anything about inference or math. For example see: http://www.robots.ox.ac.uk/~fwood/anglican/examples/index.html My group would be very interested to get feedback on the language design and its usefulness to the community. Also, frankly, we could use your help in taking it forward, where help largely means writing queries and telling us what doesn't work. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: contains? on String
contains? has always been a little counter-intuitive. It essentially only works on collections that allow for a constant or logarithmic lookup time, and often works on the keys of a collection, rather than its values. The only exception to this are sets, where the values are essentially keys as well. So: (contains? {:a 1} :a) = true (contains? {:a 1} 1) = false (contains? [:a] :a) = false (contains? [:a] 0) = true (contains? #{:a} :a) = true (contains? a \a) = error (contains? '(:a) :a) = error - James On 12 May 2015 at 19:25, Shantanu Kumar kumar.shant...@gmail.com wrote: Hi, I notice the following in Clojure 1.7.0-beta2: user= (contains? hello 2) true user= (contains? hello \e) IllegalArgumentException contains? not supported on type: java.lang.String clojure.lang.RT.contains (RT.java:800) Is this just a case of misleading error message or am I missing something? 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 --- 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.
contains? on String
Hi, I notice the following in Clojure 1.7.0-beta2: user= (contains? hello 2) true user= (contains? hello \e) IllegalArgumentException contains? not supported on type: java.lang.String clojure.lang.RT.contains (RT.java:800) Is this just a case of misleading error message or am I missing something? 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 --- 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: contains? on String
On Tuesday, May 12, 2015 at 3:34:46 PM UTC-4, Michael Gardner wrote: On May 12, 2015, at 1:54 PM, Shantanu Kumar kumar.s...@gmail.com javascript: wrote: I agree about the counter-intuitiveness. I'm only wondering whether the error message is a bit misleading contains? not supported on type: java.lang.String because of course (contains? hello 2) works fine. It seems odd that (contains? abc 2) works, at least to me. It's clearly intentional, from this line in RT.java: else if(key instanceof Number (coll instanceof String || coll.getClass().isArray())) { Can anyone comment on why Strings are explicitly supported here? Strings and arrays support constant-time access by index. The thing that's broken is contains? not supported on type: java.lang.String instead of nil when a nonnumeric key is used. One gets nil with a nonnumeric key and a PersistentVector, rather than an exception. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: Opinion on take-while for stateful transducers
Thanks for the reply. I do like this. I think it's actually more elegant. Definitely going into my toolbox. One thing I dislike is that I still have to re-implement the logic of the already existing (performant tested) transducers. Also, I could also add a 4th parameter: 'terminate-early?' but that's then already 4 parameters to remember... I'll have to see what way is best once I implement more transducers with your or my (hacky) method. Cheers On Monday, May 11, 2015 at 1:34:31 PM UTC-4, miner wrote: Not an expert, but I’ll throw out an alternative approach that might work for you. I think it’s simpler to use a transducer that calls functions rather than trying to transform an existing transducer to do the cutoff. (defn take-while-accumulating [accf init pred2] (fn [rf] (let [vstate (volatile! init)] (fn ([] (rf)) ([result] (rf result)) ([result input] (if (pred2 @vstate input) (do (vswap! vstate accf input) (rf result input)) (reduced result))) accf is like a reducing function: takes two args, state and input, and returns new state of the “accumulation”. init is the initial state of the accumulation. pred2 is a predicate taking two args, the accumulation state and the new input. The process stops when pred2 returns false. ;; distinct (into [] (take-while-accumulating conj #{} (complement contains?)) '(1 2 3 4 2 5 6)) ;;= [1 2 3 4] ;; dedupe (into [] (take-while-accumulating (fn [r x] x) ::void not=) '(1 2 1 3 4 4 5 6)) ;;= [1 2 1 3 4] ;; monotonically increasing (into [] (take-while-accumulating max 0 =) '(1 2 3 4 4 1 5 6)) [1 2 3 4 4] Steve Miner steve...@gmail.com javascript: On May 9, 2015, at 6:28 PM, Andy- andre...@gmail.com javascript: wrote: (defn take-while-xf Takes a transducer and returns a transducer that will immediately finish (ie call (reduced)) when the transducer did not call the reducing function and just returned the result. Only really useful with stateful transducers. Otherwise you'd use take-while. [xf] -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: What does ^:internal mean?
You can use Symbol Hound to search for strange things though here it fails. Ex: http://symbolhound.com/?q=-%3E%3E+clojure On Sunday, May 10, 2015 at 9:00:10 PM UTC+2, piast...@gmail.com wrote: Sadly, Google seems to think I am search for internal when I search for ^:internal so that makes it hard to find the documentation. I am curious about this code: ;;; Capture the standard def forms' arglists (def ^:internal defn-arglists (vec (:arglists (meta #'defn (def ^:internal fn-arglists (vec (:arglists (meta #'fn (def ^:internal defmulti-arglists (vec (:arglists (meta #'defmulti (def ^:internal def-arglists '[[symbol doc-string? init?]]) From here: https://github.com/palletops/api-builder/blob/4d82355bec1ebdf7c501be71e2f3d156ae84ad2c/src/com/palletops/api_builder/impl.clj What does ^:internal mean in this context? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: What does ^:internal mean?
You can use Symbol Hound to search for strange things though here it fails. Ex: http://symbolhound.com/?q=-%3E%3E+clojure On Sunday, May 10, 2015 at 9:00:10 PM UTC+2, piast...@gmail.com wrote: Sadly, Google seems to think I am search for internal when I search for ^:internal so that makes it hard to find the documentation. I am curious about this code: ;;; Capture the standard def forms' arglists (def ^:internal defn-arglists (vec (:arglists (meta #'defn (def ^:internal fn-arglists (vec (:arglists (meta #'fn (def ^:internal defmulti-arglists (vec (:arglists (meta #'defmulti (def ^:internal def-arglists '[[symbol doc-string? init?]]) From here: https://github.com/palletops/api-builder/blob/4d82355bec1ebdf7c501be71e2f3d156ae84ad2c/src/com/palletops/api_builder/impl.clj What does ^:internal mean in this context? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: What does ^:internal mean?
knowing how to break down Clojure's syntax a bit helps, too. which means newbies are kinda screwed until they divine this. http://stackoverflow.com/questions/8920137/clojure-caret-as-a-symbol -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: What does ^:internal mean?
even github gets it totally wrong, apparently? https://github.com/laurentpetit/ccw/search?utf8=%E2%9C%93q=%22^%3Ainternal%22type=Code because, you know, it isn't as if github is mostly all about hosting *code*. such that, you know, you'd think they'd have realized by now this kind of feature is desirable / the current functionality is a huge lameness. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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 needs a web framework with more momentum
How do we effectively leverage some of the more advanced Clojure-oriented webservers such as Aleph and Immutant? I've just posted about yada on another thread, a library for 'proper' handling of Ring requests, fully supporting async. Although yada is a separate library, it fully complements bidi (a url routing library). There are a couple more complementary libraries on the way which will combine to form something akin to a 'web framework' discussed on this thread. Regards, Malcolm On Sunday, 3 May 2015 04:19:19 UTC+1, puzzler wrote: Last week, at the Clojure/West conference, someone (I think it was Brandon Bloom) summed up the general vibe well, by saying something along the lines of, We now have all the pieces in place to make web development an order of magnitude more productive than in any other language, we just need to figure out how to put it all together and make that happen. I think that's right. From a technological standpoint, I think we're there. The things we most need are informational resources and higher-level shared resources, such as UI widgets. For example: How do we use Buddy/Friend effectively to achieve secure web apps? (The docs are not sufficiently informative for those who haven't thought much about security and assume too much prior knowledge). How do we effectively leverage some of the more advanced Clojure-oriented webservers such as Aleph and Immutant? Clojure is great for creating new, disruptive web models, but what's the easiest path to creating something that can be done trivially with, say, Drupal or Django? Since more and more people are working with Reagent/Om/etc., we need as many Bootstrap-like widgets as possible for those tools, and more informational resources about how to use these new reactive models effectively, for example, how to do animated UIs. Are there reusable components like, say, shopping baskets? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: What does ^:internal mean?
There are other sources for this information, too (perhaps better ones), but the cheat sheet has a section with many of these special symbols: clojure.org/cheatsheet Andy On Tue, May 12, 2015 at 1:49 PM, Raoul Duke rao...@gmail.com wrote: knowing how to break down Clojure's syntax a bit helps, too. which means newbies are kinda screwed until they divine this. http://stackoverflow.com/questions/8920137/clojure-caret-as-a-symbol -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: contains? on String
On May 12, 2015, at 3:28 PM, Fluid Dynamics a2093...@trbvm.com wrote: Strings and arrays support constant-time access by index. Yes, but why should that mean that contains? should work on Strings? Because it can doesn't seem compelling to me. In discussions about contains?, one often hears that it works on associative containers, which is supported by the use of the word key in its docstring. Vectors are indeed associative, but Strings aren't (at least according to associative?), which is why this seems like a strange feature to me. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: contains? on String
Ignoring some of the conversation here to point out that what you want is: (.contains foo f) On Tue, May 12, 2015 at 4:04 PM, Michael Gardner gardne...@gmail.com wrote: On May 12, 2015, at 3:28 PM, Fluid Dynamics a2093...@trbvm.com wrote: Strings and arrays support constant-time access by index. Yes, but why should that mean that contains? should work on Strings? Because it can doesn't seem compelling to me. In discussions about contains?, one often hears that it works on associative containers, which is supported by the use of the word key in its docstring. Vectors are indeed associative, but Strings aren't (at least according to associative?), which is why this seems like a strange feature to me. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: contains? on String
On May 12, 2015, at 4:28 PM, Fluid Dynamics a2093...@trbvm.com wrote: On Tuesday, May 12, 2015 at 3:34:46 PM UTC-4, Michael Gardner wrote: On May 12, 2015, at 1:54 PM, Shantanu Kumar kumar.s...@gmail.com javascript: wrote: I agree about the counter-intuitiveness. I'm only wondering whether the error message is a bit misleading contains? not supported on type: java.lang.String because of course (contains? hello 2) works fine. Can anyone comment on why Strings are explicitly supported here? Strings and arrays support constant-time access by index. The thing that's broken is contains? not supported on type: java.lang.String instead of nil when a nonnumeric key is used. One gets nil with a nonnumeric key and a PersistentVector, rather than an exception. The contains? function is just badly named, spawning a couple of different kinds of confusion. I know it's not going to change -- the problems have been pointed out for years. But FWIW I find it's usually best to pretend it doesn't exist, and when my students run into trouble with it I suggest that they do the same. -Lee -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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.
load a namespace at repl?
If I: git clone https://github.com/overtone/overtone.git cd overtone lein repl and then at the REPL, I try to load Overtone: user= (all-ns) (#Namespace clojure.set #Namespace clojure.tools.nrepl.ack #Namespace clojure.stacktrace #Namespace clojure.string #Namespace clojure.java.browse #Namespace clojure.tools.nrepl.middleware.load-file #Namespace clojure.uuid #Namespace complete.core #Namespace clojure.main #Namespace clojure.tools.nrepl.middleware.session #Namespace user #Namespace clojure.test #Namespace clojure.java.javadoc #Namespace clojure.tools.nrepl #Namespace clojure.repl #Namespace clojure.tools.nrepl.bencode #Namespace clojure.tools.nrepl.server #Namespace clojure.java.io #Namespace clojure.tools.nrepl.middleware #Namespace clojure.template #Namespace clojure.java.shell #Namespace clojure.core.protocols #Namespace clojure.tools.nrepl.transport #Namespace clojure.tools.nrepl.middleware.interruptible-eval #Namespace clojure.pprint #Namespace clojure.core #Namespace clojure.tools.nrepl.misc #Namespace clojure.tools.nrepl.middleware.pr-values #Namespace clojure.walk #Namespace reply.exports #Namespace clojure.instant) user= (resolve 'overtone.studio.inst) ClassNotFoundException overtone.studio.inst java.net.URLClassLoader$1.run (URLClassLoader.java:372) user= (ns-resolve *ns* 'overtone.studio.inst) ClassNotFoundException overtone.studio.inst java.net.URLClassLoader$1.run (URLClassLoader.java:372) user= (ns-resolve *ns* overtone.studio.inst) CompilerException java.lang.ClassNotFoundException: overtone.studio.inst, compiling:(/private/var/folders/85/50nmp8fx3q72pxv4zlh_74pmgn/T/form-init5181314797293724962.clj:1:1) user= *ns* #Namespace user user= (namespace 'overtone.studio.inst) nil user= (namespace overtone.studio.inst) CompilerException java.lang.ClassNotFoundException: overtone.studio.inst, compiling:(/private/var/folders/85/50nmp8fx3q72pxv4zlh_74pmgn/T/form-init5181314797293724962.clj:1:1) What am I doing wrong? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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.
Probabilistic programming anyone?
I'm a professor at Oxford and my group has been working on a new embedded language called Anglican: http://www.robots.ox.ac.uk/~fwood/anglican/ It can be used to do advanced machine learning in Clojure (Java, etc.) applications without having to know anything about inference or math. For example see: http://www.robots.ox.ac.uk/~fwood/anglican/examples/index.html My group would be very interested to get feedback on the language design and its usefulness to the community. Also, frankly, we could use your help in taking it forward, where help largely means writing queries and telling us what doesn't work. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: separation of concerns w/o encapsulation
No tool or technology beats the combination of: a) component/responsibility blueprint b) discipline in communicating, following and adapting it encapsulation can be a nice safety net once you have the things above, but it would never be a solution to the problem. just a convenience. coding and designing defensively because you are concerned about your teammates is big waste of time. if this is the reality (in the enterprise it's the norm) guess clojure is not the best tech for that organization. On Friday, May 8, 2015 at 6:29:50 PM UTC+2, Brian Craft wrote: Talk on the list about encapsulation usually comes back to some variation of you don't need it when you have immutable data structures. But in the long term I'm finding the problem of working w/o encapsulation is not the danger of data being mutated under you. Rather, it's the danger of all the module boundaries blurring over time, leading to the big ball of mud: a very fragile code base where everything depends on everything else. E.g. if you model your application with a plain data structure which you pass around to different modules, each concerned with a small part of that data structure, the tendency over time is for every module to become concerned with every part of that data structure. Then you have no separation, nothing is reusable, and the code is very fragile. How do you avoid this, practically? In OO it would be enforced with encapsulation, so the next developer (which might be me, six months later) trying to fix a bug, or add a feature, knows Oh, I shouldn't peek in here: this module isn't supposed to depend on that piece of data. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: contains? on String
On Tuesday, May 12, 2015 at 5:05:00 PM UTC-4, Michael Gardner wrote: On May 12, 2015, at 3:28 PM, Fluid Dynamics a209...@trbvm.com javascript: wrote: Strings and arrays support constant-time access by index. Yes, but why should that mean that contains? should work on Strings? Because it can doesn't seem compelling to me. In discussions about contains?, one often hears that it works on associative containers, which is supported by the use of the word key in its docstring. Vectors are indeed associative, but Strings aren't (at least according to associative?), which is why this seems like a strange feature to me. Yes; and presumably you can't produce a string with one character changed using assoc either. But it should work consistently. Either it shouldn't work for strings, or it should work fully, including producing nil for not-found with nonnumeric keys. Ditto arrays. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: load a namespace at repl?
On Tue, May 12, 2015 at 9:09 PM, Fluid Dynamics a2093...@trbvm.com wrote: On Tuesday, May 12, 2015 at 10:55:27 PM UTC-4, piast...@gmail.com wrote: If I: git clone https://github.com/overtone/overtone.git cd overtone lein repl All you need to do is create a new lein project, and add the overtone dependency to it. https://github.com/overtone/overtone/#installation has the details, but in short: lein new my-music then add [overtone 0.9.1] to the :dependencies section of project.clj. This is the standard way to use most libraries in your Clojure project. -Ian. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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.
Need advice/idiom to reduce number of parameters in functions
I have a set of functions that need a map of historic data. Hence, this map gets passed along from function to function, usually several levels deep. In addition to the map, a reference date also frequently get passed along in 80% of the API. Sometimes a third or fouth parameter is also passed along several layer in addition to function specific parameters. You got the idea. In OOP, these common function parameters usually are part of the object's attributes. In FP, I've seen them passed along individually or packaged up into a map or vector so that they are easy to pass along... sort of like a context object getting passed around. What's the Clojure's way or FP way to improve this without having 5+ parameters in almost every function? Thanks Chris -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: load a namespace at repl?
On Tuesday, May 12, 2015 at 10:55:27 PM UTC-4, piast...@gmail.com wrote: If I: git clone https://github.com/overtone/overtone.git cd overtone lein repl and then at the REPL, I try to load Overtone: user= (all-ns) (#Namespace clojure.set #Namespace clojure.tools.nrepl.ack #Namespace clojure.stacktrace #Namespace clojure.string #Namespace clojure.java.browse #Namespace clojure.tools.nrepl.middleware.load-file #Namespace clojure.uuid #Namespace complete.core #Namespace clojure.main #Namespace clojure.tools.nrepl.middleware.session #Namespace user #Namespace clojure.test #Namespace clojure.java.javadoc #Namespace clojure.tools.nrepl #Namespace clojure.repl #Namespace clojure.tools.nrepl.bencode #Namespace clojure.tools.nrepl.server #Namespace clojure.java.io #Namespace clojure.tools.nrepl.middleware #Namespace clojure.template #Namespace clojure.java.shell #Namespace clojure.core.protocols #Namespace clojure.tools.nrepl.transport #Namespace clojure.tools.nrepl.middleware.interruptible-eval #Namespace clojure.pprint #Namespace clojure.core #Namespace clojure.tools.nrepl.misc #Namespace clojure.tools.nrepl.middleware.pr-values #Namespace clojure.walk #Namespace reply.exports #Namespace clojure.instant) user= (resolve 'overtone.studio.inst) ClassNotFoundException overtone.studio.inst java.net.URLClassLoader$1.run (URLClassLoader.java:372) user= (ns-resolve *ns* 'overtone.studio.inst) ClassNotFoundException overtone.studio.inst java.net.URLClassLoader$1.run (URLClassLoader.java:372) user= (ns-resolve *ns* overtone.studio.inst) CompilerException java.lang.ClassNotFoundException: overtone.studio.inst, compiling:(/private/var/folders/85/50nmp8fx3q72pxv4zlh_74pmgn/T/form-init5181314797293724962.clj:1:1) user= *ns* #Namespace user user= (namespace 'overtone.studio.inst) nil user= (namespace overtone.studio.inst) CompilerException java.lang.ClassNotFoundException: overtone.studio.inst, compiling:(/private/var/folders/85/50nmp8fx3q72pxv4zlh_74pmgn/T/form-init5181314797293724962.clj:1:1) What am I doing wrong? Looks like Overtone isn't in the classpath. I'd check the lein documentation for how to add a library to the classpath, or use a batteries-included IDE like CCW that has its own built-in library package manager and also manages things like classpaths for you. IME, in CCW using a new library is as simple as add it to project.clj dependencies, wait for CCW to finish auto-downloading stuff, and then launch REPL. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: load a namespace at repl?
On Tue, May 12, 2015 at 7:55 PM, piastkra...@gmail.com wrote: If I: git clone https://github.com/overtone/overtone.git cd overtone lein repl and then at the REPL, I try to load Overtone: ... user= (resolve 'overtone.studio.inst) You want require, not resolve, in order to load the namespace. Depending on exactly what you want to do, you may want: (require '[overtone.studio.inst :refer :all]) which will load the namespace and import all of its symbols into the user namespace. -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To 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.
[ANN] Dominator - Virtual DOM in ClojureScript
I'm excited to announce the first release of Dominator https://github.com/dubiousdavid/dominator. Dominator brings the simplicity and performance of the Virtual-DOM https://github.com/Matt-Esch/virtual-dom project to ClojureScript https://github.com/clojure/clojurescript. Dominator encourages a single flow of events, using pure functions for updating state and rendering, and using Zelkova https://github.com/jamesmacaulay/zelkova/core.async http://clojure.github.io/core.async/ for data flow. The concepts and patterns from the Elm http://elm-lang.org/ language are used extensively. Please hit me up with any questions. David https://github.com/dubiousdavid/dominator [dominator 0.1.0] -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: What does ^:internal mean?
Re: Some people don't like the native approach to private vars since anyone who wants to override it can do so anyway, so they go with a purely conventional and unenforced approach: delineate the boundaries of API vs internal using :internal or :impl and/or put the internal bits in an impl namespace. Yes. I've used this approach myself sometimes. Function metadata can also enhance documentation generation. Functions with ^:internal metadata could be treated and presented as internal API only. I don't know if codox or marginalia are customizable in this way. On Monday, May 11, 2015 at 8:35:06 PM UTC-4, Mischov wrote: To answer your question, ^:internal is shorthand meaning set the :internal key of the object's metadata to true. You can read more about metadata here http://clojure.org/metadata. On Sunday, May 10, 2015 at 2:00:10 PM UTC-5, piast...@gmail.com wrote: What does ^:internal mean in this context? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: [ANN] Dominator - Virtual DOM in ClojureScript
Dominator brings the simplicity and performance of the Virtual-DOM project to ClojureScript. Is this the same kind of Virtual DOM as in facebook react? I.e. is Dominator a react replacement (written in cljs, of course)? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from 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: [ANN] Dominator - Virtual DOM in ClojureScript
In this case I'm referring to a project called virtual-dom, which is a separate project from React. It is conceptually the same as React, but is smaller, faster, and generally more in line with functional programming principles. https://github.com/Matt-Esch/virtual-dom David -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- 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.