Re: a library I'm working on for generating PDFs from Clojure

2012-04-22 Thread David Jagoe
On 21 April 2012 14:41, Dan Cross wrote: > On Sat, Apr 21, 2012 at 6:20 AM, David Jagoe wrote: > > Can anybody tell me whether wkhtmltopdf or flying-saucer deal with > > pagination properly? I've been templating TeX to get properly laid out > > tables broken over multiple pages. But of course I'

[ANN] slacker (RPC framework) 0.8.0 released

2012-04-22 Thread Sun Ning
Hi all, Glad to announce the new release of slacker, an RPC framework for clojure: https://github.com/sunng87/slacker Major changes in this release: * clojure 1.3 compatible * performance boost: 8x faster than previous release * ring app wrapper: slacker can be wrapped as a ring app If you have

Re: a library I'm working on for generating PDFs from Clojure

2012-04-22 Thread Cedric Greevey
On Sun, Apr 22, 2012 at 3:33 AM, David Jagoe wrote: > > On 21 April 2012 14:41, Dan Cross wrote: >> >> On Sat, Apr 21, 2012 at 6:20 AM, David Jagoe wrote: >> > Can anybody tell me whether wkhtmltopdf or flying-saucer deal with >> > pagination properly? I've been templating TeX to get properly la

Re: Typed Clojure 0.1-alpha2

2012-04-22 Thread Softaddicts
Oups :) Should have read twice :) > He did say, compile-time error. These errors are at run-time - that > is, the following is just as obviously bad, but generates no warning > until bar is called: > > (defn foo [x] 1) > > (defn bar [y] (foo y 1)) ;; compiles fine > > (bar 5) ;; throws runtime

When I use Agents for logging I have a different behavior in the REPL as in the program

2012-04-22 Thread Goldritter
I wanted to log some information during the execution of the genetic algorithm I posted earlier here. So I chnaged the code and changed the function 'track-evolution' so, that it now accept a maximal runtime and returns a m

Re: New release of Paredit mode for Vim with support for VimClojure repls and Map literals

2012-04-22 Thread dgrnbrg
I didn't know that support had been added to paredit mode! When I googled for better Clojure support, I didn't see that one. The differences between Kovac's Nov 2011 version and mine is only that mine applies the mode to VimClojure REPL buffers. I haven't checked to see whether he treats {} the sa

any advice for translating the book "The Joy of Clojure"?

2012-04-22 Thread Zhitong He
Hi, all. I am new to Clojure and feel exciting playing with it. Recently, I read the book "The Joy of Clojure", and got a strong feeling toward translating the book from English to Chinese, to introduce Clojure to more programmers in China. Actually I am working now. However, though having some e

Re: When I use Agents for logging I have a different behavior in the REPL as in the program

2012-04-22 Thread Moritz Ulrich
Just a quick guess after a quick glimpse at the code you linked: (map #(send % a-day-in-the-life-agent-fn) domiciles) map is lazy. It doesn't execute anything until you request the result. (do ... (map ...) (foo)) discards the result of map, making it a no-op. This also explains why it works in

Re: any advice for translating the book "The Joy of Clojure"?

2012-04-22 Thread Zhitong He
BTW, is there any way to get the book's source code (latex or other)? so that I can do a fully translation, with the right typesetting, etc. I will try to publish the book translated if chances, and contribute all the remuneration (if any) to the Clojure community. I would like to know if this wi

Re: When I use Agents for logging I have a different behavior in the REPL as in the program

2012-04-22 Thread Marcus Lindner
I had made some changes on the code I posted. Here is the actual usedcode with the logging functions included. (ns evolution.genalg (:use [util.time]) (:use [util.profile])) ;; Implementation of a genetic algorithm based on the code given ;; in the book "Clojure" by Stefan Kamphausen and Tim

Re: New release of Paredit mode for Vim with support for VimClojure repls and Map literals

2012-04-22 Thread Evan Mezeske
Version 0.9.3 does indeed support balanced map literals. I believe that the bitbucket repository is the official home of slimv (from which paredit.vim comes): https://bitbucket.org/kovisoft/slimv/ . On Sunday, April 22, 2012 7:53:26 AM UTC-7, dgrnbrg wrote: > > I didn't know that support had be

Re: Macros to help writing closures?

2012-04-22 Thread timc
Thanks Cedric - that's very nice. I'm beginning to understand the power of macros. I have to say they are not very well explained in the clojure docs. In particular, how many distinct 'macro operators' are there, and what are their precise definitions? For instance, is ~' a single operator, or is

Re: Macros to help writing closures?

2012-04-22 Thread Alex Baranosky
~' is two operators. 'x is the same as (quote x) ~'x has the effect of not namespacing the symbol when it expands. You can use this technique to create symbols with known names (rather than random autogensymed symbols) that you can use inside your macro. -- You received this message because you

Re: Macros to help writing closures?

2012-04-22 Thread timc
I often write functions like this: (defn foobar [] (let [log (makeLogger "foobar")] blah blah )) where makeLogger returns a logging function that prefixes all messages with the name provided. It looks as though macros don't have a "stringize" ability (like the C preprocessor) so tha

Re: Macros to help writing closures?

2012-04-22 Thread Cedric Greevey
On Sun, Apr 22, 2012 at 5:42 PM, timc wrote: > I often write functions like this: > > (defn foobar [] >   (let [log (makeLogger "foobar")] >     blah blah )) > > where makeLogger returns a logging function that prefixes all messages with > the name provided. > > It looks as though macros don'

Re: New release of Paredit mode for Vim with support for VimClojure repls and Map literals

2012-04-22 Thread John Szakmeister
On Sun, Apr 22, 2012 at 3:28 PM, Evan Mezeske wrote: > Version 0.9.3 does indeed support balanced map literals. > > I believe that the bitbucket repository is the official home of slimv (from > which paredit.vim comes):  https://bitbucket.org/kovisoft/slimv/ . Just an FYI, but there seems to be v

Re: any advice for translating the book "The Joy of Clojure"?

2012-04-22 Thread George Oliver
On Apr 22, 10:40 am, Zhitong He wrote: > Hi, all. I am new to Clojure and feel exciting playing with it. > > Recently, I read the book "The Joy of Clojure", and got a strong > feeling toward translating the book from English to Chinese, to > introduce Clojure to more programmers in China. I thi

Re: Newbie question about rebinding local variables

2012-04-22 Thread Tim Cross
On Friday, April 20, 2012 8:21:56 AM UTC+10, Craig Ching wrote: > > Ok, I've read that what I want to do is a no no. But this is the sort of > thing I did in Scheme about 20 years ago (and because of that I'm probably > misremembering ;-)). > > Basically I'm learning clojure and thought I'd wr

Re: Newbie question about rebinding local variables

2012-04-22 Thread Tim Cross
On Saturday, April 21, 2012 12:26:30 AM UTC+10, Craig Ching wrote: > > > > On Friday, April 20, 2012 9:07:49 AM UTC-5, Walter van der Laan wrote: >> >> You could start with pure functions to handle the game logic, e.g.: >> >> (defn new-game [] >> [[\- \- \-] >>[\- \- \-] >>[\- \- \-]])

Re: Macros to help writing closures?

2012-04-22 Thread Ludwig Valda Vasquez
Not sure what you want to obtain, but consider this example (defmacro foo [fn-name] `(defn ~fn-name [] ~(str fn-name))) (foo some-name) ; This will define a function some-name, which returns it's name as a string "some-name" понедельник, 23 апреля 2012 г., 1:42:26 UTC+4 пользователь timc н

Re: Macros to help writing closures?

2012-04-22 Thread Kyle R. Burton
> (defmacro foo [fname & body] >   `(defn ~fname [] > (let [~'log (~'makeLogger "~fname")] >    ~@body))) You may be able to do this as: (defmacro foo [fname & body]   `(defn ~fname [] (let [~'log (~'makeLogger ~(str fname))]    ~@body))) Macros can call other functions - so

Re: Macros to help writing closures?

2012-04-22 Thread Ken Causey
Regarding learning about macros: I suspect that most within the community are relying on existing knowledge of writing macros in Common Lisp or relying on documentation for Common Lisp. I highly recommend reading Paul Graham's _On Lisp_. http://paulgraham.com/onlisp.html Ken On Sun, Apr 22, 20

Help with #'

2012-04-22 Thread David Simmons
Hi I'm new to Clojure but very keen to learn. I'm following Web Development with Clojure (http://www.vijaykiran.com/2012/01/11/web- application-development-with-clojure-part-1/) and came across the following code: (run-jetty #'routes {:port (or port 8080) :join? false})) I know that #'routes is

StackOverflowError caused by apply-template

2012-04-22 Thread Shogo Ohta
Hi, I've run into such an error: (clojure.template/apply-template '[x] 'x '[[x]]) ;=> StackOverflowError It appears to be caused by replacing x with [x] infinitely recursively. Is it a bug or spec? -- You received this message because you are subscribed to the Google Groups "Clojure" group.

Re: StackOverflowError caused by apply-template

2012-04-22 Thread Stuart Sierra
I think that falls under the heading of "don't do that." :) clojure.template (which I wrote) wasn't a great idea to begin with. It was slightly useful in clojure.test, but I haven't found a use for it since. -S On Sunday, April 22, 2012 8:02:45 AM UTC-4, Shogo Ohta wrote: > > Hi, > > I've run

Re: Help with #'

2012-04-22 Thread Stuart Campbell
Hi Dave, If you write (run-jetty routes ...) then the current value of "routes" is looked-up and passed to run-jetty. You won't see any change if you subsequently redefine "routes", because the original definition is what was passed to run-jetty. On the other hand, (run-jetty #'routes ...)

Re: New release of Paredit mode for Vim with support for VimClojure repls and Map literals

2012-04-22 Thread dgrnbrg
I am having trouble porting my simple VimClojure support with the version 0.9.6 of the script. The integration w/ slimv's REPL appears to have increased. I'm not sure what the best course of action is, since I don't really want to continue trying to merge the codebases, and instead just fix any bug

Re: any advice for translating the book "The Joy of Clojure"?

2012-04-22 Thread Zhitong He
Thank you, George. I will to contact a publisher to negotiate the translation rights with Manning. On Mon, Apr 23, 2012 at 7:50 AM, George Oliver wrote: > > > On Apr 22, 10:40 am, Zhitong He wrote: >> Hi, all. I am new to Clojure and feel exciting playing with it. >> >> Recently, I read the book

Re: any advice for translating the book "The Joy of Clojure"?

2012-04-22 Thread Sun Ning
I don't think the book is an open source one, so you should have to find a publisher in China first. And ask them to contact Manning for the importing details. On Apr 23, 2012 1:59 AM, "Zhitong He" wrote: > BTW, is there any way to get the book's source code (latex or other)? > so that I can do

Re: New release of Paredit mode for Vim with support for VimClojure repls and Map literals

2012-04-22 Thread Dave Ray
Note that Tomas recently extracted paredit from slimv, so it has its own home now: https://bitbucket.org/kovisoft/paredit Also, there have been several important bug fixes applied to paredit in the last few months. It would be great if any improvements you've made could make it back into the offici