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

2014-10-08 Thread Max Penet
This is something that should be configurable & extendable in core.async really... but given how long it took to have this possibility with agents I am not holding my breath (not to mention it was never even considered for c.c/future). On Tuesday, October 7, 2014 8:48:23 PM UTC+2, Brian Guthrie

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

2014-10-08 Thread Jozef Wagner
One way how to handle this elegantly in Java is to add support for java.nio.channels.SelectableChannel in core.async buffer. That way you could select on any combination of core.async channels and io resources, waiting for core.async channels to free and resources to have data ready. Jozef On Wed

Re: com.stuartsierra/component & ring/compojure example

2014-10-08 Thread Daniel Szmulewicz
1, Extract the app out of the Webserver record into its own var. 2, Add to the Webserver record an additional argument called handler. 2, Put the component in a separate namespace. 3, Initialize your component with the app var. OR, use system, which does all of the above for you. https://gith

Re: com.stuartsierra/component & ring/compojure example

2014-10-08 Thread Daniel Szmulewicz
I posted a working example in the system repo: https://github.com/danielsz/system/tree/master/example On Tuesday, October 7, 2014 2:33:33 PM UTC+3, JPatrick Davenport wrote: > > Hello, > I'm trying to create a web app. I'm having the damnest time trying to > figure out how to layer my applicati

[ANN] Example project to illustrate usage of system library

2014-10-08 Thread Daniel Szmulewicz
Hello everybody, I noticed a demand for examples in how to put together a web app with the reloaded approach (Stuart Sierra's components). For this reason, I've published an example project in the system library. https://github.com/danielsz/system/tree/master/example Enjoy. Please let me k

Re: Advice for building backend REST services from scratch using clojure

2014-10-08 Thread Daniel Szmulewicz
I felt the Austin pain. Then I discovered figwheel. In one fell swoop, it solved all aforementioned problems. Live coding with Emacs has never been more joyful. https://github.com/bhauman/lein-figwheel On Tuesday, October 7, 2014 7:21:19 PM UTC+3, g vim wrote: > > On 11/04/2014 09:17, Colin Yate

Issue with log4j inside lein plugin.

2014-10-08 Thread Max Gonzih
Hello guys, I'm trying to create small lein plugin (https://github.com/Gonzih/lein-feeds2imap/blob/master/src/leiningen/feeds2imap.clj) that should use library underneath that uses log4j via clojure.tools.logging. But I don't see logging output when I call plugin. I tried to configure it in m

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

2014-10-08 Thread adrian . medina
Check out https://github.com/halgari/com.tbaldridge.hermod for an interesting take on this. On Wednesday, October 8, 2014 1:17:11 AM UTC-4, Sun Ning wrote: > > BTW, is there any network based core.async channel available now? > > On 10/08/2014 04:36 AM, adrian...@mail.yu.edu wrote: > > It's

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

2014-10-08 Thread Zach Tellman
I wasn't aware of hermod, that's interesting. I would still characterize its approach to backpressure as "broken", though, since when the queues get full it silently drops messages on the ground. In fairness, this is very clearly documented, so it's less pernicious than some of the other cases ou

Re: [ANN] Clojure instaREPL for web

2014-10-08 Thread Dylan Butman
Very nice! looks like there are some css issues with output display for example, (map inc [1 2 3 4]) doesn't output on a single line, and seems to shift a little bit from time to time. With a little more polishing this could be fantastic teaching tool for intro to clojure workshops and tutorial

Re: [ANN] rmap - define lazy, recursive maps

2014-10-08 Thread Zach Tellman
Hi Arnout, This is interesting, but may be a lot less useful than you think without filling in all the other methods that a normal map has. For instance, you cannot do an equality check with another map (no use of clojure.lang.MapEquivalence or implementation of equals and equiv), nor use it

Re: Evaluation order

2014-10-08 Thread Johannes Langøy
Thanks! kl. 02:17:45 UTC+2 onsdag 8. oktober 2014 skrev adrian...@mail.yu.edu følgende: > > *output > > On Tuesday, October 7, 2014 8:17:34 PM UTC-4, adrian...@mail.yu.edu wrote: >> >> You need to flush the input stream after printing. Call >> (clojure.core/flush) to do so. >> >> On Tuesday, Oct

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

2014-10-08 Thread Jozef Wagner
If you want to handle multiple TCP connections and async channels in one thread, you need a way how to block on both connections (wait for new input to arrive) and channels (wait for a free space in a buffer). Blocking only on connections will get you a busy loop if channels are full. If you cou

Re: Evaluation order

2014-10-08 Thread Johannes Langøy
Here is the finished Yatzy, in case anyone is interested: https://github.com/Jovlang/catzy/blob/master/src/catzy/core.clj kl. 19:05:50 UTC+2 onsdag 8. oktober 2014 skrev Johannes Langøy følgende: > > Thanks! > > kl. 02:17:45 UTC+2 onsdag 8. oktober 2014 skrev adrian...@mail.yu.edu > følgende: >>

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

2014-10-08 Thread Zach Tellman
The documentation for Manifold can explain the API better than I can here. The point where that interacts with Netty w.r.t. backpressure is here: https://github.com/ztellman/aleph/blob/0.4.0/src/aleph/netty.clj#L109. Here the stream represents data coming off the wire, and if the put onto the strea

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

2014-10-08 Thread Zach Tellman
Sorry, didn't cover converse case. That's handled by the ChannelSink directly underneath. Note that each write returns a Netty ChannelFuture representing completion of the write, which is transformed into a Manifold deferred. Any time a Manifold put returns an unrealized deferred, that creates u

Re: com.stuartsierra/component & ring/compojure example

2014-10-08 Thread Juho Teperi
The Stuart Sierra's talk about Component has short bit about using it with ring, at around 32:24 . Idea is that you'll wrap your basic routes with a middleware which will assoc components to every request. Difference to the other approach (crea

help with sequence, "seq", Seq, and `seq`

2014-10-08 Thread John Gabriele
Reading Joy of Clojure, section 5.1.2, I'm hoping someone here can help me understand the following: * `clojure.core/seq` returns a "seq" or a "sequence"? Likewise for `map` and `filter`. * What is the difference between a "seq" and a "sequence"? * A seq may possibly be lazy, but vectors

ANN: State of Clojure 2014 Survey - please contribute!!

2014-10-08 Thread Alex Miller
The 2014 State of Clojure survey is now available! This year's edition is broken into 2 parts - one for anyone who uses any Clojure dialect and a second specifically for ClojureScript users. http://blog.cognitect.com/blog/2014/10/3/2014-state-of-clojure-clojurescript-survey >From a community pers

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

2014-10-08 Thread Jozef Wagner
Thank you! Using put! callback to control backpressure is a very elegant solution. BTW there always has to be blocking somewhere. Netty uses selector to block at [1] and .setAutoRead causes respective channel to deregister itself from a selector [2], until put! completes. Regarding the other wa

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

2014-10-08 Thread Zach Tellman
Yes, I didn't mean to imply that there are no blocking operations anywhere, only that nothing in the worker threads (where the put! occurs) will block, and that backpressure isn't exerted by causing an active thread to hang. As to the second point, I'm not sure why you'd think that. These aren't

Unmarshalling EDN to Java Object

2014-10-08 Thread Timur
Hi everyone, One can use into-edn [1] to convert from Java objects to EDN structures. Is there a way to convert EDN structures to their original Java objects? Regards, Timur [1] https://github.com/thebusby/into-edn -- You received this message because you are subscribed to the Google Group

Re: Unmarshalling EDN to Java Object

2014-10-08 Thread Mark Mandel
I'm sure you can, but you would need to implement your own custom methods to do it, using :readers or :default options in edn/read / edn/read-string It would very much depend on the format of the outputted EDN as to which approach to take. Mark On 9 October 2014 07:12, Timur wrote: > Hi eve

Re: [ANN] rmap - define lazy, recursive maps

2014-10-08 Thread Arnout Roemers
Hi Zach, Thank you for checking out the library. You were right, some interfaces were missing and some methods had not been implemented. Though this was documented, they were limitations that could be fixed. *So, I'd like to announce version 0.2.0.* This version does implement all the necessar

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

2014-10-08 Thread Jozef Wagner
It was just my ignorance of manifold's concepts :). I was thinking in terms of "I have this thread which should connect these channels to those sockets, when to do what". Manifold's async approach with its connectable streams and deferreds with callbacks seems to abstract away such bookkeeping.

Re: com.stuartsierra/component & ring/compojure example

2014-10-08 Thread Huahai Yang
This solution (creating the routes in a function and passing components into the function) seems to be the best solution. Other solutions all require defining the routes a prior, which may be the root of the problems, because some handlers may depend on functions generated by components in the

Re: [ClojureScript] Re: [ANN] Silk, an isomorphic routing library for Clojure and ClojureScript

2014-10-08 Thread Dom Kiva-Meyer
Thanks for putting that together, Dylan. Looking forward to seeing what you're building. :) Olli, please feel free to reach out to me (email, Twitter, GitHub issue, whatever) if you have any questions. Thanks for trying it out! On Tue, Oct 7, 2014 at 12:05 PM, Dylan Butman wrote: > Sorry i don'

Re: help with sequence, "seq", Seq, and `seq`

2014-10-08 Thread tao.zhou2009
you can read Programming Clojure 2nd, which explains very clearly. -- tao.zhou2009 Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Thursday, October 9, 2014 at 2:39 AM, John Gabriele wrote: > Reading Joy of Clojure, section 5.1.2, I'm hoping someone here can help me > understand th

Re: help with sequence, "seq", Seq, and `seq`

2014-10-08 Thread James Reeves
The words "seq" and "sequence" can be used interchangeably. The "map" and "filter" functions return seqs. Yes, a seq may be lazy, but vectors and lists cannot. "seqable" means any data structure that can be turned into a seq using the "seq" function. This includes the Clojure collections, but al

Re: [PSA] Clojars scp disabled until further notice

2014-10-08 Thread Bridget
On Friday, September 26, 2014 11:09:55 AM UTC-4, Nelson Morris wrote: > > Clojars has become a critical part of the clojure ecosystem. As a small > sample, it hosts artifacts for: > > * Web development - ring, compojure, hoplon, hiccup, enlive, friend, > immutant > * Tooling - lein templates/pl

Re: [ANN] rmap - define lazy, recursive maps

2014-10-08 Thread Ben Wolfson
This is pretty nifty: user=> (require '[rmap.core :as rmap]) nil user=> (def fibs (rmap/rmap FIBS {:a 0 :b 1 :next (-> FIBS (update-in [:a] (constantly (:b FIBS))) (update-in [:b] (constantly (+ (:b FIBS) (:a FIBS)})) #'user/fibs user=> (defn fib [n] (loop [fibs fibs n n] (if (zero? n) (:a fib

Re: [ANN] Clojure instaREPL for web

2014-10-08 Thread Sam Raker
This is great. A little buggy, but that's to be expected :) I really appreciate the ability to hop onilne and test the behavior of little bits of code without waiting for a local repl to start up! On Tuesday, October 7, 2014 3:00:08 PM UTC-4, Lauri Hartikka wrote: > > A web based clojure instaREP

Re: Profiling in Counterclockwise

2014-10-08 Thread Skottk
I just did this for the first time last week. Run VisualVM, it gives you a list of running VMs. Select one. Hit the button to start collecting profiling data. Execute some code in the REPL. Eventually it will finish, and you'll have a big stack of profiling data. It won't go down to the granula

Re: help with sequence, "seq", Seq, and `seq`

2014-10-08 Thread John Gabriele
Thanks, James! What still throws me off is that the JoC book points out a symmetry that I wanted to better grasp. It first notes that: * `(first []) ;=> nil` and * `(rest []) ;=> ()` and then goes on to say: * "Clojure functions that promise to return sequences, such as `map` and `filte

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

2014-10-08 Thread Fluid Dynamics
On Monday, October 6, 2014 9:36:59 AM UTC-4, edbond wrote: > > Add one more chan, "external ready". > Put :ok there to let producer generate new value. > > producer: > - read from "external ready" > - generate value > - put into "outgoing" chan > > client: > - contact external server, put in "exter

Re: Profiling in Counterclockwise

2014-10-08 Thread Fluid Dynamics
On Wednesday, October 8, 2014 9:20:31 PM UTC-4, Skottk wrote: > > I just did this for the first time last week. Run VisualVM, it gives you > a list of running VMs. Select one. Hit the button to start collecting > profiling data. Execute some code in the REPL. Eventually it will finish, > and yo

Re: help with sequence, "seq", Seq, and `seq`

2014-10-08 Thread Fluid Dynamics
On Wednesday, October 8, 2014 8:16:38 PM UTC-4, James Reeves wrote: > > The words "seq" and "sequence" can be used interchangeably. > > The "map" and "filter" functions return seqs. > > Yes, a seq may be lazy, but vectors and lists cannot. > > "seqable" means any data structure that can be turned

Re: ANN: State of Clojure 2014 Survey - please contribute!!

2014-10-08 Thread Mars0i
Thanks for the survey! I have a couple of suggestions/questions: For domains, there are no categories for scientific or other research applications. For example, I mainly use Clojure for writing agent-based models for academic research. Would a set of categories in this area be usedful? The

Re: help with sequence, "seq", Seq, and `seq`

2014-10-08 Thread Ambrose Bonnaire-Sergeant
On Wed, Oct 8, 2014 at 10:55 PM, John Gabriele wrote: > * (when calling `seq` on a coll) "...In either case, if the collection > is empty, `seq` returns nil and never an empty sequence. Functions that > promise to return seqs (not sequences), such as `next`, work the same way." > > I think that