first vals first vals

2013-11-21 Thread Zhemin Lin
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 su

Re: first vals first vals

2013-11-21 Thread John Szakmeister
On Thu, Nov 21, 2013 at 4:08 AM, 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"] I thi

Re: first vals first vals

2013-11-21 Thread Jernau
You could use 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 .

Re: first vals first vals

2013-11-21 Thread Zhemin Lin
Thanks, John & Jernau. What if :cf, :cq are not fixed, and I don't really care about the keys, but only the value of the value of the value ...? Thanks, Zhemin. -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email t

Re: preferred way to dereference a ref: outside or inside dosync?

2013-11-21 Thread Jim - FooBar();
On 20/11/13 19:36, juan.facorro wrote: The value for all refs whose value you don't actually modify inside a transaction should be obtained through ensure if you want to make sure :P their value won't be changed by a different transactio

Re: preferred way to dereference a ref: outside or inside dosync?

2013-11-21 Thread Meikel Brandmeyer (kotarak)
Hi Jim, the main differences are: deref inside transaction: returns the value of bank at the end of this transaction (unless you used commute somewhere). deref outside transaction: returns the value of bank at that time, other transaction may have committed meanwhile. Hope that helps. Meikel

Re: first vals first vals

2013-11-21 Thread John Szakmeister
On Thu, Nov 21, 2013 at 4:32 AM, Zhemin Lin wrote: > Thanks, John & Jernau. > What if :cf, :cq are not fixed, and I don't really care about the keys, but > only the value of the value of the value ...? You might want to consider tree-seq to get at the innermost string: (last (tree-seq map? v

Re: ANN: Clojure High Performance Programming

2013-11-21 Thread Ulises
First of all: Congratulations, looks like a great book! Second, do you know why Amazon doesn't offer the kindle version while Packt says it's available in digital format and displays an Amazon logo (I'm assuming the Amazon logo means it's kindle)? Cheers and looking forward to reading your book!

Re: preferred way to dereference a ref: outside or inside dosync?

2013-11-21 Thread Meikel Brandmeyer (kotarak)
Hi, Am Donnerstag, 21. November 2013 11:19:54 UTC+1 schrieb Jim foo.bar: > > On 20/11/13 19:36, juan.facorro wrote: > > The value for all refs whose value you don't actually modify inside a > transaction should be obtained through > ensure

Re: preferred way to dereference a ref: outside or inside dosync?

2013-11-21 Thread Stefan Kamphausen
Hi, I may be missing something here, since this thread leaves me a bit confused. 1. Why are you using a Ref for the bank in the first place? It is a single identity and thus should be an atom, because you do not need to coordinate changes of at least two identities. If I am not mistaken, the

Re: [Job spam] Write Clojure in your pajamas, for decent money in a pleasant company, remote pairing all the time

2013-11-21 Thread Thiago Massa
Again, does it offers H1B's? I've got a good github(mostly ruby), but like you said... I'm from south america. I don't mind to freelance for a while with you guys until next H1B's quota, or to pay it with my work. I think the thread kinda has lost it's purpose as people started arguing about Ruby

Re: ANN: Clojure High Performance Programming

2013-11-21 Thread Shantanu Kumar
On Thursday, 21 November 2013 07:40:09 UTC+5:30, Alex Baranosky wrote: > > Congratulation on the book Shantanu! > Thanks, Alex! Shantanu > > > On Wed, Nov 20, 2013 at 5:16 PM, Shantanu Kumar > > > wrote: > >> Now also available on >> Amazon US: http://www.amazon.com/dp/1782165606/?tag=pack

Re: ANN: Clojure High Performance Programming

2013-11-21 Thread Shantanu Kumar
On Thursday, 21 November 2013 15:57:21 UTC+5:30, Ulises wrote: > > First of all: Congratulations, looks like a great book! > > Second, do you know why Amazon doesn't offer the kindle version while > Packt says it's available in digital format and displays an Amazon > logo (I'm assuming the Ama

Re: ANN: Clojure High Performance Programming

2013-11-21 Thread Ulises
> Thank you! The book is published very recently and I noticed it took a while > for the printed editions to appear on Amazon. I am getting in touch with > Packt to find out why the kindle editions not on Amazon and whether this is > temporary. Great! Thanks for the diligence. If you're getting i

Re: preferred way to dereference a ref: outside or inside dosync?

2013-11-21 Thread Jim - FooBar();
Hi Stefan, thanks for your interest. let me explain further... 1. I did start with a design that involved a map (the bank) full of agents (accounts). Then I switched to a map full of atoms thinking that I don't really need asynchronous operations. I settled to the single ref approach because

Re: ANN: Clojure High Performance Programming

2013-11-21 Thread Shantanu Kumar
On Thursday, 21 November 2013 16:28:14 UTC+5:30, Ulises wrote: > > > Thank you! The book is published very recently and I noticed it took a > while > > for the printed editions to appear on Amazon. I am getting in touch with > > Packt to find out why the kindle editions not on Amazon and wheth

Re: ANN: Clojure High Performance Programming

2013-11-21 Thread Baishampayan Ghose
The ToC looks amazing. Great work, Shantanu! ~BG On Thu, Nov 21, 2013 at 5:21 AM, Shantanu Kumar wrote: > Hi, > > I am pleased to announce availability of the book `Clojure High Performance > Programming` that I have been writing for the better part of this year: > > http://www.packtpub.com/cloju

Re: [ANN] Component: dependency injection and state management

2013-11-21 Thread Jan Herich
This is simple brilliant... The approach proposed and the component "framework" implementing it finally solves the issue with the "necessary evil" (start/stop interactions with statefull components in any bigger Clojure app) by cleverly taking only the best ideas (like using inferred dependency

Re: ANN: Clojure High Performance Programming

2013-11-21 Thread Ulises
> Could you please let me know which URL and page no. did you find the images > missing on? I noticed the images are visible (for example on page number 21) > when I visited http://www.amazon.com/dp/1782165606/?tag=packtpubli-20 and > clicked on the book image to open the preview. Apologies for th

Re: preferred way to dereference a ref: outside or inside dosync?

2013-11-21 Thread Jim - FooBar();
also I forgot to add that having the bank in some reference type allows opening/closing new accounts, an operation that at least to me sounds like it needs coordination... So which way is preferred? map-ref that stores values, map that stores refs or map-ref that stores refs? Jim On 21/11/13

Re: first vals first vals

2013-11-21 Thread Zhemin Lin
Wow, that's really cool! Thanks a lot, John! -- -- 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

Re: [ANN] tools.reader 0.8.0 released

2013-11-21 Thread Ambrose Bonnaire-Sergeant
Cool, nice work Nicola and Alex! Ambrose On Thu, Nov 21, 2013 at 2:16 PM, Nicola Mometto wrote: > > https://github.com/clojure/tools.reader > > Changelog: > https://github.com/clojure/tools.reader/blob/master/CHANGELOG.md > > Leiningen dependency information: [org.clojure/tools.reader "0.8.0"]

Re: [ANN] Component: dependency injection and state management

2013-11-21 Thread abp
Hi, great work indeed. One question though: Why do you prefer declaring dependencies between components of a system explicitly instead of using prismatics Graph? On Thursday, November 21, 2013 3:01:19 AM UTC+1, Stuart Sierra wrote: > > This is a small library/framework I've been working on for a

ANN: double-check, a Clojure/ClojureScript-portable fork of simple-check

2013-11-21 Thread Chas Emerick
Reid Draper's simple-check[1] is a generative/property-based testing library for Clojure that implements (and improves upon IMO) the shrinking of failing test cases seen in e.g. quickcheck in the Haskell and Erlang lands. simple-check has totally changed how I do certain kinds of testing. From

Re: Using xlisp assoc-lists in clojure

2013-11-21 Thread Justin Smith
The issue, as far as I am concerned, is not that clojure cannot do alists as any traditional lisp would (it can, quite easily, as has already been shown). The real question is why you would use a linked list for associative data, when you have an associative type with better lookup time and a c

Re: preferred way to dereference a ref: outside or inside dosync?

2013-11-21 Thread Jim - FooBar();
On 21/11/13 13:19, John D. Hume wrote: If you want to demonstrate STM with the deposit-withdraw-transfer example, you definitely need a ref for each account. I'd suggest an atom for the account-num->balance-ref map ("the bank") and an atom for the account-num-generator, but you say coordinat

Re: ANN: double-check, a Clojure/ClojureScript-portable fork of simple-check

2013-11-21 Thread Stephen Cagle
Did you try out test.generative? If so, how does simple check contrast to test.generative? On Thursday, November 21, 2013 11:31:19 AM UTC-8, Chas Emerick wrote: > > simple-check is planning on remaining Clojure-only, at least for the > foreseeable future. This "non-fork fork" is the best altern

Re: preferred way to dereference a ref: outside or inside dosync?

2013-11-21 Thread John D. Hume
generate-key is not thread-safe. Multiple callers might get the same id. It would probably be worthwhile to have your debit fn disallow a negative balance in some way. Maybe also don't allow closing an account unless it has zero balance. (Though the latter might require coordination between the "b

Re: [ANN] Major update of modern-cljs

2013-11-21 Thread Gary Johnson
+1 to Bastien's comment. Your tutorials are by far the best introduction to web programming in Clojure and Clojurescript on the web. Thank you so much for keeping these up to date so that we can all benefit from them. ~Gary -- -- You received this message because you are subscribed to the

Re: preferred way to dereference a ref: outside or inside dosync?

2013-11-21 Thread Jim - FooBar();
apart from the generate-keys fn which is intentionally simplistic and predictable so I can test somehow, I will admit that these are very good points indeed. Do at least consider the case where one thread already has a reference to an account another thread is closing. to me, this smells l

Re: ANN: double-check, a Clojure/ClojureScript-portable fork of simple-check

2013-11-21 Thread Max Penet
Looks good! I am wondering though, why not merging your work on the parent project instead of creating a new one (with a new name etc), you seemed to be on your way of doing just this? On Thursday, November 21, 2013 5:38:16 PM UTC+1, Chas Emerick wrote: > > Reid Draper's simple-check[1] is a

ANN: ClojureScript 0.0-2060

2013-11-21 Thread David Nolen
ClojureScript, the Clojure compiler that emits JavaScript source code. README and source code: https://github.com/clojure/clojurescript New release version: 0.0-2060 Leiningen dependency information: [org.clojure/clojurescript "0.0-2060"] Source map accuracy is considerably improved in thi

Re: preferred way to dereference a ref: outside or inside dosync?

2013-11-21 Thread John D. Hume
If you want to demonstrate STM with the deposit-withdraw-transfer example, you definitely need a ref for each account. I'd suggest an atom for the account-num->balance-ref map ("the bank") and an atom for the account-num-generator, but you say coordination is necessary for opening and closing acco

Re: [ANN] Component: dependency injection and state management

2013-11-21 Thread Ben Mabey
On Thu Nov 21 07:14:16 2013, Stuart Sierra wrote: On Thursday, November 21, 2013 7:22:10 AM UTC-5, abp wrote: > Why do you prefer declaring dependencies between > components of a system explicitly instead of using > prismatics Graph? 'Graph' by itself does not preserve the dependency relationshi

Re: ANN: Clojure High Performance Programming

2013-11-21 Thread Shantanu Kumar
On Thursday, 21 November 2013 16:48:56 UTC+5:30, Ulises wrote: > > > Could you please let me know which URL and page no. did you find the > images > > missing on? I noticed the images are visible (for example on page number > 21) > > when I visited http://www.amazon.com/dp/1782165606/?tag=pac

Re: preferred way to dereference a ref: outside or inside dosync?

2013-11-21 Thread Jim - FooBar();
My latest iteration has brought me to this: https://github.com/jimpil/bankio/blob/master/src/bankio/core.clj If anyone can think of a more evident and safe approach for demonstration purposes, by all means, shout out. After consulting the Clojure Programming book, I decided to use commute for

Re: ANN: Clojure High Performance Programming

2013-11-21 Thread Praki Prakash
Hi Shantanu, Congrats on the book. Looks like it's going to be a great read and no doubt a much needed book on the subject of performant code. Regards, Praki Prakash On Thu, Nov 21, 2013 at 11:09 AM, Shantanu Kumar wrote: > > > On Thursday, 21 November 2013 21:39:36 UTC+5:30, Gary Johnson wrot

Re: first vals first vals

2013-11-21 Thread John D. Hume
On Nov 21, 2013 3:32 AM, "Zhemin Lin" wrote: > What if :cf, :cq are not fixed, and I don't really care about the keys, but only the value of the value of the value ...? Maps seem an awkward choice of data-structure for a scenario where you don't know or care about the keys. -- -- You received

Re: ANN: ClojureScript 0.0-2060

2013-11-21 Thread Thomas Heller
Amazing work! Thanks to everyone involved. Are there any hopes of optimizing things in the source-map department? It adds about 30sec (on optimize only, compile times are fine) to my build which makes it unsuitable for development. A while back I opened http://dev.clojure.org/jira/browse/CLJS-4

R: [ClojureScript] ANN: ClojureScript 0.0-2060

2013-11-21 Thread mimmo.cose...@gmail.com
great work david!Inviato da Samsung Mobile David Nolen ha scritto: ClojureScript, the Clojure compiler that emits _javascript_ source code.README and source code: https://github.com/clojure/clojurescript New release version: 0.0-2060Leiningen dependency information:    [org.clojure/clojurescr

Re: My recap of Clojure/conj 2013

2013-11-21 Thread Daniel Higginbotham
Thanks, Logan! It was fun meeting you! Congrats again on winning the conj! :D Daniel On Wednesday, November 20, 2013 11:02:38 AM UTC-5, Logan Linn wrote: > > I've posted a writeup of my experience from this year's Clojure/conj and > wanted to share with those who couldn't make it: > http://log

Re: ANN: Clojure High Performance Programming

2013-11-21 Thread Shantanu Kumar
On Thursday, 21 November 2013 21:39:36 UTC+5:30, Gary Johnson wrote: > > This looks incredible! Just bought a copy. Congratulations, Shantanu! > Thanks, Gary! Those who might look for a Kindle edition can find it here: http://www.amazon.com/Clojure-Performance-Programming-Shantanu-Kumar-ebook/d

Re: Compiling ClojureScript in the repl using a macro defined in Clojure

2013-11-21 Thread juan.facorro
I tried the following: 1. Created a project with David Nolen's lein template (taken from here ): *$ lein new mies hello-world* 2. Created a *macro.clj* file in the *src/hello-world* folder with the contents you posted:

Re: [ANN] Component: dependency injection and state management

2013-11-21 Thread Stuart Sierra
On Thursday, November 21, 2013 7:22:10 AM UTC-5, abp wrote: > Why do you prefer declaring dependencies between > components of a system explicitly instead of using > prismatics Graph? 'Graph' by itself does not preserve the dependency relationships after constructing the map. But the two approache

Access the datastructure used to create a function?

2013-11-21 Thread henry w
Say you have a function created like this: (fn [x] (+ x y)) and then you have a reference to an instance of this function, is there some way to use the function reference to access the list '(fn [x] (+ x y)), including the symbol 'y' (such that you could dereference 'y' and get its value)? The

Re: ANN: Clojure High Performance Programming

2013-11-21 Thread Gary Johnson
This looks incredible! Just bought a copy. Congratulations, Shantanu! -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient

Re: ANN: double-check, a Clojure/ClojureScript-portable fork of simple-check

2013-11-21 Thread Chas Emerick
simple-check is planning on remaining Clojure-only, at least for the foreseeable future. This "non-fork fork" is the best alternative Reid and I could come up with to enable people to use it on both Clojure and ClojureScript. Hopefully double-check will be unnecessary at some point. :-) - C

Re: first vals first vals

2013-11-21 Thread Lin Zhemin
Clojure-hbase returns {rowkey {:cf {:cq value }}} and its a trade-off not to write it in hbase API. 2013/11/21 21:24 "John D. Hume" : > On Nov 21, 2013 3:32 AM, "Zhemin Lin" wrote: > > What if :cf, :cq are not fixed, and I don't really care about the keys, > but only the value of the value of the

Re: preferred way to dereference a ref: outside or inside dosync?

2013-11-21 Thread Stefan Kamphausen
Hi, On Thursday, November 21, 2013 11:58:31 AM UTC+1, Jim foo.bar wrote: > > [...] 1. [...] Since there is a single > identity, perhaps STM is an overkill... > If I read your example correctly, it is not a typical use-case for STM. > > 2. can you ellaborate why you think this is debatable?

Re: java.jdbc DSLs (java.jdbc.sql / java.jdbc.ddl)

2013-11-21 Thread Alexander Hudek
> > > Is anyone using the java.jdbc.sql namespace? (besides World Singles :) > > We are using it but not the DDL. We also use honeysql in places where jdbc.sql cannot express the query. -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to

Re: ANN: ClojureScript 0.0-2060

2013-11-21 Thread Feng Hou
On Thursday, November 21, 2013 10:12:55 AM UTC-5, David Nolen wrote: > ClojureScript, the Clojure compiler that emits JavaScript source code. > > > README and source code: https://github.com/clojure/clojurescript > > > > New release version: 0.0-2060 > > > Leiningen dependency information: >

Re: [ClojureScript] Re: ANN: ClojureScript 0.0-2060

2013-11-21 Thread Tim Visher
Thanks for the patch, Feng. Patches don't tend to get discussed on the mailing list for Clojure. Do you have your CA signed yet? http://clojure.org/contributing Ironically, I had basically produced this patch, line for line, a couple of hours ago. Hopefully we can get a release out soon. This was

Re: [ClojureScript] Re: ANN: ClojureScript 0.0-2060

2013-11-21 Thread Feng Hou
On Thursday, November 21, 2013 10:48:42 PM UTC-5, Tim Visher wrote: > Thanks for the patch, Feng. > > > > Patches don't tend to get discussed on the mailing list for Clojure. > > Do you have your CA signed yet? http://clojure.org/contributing > > > > Ironically, I had basically produced this

Re: ANN: ClojureScript 0.0-2060

2013-11-21 Thread Feng Hou
On Thursday, November 21, 2013 10:12:55 AM UTC-5, David Nolen wrote: > ClojureScript, the Clojure compiler that emits JavaScript source code. > > > README and source code: https://github.com/clojure/clojurescript > > > > New release version: 0.0-2060 > > > Leiningen dependency information: >

Re: java.jdbc DSLs (java.jdbc.sql / java.jdbc.ddl)

2013-11-21 Thread seancorfield
I spent this afternoon removing use of java.jdbc.sql from World Singles’ code base to see how much work it would be. The worst part for us was how much we relied on the naming strategy convenience macros (especially entities, since it flows :entities through all the DSL constructs). How much i

[ANN] Reaction

2013-11-21 Thread Kelker Ryan
Reaction  - https://github.com/runexec/reactionA small reactive programming library for ClojureUsageuser> (use '[reaction.core])niluser> (def-reactive! my-int 123)#'user/my-intuser> @my-int123user> (rapply! my-int inc)niluser> @my-int124user> (original-value my-int)123user> @my-int124user> (rapply!