Re: Re: Handling java streams..

2014-10-05 Thread adrian . medina
It's use cases like these that make me wish clojure.lang.Seqable and the like were protocols. Ah, one can dream... On Sunday, October 5, 2014 11:59:15 PM UTC-4, Zach Tellman wrote: > > Calling (-> stream .iterator iterator-seq) should give the desired result. > > On Wednesday, October 1, 2014 6:

Re: [ANN] async-sockets - work with sockets using core.async channels

2014-10-05 Thread Zach Tellman
Please note that if you use core.async with java.nio, you need to make sure backpressure is properly propagated (this happens automatically with java.io, assuming you have a thread per connection). On Sunday, October 5, 2014 9:10:24 PM UTC-7, adrian...@mail.yu.edu wrote: > > Zach makes an excell

Re: [ANN] async-sockets - work with sockets using core.async channels

2014-10-05 Thread adrian . medina
Zach makes an excellent point; I've used AsyncSocketChannels and its irk (http://docs.oracle.com/javase/8/docs/api/java/nio/channels/AsynchronousServerSocketChannel.html), with core.async in the past. Perhaps replacing your direct java.net.Sockets with nio classes that can be given CompletionHa

Re: Re: Handling java streams..

2014-10-05 Thread Zach Tellman
Calling (-> stream .iterator iterator-seq) should give the desired result. On Wednesday, October 1, 2014 6:39:11 AM UTC-7, José Ricardo wrote: > > By nicer I meant something like being able to use, for example, map and > filter, just like I can do on a java.util.ArrayList (in clojure) and on a >

Re: [ANN] async-sockets - work with sockets using core.async channels

2014-10-05 Thread Zach Tellman
If I'm reading this correctly, you're using non-blocking thread pools for blocking operations on the sockets. Given more than N connections (last time I looked the thread pool's size was 42), you risk deadlock or at the very least poor average throughput. On Sunday, October 5, 2014 7:06:56 PM

Re: Profiling in Counterclockwise

2014-10-05 Thread Fluid Dynamics
On Sunday, October 5, 2014 6:55:53 PM UTC-4, Andy Fingerhut wrote: > > I would suggest doing Google searches for combinations of terms such as: > > clojure profiling > > That search found several relevant matches when I tried it. > I didn't find much and the only real lead I came up with dead-

Re: Profiling in Counterclockwise

2014-10-05 Thread juan.facorro
VisualVM has a GUI which is fairly simple to use, you just download it, run it and get a list of all the running JVM instances on your local machine. There's even an option to sample the running code, that shows what functions are taking the most CPU time. If I understood correctly VisualVM is

[ANN] async-sockets - work with sockets using core.async channels

2014-10-05 Thread Brian Guthrie
Hi all, I'm releasing a little library for working with sockets. Feedback and pull requests gratefully appreciated. The skinny --- This library allows you to create socket servers and socket clients and interact with them asynchronously using channels. Servers return a record with a

Re: Profiling in Counterclockwise

2014-10-05 Thread Mark Engelberg
I haven't done it in a while so can't give detailed instructions, but it is definitely possible to profile code running in the REPL. The profiler that comes with java allows you to select any java process running on your machine, so you just select the JVM instance that is running the REPL. Then,

Re: Profiling in Counterclockwise

2014-10-05 Thread Andy Fingerhut
I would suggest doing Google searches for combinations of terms such as: clojure profiling That search found several relevant matches when I tried it. I am not sure why you say "2) Deploy to somewhere", unless by "somewhere" you include running a JVM on your own local development machine? Y

Re: Variadic argument function call to another v.a.f.

2014-10-05 Thread Mate Varga
Thanks, the JIRA issue confused me sightly. On Sunday, October 5, 2014 8:21:01 PM UTC+2, Ashton Kemerling wrote: > > That makes plenty of sense, you passed 1 argument to va1, and it was a > list (from &args). If you wish to unwrap that list, use apply: > > (apply va1 '(1 2 3)) > > > > On Sun, Oct

Re: Profiling in Counterclockwise

2014-10-05 Thread Luc Prefontaine
As far as I know the external tools exposed so far are the only way to get the breakdown you are seeking. Profiling in dev with an external tool is kind of a conflicting goal to me. Such tools used in dev are also a form of micro benchmarking on incomplete code. Your app is not fully packaged,

Re: Profiling in Counterclockwise

2014-10-05 Thread Fluid Dynamics
On Sunday, October 5, 2014 4:58:04 PM UTC-4, Luc wrote: > > Have a look at criterium. > > https://github.com/hugoduncan/criterium > That's (micro)benchmarking, not profiling. Profiling would break down the time spent in different functions and help to identify hot spots that might especially b

Re: Profiling in Counterclockwise

2014-10-05 Thread Luc Prefontaine
Have a look at criterium. https://github.com/hugoduncan/criterium It will allow you to look at the performance of code chunks in the REPL, you get meaningful results and a solid comparison basis. So practical that it's part of my default profile. You can test different approaches w/o leaving t

Re: Profiling in Counterclockwise

2014-10-05 Thread Ashton Kemerling
The profiling and logging tool might be Java specific. On Sun, Oct 5, 2014 at 2:38 PM, Fluid Dynamics wrote: > On Sunday, October 5, 2014 3:57:37 PM UTC-4, Gary Verhaegen wrote: >> >> When I need to profile (which is asmittedly quite rare), I use VisualVM, >> which should have been installed al

Re: core.async: peek the next value from a channel without consuming it

2014-10-05 Thread Leon Grapenthin
On Sunday, October 5, 2014 10:14:19 PM UTC+2, Nahuel Greco wrote: > > Maybe not, maybe you want to reserve the cpu cycles for other tasks, or > the producer needs a confirmation for other purposes before computing or > requesting the value from another party. This is a simplified and distilled

Re: Profiling in Counterclockwise

2014-10-05 Thread Fluid Dynamics
On Sunday, October 5, 2014 3:57:37 PM UTC-4, Gary Verhaegen wrote: > > When I need to profile (which is asmittedly quite rare), I use VisualVM, > which should have been installed along with the JDK. I'd recommend editing > the default settings to remove clojure.** and add your own namespaces as

Re: core.async: peek the next value from a channel without consuming it

2014-10-05 Thread Nahuel Greco
No reservation, the ack solution works, but 1- I think the producer code can be simplified with the peek operation and 2- I want to know is there is a fudamental limitation in chans design/implementation prohibiting adding a peek operation. El 05/10/2014 17:03, "Gary Verhaegen" escribió: > I thi

Re: core.async: peek the next value from a channel without consuming it

2014-10-05 Thread Nahuel Greco
Maybe not, maybe you want to reserve the cpu cycles for other tasks, or the producer needs a confirmation for other purposes before computing or requesting the value from another party. This is a simplified and distilled scenario. El 05/10/2014 16:55, "Leon Grapenthin" escribió: > > > On Sunday,

Re: core.async: peek the next value from a channel without consuming it

2014-10-05 Thread Gary Verhaegen
I think you should go for the ack solution. What is your reservation about it? On Sunday, 5 October 2014, Leon Grapenthin wrote: > > > On Sunday, October 5, 2014 5:33:16 PM UTC+2, Nahuel Greco wrote: >> >> Picture the following: >> >> producer ---> go-loop ---> external service >> >> 1- The prod

Re: Profiling in Counterclockwise

2014-10-05 Thread Gary Verhaegen
When I need to profile (which is asmittedly quite rare), I use VisualVM, which should have been installed along with the JDK. I'd recommend editing the default settings to remove clojure.** and add your own namespaces as starting points for the profiling. For more lightweight approaches, I'd sugge

Re: core.async: peek the next value from a channel without consuming it

2014-10-05 Thread Leon Grapenthin
On Sunday, October 5, 2014 5:33:16 PM UTC+2, Nahuel Greco wrote: > > Picture the following: > > producer ---> go-loop ---> external service > > 1- The producer puts a value to a unbuffered (chan) by doing (>! c v) > 2- The go-loop consumes the value with a take operation, **unblocking** > the pr

Re: Variadic argument function call to another v.a.f.

2014-10-05 Thread Ashton Kemerling
That makes plenty of sense, you passed 1 argument to va1, and it was a list (from &args). If you wish to unwrap that list, use apply: (apply va1 '(1 2 3)) On Sun, Oct 5, 2014 at 12:01 PM, Mate Varga wrote: > Hi, > there's a closed old bug on the CLJS JIRA from 2012: > http://dev.clojure.org/j

Variadic argument function call to another v.a.f.

2014-10-05 Thread Mate Varga
Hi, there's a closed old bug on the CLJS JIRA from 2012: http://dev.clojure.org/jira/browse/CLJS-383 "Empty variadic argument initialised with (nil) when using arity overloading " I am experiencing completely similar behavior in the latest CLJ 1.6:

Re: For async, expose the channel directly or expose a function?

2014-10-05 Thread Brian Guthrie
Fair enough. Thanks again. On Sat, Oct 4, 2014 at 11:49 AM, Stuart Sierra wrote: > > On Sat, Oct 4, 2014 at 12:31 AM, Brian Guthrie > wrote: > >> But I'm troubled by the idea of accepting channels as arguments, even >> though there's a lot to be said for consumer control of buffer sizes (to >>

Profiling in Counterclockwise

2014-10-05 Thread Fluid Dynamics
How does one profile in Counterclockwise? Googling for counterclockwise profile clojure didn't bear fruit, and googling for eclipse profile java turned up that there's apparently supposed to be a "Profiling and Logging perspective" which is missing, at least in the Open Perspective dialog in th

Re: core.async: peek the next value from a channel without consuming it

2014-10-05 Thread adrian . medina
Yes, but the advantage of using a pub is that it's simpler to have one input channel than to continually spawning new ones. But that's just my opinion. Anyway, sorry I couldn't be more help. On Sunday, October 5, 2014 1:04:58 PM UTC-4, Nahuel Greco wrote: > > You can do that without a pub, the

Re: core.async: peek the next value from a channel without consuming it

2014-10-05 Thread Nahuel Greco
You can do that without a pub, the producer can send a new (chan) inside the request to the go-loop and the go-loop will ack on that chan when getting a good response from the external service. That schema solves this scenario, I mentioned it in the previous mail, but I think a peek operation maybe

Re: core.async: peek the next value from a channel without consuming it

2014-10-05 Thread adrian . medina
Ah, I think we're on the same page now. I've come across the need for this recently in some code for a UDP based protocol between a multiplayer game client and server. I still think a pub fits in here nicely. You can consume the value from the channel in question and park until you get an ackn

Re: core.async: peek the next value from a channel without consuming it

2014-10-05 Thread Nahuel Greco
previous example with the peek operation: 1- The producer puts a value to a unbuffered (chan) by doing (>! c v) 2- The go-loop unparks from (peek wrote: > Then how would peeking at the value help? > > On Sunday, October 5, 2014 12:14:32 PM UTC-4, Nahuel Greco wrote: >> >> Adrian: I don't see how

Re: core.async: peek the next value from a channel without consuming it

2014-10-05 Thread adrian . medina
Then how would peeking at the value help? On Sunday, October 5, 2014 12:14:32 PM UTC-4, Nahuel Greco wrote: > > Adrian: I don't see how a pub can help here, in the previous example to > consume or not the value was decided not on some property intrinsic to the > value (one you can create a topi

Re: core.async: peek the next value from a channel without consuming it

2014-10-05 Thread Nahuel Greco
Adrian: I don't see how a pub can help here, in the previous example to consume or not the value was decided not on some property intrinsic to the value (one you can create a topic from), but on the result of sending it to an external service. Saludos, Nahuel Greco. On Sun, Oct 5, 2014 at 12:59

Re: class file too large

2014-10-05 Thread Mayank Jain
I faced the same problem when I had written several midje tests under one facts which had several fact defined in it. One way around is to break your ns into several smaller logical namespaces. That helped. On Sun, Oct 5, 2014 at 9:26 PM, Sunil S Nandihalli < sunil.nandiha...@gmail.com> wrote: >

Re: core.async: peek the next value from a channel without consuming it

2014-10-05 Thread adrian . medina
I think you can achieve an effect similar to what you want by using a pub with an appropriate topic function that classifies the input in some way, and then subscribing to the topic whose value you want to see. This also has the benefit of automatically 'mult'ing the channel input, so you can h

Re: class file too large

2014-10-05 Thread Sunil S Nandihalli
Hi Michael, Thanks for the response. You are likely right about that. While none of them actually look very large, The function is built-up using macros. I will cross check if I can split it. I am using PigPen which makes heavy use of macros and due to some of the semantics of how it is able to ha

Re: core.async: peek the next value from a channel without consuming it

2014-10-05 Thread Nahuel Greco
Picture the following: producer ---> go-loop ---> external service 1- The producer puts a value to a unbuffered (chan) by doing (>! c v) 2- The go-loop consumes the value with a take operation, **unblocking** the producer 3- The go-loop contacts the external-service but the external service answe

Re: core.async: peek the next value from a channel without consuming it

2014-10-05 Thread Fluid Dynamics
On Sunday, October 5, 2014 12:51:04 AM UTC-4, Nahuel Greco wrote: > > I was thinking in a single-consumer scenario with a buffered chan, in > which you want to check if you can consume the value before effectively > consuming it. As you said, a peek operation has no sense if the channel has > mu

Re: class file too large

2014-10-05 Thread Michael Klishin
On 5 October 2014 at 15:20:36, Sunil S Nandihalli (sunil.nandiha...@gmail.com) wrote: > I am getting class file too-large errors when I compile the clojure > file. Do you have pointers as to how one can identify the offending > piece of code? You likely have a giant function somewhere. Spli

class file too large

2014-10-05 Thread Sunil S Nandihalli
Hi Everybody, I am getting class file too-large errors when I compile the clojure file. Do you have pointers as to how one can identify the offending piece of code? Thanks, Sunil. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group,

Re: `as->` does not work with `recur`.

2014-10-05 Thread Jan-Paul Bultmann
Ah thanks, I did a JIRA search for `as->` before but nothing had popped up. On 05 Oct 2014, at 03:06, Sunil S Nandihalli wrote: > This issue has been reported > > May be you should upvote this.. > > http://dev.clojure.org/jira/browse/CLJ-1418 > > > > On Sun, Oct 5, 2014 at 4:56 AM, Leon G