What is the good way of def-ing during macro expansion

2010-08-13 Thread Nicolas Oury
Dear all, In my project, I need (in order to share constant trees in rule definitions), to define new variable during macro expansion. What I do currently: I keep all the constant definitions and the rules definitions in an atom and at the end, I call a macro at top level that define everything,

Re: chinese character in hiccup

2010-08-13 Thread ngocdaothanh
Perhaps Jetty add a charset of iso-8859-1 if there isn't one in response I think this behavior is specified in the servlet spec: If no charset is specified, ISO-8859-1 will be used

ANN: form-dot-clj - HTML form validation and display

2010-08-13 Thread Saul Hazledine
Form-dot-clj is library for handling the display and validation of forms. It Supports HTML5 forms, javascript validation and plain HTML. It should work with most methods of generating HTML. http://github.com/alienscience/form-dot-clj In the last 10 minutes I have also found a library called pour

Re: chinese character in hiccup

2010-08-13 Thread limux
Then, if Ring doesn't care of the charset also, there is no one, suck as jetty, ring, compojure would take care of the charset except myself. There are many peopole come from all kinds of country or region who use ring, jetty and compojure. Let themselves set the right charset manually by wrap? I

Re: chinese character in hiccup

2010-08-13 Thread limux
One word, Why we would let Jetty set default charset to iso-8859-1, Why not Compojure can set the default charset to utf-8? Isn't utf8 a better choice? Is iso-8859 better than utf-8? On 8月13日, 下午5时05分, ngocdaothanh ngocdaoth...@gmail.com wrote: Perhaps Jetty add a charset of iso-8859-1 if there

Re: chinese character in hiccup

2010-08-13 Thread James Reeves
2010/8/13 limux liumengji...@gmail.com: Then, if Ring doesn't care of the charset also, there is no one, suck as jetty, ring, compojure would take care of the charset except myself. There are many peopole come from all kinds of country or region who use ring, jetty and compojure. Let

More urgency for CinC CLR given Oracle's lawsuit against Google?

2010-08-13 Thread Seth
Given Oracle's lawsuit against Google for its use of the JVM, is anyone else suddenly much more concerned about the states of Clojure in Clojure and CLR compatibility? I know the former is an important goal and also that the existence of the latter is due to heroic volunteer efforts on behalf of a

Re: More urgency for CinC CLR given Oracle's lawsuit against Google?

2010-08-13 Thread Nicolas Oury
I believe they do not sue over the JVM but over Dalvik. The OpenJDK is,I think, a bit protected frompatents by its license and the fact t has been distributed by the patents' owner. However, Clojure in Clojure and better support of other platforms would be great. On Fri, Aug 13, 2010 at 12:13

Re: chinese character in hiccup

2010-08-13 Thread limux
You are right that there should be such a middleware in Ring. On 8月13日, 下午6时40分, James Reeves jree...@weavejester.com wrote: 2010/8/13 limux liumengji...@gmail.com: Then, if Ring doesn't care of the charset also, there is no one, suck as jetty, ring, compojure would take care of the charset

Re: More urgency for CinC CLR given Oracle's lawsuit against Google?

2010-08-13 Thread nickikt
Clojure runnes manly on the JVM. Oracle ownes (or has the patents) why should anything change for clojure? As far as Dalvik goes. Why should Clojure care the lawsuit is about implementation details (as far as I understand) in the VM the basic working will be the same. Befor starting a real

Re: chinese character in hiccup

2010-08-13 Thread Steve Purcell
On 13 Aug 2010, at 11:40, James Reeves wrote: I think it would be worth adding some charset setting middleware to Ring, though, and perhaps document this behaviour. +1 -- character encoding is exactly the kind of thing one would want to set up application-wide. -Steve -- You received this

Re: Protocols and default method implementations

2010-08-13 Thread Rich Hickey
On Aug 12, 2010, at 7:52 PM, Tim Daly wrote: I find that I'm horribly confused at this point about what a protocol is. Can someone use some other comp. sci. terms to define this idea? I thought of them as Java interfaces with default methods but clearly I'm wrong. Coming from CL, the best

cljr-record: what's the idiomatic way to create API to database?

2010-08-13 Thread jandot
Hi all, I'd like to build a clojure api to a mysql database. Have done this previously using ruby's ActiveRecord which makes this very easy. clj- record apparently provides the same kind of functionality. The clj-record README shows how to create an interface to a table (let's say employees)

Re: Protocols and default method implementations

2010-08-13 Thread Nicolas Oury
On Fri, Aug 13, 2010 at 1:17 PM, Rich Hickey richhic...@gmail.com wrote: not. They *sometimes* use interfaces in the implementation, but not always. At no point should one assume that because a type supports a protocol it 'isA' that protocol (or its interface). That's very interesting. From a

Re: cljr-record: what's the idiomatic way to create API to database?

2010-08-13 Thread Meikel Brandmeyer
Hi, On 13 Aug., 14:51, jandot jan.ae...@gmail.com wrote: The clj-record README shows how to create an interface to a table (let's say employees) with:     (ns our-warehouse.employee       (:require clj-record.boot))     (def db ...a clojure.contrib.sql db-spec...)    

Re: Protocols and default method implementations

2010-08-13 Thread Meikel Brandmeyer
Hi, On 13 Aug., 14:58, Nicolas Oury nicolas.o...@gmail.com wrote: That's very interesting. From a performance point of view, is there a penalty involved in being in a case where the implementation does not use interfaces? Using extend is slower, but more dynamic (read: mix-in via map merge

Re: Protocols and default method implementations

2010-08-13 Thread Nicolas Oury
On Fri, Aug 13, 2010 at 2:46 PM, Meikel Brandmeyer m...@kotka.de wrote: Using extend is slower, but more dynamic (read: mix-in via map merge vs. hard-wiring things with inline definition). Interesting... Is there a link explaining how it is implemented in the extend situation and how much

Re: Protocols and default method implementations

2010-08-13 Thread nickikt
@rich What are your thoughts on the default implementation problem? On Aug 13, 2:17 pm, Rich Hickey richhic...@gmail.com wrote: On Aug 12, 2010, at 7:52 PM, Tim Daly wrote: I find that I'm horribly confused at this point about what a protocol is. Can someone use some other comp. sci. terms

Re: Resource cleanup when lazy sequences are finalized

2010-08-13 Thread Jeff Palmucci
Any interest in moving this to clojure-contrib? It seems like a pretty useful facility to have for a language like clojure that relies so heavily on lazy sequences. Also, it's an easy way to implement a pretty common parallel programming pattern, two threads communicating through a buffered

Re: What's a single-segment namespace and why should it be avoided?

2010-08-13 Thread Adam Schmideg
On Aug 12, 2:09 pm, Meikel Brandmeyer m...@kotka.de wrote: it's for technical reasons. Clojure wll then generate classes without a package, which causes them to be put in the default package. There are problems/restrictions/issues with classes in the default package. I'm not a JVM expert, so

Re: What's a single-segment namespace and why should it be avoided?

2010-08-13 Thread Evan R. Murphy
Thanks for responding. I'm glad to know this is about technical limitations rather than some preference for deeper namespace hierarchies. On Aug 12, 2:42 pm, Armando Blancas armando_blan...@yahoo.com wrote: The Java compiler doesn't like it; it won't import it from other packages. The JVM won't

Re: Protocols and default method implementations

2010-08-13 Thread Matthew Phillips
On Aug 13, 3:38 am, Stuart Halloway stuart.hallo...@gmail.com wrote: Stu, (or anybody) I'd like to ask about a variation on this point. How do you handle the case where you have a general function that works for every type you'd like to implement a protocol for (thus not technically

ANN: Lambdebug, A stepping debugger for the REPL

2010-08-13 Thread Adam Schmideg
Hi, this is my attempt to enter the Clojure debugger market :) Feedbacks are welcome, and thanks to Kotka for his comment on the previous version. You can find it at http://lambdebug.github.com Adam -- You received this message because you are subscribed to the Google Groups Clojure group.

Re: What is the good way of def-ing during macro expansion

2010-08-13 Thread Evan R. Murphy
Hi Nicolas, What I do currently: I keep all the constant definitions and the rules definitions in an atom and at the end, I call a macro at top level that define everything, in the dependency order. Would you mind posting an example of this? That would definitely help me to better understand

Game development in Clojure

2010-08-13 Thread Mike Anderson
Hello all, I've recently been working on a game development project in Clojure which is now starting to bear fruit. I thought people here might be interested, and that it would be worthwhile to share some experiences and perspectives. The project is a steampunk-themed strategy game, and a

Re: Protocols and default method implementations

2010-08-13 Thread Stuart Halloway
Following Stuart's suggestion, I *could* just add a protocol called PrettyPrintable with one method and implement it on some of the new node types, but now I can't just call pretty-print on any node: I need to write another function that checks if it's a PrettyPrintable first and calls

Re: Game development in Clojure

2010-08-13 Thread Mac
On Aug 13, 9:51 am, Mike Anderson mike.r.anderson...@gmail.com wrote: 2. It would be great to reduce the amount of memory allocations. Yes, I know memory is plentiful and GC is very cheap, but it's still not as cheap as stack allocation and any noticeable GC pauses are not good for the

Re: More urgency for CinC CLR given Oracle's lawsuit against Google?

2010-08-13 Thread Heinz N. Gies
On Aug 13, 2010, at 13:13 , Seth wrote: Given Oracle's lawsuit against Google for its use of the JVM, is anyone else suddenly much more concerned about the states of Clojure in Clojure and CLR compatibility? As far as I understand those things are absolutely not related, oracle isn't suing

Re: What's a single-segment namespace and why should it be avoided?

2010-08-13 Thread Meikel Brandmeyer
Hi, Am 12.08.2010 um 21:48 schrieb Adam Schmideg: You can't call anything in the default package from a regular package. But I think (ns foo) would compile into a foo package, so this wouldn't be a problem. No. It compiles to something like foo__init.class, which lives in the default

Re: More urgency for CinC CLR given Oracle's lawsuit against Google?

2010-08-13 Thread Quzanti
I think it is all just posturing and gamesmanship, and will get settled by Google paying some sort of fee. Unless Google can buy someone with patents that Oracle is infringing then they can cross license. The only two implications I can think of are (1) Hardly helpful for people's confidence in

Re: Resource cleanup when lazy sequences are finalized

2010-08-13 Thread David Andrews
Easy enough to use via lein (thanks for uploading it to clojars BTW). I think it deserves a place in cc. -- 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

Re: Game development in Clojure

2010-08-13 Thread Brian Carper
On Aug 13, 6:51 am, Mike Anderson mike.r.anderson...@gmail.com wrote: Hello all, I've recently been working on a game development project in Clojure which is now starting to bear fruit. I thought people here might be interested, and that it would be worthwhile to share some experiences and

Re: More urgency for CinC CLR given Oracle's lawsuit against Google?

2010-08-13 Thread evins.mi...@gmail.com
On Aug 13, 11:32 am, Quzanti quza...@googlemail.com wrote: The only two implications I can think o (1) Hardly helpful for people's confidence in the Java Platform, if Oracle embarks on these kind of surprise antics. May push people towards CLR. If Oracle start getting aggressive, then

Re: Game development in Clojure

2010-08-13 Thread Wilson MacGyver
I assumed he didn't use OpenGL because it's a 2d tile game? Using OpenGL for 2d or 2.5d (isometric) is really only a good idea if you can assume the target has hardware OpenGL acceleration. Even then you may not want to do that, due to battery concerns. On Fri, Aug 13, 2010 at 2:06 PM, Brian

Re: What is the good way of def-ing during macro expansion

2010-08-13 Thread Nicolas Oury
No problem Evan, (def constants (atom ())) (defn add-constant [name x] (let [sym (gensym name)] (reset! constants (cons ([sym x]) @constants) sym )) Then when I produce code, I call add-constant and use the returned symbol. (I only use it to produce new constants, which is the

Re: Game development in Clojure

2010-08-13 Thread Nicolas Oury
On Fri, Aug 13, 2010 at 2:51 PM, Mike Anderson mike.r.anderson...@gmail.com wrote: 2. It would be great to reduce the amount of memory allocations. Yes, I know memory is plentiful and GC is very cheap, but it's still not as cheap as stack allocation and any noticeable GC pauses are not good

Re: ANN: form-dot-clj - HTML form validation and display

2010-08-13 Thread Emeka
Thanks for sharing, I will be trying out your lib. I am doing some web thing. Emeka On Fri, Aug 13, 2010 at 10:11 AM, Saul Hazledine shaz...@gmail.com wrote: Form-dot-clj is library for handling the display and validation of forms. It Supports HTML5 forms, javascript validation and plain

Re: Protocols and default method implementations

2010-08-13 Thread Armando Blancas
A more concrete example: say I've defined a protocol for AST nodes in 1.0 of a library, and later when developing 2.0 I discover it would have been a good idea to have a pretty-print method on nodes to show human-readable output. If the protocol had Trait-like characteristics I could add

Re: Game development in Clojure

2010-08-13 Thread Peter Schuller
This can be made a bit better by turning Escape Analysis on? Have you tried that? The G1 collector is supposed to have lower latency. Have you tried it? http://research.sun.com/jtech/pubs/04-g1-paper-ismm.pdf (GC choice/tuning is a lng story, but some select suggestions follow) First

Re: Game development in Clojure

2010-08-13 Thread Alan
Funny you should mention this - I was about to post a question about my own game when I saw your article. My issue is, I assume someone has written minimax and/or alpha-beta pruning in Clojure (or a java library that's easy to interop with). My case is slightly different in that the turn order is

Re: More urgency for CinC CLR given Oracle's lawsuit against Google?

2010-08-13 Thread Mikhail Kryshen
CLR also infringes Oracle's patents and the only reason why Oracle is not likely to sue Microsoft is that Microsoft could do the same to Oracle. See http://jonathanischwartz.wordpress.com/2010/03/09/good-artists-copy-great-artists-steal/ Mono - the open source implementation of .NET also has

Re: Game development in Clojure

2010-08-13 Thread Wilson MacGyver
Paradigms of artificial intelligence programming: case studies in Common LISP By Peter Norvig has a full chapter on this (ch18), complete with code in Common LISP. his Artificial Intelligence: A Modern Approach is also a good book if you are interested in game AI. 3rd edition just came out

Re: More urgency for CinC CLR given Oracle's lawsuit against Google?

2010-08-13 Thread Mike Meyer
On Fri, 13 Aug 2010 23:08:40 +0400 Mikhail Kryshen mikh...@kryshen.net wrote: I doubt it is possible to create runtime like JVM or CLR without patent problems. Given that virtual machine technology like(1) the JVM and CLR have been around since the 70s - long before even C++ ++ -- was a gleam

Re: More urgency for CinC CLR given Oracle's lawsuit against Google?

2010-08-13 Thread Seth
Sorry all -- I think my original message went slightly awry. The announcement was a shock and quickly followed by waves of grumbling from devs I follow on Twitter. While it's easy to extrapolate the future from Oracle's past and this announcement, it's not necessarily useful or accurate to do so.

Re: Game development in Clojure

2010-08-13 Thread Brian Carper
On Aug 13, 11:09 am, Wilson MacGyver wmacgy...@gmail.com wrote: I assumed he didn't use OpenGL because it's a 2d tile game? Using OpenGL for 2d or 2.5d (isometric) is really only a good idea if you can assume the target has hardware OpenGL acceleration. Even then you may not want to do that,

Re: Game development in Clojure

2010-08-13 Thread Wilson MacGyver
On Fri, Aug 13, 2010 at 4:51 PM, Brian Carper briancar...@gmail.com wrote: But there are some good OpenGL 2D game engines for Java, e.g. Slick[1].  There's also Penumbra[2] which nicely wraps LWJGL for Clojure.  I ask this mostly because I'm making my own 2D game and somewhat torn between

Transactions in c.c.sql functions

2010-08-13 Thread Shantanu Kumar
Hi, While going through the clojure.contrib.sql sources I noticed at several places that a new transaction is started to execute the operation under. Case at hand: do-commands, do-prepared, update-or- insert-values. As far I understand, transactions belong to the user. The user should decide

Re: More urgency for CinC CLR given Oracle's lawsuit against Google?

2010-08-13 Thread dmiller
I'm in favor of any discussion that yields more support for Clojure on CLR. :) - David On Aug 13, 3:36 pm, Seth seth.schroe...@gmail.com wrote: Sorry all -- I think my original message went slightly awry. The announcement was a shock and quickly followed by waves of grumbling from devs I

Re: Game development in Clojure

2010-08-13 Thread BerlinBrown
I played it, it was pretty fun. I have UI recommendations. I couldn't tell the difference between the enemy and my units. I wish maybe you had some quick tips and recommended next actions so I could get used to how the game works. On Aug 13, 9:51 am, Mike Anderson mike.r.anderson...@gmail.com

Protocols not changing the caller's contract

2010-08-13 Thread Brenton
Greetings, Suppose that I create a function that is designed to receive a map as a parameter: (defn add-ten [m] (+ 10 (:amount m))) but then later I want to make this function part of a protocol (defprotocol AddTen (add-ten [this])) but I still want it to work when someone passes a plain

Re: Protocols not changing the caller's contract

2010-08-13 Thread Kevin Downey
IPersistentMap is an interface, which are sort of the java analog of protocols, and in fact last I checked protocols generate named java interfaces, so I think you're fine On Fri, Aug 13, 2010 at 5:10 PM, Brenton bashw...@gmail.com wrote: Greetings, Suppose that I create a function that is

Re: Game development in Clojure

2010-08-13 Thread Eric Lavigne
3. I think it would be great to have better support for circular references - perhaps a two-pass compile? The reason this is particularly acute in game development is that different subsystems have quite a lot of inter-dependencies. AI evaluation system needs to understand game state/engine

Re: Game development in Clojure

2010-08-13 Thread Wilson MacGyver
I rarely run into this. The few times I have, I just do (def g) ;creates a var g that is unbound (defn f [] (g)) ;ok (defn g [] ;f will call this nil) as shown by Rich at http://markmail.org/message/vuzvdr4xyxx53hwr#query:+page:1+mid:tzsd3k6tvvc4ahoq+state:results On Fri, Aug 13,

Re: Game development in Clojure

2010-08-13 Thread Eric Lavigne
The (def g) in your example has the same effect as the (declare foo) in my example. I discussed two problems. The first problem, which you addressed, was mostly just a warm-up for discussing a related problem that is more severe. Where can I put (def g) so that two files can require each other?

Re: Game development in Clojure

2010-08-13 Thread Tim Daly
Suppose you make a file containing a (def foo) form for every defn in every file and then load that first? Does that solve the circular reference problem? Tim Daly Eric Lavigne wrote: The (def g) in your example has the same effect as the (declare foo) in my example. I discussed two problems.

Re: Game development in Clojure

2010-08-13 Thread Wilson MacGyver
I realize that. I was pondering why I don't run into the the 2nd problem. In your code, how many files/name spaces are you creating? And how many lines of code are in each file? I'm curious how you organize your code. On Aug 14, 2010, at 12:39 AM, Eric Lavigne lavigne.e...@gmail.com wrote: .

two announcements: a new Clojure article, and a new site for beginners

2010-08-13 Thread Gregg Williams
** First announcement: a tutorial article on how to call Java classes from Clojure Several months ago, I asked a few questions about the use of proxy and interoperability with Java. I'm pleased to say that with the help of several members here, I was able to get past being stuck and finish my