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

2014-10-07 Thread Andrew Meredith
This is not a full example, but I ran into the same issue when building an app for the Clojure Cup not too long ago. The general approach I used is this: - create the Compojure routes in a function with the components I need as parameters - declare the web server itself (I used httpkit

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

2014-10-07 Thread Zach Tellman
The reason the thread-per-connection approach is nice is because it correctly propagates backpressure. If we're copying data from a source to a sink (let's say reading it in from the network and writing to a file), it's possible that the production of data may outstrip the consumption. If thi

Re: What is the reasoning behind the Transducers eduction function?

2014-10-07 Thread Laurent PETIT
Hello, eduction does not return a seq, or anything already "concrete" like that, rather it returns a new reducible, with the interesting property lying in the retention of the xform argument (a transducer). This allows you, for instance, to pass around a collection with all the processing steps b

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

2014-10-07 Thread Sun Ning
BTW, is there any network based core.async channel available now? On 10/08/2014 04:36 AM, adrian.med...@mail.yu.edu wrote: It's not about 'safety' (depending on what that means in this context), but as Zach pointed out, if you aren't careful about backpressure you can run into performance bottl

Re: Evaluation order

2014-10-07 Thread adrian . medina
You need to flush the input stream after printing. Call (clojure.core/flush) to do so. On Tuesday, October 7, 2014 4:51:05 PM UTC-4, Johannes Langøy wrote: > > Hi, I can't figure this out. I have these two functions: > > (defn get-number [] > (try (let [input (read-string (read-line))] >

Re: Evaluation order

2014-10-07 Thread adrian . medina
*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, October 7, 2014 4:51:05 PM UTC-4, Johannes Langøy wrote: >> >> Hi, I can't figure this out. I have these

What is the reasoning behind the Transducers eduction function?

2014-10-07 Thread Jason Gilman
There's a few new functions that have been added with Transducers which mostly have very clear use cases to me. What are the use cases for the new eduction function? (which looks like it was previously

Evaluation order

2014-10-07 Thread Johannes Langøy
Hi, I can't figure this out. I have these two functions: (defn get-number [] (try (let [input (read-string (read-line))] (if (number? input) input (get-number))) (catch Exception e (get-number (defn selection-handler [tests] (dotimes [i (count tests)

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

2014-10-07 Thread adrian . medina
It's not about 'safety' (depending on what that means in this context), but as Zach pointed out, if you aren't careful about backpressure you can run into performance bottlenecks with unrestrained async IO operations because although they let you code as if you could handle an unlimited amount o

[ANN] Clojure instaREPL for web

2014-10-07 Thread Lauri Hartikka
A web based clojure instaREPL, Check it out :) http://clojurerepl.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 w

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

2014-10-07 Thread Dylan Butman
Sorry i don't have time to really explain any of this... but here's some code I pulled out of a recent project. maybe it'll be helpful to you. unfortunately I can't share the whole project. https://gist.github.com/pleasetrythisathome/7adbdc9c8b7ab689df45 -- You received this message because yo

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

2014-10-07 Thread Brian Guthrie
On Mon, Oct 6, 2014 at 12:10 AM, wrote: > 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 >

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

2014-10-07 Thread Brian Guthrie
On Sun, Oct 5, 2014 at 11:57 PM, Zach Tellman wrote: > 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

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

2014-10-07 Thread Colin Fleming
To be fair, Cursive doesn't yet provide a great CLJS REPL solution either, although that is coming soon. Right now, for ease of getting a CLJS REPL up and running Light Table definitely wins. On 8 October 2014 05:20, gvim wrote: > On 11/04/2014 09:17, Colin Yates wrote: > >> * you can fight it

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

2014-10-07 Thread gvim
On 11/04/2014 09:17, Colin Yates wrote: * you can fight it as hard as you like but you will eventually end up using emacs, clojure-mode, cider, paredit and magit and then wonder how you ever lived without it, but not without spending at least a month or two cursing anything to do wi

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

2014-10-07 Thread gvim
On 11/04/2014 09:17, Colin Yates wrote: * you can fight it as hard as you like but you will eventually end up using emacs, clojure-mode, cider, paredit and magit and then wonder how you ever lived without it, but not without spending at least a month or two cursing anything to do wi

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

2014-10-07 Thread Daniel Szmulewicz
You may want to look here for integrating components in your app. https://github.com/danielsz/system/ 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 applicat

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

2014-10-07 Thread gaz jones
Here is a toy app that downloads nzbs from usenet: https://github.com/gar3thjon3s/leacher It's not documented, but it works. The component stuff is hooked up here: https://github.com/gar3thjon3s/leacher/blob/master/src/clj/leacher/main.clj#L53 On 7 October 2014 12:33, JPatrick Davenport wrot

com.stuartsierra/component & ring/compojure example

2014-10-07 Thread JPatrick Davenport
Hello, I'm trying to create a web app. I'm having the damnest time trying to figure out how to layer my application. I want to pass protocol implementations to the routes. The protocols define interacting with various data sources that I need down the way. I saw Stuart Sierra's talk about Comp

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

2014-10-07 Thread Olli Piepponen
Has anyone here had a chance to use Silk for a project they'd be willing to share? I'm a front-end web-dev newbie who has been researching server-side Om/React rendering, and it seems like Silk is ideal for this use case. However I'd be much more comfortable starting out if there were some examp

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

2014-10-07 Thread jongwon.choi
With Lispy languages, you can do whatever you want without worrying too much about underlying web server, db, etc. I use my own constructors like: (define-crud-handler :employee [:path ["customers" cust-id "sites" site-id "employees"] :auth-required? true] {:collection {:create (employees-cr

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

2014-10-07 Thread jongwon.choi
With Lispy languages, you can do whatever you want without worrying too much about underlying web server, db, etc. I use my own constructors like: (define-crud-handler :employee [:path ["customers" cust-id "sites" site-id "employees"] :auth-required? true] {:collection {:create (employees-cr