Re: Inconsistency of dissoc on maps vs records?

2012-04-21 Thread Matthew Phillips
On Friday, April 20, 2012 4:01:54 PM UTC+9:30, David Jagoe wrote: > > > On 20 April 2012 07:08, Matthew Phillips wrote: > >> I've always liked the way assoc and dissoc return the original map >> instance when there's no change to be made. But this is not apparently >> true of records. e.g.: > >

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

2012-04-21 Thread David Jagoe
Hi all, 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'd much rather just generate the PDFs from the HTML that I am already maintaining. Thanks, David On

Re: Term rewriting systems implemented in Clojure

2012-04-21 Thread Walter van der Laan
A few years back I copied a small rewrite system from Scheme to Clojure while watching the SICP video lectures. It's a nice use case for a rewrite system. You can enter a mathematical function and the system will rewrite the function to its derivative. > > Perhaps this code plus the videos will

Macros to help writing closures?

2012-04-21 Thread timc
Hello I am a beginner when it comes to writing macros, so there may be an easy way to do this. I have a number of 'state machines' which have this sort of appearance: (defn startFSM [eventQ] (let [state (atom :1) going (atom true) timerId (atom -1) startTimer (fn []

Re: Macros to help writing closures?

2012-04-21 Thread Cedric Greevey
On Sat, Apr 21, 2012 at 11:27 AM, timc wrote: > Hello > > I am a beginner when it comes to writing macros, so there may be an easy way > to do this. > I have a number of 'state machines' which have this sort of appearance: > > (defn startFSM [eventQ] >   (let [state (atom :1) > going (ato

Clojurescript and SQLite?

2012-04-21 Thread Antonio Recio
I would like to write an offline webapp for iphone using clojurescript and sqlite. Do you know some project/tutorial to take a look? -- 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 th

ANN expectations-mode 0.0.2

2012-04-21 Thread gaz jones
Hey, I use the expectations testing framework a fair amount at work, so created an emacs minor mode for running the tests ala clojure-test-mode. It is based on clojure-test-mode so has many of the same keybindings: https://github.com/gar3thjon3s/expectations-mode/tree/0.0.2 I had to update expec

Re: Newbie question about rebinding local variables

2012-04-21 Thread Sergey Didenko
There is also a non-idiomatic way - transform your code to use a native Java data structure like ArrayList or primitive array. You may want it for the speed or if the mutable algorithm is more readable. Anyway isolation of the mutable code is always a good advice. (defn new-game [] (let [board

Re: Newbie question about rebinding local variables

2012-04-21 Thread Alex Baranosky
Another non-standard solution you could try is to use the state monad from the monad library. On Apr 21, 2012 3:22 PM, "Sergey Didenko" wrote: > There is also a non-idiomatic way - transform your code to use a > native Java data structure like ArrayList or primitive array. > > You may want it for

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

2012-04-21 Thread Dan Cross
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'd much rather just > generate the PDFs from the HTM

Re: PersistentHashMaps coming to ClojureScript

2012-04-21 Thread Casper Clausen
Excellent! Any idea how this implementation would compare performance wise to the java implementation if imported to Clojure? On Apr 20, 8:36 pm, Michał Marczyk wrote: > It's pure ClojureScript. Hopefully a step towards CinC, yes. :-) > > Sincerely, > Michał > > On 20 April 2012 20:32, Brent Mill

Re: Typed Clojure 0.1-alpha2

2012-04-21 Thread Casper Clausen
Looks interesting. Personally I always thought clojure's handling of function arity is a bit strange. I don't understand why calling a function like this (defn testfn [one two] ...) (test-fn 1) is not at least a compiler warning, possibly with a switch for the compiler for strict checking. I un

Re: PersistentHashMaps coming to ClojureScript

2012-04-21 Thread David Nolen
With some minor alterations it should be just as fast as the Java implementation. David On Fri, Apr 20, 2012 at 7:35 PM, Casper Clausen wrote: > Excellent! Any idea how this implementation would compare performance > wise to the java implementation if imported to Clojure? > > On Apr 20, 8:36 pm

Re: Treatment of nil/null in a statically typed Clojure

2012-04-21 Thread Daniel Solano Gómez
On Fri Apr 20 02:46 2012, Ambrose Bonnaire-Sergeant wrote: > I've been doing some thinking about the treatment of nil in a > statically typed version of Clojure. > > It occurs to me that nil is significantly different to Java's null > reference, which is almost a Bottom type. > > Java's null is a

Re: Typed Clojure 0.1-alpha2

2012-04-21 Thread Softaddicts
user=> (defn a [x y] x) #'user/a user=> (a 1) java.lang.IllegalArgumentException: Wrong number of args passed to: user$a (NO_SOURCE_FILE:0) user=> (a 1 2) 1 user=> (a 1 2 3) java.lang.IllegalArgumentException: Wrong number of args passed to: user$a (NO_SOURCE_FILE:0) user=> user=> (defn b

Re: Typed Clojure 0.1-alpha2

2012-04-21 Thread Stuart Campbell
The ClojureScript compiler doesn't seem to do those kinds of checks, but the Clojure compiler does. On 21 April 2012 09:18, Casper Clausen wrote: > Looks interesting. > > Personally I always thought clojure's handling of function arity is a > bit strange. I don't understand why calling a functio

Re: Typed Clojure 0.1-alpha2

2012-04-21 Thread Softaddicts
I assumed he was talking about Clojure on the JVM... We came to a point where specifying the implementation is a requirement when posting on this list to prevent confusion :))) Luc > The ClojureScript compiler doesn't seem to do those kinds of checks, but > the Clojure compiler does. > > On 21

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

2012-04-21 Thread Michael Wood
On 21 April 2012 12:20, David Jagoe wrote: > Hi all, > > 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'd much rather just > generate the PDFs from the

Re: Typed Clojure 0.1-alpha2

2012-04-21 Thread Alan Malloy
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 exception On Apr 21, 5:14 pm, Softaddicts wrote: >

Re: Treatment of nil/null in a statically typed Clojure

2012-04-21 Thread James Reeves
On 20 April 2012 01:43, Alan Malloy wrote: > On Apr 19, 4:06 pm, James Reeves wrote: >> On 19 April 2012 19:46, Ambrose Bonnaire-Sergeant >> >> wrote: >> > I've been doing some thinking about the treatment of nil in a >> > statically typed version of Clojure. >> >> Statically typed in what way?