Is this the good way to write get-percentage

2015-02-10 Thread Cecil Westerhof
I needed a function to get the percentage as an int. Input is place and total-count. I want the normal definition (which is the default) and a high and low variant. I came up with the following code: (defn get-percentage ([place total-count] (get-percentage :normal place total-count))

Re: [ANN] Immutant 2.0.0-beta2

2015-02-10 Thread Ravindra Jaju
That's really great! I can vouch for the stability of beta1. Been running for a small app in production, handling filtered twitter stream data. Never have looked at it since it was started some months ago (except for a VM restart once). To be fair, there's no high load on this app, but it handles

[ANN] Immutant 2.0.0-beta2

2015-02-10 Thread Jim Crossley
Hi all, We released Beta 2 of "The Deuce" today: http://immutant.org/news/2015/02/09/announcing-2-beta2/ We introduced some breaking changes, specifically around WebSockets, but we like the new API, as it now directly supports HTTP streams, including Server-Sent Events. See the "Asynchrony" se

Re: Extending the LispReader with "embeded language lorms"

2015-02-10 Thread Sam Raker
For a competent English speaker/reader, Infinite Jest is "hard to read" because it's dense and elliptical &c. &c. For that same reader, Tintin in the original French is "hard to read" because it's in French. I think that's a relevant distinction to make in this context. Extensibility is nice, b

Re: Serving files from outside a ring uberjar

2015-02-10 Thread Gary Verhaegen
If you're using Compojure, you can use compjure.route/files for that (as opposed to compojure.route/resources which looks inside the jar). As Moritz said, you still have to be a bit wary about the file path, as it will be relative to the current directory of the JVM, not relative to the JAR file lo

Re: Extending the LispReader with "embeded language lorms"

2015-02-10 Thread Gary Verhaegen
I *think* Alex means "read" in the very specific and technical sense of a Lisp reader, i.e. a piece of program that turns a stream of characters into data structures in memory, and then I guess the other "users" are all of the other programs, beside the Clojure compiler itself, that may want to ana

Re: Extending the LispReader with "embeded language lorms"

2015-02-10 Thread Gary Verhaegen
For the sake of completeness, in this context "other users" is not limited to humans: what about IDE support? Refactoring tools? Code analysis? You have to balance the potential extra complexities with the benefit, which to me seems to be very sparse: how often do you actually need to embed large

Re: Extending the LispReader with "embeded language lorms"

2015-02-10 Thread Ben Wolfson
On Tue, Feb 10, 2015 at 11:29 AM, Alex Miller wrote: > Hi Henrik, > > There is a long-standing philosophical position in Clojure that it should > not be possible to write programs that cannot be read by other users. > What does that mean? -- Ben Wolfson "Human kind has used its intelligence to

Re: Extending the LispReader with "embeded language lorms"

2015-02-10 Thread Alex Miller
Hi Henrik, There is a long-standing philosophical position in Clojure that it should not be possible to write programs that cannot be read by other users. Because of this position, I do not believe there is any chance of this moving forward in Clojure itself. Tagged literals allow creating new

[RFC] Testing ClojureScript code with clojurescript.test and Karma

2015-02-10 Thread Kevin Bell
We at CircleCI have been running our clojurescript.test tests with Karma lately, with great results. Easy access to Chrome devtools for unit tests is great, and it provides great community plugins like junit-formatted xml output (which CircleCI understands). You can read about how it works in o

Re: Serving files from outside a ring uberjar

2015-02-10 Thread Moritz Ulrich
See https://github.com/ring-clojure/ring/wiki/Static-Resources You should be able to pass '.' signifying the directory your application was started in (that might NOT be the same place as the jar). viper110110 writes: > I would like to be able to serve up files from a folder after the jar has

Re: How to profile a clojure program?

2015-02-10 Thread Nicholas Kariniemi
I would think you could just use a normal profiler with some mental translations. The translations between Clojure vars/namespaces and Java classes are in most cases pretty straightforward. A function "foo" in namespace "core" becomes class "core$foo", function bar becomes "core$bar", etc. Then

Why STM read are not cached?

2015-02-10 Thread Heikki Hämäläinen
Hello Clojure developers I am currently doing my masters thesis about Clojure as a paraller programming language. I have studied Clojures STM from the source and I have a next question about the implementation. If this is a wrong place to ask this question I apologize beforehand. Read operatio

Serving files from outside a ring uberjar

2015-02-10 Thread viper110110
I would like to be able to serve up files from a folder after the jar has been built. Ideally I could take a parameter in to the jar with the target directory, but I could also settle for putting the jar in the directory with the files or hardcoding a target directory near the jar. This is so t

Re: Help needed with Component library

2015-02-10 Thread Gilberto Garcia
You nailed it Steve. thanks for the insight :) On Tue, Feb 10, 2015 at 12:13 PM, Steve Ashton wrote: > In main.clj, it looks like you aren't keeping a reference to the started > app. So when you call stop, you are actually stopping the version of the > system which doesn't have the jetty server

Re: Help needed with Component library

2015-02-10 Thread James Reeves
On 10 February 2015 at 11:36, wrote: > > I also do (assoc this :jetty nil) instead of (dissoc this :jetty-server) > as the dissoc will stop it being a defrecord. > dissoc only turns the record into a map if you remove one of its core fields: user=> (defrecord Foo [x]) user.Foo user=> (def f (m

Re: ANN: ClojureScript 0.0-2814, Nashorn REPL, async testing, and much more

2015-02-10 Thread Mikey Griffiths
According to GitHub, ClojureScript now has 104 contributors to Clojure's 102 - and has had more commits since around December. Congrats to all involved! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@goog

Re: Help needed with Component library

2015-02-10 Thread guy . barlow
Hi, I've been messing around with the component library too recently, It's probably worth printing out the defrecord (the Ring one) to see if the values are being populated by the start function. You could just do this in the repl using clojure/pprint.pprint. I also do (assoc this :jetty nil)

Re: ANN: boltzmann 0.1.1 - a deep-learning library

2015-02-10 Thread Christian Weilbach
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey, On 06.01.2015 05:04, Mike Anderson wrote: > On Tuesday, 6 January 2015 04:27:55 UTC+8, Christian Weilbach > wrote: >> > On 05.01.2015 03:34, Mike Anderson wrote: Very cool stuff! > > Like yours! I wish nurokit was EPLed, then I could have

Re: Combining reloaded workflow in web dev with dynamic var approach

2015-02-10 Thread Sven Richter
Hi, Thank you for the hint. I was taking some more time to look at other products and finally saw that luminus just uses ring.server.standalone/serve which supports auto reload for templates and clj code. So I just created two different components, one for development and one for runtime which

Re: Help needed with Component library

2015-02-10 Thread Steve Ashton
In main.clj, it looks like you aren't keeping a reference to the started app. So when you call stop, you are actually stopping the version of the system which doesn't have the jetty server set. Try changing this: (defn -main [& args] (component/start app) (component/stop app)) to this: (de

Re: Help needed with Component library

2015-02-10 Thread Gilberto Garcia
I get the same error because the key :jetty-server = nil so, (:jetty-server this) will return nil what turns into (.stop nil) note that if I print 'this' after assoc'ing :jetty-server in the start lifecycle I see the jetty server associated with the key :jetty-server for some reason I'm loosing t

Re: New Member Initiation

2015-02-10 Thread Akos Gyimesi
Hi Shubham, See also this list of novice-friendly Clojure projects, it may be a good starting point for contribution: https://github.com/marcuscreo/clojure-learning-resources Regards, Akos > On 10 Feb 2015, at 00:56, Christopher Small

Re: ANN: ClojureScript 0.0-2814, Nashorn REPL, async testing, and much more

2015-02-10 Thread David Nolen
Cut 0.0-2816. The only change is a fix for reader metadata leakage around `reify`. David On Mon, Feb 9, 2015 at 7:47 PM, David Nolen wrote: > ClojureScript, the Clojure compiler that emits JavaScript source code. > > README and source code: https://github.com/clojure/clojurescript > > New relea

Re: Help needed with Component library

2015-02-10 Thread Chris Ford
What happens if you try: (.stop (:jetty-server this)) instead of: (.stop jetty-server) I'm not at a repl right now, but maybe your stop method is closing over the value of jetty-server that's passed in when the record was constructed? On 10 February 2015 at 22:58, Gilberto Garcia wrote: > He

Re: Extending the LispReader with "embeded language lorms"

2015-02-10 Thread henrik42
@Luc: I see your points. Thanks for the reply. Just to make it clear: all I suggest is to integrate https://github.com/henrik42/extended-lisp-reader/blob/master/src/extended_lisp_reader/core.clj into clojure.core - i.e. make #[...]-forms and the delegation to user code "official". The rest of my

Re: Help needed with Component library

2015-02-10 Thread Gilberto Garcia
Here it goes https://gist.github.com/ggarciajr/e5f1c0f1072c63705ac4 Note that the :jetty-server is nil and it should hold the jetty server so it can be stopped in the stop phase. #toro_tokens_rest.components.ring.Ring{:port 3000, :database #toro_tokens_rest.components.database.Database{:path /tmp

Re: Help needed with Component library

2015-02-10 Thread Chris Ford
Perhaps it would help if you posted a gist of the stacktrace you encounter? On 10 February 2015 at 20:29, Gilberto Garcia wrote: > Hi All, > > I'm new to clojure and I'm trying to create a simple rest api to create > and manages to token. > I'm trying to use Stuart's component library but I'm ha

Help needed with Component library

2015-02-10 Thread Gilberto Garcia
Hi All, I'm new to clojure and I'm trying to create a simple rest api to create and manages to token. I'm trying to use Stuart's component library but I'm having problems when trying to stop a component because one of the component's map attribute is nil, so, when I try to stop the jetty server I