Re: core.async count in a channel

2014-01-17 Thread Meikel Brandmeyer (kotarak)
Hi,

the average channel has no queue. Processes freeze until the peer process 
arrives. So count doesn't make sense for the typical channel. If you want 
to implement a queue, you could create a process which accepts values on 
end and distributes to the other. Then you can keep also track of any stats 
you like independent of the underlying channel implementation.

(defn queue-process
  [input output stats]
  (async/go
; Wait for the first input.
(loop [v (async/ Empty queue.
  (identical? ch input) (do
  (doseq [v (cons v q)]
(async/>! output v))
  (async/close! output))

  ; Write happened, and there is more in the queue.
  (pos? (count q)) (recur (peek q) (pop q))

  ; Write happened, and queue is empty. Start over.
  :else (recur (async/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: core.async count in a channel

2014-01-17 Thread Meikel Brandmeyer (kotarak)
Bleh when you see the bug as you hit "Send"

(defn queue-process
  [input output stats]
  (async/go
; Wait for the first input.
(loop [v (async/ Empty queue.
(identical? ch input) (recur nil (cons v q))

; Write happened, and there is more in the queue.
(pos? (count q)) (recur (peek q) (pop q))

; Write happened, and queue is empty. Start over.
:else (recur (async/! output v))
  (async/close! output))

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


Functional Programming Challenge at CodeSprint

2014-01-17 Thread Abhiranjan Kumar
Hi All

There's a contest going to be held on 18'th Jan (tomorrow). This time there 
will be one functional programming challenge to be solved.

Link: https://www.hackerrank.com/codesprint5

We started functional programming track few months ago and it's growing, 
https://www.hackerrank.com/tracks/fp.

Abhiranjan Kumar
Problem Curator and Developer @ HackerRank
[Pardon for spamming]

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


Looking for a Clojure expert for video training

2014-01-17 Thread marlene saucier
My company is looking for a Clojure expert who is interested in developing 
training videos for our partner. Gig pays well! 

Let me know!! 

Marlene

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


Best Informatica Online Training By Vast IT Expert trainers in Hyderabad | India | UK| USA

2014-01-17 Thread Sairam Shankar
Informatica Online Training by Sunitlabs We are providing excellent 
Informatica Training by real-time 

IT industry experts Our training methodology is very unique Our Course 
Content covers all the in-

depth critical scenarios. We have completed more than 200 Informatica 
batches through Online Informatica

Training program, Our Informatica Classes covers all the real time 
scenarios, and its completely on Hands-

on for each and every session.

Please call us for the Demo Classes we have regular batches and weekend 
batches.

Contact Number : India :+91 9030928000,

Email : i...@sunitlabs.com ,

Web: http://sunitlabs.com/informatica-online-training/

-- 
-- 
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: Best Informatica Online Training By Vast IT Expert trainers in Hyderabad | India | UK| USA

2014-01-17 Thread Baishampayan Ghose
Please don't send spam to our mailing list. Thank you. ~BG

On Fri, Jan 17, 2014 at 2:59 PM, Sairam Shankar
 wrote:
> Informatica Online Training by Sunitlabs We are providing excellent
> Informatica Training by real-time
>
> IT industry experts Our training methodology is very unique Our Course
> Content covers all the in-
>
> depth critical scenarios. We have completed more than 200 Informatica
> batches through Online Informatica
>
> Training program, Our Informatica Classes covers all the real time
> scenarios, and its completely on Hands-
>
> on for each and every session.
>
> Please call us for the Demo Classes we have regular batches and weekend
> batches.
>
> Contact Number : India :+91 9030928000,
>
> Email : i...@sunitlabs.com ,
>
> Web: http://sunitlabs.com/informatica-online-training/
>
> --
> --
> 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.



-- 
Baishampayan Ghose
b.ghose at gmail.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/groups/opt_out.


Re: Very strange behaviour in reducers

2014-01-17 Thread Yves Parès
Ok, but apparently I'm not the only one to be puzzled by this behaviour, 
which we may regard as an inconsistency.
Just to know, is it planned to be changed? (so that I can note it and 
remember it if I have an error that appears in this part of my code after a 
clojure upgrade)

Le mardi 14 janvier 2014 18:20:45 UTC+1, Filip Štaffa a écrit :
>
> Hi Yves,
>
> I guess it is because r/reduce calls r/reduce-kv (which is specific for 
> map), while r/fold it does not have such special handling
>
> Filip
>
> On Tuesday, January 14, 2014 4:43:10 PM UTC+1, Yves Parès wrote:
>>
>> Hello!
>> When mapping and reducing a map, it seems arguments are passed 
>> differently to the function that is mapped depending on whether you reduce 
>> with r/reduce or r/fold:
>>
>> (r/fold +
>> (r/map (fn [k v] (inc v)) {:a 4 :b 5}))
>> But:
>> (r/reduce +
>> (r/map (fn [[k v]] (inc v)) {:a 4 :b 5}))
>>
>> The function r/mapped is the same each time, but if the return value of 
>> r/map is further reduce with r/fold, it received 2 arguments (key and 
>> value). However, if it is reduced with r/reduce, the fn is called with ONE 
>> pair [k v].
>>
>> Is that normal?
>>
>

-- 
-- 
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: core.async count in a channel

2014-01-17 Thread Meikel Brandmeyer (kotarak)
Hi again,

and some more golfing by Christophe:

(defn queue-process-uncontrolled
  [input output stats]
  (async/go
(loop [q clojure.lang.PersistentQueue/EMPTY]
  (let [[val-to-q ch] (async/alts! 
(if-let [v (peek q)]
  [input [output v]]
  [input]))]
(swap! stats update-stats-as-you-see-fit q)
(cond
  ; Read a value from input.
  val-to-q (recur (conj q val-to-q))
; Input channel is closed. => drain queue.
  (identical? ch input) (doseq [v q] (async/>! output v))
 
  ; Write happened.
  :else (recur (pop q)
 
(defn queue-process-controlled
  [input stats]
  (let [output  (async/chan)
process (queue-process-uncontrolled input output stats)]
(async/go
  (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: core.async count in a channel

2014-01-17 Thread t x
@Meikel: I am now convinced that you are right. It's clear to me that I
completely underestimated the power / flexibility of the Channel
abastraction.

@World: I now retract my second-ing of "adding count to Protocol of Channel"


On Fri, Jan 17, 2014 at 2:10 AM, Meikel Brandmeyer (kotarak) 
wrote:

> Hi again,
>
> and some more golfing by Christophe:
>
> (defn queue-process-uncontrolled
>   [input output stats]
>   (async/go
> (loop [q clojure.lang.PersistentQueue/EMPTY]
>   (let [[val-to-q ch] (async/alts!
> (if-let [v (peek q)]
>   [input [output v]]
>   [input]))]
> (swap! stats update-stats-as-you-see-fit q)
> (cond
>   ; Read a value from input.
>   val-to-q (recur (conj q val-to-q))
> ; Input channel is closed. => drain queue.
>   (identical? ch input) (doseq [v q] (async/>! output v))
>
>   ; Write happened.
>   :else (recur (pop q)
>
> (defn queue-process-controlled
>   [input stats]
>   (let [output  (async/chan)
> process (queue-process-uncontrolled input output stats)]
> (async/go
>   (   (async/close! output))
> output))
>
>
> Plus an improvement for the closing of the output channel.
> queue-process-uncontrolled is not necessarily the master of the channel.
>
> 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 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.
>

-- 
-- 
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: How to handle configuration in Clojure?

2014-01-17 Thread Malcolm Sparks
There's also Jig : https://github.com/juxt/jig

Jig's recommendation is for configuration to be held in EDN files.

I much prefer EDN over environment variables. Environment variables feel 
awkward when there you have lots of configuration, usually in the form of a 
tree.

Usually it makes sense to have one configuration file per environment. That 
can make it hard to keep configuration files up to date, so judicious use 
of the #=() Clojure reader macro can allow you to programmatically deviate 
from a default configuration - often the delta from a default configuration 
is more informative. There are more details in Jig's README.md file.

I agree with the comments against using dynamic vars. They reduce the 
ability to reason about functions and are precarious when dealing with 
threads - binding conveyance is tricky and small mistakes can lead to 
elusive bugs.

I pass configuration as a single argument into types/records that declare 
lifecycle methods. I have found this pattern to serve me well in over a 
dozen projects. Since stumbling on this pattern I have had no need to 
resort to dynamic vars for environment config, and my projects have been 
smaller, more reliable and easier to reason about.


On Tuesday, January 14, 2014 9:04:45 AM UTC, James Trunk wrote:
>
> Thanks for all the great links and ideas you have all posted, now I have 
> plenty of reading and thinking to do!
>
> > I am curious about what you mean by 'thread safety'.
> Perhaps "thread safety" is the wrong term, but what I meant was the 
> limitations dynamic binding introduces around thread dispatching, which 
> Stuart Sierra explains in this blog 
> post
> .
>
> Cheers,
> James
>
> On Monday, January 13, 2014 7:10:38 PM UTC+1, Stefan Kanev wrote:
>>
>> On 13/01/14, James Trunk wrote: 
>> > The downsides to dynamic vars seem to be: hiddenness, thread safety, 
>> and 
>> > more complex tests (binding before each test). 
>>
>> I am curious about what you mean by 'thread safety'.  As far as I know, 
>> dynamic variables are thread-local, which means that they are 
>> thread-safe, at least to some extend.  I assume you mean something 
>> specific? 
>>
>> -- 
>> Stefan Kanev  ¦  @skanev  ¦  http://skanev.com/ 
>> If a program manipulates a large amount of data, it does so in a small 
>> number 
>> of ways. 
>>
>

-- 
-- 
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: how to check if something is a channel ?

2014-01-17 Thread Timothy Baldridge
Those interfaces are also broken into ReadPort, WritePort and Channel. Each
protocol defines (in order), read, write, and close!. So you can check on
or all of those for only the ops you need.

Note however, anything under clojure.core.async.impl is subject to change
without notice in future versions. Not that we will, but they may change.

Timothy


On Fri, Jan 17, 2014 at 12:43 AM, Meikel Brandmeyer (kotarak)
wrote:

> Hi,
>
> you could check to see whether a thing implements the interface.
>
> (defn channel?
>   [x]
>   (satisfies? clojure.core.async.impl.protocols/Channel x))
>
> 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 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.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
-- 
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: Possible heisenbug in test suite (not in individual test runs) with memoization

2014-01-17 Thread Alex Miller
Further, in Clojure <= 1.5.1, (= 1M 1.0M) => false. Please note, this 
behavior has changed in 1.6.

On Monday, January 6, 2014 12:21:13 PM UTC-6, Justin Kramer wrote:
>
> Shot in the dark: check that arguments passed to your memoized functions 
> use consistent typing. A BigDecimal such as 1M does not necessarily equal 1 
> (a Long):
>
> > (= 1 1M)
> false
> > (== 1 1M)
> true
>
> Your memoized functions could be recomputing values unnecessarily if 
> you're giving them different types of numbers.
>
> Justin
>
> On Monday, January 6, 2014 12:57:49 PM UTC-5, David James wrote:
>>
>> I've got a Clojure test suite that fails when run as whole but passes 
>> when run piecemeal. This just started happening. I've tested the code 
>> thoroughly. The bug pops up in a part of the code that I did not change. 
>> So, at present, it feels like a heisenbug!
>>
>> These may be some relevant pieces:
>> * I'm using memoization; the failures happen in memoized functions.
>> * I'm doing a lot of various precision BigDecimal math.
>>
>> Some tentative guesses:
>> * Somehow one test is affecting another test
>>
>> Questions (there are speculative):
>> * What are some possible ways that memoization might fail (e.g. return an 
>> incorrect value)?
>> * Is it possible that higher memory usage could cause memoization results 
>> to get lost?
>>
>> Unfortunately, it is a sizable code base, and I don't have a small, 
>> reproducible example. Any suggestions?
>>
>> -David
>>
>

-- 
-- 
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: functions inside of go blocks

2014-01-17 Thread Alex Miller
You can definitely call functions, just not ones use the channel ops. The 
recommendation is to keep the io ops inside the go block and pull your 
logic into external functions. 

There are two benefits to this approach: 
1) You keep all the impure io stuff together in the go block while putting 
your logic into pure functions.
2) Code in the go block has a performance penalty as it is being rewritten 
by the go macro - putting your logic into external functions avoids this 
penalty.

If you really want to abstract code with channel ops, then you should use a 
macro. 



On Saturday, January 11, 2014 1:45:08 PM UTC-6, t x wrote:
>
> Hi,
>
>   Consider this function:
>
> (defn try-put! [chan msg]
> (not (= (alts! [chan msg]
> :default :chan-full)
> :chan-full)))
>
>
> Now, I understand that:
> * go blocks involve deep macro walking / rewriting
> * thus, I can't call this function inside of a go block
>
> My question:
>
> * without rewriting the above as a macro, is there a way to
> "call functions inside a go block"?
>
>
>

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


Using macro to generate boilerplate keywords

2014-01-17 Thread Kashyap CK
Hi,

I am exploring javax.sound.midi using clojure and while creating keywords 
for notes I wonder if I could use macros to generate the keywords -

(defn note-2-num [n]
  (let [
m {
   :C1  0
   :C#1 1
   :D1  2
   :D#1 3
   :E1  4
   :F1  5
   :F#1 6
   :G1 7
   :G#1 8
   :A1  9
   :A#1 10
   :B1  11
   }] (m n)))


I want to repeat this sequence such that note-2-num returns 12 for C2 13 
for C#2 etc . Could someone please suggest how I can do that?

btw I am exploring overtone as well.

Regards,
Kashyap

-- 
-- 
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: Using macro to generate boilerplate keywords

2014-01-17 Thread Timothy Baldridge
perhaps something like:

(zipmap  (range)
 (for [octave (range 8)
key ["C" "C#" "D" "D# ...]]
 (keyword (str key octave

Timothy


On Fri, Jan 17, 2014 at 9:21 AM, Kashyap CK  wrote:

> Hi,
>
> I am exploring javax.sound.midi using clojure and while creating keywords
> for notes I wonder if I could use macros to generate the keywords -
>
> (defn note-2-num [n]
>   (let [
> m {
>:C1  0
>:C#1 1
>:D1  2
>:D#1 3
>:E1  4
>:F1  5
>:F#1 6
>:G1 7
>:G#1 8
>:A1  9
>:A#1 10
>:B1  11
>}] (m n)))
>
>
> I want to repeat this sequence such that note-2-num returns 12 for C2 13
> for C#2 etc . Could someone please suggest how I can do that?
>
> btw I am exploring overtone as well.
>
> Regards,
> Kashyap
>
> --
> --
> 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.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
-- 
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: Using macro to generate boilerplate keywords

2014-01-17 Thread Alex Walker
Is a macro necessary?

https://gist.github.com/alexpw/8476780

On Friday, January 17, 2014 10:21:52 AM UTC-6, Kashyap CK wrote:
>
> Hi,
>
> I am exploring javax.sound.midi using clojure and while creating keywords 
> for notes I wonder if I could use macros to generate the keywords -
>
> (defn note-2-num [n]
>   (let [
> m {
>:C1  0
>:C#1 1
>:D1  2
>:D#1 3
>:E1  4
>:F1  5
>:F#1 6
>:G1 7
>:G#1 8
>:A1  9
>:A#1 10
>:B1  11
>}] (m n)))
>
>
> I want to repeat this sequence such that note-2-num returns 12 for C2 13 
> for C#2 etc . Could someone please suggest how I can do that?
>
> btw I am exploring overtone as well.
>
> Regards,
> Kashyap
>

-- 
-- 
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: Using macro to generate boilerplate keywords

2014-01-17 Thread Kashyap CK
Thanks Alex ... I believe, pre-computing the map upfront would be more 
efficient.
But yeah, looks like macros are not required as Timothy has shown.

Regards,
Kashyap

On Friday, January 17, 2014 10:20:31 PM UTC+5:30, Alex Walker wrote:
>
> Is a macro necessary?
>
> https://gist.github.com/alexpw/8476780
>
> On Friday, January 17, 2014 10:21:52 AM UTC-6, Kashyap CK wrote:
>>
>> Hi,
>>
>> I am exploring javax.sound.midi using clojure and while creating keywords 
>> for notes I wonder if I could use macros to generate the keywords -
>>
>> (defn note-2-num [n]
>>   (let [
>> m {
>>:C1  0
>>:C#1 1
>>:D1  2
>>:D#1 3
>>:E1  4
>>:F1  5
>>:F#1 6
>>:G1 7
>>:G#1 8
>>:A1  9
>>:A#1 10
>>:B1  11
>>}] (m n)))
>>
>>
>> I want to repeat this sequence such that note-2-num returns 12 for C2 13 
>> for C#2 etc . Could someone please suggest how I can do that?
>>
>> btw I am exploring overtone as well.
>>
>> Regards,
>> Kashyap
>>
>

-- 
-- 
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: Managing role-based permissions in Ring apps

2014-01-17 Thread Sam Ritchie
Okay, here's my post: 
http://sritchie.github.io/2014/01/17/api-authentication-with-liberator-and-friend/


This is basically everything I understand about Friend, plus my 
integrations with Liberator. The code's in this example project:


https://github.com/paddleguru/liberator-friend

Hope this helps!

Stefan Kamphausen wrote:
To clarify, that was an example of content negotiation middleware, not 
ACL.


--
Sam Ritchie (@sritchie)
Paddleguru Co-Founder
703.863.8561
www.paddleguru.com 
Twitter // Facebook 



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


RESTful API Auth with Friend and Liberator

2014-01-17 Thread Sam Ritchie

Hey guys,

Those of you working on webapps might find this interesting:

http://sritchie.github.io/2014/01/17/api-authentication-with-liberator-and-friend/

Enjoy!
--
Sam Ritchie (@sritchie)
Paddleguru Co-Founder
703.863.8561
www.paddleguru.com 
Twitter // Facebook 



--
--
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: Looking to migrate thousands of Clojure applications from 1.2 to 1.5.

2014-01-17 Thread Vijay Kiran

May be this would help? https://github.com/flatland/classlojure

On Thursday, January 16, 2014 5:13:11 PM UTC+1, solo...@gmail.com wrote:
>
> Quick update and question: We've put together a preliminary migration plan 
> and are considering options.
>  
> Can someone share information or point me to where I can learn whether two 
> different versions of Clojure (1.2 and 1.5) can run in the same JVM?
>

-- 
-- 
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: RESTful API Auth with Friend and Liberator

2014-01-17 Thread Mimmo Cosenza
:-)
mimmo
On Jan 17, 2014, at 10:27 PM, Sam Ritchie  wrote:

> Hey guys,
> 
> Those of you working on webapps might find this interesting:
> 
> http://sritchie.github.io/2014/01/17/api-authentication-with-liberator-and-friend/
> 
> Enjoy!
> -- 
> Sam Ritchie (@sritchie)
> Paddleguru Co-Founder
> 703.863.8561
> www.paddleguru.com
> Twitter // Facebook
> 
> -- 
> -- 
> 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.



signature.asc
Description: Message signed with OpenPGP using GPGMail


Factual is hiring Clojure engineers

2014-01-17 Thread Zach Tellman
It's been six months since I last announced this, so: Factual is 
perpetually hiring smart, driven engineers to solve deep problems in data 
analysis and systems engineering.  We have offices in both SF and LA, and 
remote candidates with a strong background in analysis will be considered.

Factual provides an index of things in the world (businesses, places, and 
products).  You can either use this directly via our API [1] to ask 
questions like "what are the three coffee shops nearest to me", or 
indirectly by giving us your own real world data to enrich and refine [2] 
[3].  Factual uses Clojure extensively [4], both for realtime systems and 
batch data analysis.  Systems written purely in Clojure handle the 
following:

* realtime intake of 70k datapoints/sec from our partners
* batch processing of 7 billion new datapoints every day, comprising 
terabytes of compressed textual data
* generating, storing, and serving 150 million records, refreshed daily

Both of these numbers have at least doubled in the last six months, and 
could very easily do so again.  There are also other projects that use 
Clojure alongside Java to work at similar scales.

Libraries developed in the course of working on these projects include:

https://github.com/factual/skuld
https://github.com/factual/clj-leveldb
https://github.com/aphyr/merkle
https://github.com/ztellman/clj-tuple
https://github.com/ztellman/narrator

Several other libraries are on the cusp of being open sourced, when we get 
a chance.

We need people who enjoy using technology as a lever to accomplish amazing 
things (wasn't it Archimedes who said "give me a large enough data 
center..."), who want to work alongside people they can continuously learn 
from, and who want to be just a little uncomfortable with the scale and 
scope of their responsibilities.

If this sounds interesting, contact me at zach at factual.com.  I'm heading 
up the small but growing SF office, and am happy to talk in person with 
anyone in the Bay Area who'd like to know more.

[1] http://developer.factual.com/working-with-factual-places/
[2] http://www.factual.com/products/geopulse-audience
[3] http://www.factual.com/products/resolve
[4] http://www.factual.com/jobs/clojure

-- 
-- 
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: RESTful API Auth with Friend and Liberator

2014-01-17 Thread Curtis Gagliardi
Exactly the kind of article I was going to looking for in a few days, 
excellent.

On Friday, January 17, 2014 1:27:10 PM UTC-8, Sam Ritchie wrote:
>
>  Hey guys,
>
> Those of you working on webapps might find this interesting:
>
>
> http://sritchie.github.io/2014/01/17/api-authentication-with-liberator-and-friend/
>
> Enjoy!
> -- 
> Sam Ritchie (@sritchie)
> Paddleguru Co-Founder
> 703.863.8561
> www.paddleguru.com
> Twitter  // 
> Facebook
>  

-- 
-- 
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: How to handle configuration in Clojure?

2014-01-17 Thread Curtis Gagliardi
I've been using carica (https://github.com/sonian/carica) and have config 
map like {:dev <...> :prod <...>} and just using a single environmental 
variable to determine which of those config maps to use. 

On Friday, January 17, 2014 5:06:31 AM UTC-8, Malcolm Sparks wrote:
>
> There's also Jig : https://github.com/juxt/jig
>
> Jig's recommendation is for configuration to be held in EDN files.
>
> I much prefer EDN over environment variables. Environment variables feel 
> awkward when there you have lots of configuration, usually in the form of a 
> tree.
>
> Usually it makes sense to have one configuration file per environment. 
> That can make it hard to keep configuration files up to date, so judicious 
> use of the #=() Clojure reader macro can allow you to programmatically 
> deviate from a default configuration - often the delta from a default 
> configuration is more informative. There are more details in Jig's 
> README.md file.
>
> I agree with the comments against using dynamic vars. They reduce the 
> ability to reason about functions and are precarious when dealing with 
> threads - binding conveyance is tricky and small mistakes can lead to 
> elusive bugs.
>
> I pass configuration as a single argument into types/records that declare 
> lifecycle methods. I have found this pattern to serve me well in over a 
> dozen projects. Since stumbling on this pattern I have had no need to 
> resort to dynamic vars for environment config, and my projects have been 
> smaller, more reliable and easier to reason about.
>
>
> On Tuesday, January 14, 2014 9:04:45 AM UTC, James Trunk wrote:
>>
>> Thanks for all the great links and ideas you have all posted, now I have 
>> plenty of reading and thinking to do!
>>
>> > I am curious about what you mean by 'thread safety'.
>> Perhaps "thread safety" is the wrong term, but what I meant was the 
>> limitations dynamic binding introduces around thread dispatching, which 
>> Stuart Sierra explains in this blog 
>> post
>> .
>>
>> Cheers,
>> James
>>
>> On Monday, January 13, 2014 7:10:38 PM UTC+1, Stefan Kanev wrote:
>>>
>>> On 13/01/14, James Trunk wrote: 
>>> > The downsides to dynamic vars seem to be: hiddenness, thread safety, 
>>> and 
>>> > more complex tests (binding before each test). 
>>>
>>> I am curious about what you mean by 'thread safety'.  As far as I know, 
>>> dynamic variables are thread-local, which means that they are 
>>> thread-safe, at least to some extend.  I assume you mean something 
>>> specific? 
>>>
>>> -- 
>>> Stefan Kanev  ¦  @skanev  ¦  http://skanev.com/ 
>>> If a program manipulates a large amount of data, it does so in a small 
>>> number 
>>> of ways. 
>>>
>>

-- 
-- 
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: Using macro to generate boilerplate keywords

2014-01-17 Thread Kashyap CK
Thank you so much Timothy .. this is just what I was looking for ...

On Friday, January 17, 2014 10:03:12 PM UTC+5:30, tbc++ wrote:
>
> perhaps something like:
>
> (zipmap  (range)
>  (for [octave (range 8)
> key ["C" "C#" "D" "D# ...]]
>  (keyword (str key octave
>
> Timothy
>
>
> On Fri, Jan 17, 2014 at 9:21 AM, Kashyap CK 
> > wrote:
>
>> Hi,
>>
>> I am exploring javax.sound.midi using clojure and while creating keywords 
>> for notes I wonder if I could use macros to generate the keywords -
>>
>> (defn note-2-num [n]
>>   (let [
>> m {
>>:C1  0
>>:C#1 1
>>:D1  2
>>:D#1 3
>>:E1  4
>>:F1  5
>>:F#1 6
>>:G1 7
>>:G#1 8
>>:A1  9
>>:A#1 10
>>:B1  11
>>}] (m n)))
>>
>>
>> I want to repeat this sequence such that note-2-num returns 12 for C2 13 
>> for C#2 etc . Could someone please suggest how I can do that?
>>
>> btw I am exploring overtone as well.
>>
>> Regards,
>> Kashyap
>>
>> -- 
>> -- 
>> 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
>> 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 
>> 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 .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> -- 
> “One of the main causes of the fall of the Roman Empire was that–lacking 
> zero–they had no way to indicate successful termination of their C 
> programs.”
> (Robert Firth) 
>

-- 
-- 
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: RESTful API Auth with Friend and Liberator

2014-01-17 Thread clojure . user
Thanks!

I have been looking at a lot of combinations for the front end to go with 
the liberator/friend back end e.g. using client-side technologies

om(clojurescript)
purnam (angularjs + clojurescript)

or going for a server side 
hiccup/enlive templating + clojurescript (for any client side js)

I know it is not directly relevant but would like to know what you 
experience has been and what would you suggest.

Thanks in advance!



On Saturday, January 18, 2014 2:57:10 AM UTC+5:30, Sam Ritchie wrote:
>
>  Hey guys,
>
> Those of you working on webapps might find this interesting:
>
>
> http://sritchie.github.io/2014/01/17/api-authentication-with-liberator-and-friend/
>
> Enjoy!
> -- 
> Sam Ritchie (@sritchie)
> Paddleguru Co-Founder
> 703.863.8561
> www.paddleguru.com
> Twitter  // 
> Facebook
>  

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


nested #%'s

2014-01-17 Thread t x
## Question:

  Is there a way to do nested, #%'s, where each % matches to the nearest
"parent" #.

## Counter Argument:

  You don't want this, it makes Clojure code hard to read.

## Counter Counter Argument:

  Despite it being hard to read, I'd like to try it for a few months, and
see if I can adjust to reading two levels of nested # %'s.

## Question:

  Is there any library or extension to Clojure that allows nested #%'s?

Thanks!

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


idiomatic extension to -> / --> ?

2014-01-17 Thread t x
I have the following:

(defn helper [initial funcs]
  (loop [fns funcs
 ans initial]
(if (empty? fns)
  ans
  (recur (rest fns)
 (list (first fns) ans)

(defmacro => [initial & funcs]
  (helper initial funcs))

(macroexpand-1
 '(=> 2
  #(+ % 2)
  #(* 1 % 3)))


Is there something part of the idiomatic clojure / clojure core which does
the above? Basically, I like the idea of -> and -->, but I find that I
can't always guarantee (1) last element or (2) 2nd element.

The above lets me place the argument directly via #%

Question: is there something part of idiomatic clojure / clojure core that
already does the above?

Thanks!

-- 
-- 
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: idiomatic extension to -> / --> ?

2014-01-17 Thread Shaun Gilchrist
https://github.com/rplevy/swiss-arrows


On Fri, Jan 17, 2014 at 11:05 PM, t x  wrote:

> I have the following:
>
> (defn helper [initial funcs]
>   (loop [fns funcs
>  ans initial]
> (if (empty? fns)
>   ans
>   (recur (rest fns)
>  (list (first fns) ans)
>
> (defmacro => [initial & funcs]
>   (helper initial funcs))
>
> (macroexpand-1
>  '(=> 2
>   #(+ % 2)
>   #(* 1 % 3)))
>
>
> Is there something part of the idiomatic clojure / clojure core which does
> the above? Basically, I like the idea of -> and -->, but I find that I
> can't always guarantee (1) last element or (2) 2nd element.
>
> The above lets me place the argument directly via #%
>
> Question: is there something part of idiomatic clojure / clojure core that
> already does the above?
>
> Thanks!
>
> --
> --
> 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.
>

-- 
-- 
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: idiomatic extension to -> / --> ?

2014-01-17 Thread t x
You win. :-)


On Fri, Jan 17, 2014 at 11:26 PM, Shaun Gilchrist wrote:

> https://github.com/rplevy/swiss-arrows
>
>
> On Fri, Jan 17, 2014 at 11:05 PM, t x  wrote:
>
>> I have the following:
>>
>> (defn helper [initial funcs]
>>   (loop [fns funcs
>>  ans initial]
>> (if (empty? fns)
>>   ans
>>   (recur (rest fns)
>>  (list (first fns) ans)
>>
>> (defmacro => [initial & funcs]
>>   (helper initial funcs))
>>
>> (macroexpand-1
>>  '(=> 2
>>   #(+ % 2)
>>   #(* 1 % 3)))
>>
>>
>> Is there something part of the idiomatic clojure / clojure core which
>> does the above? Basically, I like the idea of -> and -->, but I find that I
>> can't always guarantee (1) last element or (2) 2nd element.
>>
>> The above lets me place the argument directly via #%
>>
>> Question: is there something part of idiomatic clojure / clojure core
>> that already does the above?
>>
>> Thanks!
>>
>> --
>> --
>> 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.
>>
>
>  --
> --
> 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.
>

-- 
-- 
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: nested #%'s

2014-01-17 Thread Softaddicts
The reader does not support this and the reader is not configurable.

Quite a final end to any counter...counter argument :)

#() is syntactic sugar and not designed to play Russian puppets with anonymous 
fns :) (or Russian roulette ?)

As a general remark, when you need imbricated anonymous fns in many places,
it's probably a sign that you need a separate function or if really needed a 
macro to wrap this pattern. Code readability will improve accordingly.

Luc P.


> ## Question:
> 
>   Is there a way to do nested, #%'s, where each % matches to the nearest
> "parent" #.
> 
> ## Counter Argument:
> 
>   You don't want this, it makes Clojure code hard to read.
> 
> ## Counter Counter Argument:
> 
>   Despite it being hard to read, I'd like to try it for a few months, and
> see if I can adjust to reading two levels of nested # %'s.
> 
> ## Question:
> 
>   Is there any library or extension to Clojure that allows nested #%'s?
> 
> Thanks!
> 
> -- 
> -- 
> 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.
> 
--
Softaddicts sent by ibisMail from my ipad!

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