Re: Clojure as first language

2016-02-23 Thread Matching Socks

The post-Python effect came up briefly in another Conj talk -- in 2015 -- 
given by Elena Machkasova and two students, one of whom had had Clojure 
first and the other Python.  Their school offered it either way.

https://www.youtube.com/watch?v=n0yN1GauxCA

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Help] core.async and jetty

2016-02-23 Thread Jonah Benton
Hi Miguel- pipelining is essentially http keep alive. A very old jetty
thread

http://jetty.4.x6.nabble.com/HTTP-1-1-Request-Pipelining-handling-td18682.html

indicates that for simplicity jetty will execute subsequent requests on the
kept-alive socket serially.

Jonah


On Mon, Feb 22, 2016 at 3:33 PM, Miguel Ping  wrote:

> Hi guys,
>
> I'm trying to replicate an experiment on nodejs and http pipelining:
> http://blog.yld.io/2016/02/08/squeeze-the-juice-out-of-node/
>
> This is what I got right now:
> https://gist.github.com/mping/98bb8eb9faf3c51f9889 (using
> *com.ninjudd/ring-async*)
>
> Problem is I can't get pipelining to work as in nodejs; by doing two reqs
> they are sequential, ie, the dates that I'm printing have two secs.
> Basically I want that the server prints two "identical" accpt dates, and
> the  response should show that (now not working):
>
> $ tail -f reqs.txt | nc 127.0.0.1 
>
>
> HTTP/1.1 200 OK
> Date: Mon, 22 Feb 2016 20:29:10 GMT
> Transfer-Encoding: chunked
> Server: Jetty(7.6.8.v20121106)
>
> 48
> id: 1, uri: /a
> Mon Feb 22 20:29:10 WET 2016
> Mon Feb 22 20:29:12 WET 2016
> 0
>
> HTTP/1.1 200 OK
> Date: Mon, 22 Feb 2016 20:29:12 GMT
> Transfer-Encoding: chunked
> Server: Jetty(7.6.8.v20121106)
>
> 48
> id: 2, uri: /b
> Mon Feb 22 20:29:12 WET 2016
> Mon Feb 22 20:29:14 WET 2016
>
>
> I'm guessing that this is either my mistake with core.async or the adapter.
>
> 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/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Help] core.async and jetty

2016-02-23 Thread Miguel Ping
Thanks, thats what I eventually found out.

On Tuesday, February 23, 2016 at 12:39:00 PM UTC, jonah wrote:
>
> Hi Miguel- pipelining is essentially http keep alive. A very old jetty 
> thread
>
>
> http://jetty.4.x6.nabble.com/HTTP-1-1-Request-Pipelining-handling-td18682.html
>  
> 
>
> indicates that for simplicity jetty will execute subsequent requests on 
> the kept-alive socket serially. 
>
> Jonah
>   
>
> On Mon, Feb 22, 2016 at 3:33 PM, Miguel Ping  > wrote:
>
>> Hi guys,
>>
>> I'm trying to replicate an experiment on nodejs and http pipelining: 
>> http://blog.yld.io/2016/02/08/squeeze-the-juice-out-of-node/
>>
>> This is what I got right now: 
>> https://gist.github.com/mping/98bb8eb9faf3c51f9889 (using 
>> *com.ninjudd/ring-async*)
>>
>> Problem is I can't get pipelining to work as in nodejs; by doing two reqs 
>> they are sequential, ie, the dates that I'm printing have two secs.
>> Basically I want that the server prints two "identical" accpt dates, and 
>> the  response should show that (now not working):
>>
>> $ tail -f reqs.txt | nc 127.0.0.1    
>> 
>>   
>> HTTP/1.1 200 OK
>> Date: Mon, 22 Feb 2016 20:29:10 GMT
>> Transfer-Encoding: chunked
>> Server: Jetty(7.6.8.v20121106)
>>
>> 48
>> id: 1, uri: /a
>> Mon Feb 22 20:29:10 WET 2016
>> Mon Feb 22 20:29:12 WET 2016
>> 0
>>
>> HTTP/1.1 200 OK
>> Date: Mon, 22 Feb 2016 20:29:12 GMT
>> Transfer-Encoding: chunked
>> Server: Jetty(7.6.8.v20121106)
>>
>> 48
>> id: 2, uri: /b
>> Mon Feb 22 20:29:12 WET 2016
>> Mon Feb 22 20:29:14 WET 2016
>>
>>
>> I'm guessing that this is either my mistake with core.async or the 
>> adapter.
>>
>> Thanks
>>
>> -- 
>> 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/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [GSoC idea] Pluggable back-ends architecture for ClojureScript compiler

2016-02-23 Thread Frank Castellucci
Would not we want to "plug in" to the Clojure compiler? 

Feels weird to plug-in to ClojureScript to generate, say, python code.

On Monday, February 22, 2016 at 6:52:43 PM UTC-5, Antonin Hildebrand wrote:
>
> I like the idea.
>
> I was thinking about a similar project. The goal would be to design and 
> implement user-configurable, pluggable system for "jacking" into 
> ClojureScript compilation pipeline as discussed here[1].
>
> The first dog-fooding application could be instrumentation middleware for 
> collecting code-coverage information. I believe this could be implemented 
> by rewriting forms between reader and analyzer. Or instrumenting AST output 
> from analyzer before it gets passed to emit-phase.
>
> just my 2cents,
> Antonin
>
> [1] 
> http://blog.fogus.me/2012/04/25/the-clojurescript-compilation-pipeline/
>
>
> On Sunday, February 21, 2016 at 9:20:18 AM UTC+1, Edward Knyshov wrote:
>>
>>
>>
>> *Pluggable back-ends architecture for ClojureScript compilerBrief 
>> explanation:* There are a lot of ClojureScript script compiler forks 
>> exist to provide different compilation targets other than js. Most of them 
>> are currently stuck because of rapid ClojureScript development and 
>> difficulties with keeping fork in sync with upstream. We could consider 
>> refactoring ClojureScript to provide plugable backends architecture, 
>> specifically to allow users replace code generation stage of compiler and 
>> implement js generator as one of such backends.
>>  
>> *Expected results: *ClojureScript compiler is refactored to allow 
>> further active development of plenty other backends to bootstrap Clojure in 
>> such environments as c/c++, llvm, python, emacs lisp, lua, etc. Ability to 
>> use clojure mostly everywhere.
>>  
>> *Knowledge:* ClojureScript, Clojure, JavaScript
>>
>> Need to know, what do you think guys.
>>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [GSoC idea] Pluggable back-ends architecture for ClojureScript compiler

2016-02-23 Thread Timothy Baldridge
Just wanted to jump in here and say that Thomas is correct. Plugging into
the CLJS compiler is probably not the right place to start. The CLJS
compiler is built for speed and as such is somewhat less modular than the
tools.analyzer/tools.emitter projects. So start there if you're looking to
build a tool or a new compiler backend. The resulting compiler may not be
as fast as a one or two pass compiler (like CLJS) but it's easier to reason
about in my experience.



On Tue, Feb 23, 2016 at 6:29 AM, Frank Castellucci 
wrote:

> Would not we want to "plug in" to the Clojure compiler?
>
> Feels weird to plug-in to ClojureScript to generate, say, python code.
>
>
> On Monday, February 22, 2016 at 6:52:43 PM UTC-5, Antonin Hildebrand wrote:
>>
>> I like the idea.
>>
>> I was thinking about a similar project. The goal would be to design and
>> implement user-configurable, pluggable system for "jacking" into
>> ClojureScript compilation pipeline as discussed here[1].
>>
>> The first dog-fooding application could be instrumentation middleware for
>> collecting code-coverage information. I believe this could be implemented
>> by rewriting forms between reader and analyzer. Or instrumenting AST output
>> from analyzer before it gets passed to emit-phase.
>>
>> just my 2cents,
>> Antonin
>>
>> [1]
>> http://blog.fogus.me/2012/04/25/the-clojurescript-compilation-pipeline/
>>
>>
>> On Sunday, February 21, 2016 at 9:20:18 AM UTC+1, Edward Knyshov wrote:
>>>
>>>
>>>
>>> *Pluggable back-ends architecture for ClojureScript compilerBrief
>>> explanation:* There are a lot of ClojureScript script compiler forks
>>> exist to provide different compilation targets other than js. Most of them
>>> are currently stuck because of rapid ClojureScript development and
>>> difficulties with keeping fork in sync with upstream. We could consider
>>> refactoring ClojureScript to provide plugable backends architecture,
>>> specifically to allow users replace code generation stage of compiler and
>>> implement js generator as one of such backends.
>>>
>>> *Expected results: *ClojureScript compiler is refactored to allow
>>> further active development of plenty other backends to bootstrap Clojure in
>>> such environments as c/c++, llvm, python, emacs lisp, lua, etc. Ability to
>>> use clojure mostly everywhere.
>>>
>>> *Knowledge:* ClojureScript, Clojure, JavaScript
>>>
>>> Need to know, what do you think guys.
>>>
>> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
“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/d/optout.


Add support for seq on Java streams?

2016-02-23 Thread 676c7473
Hello!

For interoperation with Java, Clojure’s seq supports the Iterable
interface directly, which means that all Java collections are
automatically seqable. seq also supports the CharSequence and
java.util.Map interfaces, and arrays too.

Would it make sense to have seq also support java.util.stream.Stream?
Streams are just as important an abstraction as collections, and I
believe that stream-producing APIs are becoming more and more common. It
would be nice if Clojure supported it out of the box.

An example (context: http://stackoverflow.com/q/35574155):

(->> (.splitAsStream #"\s+" "one two three")
 (remove #(clojure.string/includes? % "o"))
 (map clojure.string/upper-case)
 first)

Thanks,


-- 
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/d/optout.


Re: Add support for seq on Java streams?

2016-02-23 Thread Alex Miller
It may, however keep in mind that Clojure supports Java 1.6+ and Stream was 
added in 1.8. That's not an impossible hurdle, but it might make sense to 
make longer before hurdling it.

On Tuesday, February 23, 2016 at 11:03:55 AM UTC-6, 676c7...@gmail.com 
wrote:
>
> Hello!
>
> For interoperation with Java, Clojure’s seq supports the Iterable
> interface directly, which means that all Java collections are
> automatically seqable. seq also supports the CharSequence and
> java.util.Map interfaces, and arrays too.
>
> Would it make sense to have seq also support java.util.stream.Stream?
> Streams are just as important an abstraction as collections, and I
> believe that stream-producing APIs are becoming more and more common. It
> would be nice if Clojure supported it out of the box.
>
> An example (context: http://stackoverflow.com/q/35574155):
>
> (->> (.splitAsStream #"\s+" "one two three")
>  (remove #(clojure.string/includes? % "o"))
>  (map clojure.string/upper-case)
>  first)
>
> Thanks,
>
>
> -- 
> 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/d/optout.


Re: [Help] core.async and jetty

2016-02-23 Thread Zach Tellman
For what it's worth, Aleph will handle pipelined requests in 
parallel: https://github.com/ztellman/aleph.

On Tuesday, February 23, 2016 at 4:46:23 AM UTC-8, Miguel Ping wrote:
>
> Thanks, thats what I eventually found out.
>
> On Tuesday, February 23, 2016 at 12:39:00 PM UTC, jonah wrote:
>>
>> Hi Miguel- pipelining is essentially http keep alive. A very old jetty 
>> thread
>>
>>
>> http://jetty.4.x6.nabble.com/HTTP-1-1-Request-Pipelining-handling-td18682.html
>>  
>> 
>>
>> indicates that for simplicity jetty will execute subsequent requests on 
>> the kept-alive socket serially. 
>>
>> Jonah
>>   
>>
>> On Mon, Feb 22, 2016 at 3:33 PM, Miguel Ping  wrote:
>>
>>> Hi guys,
>>>
>>> I'm trying to replicate an experiment on nodejs and http pipelining: 
>>> http://blog.yld.io/2016/02/08/squeeze-the-juice-out-of-node/
>>>
>>> This is what I got right now: 
>>> https://gist.github.com/mping/98bb8eb9faf3c51f9889 (using 
>>> *com.ninjudd/ring-async*)
>>>
>>> Problem is I can't get pipelining to work as in nodejs; by doing two 
>>> reqs they are sequential, ie, the dates that I'm printing have two secs.
>>> Basically I want that the server prints two "identical" accpt dates, and 
>>> the  response should show that (now not working):
>>>
>>> $ tail -f reqs.txt | nc 127.0.0.1    
>>> 
>>>   
>>> HTTP/1.1 200 OK
>>> Date: Mon, 22 Feb 2016 20:29:10 GMT
>>> Transfer-Encoding: chunked
>>> Server: Jetty(7.6.8.v20121106)
>>>
>>> 48
>>> id: 1, uri: /a
>>> Mon Feb 22 20:29:10 WET 2016
>>> Mon Feb 22 20:29:12 WET 2016
>>> 0
>>>
>>> HTTP/1.1 200 OK
>>> Date: Mon, 22 Feb 2016 20:29:12 GMT
>>> Transfer-Encoding: chunked
>>> Server: Jetty(7.6.8.v20121106)
>>>
>>> 48
>>> id: 2, uri: /b
>>> Mon Feb 22 20:29:12 WET 2016
>>> Mon Feb 22 20:29:14 WET 2016
>>>
>>>
>>> I'm guessing that this is either my mistake with core.async or the 
>>> adapter.
>>>
>>> Thanks
>>>
>>> -- 
>>> 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/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Partial question

2016-02-23 Thread Fernando Abrao
Hello all,

I´m trying to do something like:

(defn log [type message & {:keys [id idVe] :or {id "LOCAL" idVe "END"}}] 
 (println (str id ": " type " -> " message "<- " idVe)))


(def debug (partial log "DEBUG" ?? :idVe "COM"))


Is there any way to do what I want? Pass arguments to log and add the :idVe 
into the end? Is the partial the best using to do this?

Regards,

Fernando

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [GSoC idea] Pluggable back-ends architecture for ClojureScript compiler

2016-02-23 Thread Nicola Mometto
As the author of said libraries, I'd love to see somebody pick them up during 
GSoC and continue the work.

The reason why development seems to have stalled, is different for each library:
- tools.analyzer and tools.analyzer.jvm are pretty much done and stable, all 
that's left to do is fixing a couple of bugs around reflection and investigate 
performance enhancements
- tools.analyzer.js has stalled around a year and a half ago, I simply couldn't 
keep up with the development speed of clojurescript while also maintaining 5 
other contrib libraries
- tools.emitter.jvm has stalled around the same period, since I decided that my 
time would be best spent maintaining libraries that have actual real world use 
rather than an experimental compiler :) this is not to say that it's an 
abandoned project, just that it's now very low priority for me.

If anybody wants to pick up some work around tools.analyzer.js or related to 
tools.analyzer, I'd be more than happy to help them through, although I can't 
commit to the role of a proper GSoC mentor

Nicola

> On 22 Feb 2016, at 10:57, Thomas Heller  wrote:
> 
> Projects for this already exist but are somewhat dormant.
> 
> See:
> https://github.com/clojure/tools.analyzer
> https://github.com/clojure/tools.analyzer.jvm
> https://github.com/clojure/tools.analyzer.js
> https://github.com/clojure/tools.analyzer.clr
> https://github.com/clojure/tools.emitter.jvm
> 
> Neither Clojure or ClojureScript currently use them since they are either 
> incomplete or have performance issues compared to the default implementation. 
> The idea was however to have a pluggable solution that can share as much code 
> as possible. IIRC it all started as GSoC work, so it might be useful to 
> continue in this way. I'm not sure who was involved but authors are still 
> around I think.
> 
> Cheers,
> /thomas
> 
> 
> 
> On Sunday, February 21, 2016 at 9:20:18 AM UTC+1, Edward Knyshov wrote:
> Pluggable back-ends architecture for ClojureScript compiler
> 
> Brief explanation: There are a lot of ClojureScript script compiler forks 
> exist to provide different compilation targets other than js. Most of them 
> are currently stuck because of rapid ClojureScript development and 
> difficulties with keeping fork in sync with upstream. We could consider 
> refactoring ClojureScript to provide plugable backends architecture, 
> specifically to allow users replace code generation stage of compiler and 
> implement js generator as one of such backends.
> 
> Expected results: ClojureScript compiler is refactored to allow further 
> active development of plenty other backends to bootstrap Clojure in such 
> environments as c/c++, llvm, python, emacs lisp, lua, etc. Ability to use 
> clojure mostly everywhere.
> 
> Knowledge: ClojureScript, Clojure, JavaScript
> 
> Need to know, what do you think guys.
> 
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Partial question

2016-02-23 Thread Josh Tilles
My guess is that what you're looking for is:
(def debug #(log "DEBUG" % :idVE "COM"))
(see "Anonymous function literal" under 
http://clojure.org/reference/reader#_dispatch)

However, note that defining functions in a "point-free"-ish style in 
Clojure has a downside with regard to metadata, in that the function 
arities and argument names aren't inspectable at the REPL:
(def debug-1 #(log "DEBUG" % :idVE "COM"))
;= user/debug-1
(clojure.repl/doc debug-1)
; -
; user/debug-1
;   nil
;= nil
(defn debug-2 [message]
  (log "DEBUG" message :idVE "COM"))
;= user/debug-2
(clojure.repl/doc debug-2)
; -
; user/debug-2
; ([message])
;   nil
;= nil


Hope that's helpful,
Josh

P.S. If you *really want to* you can populate the :arglists metadata 
yourself:
(def ^{:arglists '([message])} debug #(log "DEBUG" % :idVE "COM"))



On Tuesday, February 23, 2016 at 1:14:33 PM UTC-5, Fernando Abrao wrote:
>
> Hello all,
>
> I´m trying to do something like:
>
> (defn log [type message & {:keys [id idVe] :or {id "LOCAL" idVe "END"}}] 
>  (println (str id ": " type " -> " message "<- " idVe)))
>
>
> (def debug (partial log "DEBUG" ?? :idVe "COM"))
>
>
> Is there any way to do what I want? Pass arguments to log and add the 
> :idVe into the end? Is the partial the best using to do this?
>
> Regards,
>
> Fernando
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Help] core.async and jetty

2016-02-23 Thread Miguel Ping
Thanks Zach, I would love to do an unfair comparison between clojure and 
nodejs :) 
Gonna give it a spin

On Tuesday, February 23, 2016 at 5:09:50 PM UTC, Zach Tellman wrote:
>
> For what it's worth, Aleph will handle pipelined requests in parallel: 
> https://github.com/ztellman/aleph.
>
> On Tuesday, February 23, 2016 at 4:46:23 AM UTC-8, Miguel Ping wrote:
>>
>> Thanks, thats what I eventually found out.
>>
>> On Tuesday, February 23, 2016 at 12:39:00 PM UTC, jonah wrote:
>>>
>>> Hi Miguel- pipelining is essentially http keep alive. A very old jetty 
>>> thread
>>>
>>>
>>> http://jetty.4.x6.nabble.com/HTTP-1-1-Request-Pipelining-handling-td18682.html
>>>  
>>> 
>>>
>>> indicates that for simplicity jetty will execute subsequent requests on 
>>> the kept-alive socket serially. 
>>>
>>> Jonah
>>>   
>>>
>>> On Mon, Feb 22, 2016 at 3:33 PM, Miguel Ping  wrote:
>>>
 Hi guys,

 I'm trying to replicate an experiment on nodejs and http pipelining: 
 http://blog.yld.io/2016/02/08/squeeze-the-juice-out-of-node/

 This is what I got right now: 
 https://gist.github.com/mping/98bb8eb9faf3c51f9889 (using 
 *com.ninjudd/ring-async*)

 Problem is I can't get pipelining to work as in nodejs; by doing two 
 reqs they are sequential, ie, the dates that I'm printing have two secs.
 Basically I want that the server prints two "identical" accpt dates, 
 and the  response should show that (now not working):

 $ tail -f reqs.txt | nc 127.0.0.1  

  
 
 HTTP/1.1 200 OK
 Date: Mon, 22 Feb 2016 20:29:10 GMT
 Transfer-Encoding: chunked
 Server: Jetty(7.6.8.v20121106)

 48
 id: 1, uri: /a
 Mon Feb 22 20:29:10 WET 2016
 Mon Feb 22 20:29:12 WET 2016
 0

 HTTP/1.1 200 OK
 Date: Mon, 22 Feb 2016 20:29:12 GMT
 Transfer-Encoding: chunked
 Server: Jetty(7.6.8.v20121106)

 48
 id: 2, uri: /b
 Mon Feb 22 20:29:12 WET 2016
 Mon Feb 22 20:29:14 WET 2016


 I'm guessing that this is either my mistake with core.async or the 
 adapter.

 Thanks

 -- 
 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/d/optout.

>>>
>>>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Partial question

2016-02-23 Thread Fernando Abrao
Hello, it worked, but if I use

(debug "TEST" :id "something")

is getting ArityException Wrong number of args (3) passed to ...

Em terça-feira, 23 de fevereiro de 2016 15:36:46 UTC-3, Josh Tilles 
escreveu:
>
> My guess is that what you're looking for is:
> (def debug #(log "DEBUG" % :idVE "COM"))
> (see "Anonymous function literal" under 
> http://clojure.org/reference/reader#_dispatch)
>
> However, note that defining functions in a "point-free"-ish style in 
> Clojure has a downside with regard to metadata, in that the function 
> arities and argument names aren't inspectable at the REPL:
> (def debug-1 #(log "DEBUG" % :idVE "COM"))
> ;= user/debug-1
> (clojure.repl/doc debug-1)
> ; -
> ; user/debug-1
> ;   nil
> ;= nil
> (defn debug-2 [message]
>   (log "DEBUG" message :idVE "COM"))
> ;= user/debug-2
> (clojure.repl/doc debug-2)
> ; -
> ; user/debug-2
> ; ([message])
> ;   nil
> ;= nil
>
>
> Hope that's helpful,
> Josh
>
> P.S. If you *really want to* you can populate the :arglists metadata 
> yourself:
> (def ^{:arglists '([message])} debug #(log "DEBUG" % :idVE "COM"))
>
>
>
> On Tuesday, February 23, 2016 at 1:14:33 PM UTC-5, Fernando Abrao wrote:
>>
>> Hello all,
>>
>> I´m trying to do something like:
>>
>> (defn log [type message & {:keys [id idVe] :or {id "LOCAL" idVe "END"}}] 
>>  (println (str id ": " type " -> " message "<- " idVe)))
>>
>>
>> (def debug (partial log "DEBUG" ?? :idVe "COM"))
>>
>>
>> Is there any way to do what I want? Pass arguments to log and add the 
>> :idVe into the end? Is the partial the best using to do this?
>>
>> Regards,
>>
>> Fernando
>>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Partial question

2016-02-23 Thread Leif
`partial` won't work here because you're partially applying *two* 
arguments, `type` and the :idVe portion of the &rest args.  `partial` only 
lets you override an *unbroken* sequence of args at the *beginning* of the 
arglist.
For instance, (partial log "DEBUG" "default message") would work.  To 
override some of the &rest args, you need to use `apply`:

user=> (defn debug-com [msg & args] (apply log "DEBUG" msg :idVe "COM" args
))
user=> (debug-com "message")
LOCAL: DEBUG -> message <- COM
nil
user=> (debug-com "message" :id "REMOTE")
REMOTE: DEBUG -> message <- COM
nil

If it really needs to be an anonymous function, `fn` works with the same 
syntax.

Happy hacking,
Leif

On Tuesday, February 23, 2016 at 3:14:58 PM UTC-5, Fernando Abrao wrote:
>
> Hello, it worked, but if I use
>
> (debug "TEST" :id "something")
>
> is getting ArityException Wrong number of args (3) passed to ...
>
> Em terça-feira, 23 de fevereiro de 2016 15:36:46 UTC-3, Josh Tilles 
> escreveu:
>>
>> My guess is that what you're looking for is:
>> (def debug #(log "DEBUG" % :idVE "COM"))
>> (see "Anonymous function literal" under 
>> http://clojure.org/reference/reader#_dispatch)
>>
>> However, note that defining functions in a "point-free"-ish style in 
>> Clojure has a downside with regard to metadata, in that the function 
>> arities and argument names aren't inspectable at the REPL:
>> (def debug-1 #(log "DEBUG" % :idVE "COM"))
>> ;= user/debug-1
>> (clojure.repl/doc debug-1)
>> ; -
>> ; user/debug-1
>> ;   nil
>> ;= nil
>> (defn debug-2 [message]
>>   (log "DEBUG" message :idVE "COM"))
>> ;= user/debug-2
>> (clojure.repl/doc debug-2)
>> ; -
>> ; user/debug-2
>> ; ([message])
>> ;   nil
>> ;= nil
>>
>>
>> Hope that's helpful,
>> Josh
>>
>> P.S. If you *really want to* you can populate the :arglists metadata 
>> yourself:
>> (def ^{:arglists '([message])} debug #(log "DEBUG" % :idVE "COM"))
>>
>>
>>
>> On Tuesday, February 23, 2016 at 1:14:33 PM UTC-5, Fernando Abrao wrote:
>>>
>>> Hello all,
>>>
>>> I´m trying to do something like:
>>>
>>> (defn log [type message & {:keys [id idVe] :or {id "LOCAL" idVe "END"}}] 
>>>  (println (str id ": " type " -> " message "<- " idVe)))
>>>
>>>
>>> (def debug (partial log "DEBUG" ?? :idVe "COM"))
>>>
>>>
>>> Is there any way to do what I want? Pass arguments to log and add the 
>>> :idVe into the end? Is the partial the best using to do this?
>>>
>>> Regards,
>>>
>>> Fernando
>>>
>>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.