Clojure eXchange 2014 Call for Presentations
Hello Everyone! The Call for Presentations for The Clojure eXchange 2014 in London on Thursday, 4th - Friday, 5th December is open. The form to submit proposals is here: https://docs.google.com/forms/d/1yBO0URvt6Zby0AWBp0xeBYna04JfaVUBsmGVbP5wHLc/viewform The conference registration page is here: 2014 Page https://skillsmatter.com/conferences/1956-clojure-exchange-2014 You can see the videos and programmes for the previous conferences here: 2013 https://skillsmatter.com/conferences/1579-clojure-exchange-2013#program 2012 https://skillsmatter.com/conferences/1235-clojure-exchange-2012#program Looking forward to seeing your ideas! cheers, Bruce -- @otfrom | CTO co-founder @MastodonC | mastodonc.com See recent coverage of us in the Economist http://econ.st/WeTd2i and the Financial Times http://on.ft.com/T154BA -- 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: Reagent 0.4.0
Hi Dan, I'm playing with Reagent and I find it very simple and promising. Thanks for it! Anyway, the last update was 5 months ago (react 0.10.0): is the project still alive and well? Thanks in advance! Il giorno sabato 22 febbraio 2014 09:11:42 UTC+1, Dan Holmsand ha scritto: Reagent is now at 0.4.1, with support for ClojureScript 0.0-2173. Reagent's atom now implements the necessary IAtom, ISwap and IReset protocols. Reagent should still be compatible with older ClojureScript versions, but you will get a lot of compilation warnings. /dan On 21 feb 2014, at 16:57, Dan Holmsand holm...@gmail.com javascript: wrote: Reagent, a minimalistic interface between React.js and ClojureScript, is now at 0.4.0. The new release has a breaking change: Reagent now lets you call component functions exactly like ordinary functions (albeit with square brackets). This is obviously a breaking change, but behaviour is unchanged if you passed a map as the only argument (as in all the examples in the old documentation). Also: React is updated to 0.9.0, a great new example showing svg use in Reagent, by Jonas Enlund, general performance improvement, etc. Read more here: http://holmsand.github.io/reagent/news/any-arguments.html The project page is here: https://github.com/holmsand/reagent Cheers, /dan -- 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] om-bootstrap 0.2.5 - Bootstrap 3 components in Om
Thanks: works perfectly. The minimum html is (more or less): html head link href=https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css; rel=stylesheet type=text/css class=style / /head body div id=app/div script src=http://fb.me/react-0.11.1.js;/script script src=out/goog/base.js type=text/javascript/script script src=om_boot.js type=text/javascript/script script type=text/javascriptgoog.require(om_boot.core);/script /body /html My minimum cljs example derived from the mies-om template (and ignoring the state) was: (ns om-boot.core (:require [om.core :as om :include-macros true] [om.dom :as dom :include-macros true] [om-bootstrap.button :as b])) (enable-console-print!) (def app-state (atom {:text Hello world!})) (om/root (fn [app owner] (reify om/IRender (render [_] (b/toolbar {} (b/button {} Default) (b/button {:bs-style primary} Primary) (b/button {:bs-style success} Success) (b/button {:bs-style info} Info) (b/button {:bs-style warning} Warning) (b/button {:bs-style danger} Danger) (b/button {:bs-style link} Link) app-state {:target (. js/document (getElementById app))}) woohoo! Bootstrap in Om in React. I'm three illusions to the left!! Andy Hey Andy, All you should need is the usual Om project layout, similar to the index.html you mentioned, plus this line in your project's header to include the Bootstrap CSS that Om-Bootstrap uses: link href= https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css; rel =stylesheet type=text/css class=style / For the om-bootstrap docs project, I jammed the Bootstrap CSS into the resources folder to make local development easier when I'm offline, but it's totally fine to just reference the CDNed version in your project. There's no need to know anything about the resources folder to use Om-Bootstrap. I'll add this information to the documentation site today on this barebones, TODO Getting Started page: http://om-bootstrap.herokuapp.com/getting-started Andy Dwelly javascript: August 28, 2014 at 6:05 AM I've got a working knowledge of Clojure and I'm trying to extend my reach into Clojurescript, om, and bootstrap as I want the resulting website to look reasonable. I've worked my way through the om tutorials and I have a simple plain om example of my own which doesn't use bootstrap. Apart from the [om-bootstrap 0.2.6] dependancy, it seems that to get started with om-bootstrap I need an initial index.html file similar to the one generated with the 'lein new mies-om' command, but referencing bootstrap, and some idea of the structure of the resources directory - presumably various bits of the bootstrap project. Can you give any guidance in this area ? -A On Monday, August 25, 2014 2:14:04 AM UTC+1, Sam Ritchie wrote: -- 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. Sam Ritchie javascript: August 24, 2014 at 7:13 PM Hey all, I wanted to share a library I've been putting together for writing Bootstrap 3 components in Om. It's called, creatively, Om-Bootstrap. Here's the git repository: https://github.com/racehub/om-bootstrap Version 0.2.5 is on Clojars https://clojars.org/racehub/om-bootstrap: [racehub/om-bootstrap 0.2.5] I've also written an interactive documentation site for the project, a la the Bootstrap doc site: http://om-bootstrap.herokuapp.com This site has working examples of every component in the library, and TODOs in the spots that I intend to cover. Every example snippet has a show code toggle that lets you see the code used to generate that example. You should be able to copy the code over to your project and have it work right away. There's a lot of cool stuff in this project that I hope to document. The README describes how to get the embedded websocket repl running. I'll post on how I do the embedded example snippets soon. The plan is to add server-side HTML generation and client side routing once the doc site gets a few more pages. Huge props to David for Om, and to the react-bootstrap https://github.com/react-bootstrap/react-bootstrap project for
Clojure cheatsheet v16 with few updates for Sets, Maps, and Relations sections
Newest version available here: http://jafingerhut.github.io Updates will likely make their way to the Grimoire and Clojure.org cheatsheet pages in time. I was reviewing the sections of the cheatsheet on Sets and Maps, and grew dissatisfied with the placement of some of the functions. I added a new Relations section (aka rels, sets of maps that each have identical keys), moved the relational algebra functions out of Sets into Relations, and moved a few other functions around to places that seemed more appropriate. I also added a link to the Medley library on Github, in the Maps/'Change' section. Gory details of the changes made given here: https://github.com/jafingerhut/clojure-cheatsheets/blob/master/src/clj-jvm/CHANGELOG.txt Suggestions, comments, questions on the cheatsheet welcome. Andy -- 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: Reagent 0.4.0
Dan apparently is really strapped on time. If you check out the issues list you'll see a few of us are using a fork from github/@whoops while he's out and whoops has updated to the latest react. On Friday, August 29, 2014 7:21:46 AM UTC-4, Cesare wrote: Hi Dan, I'm playing with Reagent and I find it very simple and promising. Thanks for it! Anyway, the last update was 5 months ago (react 0.10.0): is the project still alive and well? Thanks in advance! Il giorno sabato 22 febbraio 2014 09:11:42 UTC+1, Dan Holmsand ha scritto: Reagent is now at 0.4.1, with support for ClojureScript 0.0-2173. Reagent's atom now implements the necessary IAtom, ISwap and IReset protocols. Reagent should still be compatible with older ClojureScript versions, but you will get a lot of compilation warnings. /dan On 21 feb 2014, at 16:57, Dan Holmsand holm...@gmail.com wrote: Reagent, a minimalistic interface between React.js and ClojureScript, is now at 0.4.0. The new release has a breaking change: Reagent now lets you call component functions exactly like ordinary functions (albeit with square brackets). This is obviously a breaking change, but behaviour is unchanged if you passed a map as the only argument (as in all the examples in the old documentation). Also: React is updated to 0.9.0, a great new example showing svg use in Reagent, by Jonas Enlund, general performance improvement, etc. Read more here: http://holmsand.github.io/reagent/news/any-arguments.html The project page is here: https://github.com/holmsand/reagent Cheers, /dan -- 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: Reagent 0.4.0
Great! Thanks a lot! Il giorno venerdì 29 agosto 2014 16:52:49 UTC+2, Ivan L ha scritto: Dan apparently is really strapped on time. If you check out the issues list you'll see a few of us are using a fork from github/@whoops while he's out and whoops has updated to the latest react. On Friday, August 29, 2014 7:21:46 AM UTC-4, Cesare wrote: Hi Dan, I'm playing with Reagent and I find it very simple and promising. Thanks for it! Anyway, the last update was 5 months ago (react 0.10.0): is the project still alive and well? Thanks in advance! Il giorno sabato 22 febbraio 2014 09:11:42 UTC+1, Dan Holmsand ha scritto: Reagent is now at 0.4.1, with support for ClojureScript 0.0-2173. Reagent's atom now implements the necessary IAtom, ISwap and IReset protocols. Reagent should still be compatible with older ClojureScript versions, but you will get a lot of compilation warnings. /dan On 21 feb 2014, at 16:57, Dan Holmsand holm...@gmail.com wrote: Reagent, a minimalistic interface between React.js and ClojureScript, is now at 0.4.0. The new release has a breaking change: Reagent now lets you call component functions exactly like ordinary functions (albeit with square brackets). This is obviously a breaking change, but behaviour is unchanged if you passed a map as the only argument (as in all the examples in the old documentation). Also: React is updated to 0.9.0, a great new example showing svg use in Reagent, by Jonas Enlund, general performance improvement, etc. Read more here: http://holmsand.github.io/reagent/news/any-arguments.html The project page is here: https://github.com/holmsand/reagent Cheers, /dan -- 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.
Changing default clojure reader
Hello, Is it possible to change the default clojure reader to use clojure.tools.reader.reader-types/source-logging-push-back-reader? I am currently using this reader so that I can see the source code of my fns at runtime as metadata, however, it requires that I read the source again once the program starts. I'm hoping there is a way for clojure to do this on startup so that I don't have to re-read the same source again. Thanks, Sarkis -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Why is this an Exception ?
(defn foo[] (println bar/baz)) (defn car[] (println 42)) --- java -cp ~/clojure/clojure-1.6.0.jar clojure.main foo.clj Exception in thread main java.lang.RuntimeException: No such namespace: bar, compiling:(/Users/harsha/foobar/foo.clj:2:3) ... In Ruby and Python, the compiler is silent. -- 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 cheatsheet v16 with few updates for Sets, Maps, and Relations sections
Awesome! Thanks Andy. I'll make a point of getting this in to Grimoire 0.3.6. Reid On 08/29/2014 08:56 AM, Andy Fingerhut wrote: Newest version available here: http://jafingerhut.github.io Updates will likely make their way to the Grimoire and Clojure.org cheatsheet pages in time. I was reviewing the sections of the cheatsheet on Sets and Maps, and grew dissatisfied with the placement of some of the functions. I added a new Relations section (aka rels, sets of maps that each have identical keys), moved the relational algebra functions out of Sets into Relations, and moved a few other functions around to places that seemed more appropriate. I also added a link to the Medley library on Github, in the Maps/'Change' section. Gory details of the changes made given here: https://github.com/jafingerhut/clojure-cheatsheets/blob/master/src/clj-jvm/CHANGELOG.txt Suggestions, comments, questions on the cheatsheet welcome. Andy -- 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.
clojure streams
Hi Everyone, Does anyone know the status of clojure streams is? I would like to try them out but I can't find the svn repository mentioned on the website: http://clojure.org/streams. Thx! -Greg -- 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 streams
(Rich Hickey is the only one who could answer finally but...) I think this information is old and outdated, streams didn't really make it into clojure. The things that survived was the *sequence* abstraction (which is used almost everywhere), later the *reducers* (facilitating javas fork-join constructs nicely interleaved with the clojure b-tree-like data structures) and last but not least the *transducers* concept, where transducers actually are very similar to the outlines of the streams abstraction in the link you mentioned with their continously spinning transform functions. http://blog.cognitect.com/blog/2014/8/6/transducers-are-coming Core.async is somewhat similar, but has other use cases in mind (sane wrapping of an event stream of various side-effects). /Linus 2014-08-29 20:56 GMT+02:00 Greg MacDonald gtmacdon...@gmail.com: Hi Everyone, Does anyone know the status of clojure streams is? I would like to try them out but I can't find the svn repository mentioned on the website: http://clojure.org/streams. Thx! -Greg -- 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.
Resources for intermediate/not-absolute-beginner Clojurians
I worked my way through *Clojure Programming* (Emerick, Carper, Grand, O'Reilly), and I've started writing my own Clojure (porting over an unfinished Python project that seemed amenable to the Clojure treatment.) I really love the language, but I'm not sure where to go from here. My other main language is Python, which I learned in school, and also found a bunch of intermediate/non-introductory resources for, like the awesome, short, topic-oriented monographs (for lack of a better term) by Matt Harrison (e.g., http://www.amazon.com/Guide-Learning-Iteration-Generators-Python-ebook/dp/B007JR4FCQ/ref=sr_1_3). These really helped me understand some of the less-obvious/less-intro parts of Python, and the stuff I learned in school helped me learn what idiomatic Python looked/felt like. I'm just not sure what to do at this point in my Clojure learning experience. I've probably written a few thousand lines of Clojure at this point, but I'm not sure that I'm doing things right: I don't know if my code is efficient, or even idiomatic. I've know next to nothing about Java, and Clojure is my first introduction to functional programming. There are so many fun, exciting, awesome-seeming things in Clojure that I want to take advantage of, like reference types and futures, but I have no point of reference for them and feel like I'm having trouble wrapping my head around them. I've come to realize that I learn best from books, and while code literacy is something I need to work on, read the sourcecode [for library X] isn't going to help me that much, unless it's aggressively commented/documented. I don't really want another intro book, since I'd rather not pay for too much overlap, and while I'll happily accept recommendations for application-/domain-specific books, I'm more looking for a deeper dive into the language itself. I'm being really difficult about this, and I'm sorry in advance. Any and all suggestions are welcome. Thanks guys! -- 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: Resources for intermediate/not-absolute-beginner Clojurians
On Fri, 29 Aug 2014, Sam Raker wrote: I'm just not sure what to do at this point in my Clojure learning experience. I've probably written a few thousand lines of Clojure at this point, but I'm not sure that I'm doing things right: I don't know if my code is efficient, or even idiomatic. I've know next to nothing about Java, and Clojure is my first introduction to functional programming. There are so many fun, exciting, awesome-seeming things in Clojure that I want to take advantage of, like reference types and futures, but I have no point of reference for them and feel like I'm having trouble wrapping my head around them. It sounds like you're at the perfect moment to hit up _The Joy of Clojure_. The second edition came out recently, so it should be nicely current. My copy of 2e is on my in-pile, so I can't yet comment specifically on the updates, but its approach is aimed directly at what you seem to be looking for: why Clojure is Clojure, and what you can do about it. http://joyofclojure.com/ Paul -- 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: Why is this an Exception ?
On Fri, Aug 29, 2014 at 3:04 PM, Ashton Kemerling ashtonkemerl...@gmail.com wrote: Bar/baz refers to the symbol baz in the namespace bar. If you haven't created and imported bar, that's an error. Ashoton's correct. So you'd expect something like this, before being able to e=compile your code. *a/bar.clj* (ns a.bar) (def baz foobar) ;; or a defn *your.clj* (ns yourns (:require [a.bar :as bar])) (defn foo[] (println bar/baz)) (defn car[] (println 42)) On Fri, Aug 29, 2014 at 11:56 AM, Sreeharsha Mudivarti msreehar...@gmail.com wrote: (defn foo[] (println bar/baz)) (defn car[] (println 42)) --- java -cp ~/clojure/clojure-1.6.0.jar clojure.main foo.clj Exception in thread main java.lang.RuntimeException: No such namespace: bar, compiling:(/Users/harsha/foobar/foo.clj:2:3) ... In Ruby and Python, the compiler is silent. -- 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.
How can I add meta to an object that doesn't implement IObj?
Obviously I can't. But I need to add this capability to an object. During testing I attach meta to this object that contains an atom. Then I pass this object to other functions, known in runtime. I can't use a dynamic var because all this happens within a mock function that may be retried and run in different threads. I have seen this: http://stackoverflow.com/questions/20724219/simplest-possible-clojure-object-that-can-accept-a-primitive-and-metadata but can't deref it since I can't change the functions that will use it later. If I wrap this object I need to be able to delegate all of its functionality to the original object. I hope this all is not too vague. The code I'm working on is not online yet. But it's for clecs (https://github.com/muhuk/clecs/), I'm adding quickcheck to compare different world implementations. -- Kind Regards, Atamert Ölçgen -+- --+ +++ www.muhuk.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To 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.
Using an atom for a caching map
Hi all, I want to use a map to cache values based on a key. I'm planning to use an atom for this. My basic operation is give me the value for this key - if the value exists in the map then that value should be returned, otherwise a new value should be calculated, inserted in the map and then returned. My plan is to implement something like the following: (defn ensure [cache key] (if (contains? cache key)cache(assoc cache key (calc-value key(let [value (get (swap! cache ensure key) key)] ... do my thing with value ...) So 'ensure' ensures that the cache contains the value for key, the swap! operation returns the cache with the value and then I get it out. This works but feels a little clumsy, is there a better way to do this? Also, looking at the Atom source code, I see that this will cause a CAS operation even if the value returned from swap! is identical to the original value. It seems like a reasonable optimisation would be to check if the values are identical and not update if so - is there a reason this might not be a good idea? Thanks, Colin -- 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.