Re: Breaking out of a map type function
Hi Dave, Another option is to use the forhttp://clojuredocs.org/clojure_core/clojure.core/formacro's while clause to stop processing as soon as you hit an error. Here's a basic example with a simple my-func that returns a string-based error to give you an idea of how it could look: (defn my-func [n] (cond ( n 4) (str n) :else error)) (for [n [1 2 3 4 5] :let [result (my-func n)] :while (not= result error)] result) Cheers, James On Sunday, November 24, 2013 5:19:49 PM UTC+1, David Simmons wrote: Hi All. Still struggling to get my head around Clojure - this is attempt number 4. I wish to process each item in a vector. I know I can use map to do this e.g. (map my-func my-vector). My problem is that I need to be able to break out of the map if my-func returns an error when processing any of the items. I know map isn't what I'm looking for but is there a function or some idiomatic piece of clojure to achieve my aim. cheers Dave -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: first vals first vals
You could use get-in:http://clojuredocs.org/clojure_core/clojure.core/get-in (- {:key1 {:cf {:cq 0,1,2,3}}} (get-in [:key1 :cf :cq])) Cheers, James On Thursday, November 21, 2013 10:08:06 AM UTC+1, Zhemin Lin wrote: Hi. I'm quite annoyed by the ugly smell of (first (vals (first ... )). Is there any better way to do it? user= (- {:key1 {:cf {:cq 0,1,2,3}}} vals first vals first vals first (clojure.string/split #,)) [0 1 2 3] Thanks a lot! -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Video] Introduction to Light Table
Hi everyone, I've recorded an introduction to Light Tablehttp://www.youtube.com/watch?v=1f13TTu_X9k screencast. During which I explain why I'm excited about LT and its future, give a quick introduction to getting started with Clojure in LT, and finally cover some basics around customising keymaps and behaviours. I hope that someone here finds it useful. Cheers, 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/groups/opt_out.
Re: ▶ Datomic: up and running - YouTube
Thanks for the nice complement mimmo! When I created the screencast I announced it in the Datomic group, but I didn't think to do it here too. Though because I introduce the database via a TDD Clojure project, hopefully it's relevant (and useful) for folks here as well. Cheers, James On Wednesday, October 9, 2013 9:56:17 AM UTC+2, Magomimmo wrote: Another very nice and useful screencast by James Trunk. Everything become easy to understand when he explains it. mimmo https://www.youtube.com/watch?v=ao7xEwCjrWQ -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Teaching Clojure to students (how ?)
Hi Phil, 1. Select the text you want auto-indented and press SHIFT+TAB. 2. The documentation tab opens in a new tabset - to close tabsets you right-click on them and choose 'Close tabset'. 3. I haven't discovered a way to disable auto-brackets. 4. Yes, you can access it from the command pane, or you can add a key-binding in your user.keymap. I have mine set to CMD+; with pmeta-; [:toggle-comment-selection]. 5. Won't you need to copy+paste from the console anyway? Why not just grab the part without the filename? 6. Currently you make projects externally (using Leiningen) and then import them into Light Table. 7. This is one downside to having an IDE that's written in Clojure. 8. You can hide evaluations using the command pane and Eval: Clear inline results, or you can add a key-binding in your user.keymap. I have mine set to CMD+SHIFT+BACKSPACE pmeta-shift-backspace [:clear-inline-results] 9. I don't think Light Table has this feature yet. It's worth noting that Light Table is still in the early stages of development, so it doesn't have all of the features of more mature IDEs. However, Chris is going to add plugin support in the next major release, which will remove him as the bottleneck for adding exactly the kind of features you're looking for. I think it's a very exciting time for Light Table. Cheers, James On Tuesday, October 8, 2013 12:00:52 AM UTC+2, Lee wrote: Hi James, I have indeed tried LightTable, and it does indeed seem promising. Really exciting potential. But I've hit enough snags every time I've tried it that I haven't really found it useful (either for teaching or for my own use). I just tried the latest version again, just now, and just for anyone who may care here are my (opinionated, and YMMV) reactions: 1. Is there auto-reindentation? I don't see it. Pretty essential, IMHO. 2. I can close a tab (like the documentation) if I control-click on it, but the pane remains... and I've ended up with lots of panes that I have to quit to get rid of. In general I love the look of the GUI but wish the controls were more obvious/standard in many cases. 3. Can automatic bracket insertion be turned off? It's problematic in my book, especially for newcomers who should be allowed to use the keyboarding skills that they already have. 4. Is there a block comment/uncomment feature? 5. The console output precedes every line with the file that generated it, which means that you can't get a clean output log. Lots of the code that I and my students write is oriented toward producing textual output in the console, and this sort of rules out those uses (unless you want to clean up the output later, which would be a pain). 6. Can I make a new project? I don't immediately see how... (Digression: tried to search the documentation for this but couldn't see how to do the search... I do get a (novel) find pane for my open editor window, but can I make that work for the documentation pane? Can I make it go away? Again, looks cool but I wish it leveraged more common GUI idioms.) 7. A new project created with lein at the command line works, but an older one gives Light Table requires Clojure Version 1.5.1 or higher... I see that that old project used [org.clojure/clojure 1.4.0]... Awkward that this couldn't be run even if the IDE needs something newer for itself... 8. Expressions that produce big values can make it hard to read your code by interspersing the values, which I may not really want to see. 9. Is there anyway to get arglist on space or arglists (and/or documentation) in another pane or a popup or whatever, either as you type or when you hit a particular key? Overall: Very cool in several ways, some glitches or little issues that I could live with, but also quite a few that would be pretty problematic to me personally, for my teaching and/or my own use (specifically 1, 3, 5, 9). Clooj is better on many of these issues, but it has some other weaknesses (esp that it is not maintained very actively, e.g. I don't know if it works with modern leiningen). NightCode is also getting into the running, I think. But from my perspective none of them yet fill the niche that I've been discussing. -Lee PS I'd be in Clojure IDE heaven if someone could provide some version of one of these light-weight Clojure IDEs that also incorporated nrepl-ritz so that we could see the values of locals when we hit exceptions... On Oct 7, 2013, at 4:15 PM, Jernau wrote: Lee, Have you tried Light Table? I think it would be a perfect match for your use-case. Here's a screencast of me using Light Table's Instarepl to teach list comprehension in Clojure. As you will hopefully agree, Light Table's features are a great match for a learning/teaching situation. Light Table's Instarepl works out-of-box after installation, so it'll be easy to get your students up and running. Then, when your
Re: Teaching Clojure to students (how ?)
Lee, Have you tried Light Table http://www.lighttable.com? I think it would be a perfect match for your use-case. Here's a screencast https://www.youtube.com/watch?v=5lvV9ICwaMo of me using Light Table's Instarepl to teach list comprehension in Clojure. As you will hopefully agree, Light Table's features are a great match for a learning/teaching situation. Light Table's Instarepl works out-of-box after installation, so it'll be easy to get your students up and running. Then, when your students have progressed to wanting to create their own projects, they can install Leiningen and continue to use Light Table (see my Datomic screencast https://www.youtube.com/watch?v=ao7xEwCjrWQfor an example). Kind regards, James On Monday, October 7, 2013 4:19:22 PM UTC+2, Lee wrote: On Oct 7, 2013, at 9:59 AM, John D. Hume wrote: I'd suggest that Clojure's Hello, World! should happen initially at the repl, where leiningen definitely simplifies the UX. lein repl # from any cwd (println ...) which launches nicely into demonstrating dynamic development. Agreed. But the complexity cliff is at the next step, after the first demo. Then you really want an editor with some basic features like auto-reindentation and bracket matching. In my teaching context the REPL alone will get us through a productive first day of class, but not a second, while something with roughly the feature set of Clooj will get us through the first semester and maybe even years of serious work depending on what kind of work we're doing. -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/groups/opt_out.
Re: [Video] Understanding list comprehension in Clojure
Thanks Mimmo. By the way, I've been working my way through your modern-cljs tutorialshttps://github.com/magomimmo/modern-cljs, and have been finding them both interesting and helpful. Thank you so much for spending the time to create such a useful resource. Cheers, James On Friday, September 27, 2013 12:06:04 AM UTC+2, Magomimmo wrote: Nice job, as usual! mimmo On Thursday, September 26, 2013 8:10:33 PM UTC+2, Jernau wrote: Hi everyone, I recorded another screencast - this time with the aim of helping people understand list comprehension in Clojurehttp://www.youtube.com/watch?v=5lvV9ICwaMo . I hope that some Clojure newcomers (or those unfamiliar with list comprehension) find it useful. Cheers, 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/groups/opt_out.
[Video] Understanding list comprehension in Clojure
Hi everyone, I recorded another screencast - this time with the aim of helping people understand list comprehension in Clojure http://www.youtube.com/watch?v=5lvV9ICwaMo. I hope that some Clojure newcomers (or those unfamiliar with list comprehension) find it useful. Cheers, 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/groups/opt_out.
Re: Screencast: understanding the thread-first and thread-last macros
This is a pretty good demo of light table as well for people who haven't really been keeping up with it lately. My first Clojure screencast was about test-driving a small project in Light Table: https://www.youtube.com/watch?v=H_teKHH_Rk0 If people would like to see some more Light Table in action, then I can recommend watching that one. (Though I should perhaps warn you that it's based around a simple TDD Kata, so the actual code will only be interesting to newcomers.) Cheers, James On Thursday, September 5, 2013 1:52:25 AM UTC+2, Curtis Gagliardi wrote: This is a pretty good demo of light table as well for people who haven't really been keeping up with it lately. On Wednesday, September 4, 2013 8:42:06 AM UTC-7, Jernau wrote: Hi everyone, I made a screencast about Clojure's *thead-first* (-) and *thread-last* (-) macros: http://www.youtube.com/watch?v=qxE5wDbt964 If you already have a good understanding of these macros then I'd recommend skipping it, but hopefully newcomers to Clojure might learn something useful. Cheers, 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/groups/opt_out.
Screencast: understanding the thread-first and thread-last macros
Hi everyone, I made a screencast about Clojure's *thead-first* (-) and *thread-last* (-) macros: http://www.youtube.com/watch?v=qxE5wDbt964 If you already have a good understanding of these macros then I'd recommend skipping it, but hopefully newcomers to Clojure might learn something useful. Cheers, 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/groups/opt_out.
Re: Screencast: understanding the thread-first and thread-last macros
Very clear and easy to follow explanation of Clojure thread macros. Thanks Mimmo, it's nice to hear that my approach was easy to follow. Unfortunately my spoken english is too affected by italian accent :( As long as you can make yourself understood, I don't see why an accent should stop you making a Clojure screencast. If you choose an interesting subject, then I know I'd watch it! But I also agree with your point that more screencasts from the community would be great. For me, there's something special about seeing *and*hearing somebody explain a subject, which usually elevates it above just reading the same content in a book or on a website. (I guess it might have something to do with the powerful combination of visual and auditory learning.) There are already some great Clojure screencasts out there, but it certainly wouldn't hurt the cause to have a few more! Cheers, James On Wednesday, September 4, 2013 6:24:11 PM UTC+2, Mimmo Cosenza wrote: Very clear and easy to follow explanation of Clojure thread macros. Highly recommended for Clojure beginners and intermediates. We should do a lot more screencasts like this. Unfortunately my spoken english is too affected by italian accent :( Highly recommended both for clojure beginners and intermediates. Mimmo On Sep 4, 2013, at 5:42 PM, Jernau wrote: Hi everyone, I made a screencast about Clojure's *thead-first* (-) and *thread-last* (-) macros: http://www.youtube.com/watch?v=qxE5wDbt964 If you already have a good understanding of these macros then I'd recommend skipping it, but hopefully newcomers to Clojure might learn something useful. Cheers, James -- -- 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/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.