Re: Using an atom for a caching map

2014-08-29 Thread Eldar Gabdullin
Something like the following would be fine for me (def cache (atom {})) (defn lookup [cache k] (let [v (get @cache k ::nil)] (if (= v ::nil) (let [v (calc-value k)] (swap! cache assoc k v) v) v))) (let [value (lookup cache k)] ; use value and @cache here )

Using an atom for a caching map

2014-08-29 Thread Colin Fleming
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 ret

How can I add meta to an object that doesn't implement IObj?

2014-08-29 Thread Atamert Ölçgen
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

Re: Why is this an Exception ?

2014-08-29 Thread Timothy Washington
On Fri, Aug 29, 2014 at 3:04 PM, Ashton Kemerling 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.b

Re: Resources for intermediate/not-absolute-beginner Clojurians

2014-08-29 Thread Paul L. Snyder
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 idiomati

Resources for intermediate/not-absolute-beginner Clojurians

2014-08-29 Thread Sam Raker
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 ma

Re: clojure streams

2014-08-29 Thread Linus Ericsson
(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 con

Re: Why is this an Exception ?

2014-08-29 Thread Ashton Kemerling
Bar/baz refers to the symbol baz in the namespace bar. If you haven't created and imported bar, that's an error. On Fri, Aug 29, 2014 at 11:56 AM, Sreeharsha Mudivarti wrote: > (defn foo[] > (println bar/baz)) > (defn car[] > (println 42)) > --- > java -cp ~/clojure/clojure-1.6.0.jar cloj

clojure streams

2014-08-29 Thread Greg MacDonald
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 po

Re: Clojure cheatsheet v16 with few updates for Sets, Maps, and Relations sections

2014-08-29 Thread Reid McKenzie
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.

Why is this an Exception ?

2014-08-29 Thread Sreeharsha Mudivarti
(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 s

Changing default clojure reader

2014-08-29 Thread Sarkis Karayan
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 p

Re: ANN: Reagent 0.4.0

2014-08-29 Thread Cesare
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. > >

Re: ANN: Reagent 0.4.0

2014-08-29 Thread Ivan L
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 an

Clojure cheatsheet v16 with few updates for Sets, Maps, and Relations sections

2014-08-29 Thread Andy Fingerhut
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 adde

Re: [ANN] om-bootstrap 0.2.5 - Bootstrap 3 components in Om

2014-08-29 Thread Andy Dwelly
Thanks: works perfectly. The minimum html is (more or less): https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"; rel="stylesheet" type="text/css" class="style" /> http://fb.me/react-0.11.1.js";> goog.requ

Re: ANN: Reagent 0.4.0

2014-08-29 Thread Cesare
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 no

Clojure eXchange 2014 Call for Presentations

2014-08-29 Thread Bruce Durling
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 her