Re: Must PersistentQueue be stored in ref not atom?

2011-11-10 Thread Takahiro
Hi, Meikel

I didn't know there is a lower level operation. Thanks.
!paws is a tony name :)

 However, my suspicion is, that you don't clearly divide the state handling
 from the program logic. The peek should happen in the update function you
 pass to swap!. If this is not side-effect free, it means that you have to
 coordinate with other identities and resources. Then a ref or an agent might
 be indeed a better fit than the atom.
The best way might be sealing stuff in poll! function and using
polymorphism so that we can easily switch identity between ref and
atom.

(defprotocol Pollable
  (poll! [x]))

(extend-protocol Pollable
  clojure.lang.Ref
  (poll! [r]
   (dosync
(let [item (peek @r)]
(alter r pop)
item)))
  clojure.lang.Atom
  (poll! [a] (peek (!paws a pop

Maybe overengineering.

2011/11/10 Meikel Brandmeyer (kotarak) m...@kotka.de:
 Hi,

 an atom can be sufficient, but you need to drop to a lower level.

 (defn !paws
   Like swap! but returns the old value of the atom.
   [a f  args]
   (loop []
     (let [old-value @a
   new-value (apply f old-value args)]
   (if (compare-and-set! a old-value new-value)
     old-value
     (recur)

 (peek (!paws atom-with-queue pop))

 However, my suspicion is, that you don't clearly divide the state handling
 from the program logic. The peek should happen in the update function you
 pass to swap!. If this is not side-effect free, it means that you have to
 coordinate with other identities and resources. Then a ref or an agent might
 be indeed a better fit than the atom.

 Sincerely
 Meikel

 --
 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 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


Re: smallest unit of code requiring a CA

2011-11-10 Thread Chris Gray
Charlie Griefer wrote:

 Chris Gray wrote:

 I have a patch to the clojure compiler that I would like to submit. I
 haven't signed a CA, but the patch is quite small. Would it be possible
 to submit it without a CA? I have no objection to signing one; it would
 just be slightly embarassing to do so for such a small patch. :)

 The patch is at
 https://github.com/chrismgray/clojure/tree/namespace-divides and simply
 allows code to refer to the / function in namespaces other than
 clojure.core.


 FWIW, I'd just go ahead and sign the CA. Regardless of how small you
 might perceive this particular patch to be, you may very well find
 yourself submitting additional patches in the future.

Okay, it's in the mail.  I will now submit the patch through JIRA.

Thanks for the advice!

Cheers,
Chris

-- 
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


Looking for example code and other learning resources

2011-11-10 Thread Christian Romney
Hi all,

As part of my effort to learn Clojure, I'm looking for examples of
good (open) source that makes use of STM and other concurrency
features. I was wondering if any of you would be kind enough to point
me at interesting, idiomatic examples of code that leverages any of
the following:

- atoms
- agents
- futures
- promises

I've read Programming Clojure and the Joy of Clojure–both of which
include helpful heuristics to decide among the concurrency options–but
I think I need to step back and better understand when I might need to
reach for any of these tools to begin with. I've managed to write a
fair amount of admittedly trivial code without any of these features,
but perhaps I'm doing it wrong.

Pointers to literature, screencasts, discussions, blog posts or books
would be most welcome. I've also been trying to understand the Clojure
source (particularly the ASM) and was wondering if there are any good
resources that explain the low-level design and implementation of the
language. If not, let me be the first to say I'd gladly part with
money for a book on the subject... ;)

Thanks very much in advance.
Christian Romney

-- 
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


Re: Looking for example code and other learning resources

2011-11-10 Thread Base
Hi -

I have found this site *very* useful.

http://clojuredocs.org/quickref/Clojure%20Core



On Nov 10, 9:50 am, Christian Romney xmlb...@gmail.com wrote:
 Hi all,

 As part of my effort to learn Clojure, I'm looking for examples of
 good (open) source that makes use of STM and other concurrency
 features. I was wondering if any of you would be kind enough to point
 me at interesting, idiomatic examples of code that leverages any of
 the following:

 - atoms
 - agents
 - futures
 - promises

 I've read Programming Clojure and the Joy of Clojure–both of which
 include helpful heuristics to decide among the concurrency options–but
 I think I need to step back and better understand when I might need to
 reach for any of these tools to begin with. I've managed to write a
 fair amount of admittedly trivial code without any of these features,
 but perhaps I'm doing it wrong.

 Pointers to literature, screencasts, discussions, blog posts or books
 would be most welcome. I've also been trying to understand the Clojure
 source (particularly the ASM) and was wondering if there are any good
 resources that explain the low-level design and implementation of the
 language. If not, let me be the first to say I'd gladly part with
 money for a book on the subject... ;)

 Thanks very much in advance.
 Christian Romney

-- 
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


Re: Clojure Conj extracurricular activities spreadsheet

2011-11-10 Thread Chas Emerick
In the interests of helping with scheduling (and, mostly, common sense
given the obvious significant overlap in likely interested parties),
I've merged the Counterclockwise-specific tooling BoF into the general-
purpose Clojure tooling BoF.

If you want to talk about Counterclockwise specifically, check out the
tooling BoF and we'll figure out a time and place for a ccw-specific
discussion.

Cheers,

- Chas

-- 
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


Re: Clojure Conj extracurricular activities spreadsheet

2011-11-10 Thread Daniel Solano Gomez
The Clojure development with Android BoF session will be in the Willow
Oak room from 6-7 this evening.

On Fri Oct 28 12:41 2011, blcooley wrote:
 
 
 On Oct 27, 5:41 pm, Daniel Solano Gomez cloj...@sattvik.com wrote:
 
  I'd like to propose a new activity: Android.  It'd be more of a hack and
  chat about doing Android development in Clojure.  Some things to talk
  about could include creating Clojure-friendly tools for Android
  development and perhaps the possibility of an Android contrib module.
 
  Thanks,
 
  Daniel Solano Gómez
 
 
 
 I would definitely attend an Android activity.
 
 -- 
 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


signature.asc
Description: Digital signature


Re: Looking for example code and other learning resources

2011-11-10 Thread Christian Romney
On Nov 10, 12:03 pm, Base basselh...@gmail.com wrote:
 Hi -

 I have found this site *very* useful.
 http://clojuredocs.org/quickref/Clojure%20Core

Thanks for your reply. I am familiar with Clojure docs and have found
it helpful on occasion.

On a separate note, I've been studying the SQL Korma source which
makes use of atoms, delays and macros.
I'm still searching for in interesting use of agents and promises...

-- 
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


Re: Clojure Conj extracurricular activities spreadsheet

2011-11-10 Thread Benny Tsai
Does anyone know if the Web and Clojure session will be taking place 
tonight or another night?

-- 
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

Re: Clojure Conj extracurricular activities spreadsheet

2011-11-10 Thread Gary Trakhman
confirmed tonight

-- 
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

Re: Clojure Conj extracurricular activities spreadsheet

2011-11-10 Thread Chas Emerick
CORRECTION: 

The Clojure tooling BoF will *now* be in the Oak Forest room (main ballroom) 
tonight, 10pm - 11pm.  I guess we weren't going to fit in the boardroom…

- Chas

On Nov 10, 2011, at 3:02 PM, Chas Emerick wrote:

 The Clojure tooling BoF will be in the President's Boardroom tonight,
 10pm - 11pm.
 
 - Chas
 
 On Nov 10, 12:33 pm, Chas Emerick cemer...@snowtide.com wrote:
 In the interests of helping with scheduling (and, mostly, common sense
 given the obvious significant overlap in likely interested parties),
 I've merged the Counterclockwise-specific tooling BoF into the general-
 purpose Clojure tooling BoF.
 
 If you want to talk about Counterclockwise specifically, check out the
 tooling BoF and we'll figure out a time and place for a ccw-specific
 discussion.
 
 Cheers,
 
 - Chas
 
 -- 
 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 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


JavaScript `debugger' statement

2011-11-10 Thread Stuart Campbell
I'm trying to enter the Firebug debugger when an exception is caught:

(try
  ; ...
  (catch js/Error e
js/debugger))

This doesn't work, because js/debugger compiles to debugger$; per
cljs.compiler/munge.

Any ideas how I can get around this?

Thanks,
Stu

-- 
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

Re: JavaScript `debugger' statement

2011-11-10 Thread Matt Hoyt
try (js* debugger())
 
Matt Hoyt



From: Stuart Campbell stu...@harto.org
To: Clojure clojure@googlegroups.com
Sent: Thursday, November 10, 2011 9:16 PM
Subject: JavaScript `debugger' statement


I'm trying to enter the Firebug debugger when an exception is caught:

(try
  ; ...
  (catch js/Error e
    js/debugger))

This doesn't work, because js/debugger compiles to debugger$; per 
cljs.compiler/munge.

Any ideas how I can get around this?

Thanks,
Stu

-- 
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 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

gaidica command??

2011-11-10 Thread jayvandal
I tried this command but can't find how to execute it.
 $ lein run -m gaidica.core
What folder do I execute this ? (Vista windows )
Probably simple but  it's difficult for me
Thanks

# gaidica

Example Seesaw application. Display weather data from
weatherunderground.com

## Usage

$ lein deps
$ lein run -m gaidica.core

-- 
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