Re: Error using core.async version of into
The problem is that core.async defines some functions which are also defined in clojure.core. When now you invoke into, you are not referring to the clojure.core/into but to cosee.async/into which, if I remember right, takes a channel as first argument. If you want to use the clojure.core into, you can use (clojure.core/into [:a] (list :b :c)). Juan Manuel El martes, 20 de mayo de 2014 07:51:59 UTC+2, Craig escribió: Hi, With the following project file: (defproject p1 0.1.0-SNAPSHOT :description Project One :url http://acme.com; :license {:name Eclipse Public License :url http://www.eclipse.org/legal/epl-v10.html} :dependencies [[org.clojure/clojure 1.6.0] [org.clojure/core.async 0.1.303.0-886421-alpha]] :main p1.core) ..and starting an associated repl, I see (into) failing thus: $ lein repl WARNING: reduce already refers to: #'clojure.core/reduce in namespace: p1.core, being replaced by: #'clojure.core.async/reduce WARNING: take already refers to: #'clojure.core/take in namespace: p1.core, being replaced by: #'clojure.core.async/take WARNING: map already refers to: #'clojure.core/map in namespace: p1.core, being replaced by: #'clojure.core.async/map WARNING: into already refers to: #'clojure.core/into in namespace: p1.core, being replaced by: #'clojure.core.async/into WARNING: partition already refers to: #'clojure.core/partition in namespace: p1.core, being replaced by: #'clojure.core.async/partition WARNING: merge already refers to: #'clojure.core/merge in namespace: p1.core, being replaced by: #'clojure.core.async/merge WARNING: partition-by already refers to: #'clojure.core/partition-by in namespace: p1.core, being replaced by: #'clojure.core.async/partition-by nREPL server started on port 60959 on host 127.0.0.1 REPL-y 0.2.1 Clojure 1.6.0 Docs: (doc function-name-here) (find-doc part-of-name-here) Source: (source function-name-here) Javadoc: (javadoc java-object-or-class-here) Exit: Control+D or (exit) or (quit) p1.core= (into [:a] (list :b :c)) #ManyToManyChannel clojure.core.async.impl.channels.ManyToManyChannel@4cc28666 #IllegalArgumentException java.lang.IllegalArgumentException: No implementation of method: :take! of protocol: #'clojure.core.async.impl.protocols/ReadPort found for class: clojure.lang.PersistentList p1.core= I can work-around using: (apply vector :q (list :a :b)), but why is the (into) failing? Thanks. Craig -- 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.
Clojurescript set count returning erroneous values.
I'm having trouble isolating a small test case. I call the following code in an update tick: (let [prev' @prev state' @state] (let [rems (clojure.set/difference prev' state') adds (clojure.set/difference state' prev')] (reset! prev state') (assert (= (count rems) (count (set rems)) (prev and state hold sets of maps.) After running for a few minutes, the assert will fail. The 'rems' and 'adds' will report that their count is 1, but when I try to access the elements there are either none or only one. What would cause a set to return an incorrect value for count? FWIW, the elements of the sets are maps, and one of the fields holds a mutable javascript array. That was my first suspicion, but the array isn't mutated in my code, and I use a memoized function to generate it (to preserve identity). I'm using [org.clojure/clojurescript 0.0-2202]. -- 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: in Clojure I rarely find myself reaching for something like the state monad, as I would in Haskell
Julian juliangam...@gmail.com writes: My question is - have other Clojure/Haskell programmers had this experience? (ie I rarely find myself reaching for something like the state monad). I'm interested to hear if so, and why. I find myself reaching for the state monad all the time; then I realise that, still, no one has been able to explain what a monad is in a way that I understand, so I stop. -- 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: Error using core.async version of into
Juan, I saw your reply and then noticed the clear warning (...being replaced by: #'clojure.core.async/into) as well. Many thanks for the quick response. -- 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: Error using core.async version of into
The question is why that is happening when you load up the repl--are you using 'use' or 'require' with :refer all on core.async in your p1.core namespace? If so you should probably switch that reference to something like (:require [cljs.core.async :as async]) If this is not what's going on I'm confused as to why these would be getting replaced on loading your repl like that. (2014/05/20 19:01), Craig wrote: Juan, I saw your reply and then noticed the clear warning (...being replaced by: #'clojure.core.async/into) as well. Many thanks for the quick response. -- 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 mailto: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: Error using core.async version of into
The repl indicates that current namespace is p1.core p1.core= (into [:a] (list :b :c)) and I imagine in p1.core is where core.async is used or required + referred :all. Juan Manuel El martes, 20 de mayo de 2014 12:48:47 UTC+2, David Della Costa escribió: The question is why that is happening when you load up the repl--are you using 'use' or 'require' with :refer all on core.async in your p1.core namespace? If so you should probably switch that reference to something like (:require [cljs.core.async :as async]) If this is not what's going on I'm confused as to why these would be getting replaced on loading your repl like that. (2014/05/20 19:01), Craig wrote: Juan, I saw your reply and then noticed the clear warning (...being replaced by: #'clojure.core.async/into) as well. Many thanks for the quick response. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: 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: mailto: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: A ClojureScript Tutorial For Light Table Users
Hi David, This has been very helpful in understanding the internals of the ClojureScript compiler and I found it fascinating. Much appreciated. I am having a bit of trouble understanding the syntax of the user environment map. Is there documentation for this? My goal is to specify multiple requires and multiple locals. You have defined it as: (def user-env '{:ns {:name cljs.user} :locals {}}) I have your code running happily in Light Table and I have pasted the following code at the end: (let [form (read1 (fn [a b] (+ a b x handler/y hand/z)))] (with-out-str (c/emit (ana/analyze user-env form This evaluates to: (function (a,b){return a + b) + cljs.user.x) + handler.y) + hand.z);\r\n});\r\n Now, I want to find a way of altering the environment to something like: (def user-env '{:ns {:name cljs.user :require [[compojure.handler :as hand]]} :locals {:name x}}) I am only showing one require and one local in this example but the result I would be hoping for is: (function (a,b){return a + b) + x) + handler.y) + compojure.handler.z);\r\n});\r\n Notice that because handler/y would just compile to handler.y since there is no specific info on what to do in the environment. When I evaluate using my environment, the JavaScript doesn't change, so what am I doing wrong? Is what I want even possible? Many thanks, Gregg. On Wednesday, 15 January 2014 23:44:06 UTC+10, David Nolen wrote: I've started what I hope will be a collaborative and comprehensive reference on the ClojureScript language for people looking to extend Light Table. This is a file that can be directly evaluated in the Light Table UI Connection. http://swannodette.github.io/2014/01/15/clojurescript-for-light-table-users/ I hope it inspires people to put together similar interactive guides on Light Table specific functionality. 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.
Re: ArithmeticException from unchecked-add
Thanks. I've got to pay more attention to the distinction between long and Long in the documentation. The docs for unchecked-add ( http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/unchecked-add ) only cover the case of both arguments being primitive longs. -- 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: Clojurescript set count returning erroneous values.
Can you demonstrate a complete minimal example? Thanks, David On Tue, May 20, 2014 at 4:06 AM, Austin Haas aus...@pettomato.com wrote: I'm having trouble isolating a small test case. I call the following code in an update tick: (let [prev' @prev state' @state] (let [rems (clojure.set/difference prev' state') adds (clojure.set/difference state' prev')] (reset! prev state') (assert (= (count rems) (count (set rems)) (prev and state hold sets of maps.) After running for a few minutes, the assert will fail. The 'rems' and 'adds' will report that their count is 1, but when I try to access the elements there are either none or only one. What would cause a set to return an incorrect value for count? FWIW, the elements of the sets are maps, and one of the fields holds a mutable javascript array. That was my first suspicion, but the array isn't mutated in my code, and I use a memoized function to generate it (to preserve identity). I'm using [org.clojure/clojurescript 0.0-2202]. -- 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: Joy of Clojure example not working
Yes, the examples in the book are missing some lines. I think the following log shows what they were going for: joy.udp= (remove-method compiler ::osx) joy.udp= (def unix (into unix {::c-compiler /usr/bin/gcc})) joy.udp= (def osx (into osx {:c-compiler gcc})) oy.udp= osx {:home /Users, :llvm-compiler clang, :os :joy.udp/osx, :joy.udp/prototype {:home /home, :os :joy.udp/unix, :c-compiler cc, :dev /dev}, :c-compiler gcc} joy.udp= unix {:home /home, :joy.udp/c-compiler /usr/bin/gcc, :os :joy.udp/unix, :c-compiler cc, :dev /dev} joy.udp= (compiler osx) gcc joy.udp= (compile-cmd osx) /usr/bin/gcc About your question: Isn't there a core function/macro where I can derive and set hierarchy all at once? Such a function would need to know in advance what hierarchy you want to construct. If you have a desired pattern of hierarchy that you want to reuse, you could define a function to create it using derive and optionally make-hierarchy. On Monday, May 19, 2014 4:38:00 PM UTC-7, gamma235 wrote: I actually just wanna know why I need to use derive so many times. Isn't there a core function/macro where I can derive and set hierarchy all at once? I'm just looking for a more efficient way. My bad for not stating that more clearly in the original post. The real problem though is the last two calls to compile-cmd. I've been messing with it for a couple of days so any help there would be well appreciated. Thanks J -- 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.
debug output with ring and fireplace
Running a ring server from vim-fireplace, any errors that occur during request processing will dump to the repl terminal, which is fine. I'd like to add debug output and have it also dump to the repl. However printing to stdout or stderr from a ring handler doesn't work. How can I output to the 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.
Client side tools for Clojure web app (back end questions as well, especially Pedestal)
I'm starting on a new Clojure app, and have been really intrigued by Pedestal. But it seems to present a new conceptual model to get my head around. I'm not sure the benefits would be worth the effort for apps that do not fit the problem Pedestal is trying to solve. That said, I'm open to anything. I would really like something that makes the mundane CRUD tasks easier, and a responsive front end with data binding and DOM manipulation. I'm strongly leaning toward AngularJS, but I'm not sure if I should learn the native version, or the ClojureScript, or a different ClojureScript specific framework/library altogether. -- 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: Client side tools for Clojure web app (back end questions as well, especially Pedestal)
Om/Reagent are wrappers over React.js with slightly different approaches, and are the bees-knees. The React.JS rendering approach is a great idea in general, and a great fit for Clojurescript, and discussed elsewhere: http://swannodette.github.io/2013/12/17/the-future-of-javascript-mvcs/ I've tried to get something going with both Om and angular, once you get over the upfront costs, Om is a much more pleasant experience. On Tue, May 20, 2014 at 4:03 PM, Jonathon McKitrick jmckitr...@gmail.comwrote: I'm starting on a new Clojure app, and have been really intrigued by Pedestal. But it seems to present a new conceptual model to get my head around. I'm not sure the benefits would be worth the effort for apps that do not fit the problem Pedestal is trying to solve. That said, I'm open to anything. I would really like something that makes the mundane CRUD tasks easier, and a responsive front end with data binding and DOM manipulation. I'm strongly leaning toward AngularJS, but I'm not sure if I should learn the native version, or the ClojureScript, or a different ClojureScript specific framework/library altogether. -- 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.
Community Interest in a Clojure Application Config Library, using Zookeeper?
Hey folks, At Room Key we're using Apache Zookeeper and a home-grown clojure library called drcfg for real-time application configuration management. We're debating open-sourcing drcfg and are trying to gauge community interest in such a tool. We think it's got great usage semantics, basically you just def an atom in any namespace where you'd like a variable that can be changed in real-time on a running system. When you define the atom, you can also provide defaults to fall back to if zookeeper is unavailable, a validator to be run on any value when a change is attempted (to prevent invalid configuration data), as well as some meta-data about the variable. We've also got a web UI we use to change configuration data, but that would likely be released separate of drcfg itself. If anyone's interested, could you reply to this post? I can provide more information as well if need be. -Thomas Steffes @ Room Key -- 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: Community Interest in a Clojure Application Config Library, using Zookeeper?
FYI atoms backed by zookeeper are already provided in Avout library [1]. [1] https://github.com/liebke/avout Jozef On Tue, May 20, 2014 at 11:33 PM, Thomas Steffes smnir...@gmail.com wrote: Hey folks, At Room Key we're using Apache Zookeeper and a home-grown clojure library called drcfg for real-time application configuration management. We're debating open-sourcing drcfg and are trying to gauge community interest in such a tool. We think it's got great usage semantics, basically you just def an atom in any namespace where you'd like a variable that can be changed in real-time on a running system. When you define the atom, you can also provide defaults to fall back to if zookeeper is unavailable, a validator to be run on any value when a change is attempted (to prevent invalid configuration data), as well as some meta-data about the variable. We've also got a web UI we use to change configuration data, but that would likely be released separate of drcfg itself. If anyone's interested, could you reply to this post? I can provide more information as well if need be. -Thomas Steffes @ Room Key -- 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: Community Interest in a Clojure Application Config Library, using Zookeeper?
RIght - we're familiar with Avout, in fact in the beginning we were using a (very early) version of Avout at Room Key. On Tuesday, May 20, 2014 5:37:32 PM UTC-4, Jozef Wagner wrote: FYI atoms backed by zookeeper are already provided in Avout library [1]. [1] https://github.com/liebke/avout Jozef On Tue, May 20, 2014 at 11:33 PM, Thomas Steffes smni...@gmail.comjavascript: wrote: Hey folks, At Room Key we're using Apache Zookeeper and a home-grown clojure library called drcfg for real-time application configuration management. We're debating open-sourcing drcfg and are trying to gauge community interest in such a tool. We think it's got great usage semantics, basically you just def an atom in any namespace where you'd like a variable that can be changed in real-time on a running system. When you define the atom, you can also provide defaults to fall back to if zookeeper is unavailable, a validator to be run on any value when a change is attempted (to prevent invalid configuration data), as well as some meta-data about the variable. We've also got a web UI we use to change configuration data, but that would likely be released separate of drcfg itself. If anyone's interested, could you reply to this post? I can provide more information as well if need be. -Thomas Steffes @ Room Key -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: 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.
Count vowels in a string
I saw a rant online about interviewing developers that mentioned candidates not being able to count the number of vowels in a string. So naturally, I decided to see if I could do it in Clojure! I wanted to see others' opinions on other ways of doing it. *https://gist.github.com/bradkurtz/6ce500d0361ccdc08c8e* -- 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: Count vowels in a string
You're seriously overthinking this if it's any more than a one-liner. (defn count-vowels [s] (count (filter #{\a \e \i \o \u \A \E \I \O \U} (seq s On Tue, May 20, 2014 at 4:03 PM, Brad Kurtz bkurtz@gmail.com wrote: I saw a rant online about interviewing developers that mentioned candidates not being able to count the number of vowels in a string. So naturally, I decided to see if I could do it in Clojure! I wanted to see others' opinions on other ways of doing it. *https://gist.github.com/bradkurtz/6ce500d0361ccdc08c8e https://gist.github.com/bradkurtz/6ce500d0361ccdc08c8e* -- 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: Count vowels in a string
The naïve implementation does sometimes underestimate the total, though. On Tue, May 20, 2014 at 4:13 PM, Mark Engelberg mark.engelb...@gmail.comwrote: You're seriously overthinking this if it's any more than a one-liner. (defn count-vowels [s] (count (filter #{\a \e \i \o \u \A \E \I \O \U} (seq s On Tue, May 20, 2014 at 4:03 PM, Brad Kurtz bkurtz@gmail.com wrote: I saw a rant online about interviewing developers that mentioned candidates not being able to count the number of vowels in a string. So naturally, I decided to see if I could do it in Clojure! I wanted to see others' opinions on other ways of doing it. *https://gist.github.com/bradkurtz/6ce500d0361ccdc08c8e https://gist.github.com/bradkurtz/6ce500d0361ccdc08c8e* -- 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. -- Ben Wolfson Human kind has used its intelligence to vary the flavour of drinks, which may be sweet, aromatic, fermented or spirit-based. ... Family and social life also offer numerous other occasions to consume drinks for pleasure. [Larousse, Drink entry] -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Count vowels in a string
Why do you say that? On Tue, May 20, 2014 at 4:16 PM, Ben Wolfson wolf...@gmail.com wrote: The naïve implementation does sometimes underestimate the total, though. On Tue, May 20, 2014 at 4:13 PM, Mark Engelberg mark.engelb...@gmail.comwrote: You're seriously overthinking this if it's any more than a one-liner. (defn count-vowels [s] (count (filter #{\a \e \i \o \u \A \E \I \O \U} (seq s On Tue, May 20, 2014 at 4:03 PM, Brad Kurtz bkurtz@gmail.com wrote: I saw a rant online about interviewing developers that mentioned candidates not being able to count the number of vowels in a string. So naturally, I decided to see if I could do it in Clojure! I wanted to see others' opinions on other ways of doing it. *https://gist.github.com/bradkurtz/6ce500d0361ccdc08c8e https://gist.github.com/bradkurtz/6ce500d0361ccdc08c8e* -- 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. -- Ben Wolfson Human kind has used its intelligence to vary the flavour of drinks, which may be sweet, aromatic, fermented or spirit-based. ... Family and social life also offer numerous other occasions to consume drinks for pleasure. [Larousse, Drink entry] -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/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: Count vowels in a string
There are three vowels in naïve, not two. On Tue, May 20, 2014 at 4:19 PM, Mark Engelberg mark.engelb...@gmail.comwrote: Why do you say that? On Tue, May 20, 2014 at 4:16 PM, Ben Wolfson wolf...@gmail.com wrote: The naïve implementation does sometimes underestimate the total, though. On Tue, May 20, 2014 at 4:13 PM, Mark Engelberg mark.engelb...@gmail.com wrote: You're seriously overthinking this if it's any more than a one-liner. (defn count-vowels [s] (count (filter #{\a \e \i \o \u \A \E \I \O \U} (seq s On Tue, May 20, 2014 at 4:03 PM, Brad Kurtz bkurtz@gmail.comwrote: I saw a rant online about interviewing developers that mentioned candidates not being able to count the number of vowels in a string. So naturally, I decided to see if I could do it in Clojure! I wanted to see others' opinions on other ways of doing it. *https://gist.github.com/bradkurtz/6ce500d0361ccdc08c8e https://gist.github.com/bradkurtz/6ce500d0361ccdc08c8e* -- 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. -- Ben Wolfson Human kind has used its intelligence to vary the flavour of drinks, which may be sweet, aromatic, fermented or spirit-based. ... Family and social life also offer numerous other occasions to consume drinks for pleasure. [Larousse, Drink entry] -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/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. -- Ben Wolfson Human kind has used its intelligence to vary the flavour of drinks, which may be sweet, aromatic, fermented or spirit-based. ... Family and social life also offer numerous other occasions to consume drinks for pleasure. [Larousse, Drink entry] -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit
Re: Count vowels in a string
To say nothing of y: yes - one vowel any - two vowels but the filter thing is good otherwise. -- 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: Count vowels in a string
On Tue 20 May 2014 at 04:22:17PM -0700, Ben Wolfson wrote: There are three vowels in naïve, not two. And watch out for those un-normalizable combining character combinations! Also, another one-liner: (defn ascii-vowel-count [s] (count (re-seq #(?i)[aeiou] s))) Doing this in a multilingual setting, as Ben Wolfson points out, would properly require a second parameter: the set of acceptable vowels in a given Language/Locale/Script (which are all different things). guns pgpCjnJtOko9u.pgp Description: PGP signature
Re: Client side tools for Clojure web app (back end questions as well, especially Pedestal)
I second Gary's suggestion of Om/Reagent. I've used Reagent on some personal projects and really like how easy it is to incorporate to the point where I just don't worry about DOM updates any more, only app logic, data storage and transmission. It's also a bit less opinionated on how you should structure your application's data than Om is. Neither library helps with client/server communication or building APIs on the server side. Another framework very much in the same vein is Hoplon which aims to cover most of the same bases as Pedestal, but I'd say is a bit easier to pick up and get started with. Brendan On Tuesday, May 20, 2014 4:03:27 PM UTC-4, Jonathon McKitrick wrote: I'm starting on a new Clojure app, and have been really intrigued by Pedestal. But it seems to present a new conceptual model to get my head around. I'm not sure the benefits would be worth the effort for apps that do not fit the problem Pedestal is trying to solve. That said, I'm open to anything. I would really like something that makes the mundane CRUD tasks easier, and a responsive front end with data binding and DOM manipulation. I'm strongly leaning toward AngularJS, but I'm not sure if I should learn the native version, or the ClojureScript, or a different ClojureScript specific framework/library altogether. -- 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: Clojurescript set count returning erroneous values.
Unfortunately, no, but not from lack of trying. The best lead I've got thus far is that there is a disj call that returns a defective set, which returns a positive value for count, but does not seem to contain any elements. I've tried to capture the offending values, but I can't reproduce the bug with them. I can't arrange the elements of the set to be in the same order, and I can't get the same hash values for the maps (which contain js objects). I suspect the issue may have something to do with hash collisions. The app state is being shuffled with some randomness, and the problem arises consistently after a minute or two of churn. If I add an extra artificial hash field to each element stored in the set, then the problem disappears (or perhaps it is postponed). I noticed that the defective sets always contain many elements with the same hash. (I know very little about how sets and hashing are implemented.) I'll keep debugging. - austin On Tuesday, May 20, 2014 8:36:37 AM UTC-7, David Nolen wrote: Can you demonstrate a complete minimal example? Thanks, David On Tue, May 20, 2014 at 4:06 AM, Austin Haas aus...@pettomato.comjavascript: wrote: I'm having trouble isolating a small test case. I call the following code in an update tick: (let [prev' @prev state' @state] (let [rems (clojure.set/difference prev' state') adds (clojure.set/difference state' prev')] (reset! prev state') (assert (= (count rems) (count (set rems)) (prev and state hold sets of maps.) After running for a few minutes, the assert will fail. The 'rems' and 'adds' will report that their count is 1, but when I try to access the elements there are either none or only one. What would cause a set to return an incorrect value for count? FWIW, the elements of the sets are maps, and one of the fields holds a mutable javascript array. That was my first suspicion, but the array isn't mutated in my code, and I use a memoized function to generate it (to preserve identity). I'm using [org.clojure/clojurescript 0.0-2202]. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: 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: Clojurescript set count returning erroneous values.
Hi Austin, I'm not sure that this is related but I've had an issue with Dates in sets and saw somewhat similar behavior to what you're describing. Context: https://github.com/ddellacosta/date-hash-bug DD (2014/05/21 10:56), Austin Haas wrote: Unfortunately, no, but not from lack of trying. The best lead I've got thus far is that there is a disj call that returns a defective set, which returns a positive value for count, but does not seem to contain any elements. I've tried to capture the offending values, but I can't reproduce the bug with them. I can't arrange the elements of the set to be in the same order, and I can't get the same hash values for the maps (which contain js objects). I suspect the issue may have something to do with hash collisions. The app state is being shuffled with some randomness, and the problem arises consistently after a minute or two of churn. If I add an extra artificial hash field to each element stored in the set, then the problem disappears (or perhaps it is postponed). I noticed that the defective sets always contain many elements with the same hash. (I know very little about how sets and hashing are implemented.) I'll keep debugging. - austin On Tuesday, May 20, 2014 8:36:37 AM UTC-7, David Nolen wrote: Can you demonstrate a complete minimal example? Thanks, David On Tue, May 20, 2014 at 4:06 AM, Austin Haas aus...@pettomato.com javascript: wrote: I'm having trouble isolating a small test case. I call the following code in an update tick: (let [prev' @prev state' @state] (let [rems (clojure.set/difference prev' state') adds (clojure.set/difference state' prev')] (reset! prev state') (assert (= (count rems) (count (set rems)) (prev and state hold sets of maps.) After running for a few minutes, the assert will fail. The 'rems' and 'adds' will report that their count is 1, but when I try to access the elements there are either none or only one. What would cause a set to return an incorrect value for count? FWIW, the elements of the sets are maps, and one of the fields holds a mutable javascript array. That was my first suspicion, but the array isn't mutated in my code, and I use a memoized function to generate it (to preserve identity). I'm using [org.clojure/clojurescript 0.0-2202]. -- 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 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 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 mailto: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: Joy of Clojure example not working
This did it Greg, Thanks a lot. On Wednesday, May 21, 2014 2:18:08 AM UTC+9, Greg D wrote: Yes, the examples in the book are missing some lines. I think the following log shows what they were going for: joy.udp= (remove-method compiler ::osx) joy.udp= (def unix (into unix {::c-compiler /usr/bin/gcc})) joy.udp= (def osx (into osx {:c-compiler gcc})) oy.udp= osx {:home /Users, :llvm-compiler clang, :os :joy.udp/osx, :joy.udp/prototype {:home /home, :os :joy.udp/unix, :c-compiler cc, :dev /dev}, :c-compiler gcc} joy.udp= unix {:home /home, :joy.udp/c-compiler /usr/bin/gcc, :os :joy.udp/unix, :c-compiler cc, :dev /dev} joy.udp= (compiler osx) gcc joy.udp= (compile-cmd osx) /usr/bin/gcc About your question: Isn't there a core function/macro where I can derive and set hierarchy all at once? Such a function would need to know in advance what hierarchy you want to construct. If you have a desired pattern of hierarchy that you want to reuse, you could define a function to create it using derive and optionally make-hierarchy. On Monday, May 19, 2014 4:38:00 PM UTC-7, gamma235 wrote: I actually just wanna know why I need to use derive so many times. Isn't there a core function/macro where I can derive and set hierarchy all at once? I'm just looking for a more efficient way. My bad for not stating that more clearly in the original post. The real problem though is the last two calls to compile-cmd. I've been messing with it for a couple of days so any help there would be well appreciated. Thanks J -- 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: Count vowels in a string
I like the one-liner. That was the kind of feedback I was looking for, thanks. On Tuesday, May 20, 2014 6:13:48 PM UTC-5, puzzler wrote: You're seriously overthinking this if it's any more than a one-liner. (defn count-vowels [s] (count (filter #{\a \e \i \o \u \A \E \I \O \U} (seq s On Tue, May 20, 2014 at 4:03 PM, Brad Kurtz bkurt...@gmail.comjavascript: wrote: I saw a rant online about interviewing developers that mentioned candidates not being able to count the number of vowels in a string. So naturally, I decided to see if I could do it in Clojure! I wanted to see others' opinions on other ways of doing it. *https://gist.github.com/bradkurtz/6ce500d0361ccdc08c8e https://gist.github.com/bradkurtz/6ce500d0361ccdc08c8e* -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: 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: Count vowels in a string
On Tue, May 20, 2014 at 10:02 PM, Brad Kurtz bkurtz@gmail.com wrote: I like the one-liner. That was the kind of feedback I was looking for, thanks. On Tuesday, May 20, 2014 6:13:48 PM UTC-5, puzzler wrote: You're seriously overthinking this if it's any more than a one-liner. (defn count-vowels [s] (count (filter #{\a \e \i \o \u \A \E \I \O \U} (seq s Great, glad it was helpful. Actually, you can remove the call to seq, since filter calls it implicitly: (defn count-vowels [s] (count (filter #{\a \e \i \o \u \A \E \I \O \U} s))) On Tue, May 20, 2014 at 4:03 PM, Brad Kurtz bkurt...@gmail.com wrote: I saw a rant online about interviewing developers that mentioned candidates not being able to count the number of vowels in a string. So naturally, I decided to see if I could do it in Clojure! I wanted to see others' opinions on other ways of doing it. *https://gist.github.com/bradkurtz/6ce500d0361ccdc08c8e https://gist.github.com/bradkurtz/6ce500d0361ccdc08c8e* -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- 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.