Re: avoiding repetition in ns declarations

2014-01-24 Thread Konrad Hinsen
--On 23 janvier 2014 13:08:57 + Phillip Lord wrote: The nstools library lets you do exactly that: https://code.google.com/p/clj-nstools/ That looks nice; why not open up the reference-map though, so that it would become extensible. That's a good idea. Just making it public is risky,

Re: semantics of >! on closed channels

2014-01-24 Thread John Szakmeister
On Thu, Jan 23, 2014 at 9:17 PM, Cedric Greevey wrote: > [meta, but about something apparently triggered by the message, from this > thread, that I'm quoting] > > Why did reading this post cause gmail to go bonkers? I saw this thread had > new articles since earlier today, brought it up, and read

Re: [ANN?]: ring-jetty-adapter with jetty 9.1.x

2014-01-24 Thread Andrey Antukh
Just renamed, thanks for suggestion! Andrey. 2014/1/23 James Reeves > You might want to give it a different name, like ring-jetty9-adapter, > otherwise it might be confused with the ring-jetty-adapter package in Ring > itself. > > - James > > > On 23 January 2014 22:39, Andrey Antukh wrote: >

Re: avoiding repetition in ns declarations

2014-01-24 Thread Mark Engelberg
I thought clj-nstools was for Clojure 1.2 only. Not true? On Thu, Jan 23, 2014 at 1:07 AM, Konrad Hinsen < googlegro...@khinsen.fastmail.net> wrote: > --On 21 janvier 2014 23:15:50 -0800 t x wrote: > >I have the following problem: >> >> (ns foo.bar >> ... >> ... >> ... ) >> >> There'

Re: [ANN?]: ring-jetty-adapter with jetty 9.1.x

2014-01-24 Thread Max Penet
FYI there is also this one on github: https://github.com/sunng87/ring-jetty9-adapter On Thursday, January 23, 2014 11:39:45 PM UTC+1, Andrey Antukh wrote: > > Hi! > > I have port the current ring-jetty-adapter from current ring repository to > use jetty 9.1.1 version. > > I understand that cur

Re: [ANN?]: ring-jetty-adapter with jetty 9.1.x

2014-01-24 Thread Andrey Antukh
Oh! Thanks! Sorry for the noise. I've definitely made ​​a bad search, thought id did not exist. I will remove my package and use the existent ;) Andrey 2014/1/24 Max Penet > FYI there is also this one on github: > https://github.com/sunng87/ring-jetty9-adapter > > On Thursday, January 23, 20

clojure.core/reduce calls (f) if given a reducible coll and no init value

2014-01-24 Thread Tassilo Horn
Hi all, in the following, set is clojure.set, and r is clojure.core reducers. Why is user> (reduce set/intersection (map set [[1 2] [3 1] [1 3]])) #{1} but user> (reduce set/intersection (r/map set [[1 2] [3 1] [1 3]])) ArityException Wrong number of args (0) passed to: set$int

Rename file uploaded

2014-01-24 Thread The Dude (Abides)
Hi, I'm new to clojure and am trying to rename an uploaded file with a unique identifier such as a long time stamp as follows: (defn add-timestamp [filename] (let [ext-position (.lastIndexOf filename ".") timestamp(tc/to-long (time/now))] (if (pos? ext-position) (str (.substri

clojure debugging repl

2014-01-24 Thread t x
Hi, One thing I miss from pre-Clojure scheme days is as follows: ## What I want 1 => (foo) ;; I'm calling foo at the repl ... foo executes ... ... at some point, an exception is thrown ... 2 => my interpreter _starts a new repl_ * at the point where the exception was thrown * lets me exam

Re: avoiding repetition in ns declarations

2014-01-24 Thread Phillip Lord
Konrad Hinsen writes: > --On 23 janvier 2014 13:08:57 + Phillip Lord > wrote: > >>> The nstools library lets you do exactly that: >>> >>> https://code.google.com/p/clj-nstools/ >> >> That looks nice; why not open up the reference-map though, so that it >> would become extensible. > > That'

Re: avoiding repetition in ns declarations

2014-01-24 Thread Konrad Hinsen
--On 24 Jan 2014 00:58:46 -0800 Mark Engelberg wrote: I thought clj-nstools was for Clojure 1.2 only.  Not true? I have used it with Clojure 1.3 without modifications. I haven't done any major Clojure project with later Clojure releases, so I don't if it works with a current setup. It should

ANN: Cloact is now Reagent 0.2.0

2014-01-24 Thread Dan Holmsand
Cloact, a minimalistic interface between React.js and ClojureScript, is now called Reagent (the old name was bad in all sorts of ways). There is also a new little demo of how to implement undo for Reagent components here: http://holmsand.github.io/reagent/news/cloact-reagent-undo-demo.html The

Re: ANN: Cloact is now Reagent 0.2.0

2014-01-24 Thread Shashy Dass
Thanks for this great library and the very detailed posts about how to use it. I've been experimenting with some of my toy apps and Cloact, now REagent really helped clean up a lot of non-essential complexity. Shashy On Friday, January 24, 2014 7:52:39 AM UTC-5, Dan Holmsand wrote: > > Cloact,

Looking for a reference binary parsing

2014-01-24 Thread Kashyap CK
Hi, I need to write a parser for MP4 - essentially, read an MP4 file and create an in-memory representation of its structure. I'd appreciate it very much if I could get some suggestions on libraries that I could use for this. Is there a https://github.com/youngnh/parsatron like library that works

Re: Looking for a reference binary parsing

2014-01-24 Thread James Reeves
You might want to take a look at Gloss ( https://github.com/ztellman/gloss) and Buffy ( https://github.com/clojurewerkz/buffy ). - James On 24 January 2014 15:08, Kashyap CK wrote: > Hi, > I need to write a parser for MP4 - essentially, read an MP4 file and > create an in-memory representation

Re: ANN: Cloact is now Reagent 0.2.0

2014-01-24 Thread Shashy Dass
Thanks for a great library and the fantastic documentation too. Reagent is fantastic. Shashy -- -- 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 modera

Re: [ClojureScript] Re: ANN: Cloact is now Reagent 0.2.0

2014-01-24 Thread Dan Holmsand
On 24 jan 2014, at 16:32, ritchie turner wrote: > Thanks for this library, i like the simplicity. > > One issue, I'm trying to add a non standard attr during rendering but it's > being dropped, is that a bug or a feature :) ? Thanks! Turns out its both bug and feature... Non standard attribu

Re: clojure.core/reduce calls (f) if given a reducible coll and no init value

2014-01-24 Thread Jarrod Swart
The reason you can't get this to work is that r/map returns a not a for reduce to operate on. I'm not sure of a solution because I'm not familiar with core.reducers. But reading this: http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html informed me

Re: clojure.core/reduce calls (f) if given a reducible coll and no init value

2014-01-24 Thread Tassilo Horn
Jarrod Swart writes: > The reason you can't get this to work is that r/map returns a > not a for reduce to operate on. Ah, indeed. I couldn't see the forest for the trees. > I'm not sure of a solution because I'm not familiar with > core.reducers. This works: (reduce set/intersection (r

Re: clojure.core/reduce calls (f) if given a reducible coll and no init value

2014-01-24 Thread Jarrod Swart
Ah cool, thanks for posting your solution! On Friday, January 24, 2014 3:29:49 PM UTC-5, Tassilo Horn wrote: > > Jarrod Swart > writes: > > > The reason you can't get this to work is that r/map returns a > > > not a for reduce to operate on. > > Ah, indeed. I couldn't see the forest for the

Re: semantics of >! on closed channels

2014-01-24 Thread Cedric Greevey
That shouldn't affect anything until the next time I try to navigate, say to the next thread with unread messages. Something caused the browser to spontaneously start navigating on its own. I didn't click a link and get redirected to the signin page at that time. It went there all by itself withou

Re: Rename file uploaded

2014-01-24 Thread Jarrod Swart
It works for me. I am guessing you are not passing in a string when you are calling (add-timstamp filename). Which is to say that your param 'filename' is a map not a string. If you are passing in a map of the upload information you need to grab the filename for your let: (let [ext-postion (

Re: clojure.core/reduce calls (f) if given a reducible coll and no init value

2014-01-24 Thread Cedric Greevey
An interesting question this raises is if there is any sensible way to define (intersection). It would need to behave as an identity element for intersection, so would need to behave as a set (so, (set? (intersection)) => truthy) that contained everything (so, (contains? (intersection) foo) => foo

Re: clojure debugging repl

2014-01-24 Thread t x
Found it, apparently it's debug-repl => swank-clojure => CDT => ritz It appears cider does not yet support this, so ritz is probably the "most powerful" at the moment. On Fri, Jan 24, 2014 at 3:39 AM, t x wrote: > Hi, > > One thing I miss from pre-Clojure scheme days is as follows: > > ## W

Is there a good Hive library?

2014-01-24 Thread Gary Zhao
I'm looking a good Clojure Hive library instead of using Java library directly. Let me know if you know. 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 ne

Re: clojure.core/reduce calls (f) if given a reducible coll and no init value

2014-01-24 Thread Jarrod Swart
If I understand you correctly I am in agreement. I don't think you could take this problem to clojure.core.reducers/reduce or fold because the problem is inherently sequential is it not? The reduction is basically (intersection (intersection (intersection A B) C) D). I was curious of this m

Re: clojure debugging repl

2014-01-24 Thread Jarrod Swart
The second version of The Joy of Clojure talks about building a debugging repl that allows insertion of breakpoints into code. Perhaps something similar could be done here. On Friday, January 24, 2014 4:38:59 PM UTC-5, t x wrote: > > Found it, apparently it's > > debug-repl => swank-clojure =>

Re: clojure.core/reduce calls (f) if given a reducible coll and no init value

2014-01-24 Thread Ben Wolfson
On Fri, Jan 24, 2014 at 12:56 PM, Cedric Greevey wrote: > An interesting question this raises is if there is any sensible way to > define (intersection). It would need to behave as an identity element for > intersection, so would need to behave as a set (so, (set? (intersection)) > => truthy) tha

Re: clojure.core/reduce calls (f) if given a reducible coll and no init value

2014-01-24 Thread Cedric Greevey
Intersection is associative and commutative: (intersection A B) = (intersection B A) and (intersection A (intersection B C)) = (intersection (intersection A B) C) = the elements common to all three sets. So it's actually perfectly well-founded for use with reducers, at least in principle, and inter

Re: clojure debugging repl

2014-01-24 Thread dgrnbrg
I have an implementation of this that's thoroughly integrated into vim. clojure code: https://github.com/dgrnbrg/redl vim plugin: https://github.com/dgrnbrg/vim-redl The code itself is written with core.async, and is capable of monitoring a thread, inspecting its stack while its running, stoppin

Re: Looking for a reference binary parsing

2014-01-24 Thread dgrnbrg
I have found Gloss to be a pleasure to work with, and the fact that it handles framing, arbitrary header logic, and streaming decoding made it the best choice when I was writing codecs for binary formats whose files didn't/needed to be streamed, rather than bulk-loaded. On Friday, January 24, 2

ANN: Om 0.3.0

2014-01-24 Thread David Nolen
A few minor simplifications to the Om model in this release. A breaking change if you were using om.core/bind, om.core/pure-bind or om.core/read - these complications have been removed. There's also now a tutorial optimized for Light Table for people want to understand the Om approach to React wit

Re: ClojureScript integration with Emacs/Cider ?

2014-01-24 Thread Gary Trakhman
Bozhidar, I created an issue summing up my concerns: https://github.com/clojure-emacs/cider/issues/460 On Wed, Jan 22, 2014 at 9:10 AM, Bozhidar Batsov wrote: > Sorry about the late response, Gary. Would you mind taking the discussion > over to cider’s issue tracker? (I tend to miss emails, but

Re: clojure.core/reduce calls (f) if given a reducible coll and no init value

2014-01-24 Thread Jarrod Swart
Good points. But the "identity" thing is still what gets me. What is the identity of an intersection? Like you said it can't be #{}. If you seed an intersection with #{} you get #{}, so you can't intersect from the empty set. The identity for an intersection is whatever the common element i

Re: clojure.core/reduce calls (f) if given a reducible coll and no init value

2014-01-24 Thread Cedric Greevey
No, the identity for intersection is a set that has everything, as (intersection A Everything) = A no matter what A is. On Fri, Jan 24, 2014 at 7:38 PM, Jarrod Swart wrote: > Good points. But the "identity" thing is still what gets me. What is the > identity of an intersection? > > Like you s

Re: core.async over websocket + cljs + clojure

2014-01-24 Thread Patrick Logan
* one side of the channel is in clojure land * other side of the channel is in cljs land Are you implementing coordination across the wire, as if the two channels are "the same virtual channel"? If so, read on... otherwise, n/m, sorry if I misinterpreted... CSP-like channels aren't a good a

Re: clojure.core/reduce calls (f) if given a reducible coll and no init value

2014-01-24 Thread Jarrod Swart
Okay, I see now. Thanks for the Socratic dialogue, at the onset of the day I knew nothing about core.reducers. I feel fairly conversational now! On Friday, January 24, 2014 7:44:03 PM UTC-5, Cedric Greevey wrote: > > No, the identity for intersection is a set that has everything, as > (inter

Re: clojure debugging repl

2014-01-24 Thread Alexandr Kurilin
I've been looking for a simple and convenient to use clojure debugger for ages now and would love to hear your recommendations. I'm a vim-fireplace user as well, if that makes a difference. I'd love to be able to set breakpoints in a running clojure application, step through the code and inspect l

Re: core.async over websocket + cljs + clojure

2014-01-24 Thread Logan Linn
> > To be reliable you'd have to introduce addition machinery to account for > the hazards of distributed systems, so you're probably better off starting > with an abstraction that has those hazards in mind already. The WebSocket (protocol) is the machinery that's handling this. We aren't dis

Re: clojure debugging repl

2014-01-24 Thread t x
I am willing to buy the book for this chapter alone. However, looking at http://www.manning.com/fogus2/ I can't seem to find it. Which chapter is it? On Fri, Jan 24, 2014 at 3:46 PM, Jarrod Swart wrote: > The second version of The Joy of Clojure talks about building a debugging > repl that al

Re: Rename file uploaded

2014-01-24 Thread The Dude (Abides)
Hi Jarrod, I tried changing filename to string as follows (defn handle-upload [filename] (upload-file (gallery-path) (add-timestamp (str filename))) (resp/redirect "/upload")) and still got an error as: java.lang.NullPointerException My entire file code is: (ns pgapp.routes.upload (:req

Re: Looking for a reference binary parsing

2014-01-24 Thread Kashyap CK
Thank you for the pointers. Regards, Kashyap On Saturday, January 25, 2014 5:43:09 AM UTC+5:30, dgrnbrg wrote: > > I have found Gloss to be a pleasure to work with, and the fact that it > handles framing, arbitrary header logic, and streaming decoding made it the > best choice when I was writin

Web App structure on server?

2014-01-24 Thread Jarrod Swart
I have a general question about application architecture as it relates to deploying to the server. Most of my previous development work involved python/php/ruby so we typically had: 1. One massive framework / application complection nightmare 2. Background scripts run by crons At prese

Re: Rename file uploaded

2014-01-24 Thread Jarrod Swart
Well that isn't quite what I meant. In that case you are just casting what is likely the map of upload data to a string. Try this: (defn handle-upload [filename] (str filename)) Why? This will show you what type of data you receiving on upload. My guess is that it is a map containing all

Re: clojure debugging repl

2014-01-24 Thread Jarrod Swart
Its a part of Chapter 17, just so you know its only a small exercise showing the beauty of Clojure, Lisp and Macros. Its only about 6 six pages. The footnote: The code in this section is based on *debug-repl* created by the amazing George Jahad, extended by Alex Osborne, and integrated into S

Re: Web App structure on server?

2014-01-24 Thread Mikera
Be careful about "weaselling in" Clojure - If I was your client and you did that without consulting me, I'd be pretty annoyed (possibly to the extent of not working with you again). Better to be upfront about the good reasons for using Clojure (concurrency support, awesome libraries, productivit

Re: Rename file uploaded

2014-01-24 Thread The Dude (Abides)
Hi Jarrod, you're exactly right, filename feeds the entire map as: {:size 17401, :tempfile #, :content-type "image/jpeg", :filename "AngryBaby4.jpg"} How can feed it just the :filename portion of the map as string to the add-timestamp function? Checking that link right now. On Friday, January

Re: Web App structure on server?

2014-01-24 Thread Jarrod Swart
I appreciate your outlook, and yes I have definitely discussed the pros of Clojure. They are apprehensive in the event they have to outsource development work, and I don't blame them. I'm just going to be a lot happier and more productive in Clojure. Thanks again! On Saturday, January 25,

Re: Rename file uploaded

2014-01-24 Thread Jarrod Swart
You need to change your timestamp function to this, my change in bold: (defn add-timestamp [filename] (let [ext-position (.lastIndexOf *(:filename filename)* ".") timestamp(tc/to-long (time/now))] (if (pos? ext-position) (str (.substring filename 0 ext-position) "-" t

Re: Rename file uploaded

2014-01-24 Thread Jarrod Swart
I'm sorry I glossed over your code. Leave (add-timestamp) the same but do this: (defn handle-upload [filename] (upload-file (gallery-path) (add-timestamp *(:filename filename)*)) (resp/redirect "/upload")) On Saturday, January 25, 2014 12:36:45 AM UTC-5, The Dude (Abides) wrote: > > Hi Jarrod

What's your testing flow with the current clj tools?

2014-01-24 Thread Alexandr Kurilin
I've been running my app's tests through `lein test` (most often for specific namespaces) for a long time now, but after reading Leiningen's recommendationto run them from the REPL I decided I should figure out how to make

Re: Rename file uploaded

2014-01-24 Thread The Dude (Abides)
Hi Jarrod, thanks for your help. I tried that but got a java.lang.NullPointerException error again. I tried the code without the add-timestamp and still get the java.lang.NullPointerException When I try it as just :filename filename it does in fact show only the file name. So not sure why

Re: Web App structure on server?

2014-01-24 Thread Joshua Ballanco
I just wanted to point out that if you’re looking to write small background processes that are more shell-script-y than server-y, you might consider CLJS + Node.js. That way you can still leverage Clojure without the need to spin up an entire JVM just for a quick cron task. Cheers, Josh On

Re: Web App structure on server?

2014-01-24 Thread Craig
My current approach accords with Mikera's suggestion, and using a single package allows me to easily leverage other components (management, database etc). I have an open mind on the future use of isolated scripts (in python or whatever), but at the moment I am enjoying the simplicity of develo