Re: Strapped to the JVM?

2009-02-07 Thread Jon Harrop
On Saturday 07 February 2009 00:19:44 mikel wrote: > Can you imagine a Clojure implementation on a different underlying > runtime? Which ones might possibly be suitable? Can you imagine a > Clojure on top of, say the CLR? Or on top of a Common Lisp? Or on GHC > or perhaps the LLVM? IMHO the world

JDK annotations with clojure?

2009-02-07 Thread Mark Derricutt
Hi all, Is it possible to generate JDK annotations on namespaces using :gen-class at all? Maybe as some form of meta information attached to a (defn) statement? Mark ...and then Buffy staked Edward. The End. --~--~-~--~~~---~--~~ You received this message becau

Re: unchecked methods for floats/doubles?

2009-02-07 Thread Korny Sietsma
Ah - I didn't realise that. I was trying to avoid the overhead, as I understood it, of both converting the parameters to Float/Double objects, and then of checking for overflow. So '*' and '+' don't do overflow checking - do they need to convert primitives to/from objects? Specifically, when I

Re: Sudoku solver with GUI

2009-02-07 Thread Tzach
Thanks Keith, I update the version with your inputs, should have test it first. Laurent, is it consider a bad practice to use hyphen on general, or just as ns / file names? Tzach On Feb 7, 1:36 am, Laurent PETIT wrote: > Hello, not related to your question, but  you should consider renaming you

Re: sorted-set-by?

2009-02-07 Thread puzzler
Still, I think it's a good point that since Clojure has sorted-map-by, it seems logical to expect that it would also have sorted-set-by. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Re: Sudoku solver with GUI

2009-02-07 Thread Laurent PETIT
>From what I know, it's a good pratice to use hypens and lower case letters in general in the "lisp" world, and it is also a good rule in clojure. But since namespaces and java classes don't accept hyphens, it is already hard coded in clojure that hyphens are replaced with underscores in namespace

Cells tutorial

2009-02-07 Thread falcon
http://github.com/stefano/cells-doc/raw/7d3ae47d540f418588f4dd8d985c2592128ab642/cells-doc.pdf various formats: http://github.com/stefano/cells-doc/tree/master --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure"

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-07 Thread Meikel Brandmeyer
Hello, Am 06.02.2009 um 09:34 schrieb mikel: (prefer-method frob ::idea ::thing) (prefer-method [::runtime-tag1 ::idea] [::runtime-tag1 ::thing]) (prefer-method [::runtime-tag2 ::thing] [::runtime-tag2 ::idea]) Provide a dispatch fn that extracts the runtime tag. Yuck. Instead of definin

Re: General form of apply

2009-02-07 Thread Meikel Brandmeyer
Hello, user> (apply + 1 2 3 [4 5]) Exactly - except that it doesn't work for me! Do you mabe have some more specific information than "it doesn't work"? This form works for me and in fact always did. Do you maybe try: (apply + 1 [2 3] 4)? Sincerely Meikel smime.p7s Description: S/MIME cr

Re: Strapped to the JVM?

2009-02-07 Thread Konrad Hinsen
On 07.02.2009, at 01:19, mikel wrote: > What happens to Clojure if something bad happens to the JVM? > > It's not that I think the JVM is going away any time soon. Sure, Sun > looks kind of shaky right now, but there are alternative sources of > JVMs. Probably the JVM can survive even if Sun does

Re: Tools for parsing arguments

2009-02-07 Thread Meikel Brandmeyer
Hi, There is also a defnk macro by Rich, which allows easy definition of keyword args for functions. http://paste.lisp.org/display/69347 Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature

Problem installing clojure-dev with Eclipse

2009-02-07 Thread AlamedaMike
I want to install clojure-dev on Eclipse but I'm getting an error when I use Eclipse's software update feature. "Cannot complete the request. See the details. Unsatisfied dependency: [clojuredev.feature.feature.group 0.0.18] requiredCapability: org.eclipse.equinox.p2.iu/org.antlr.runtime/3.0.0"

Re: Strapped to the JVM?

2009-02-07 Thread Jon Harrop
On Saturday 07 February 2009 09:50:29 Konrad Hinsen wrote: > On 07.02.2009, at 01:19, mikel wrote: > > Can you imagine a > > Clojure on top of, say the CLR? Or on top of a Common Lisp? Or on GHC > > or perhaps the LLVM? > > There is a JVM on top of the LLVM already, search for vmkit for the > deta

Re: String/valueOf on char array

2009-02-07 Thread Christian Vest Hansen
On Sat, Feb 7, 2009 at 5:29 AM, Kevin Albrecht wrote: > > Why is this happening? > > (def cs (make-array Character/TYPE 1024)) > > (apply str cs) > -> "" > > (String/valueOf cs) > -> "[...@42880d" > > Shouldn't these return the same value? Your "cs" var have type Object and therefor hits the gen

Re: Sudoku solver with GUI

2009-02-07 Thread Mibu
If you want to test your code, you can use the 50 sudokus from Project Euler problem 96: http://projecteuler.net/index.php?section=problems&id=96 You will have to register and log in to check your answer. On Feb 6, 4:22 pm, Tzach wrote: > Hi all > As my first Clojure project, I decided to fina

Re: Trying to make a recursive parser, puzzling over certain behavior

2009-02-07 Thread James Reeves
On Feb 5, 6:03 am, samppi wrote: > user=> ((array) (seq "[0,0]")) ; This works as intended: > [[\[ \0 \, \0 \]] nil] > user=> (value (seq "[0,3]")) ; This should return nil, but a weird > argument exception is raised instead: > java.lang.IllegalArgumentException: Key must be integer > (NO_SOURCE_

Re: unchecked methods for floats/doubles?

2009-02-07 Thread Rich Hickey
On Feb 7, 2009, at 3:43 AM, Korny Sietsma wrote: > > Ah - I didn't realise that. I was trying to avoid the overhead, as I > understood it, of both converting the parameters to Float/Double > objects, and then of checking for overflow. > > So '*' and '+' don't do overflow checking - do they need

Re: sorted-set-by?

2009-02-07 Thread Rich Hickey
On Feb 7, 2009, at 3:58 AM, puzzler wrote: > > Still, I think it's a good point that since Clojure has sorted-map-by, > it seems logical to expect that it would also have sorted-set-by. > Yes, this is just an API gap. Issue/patch welcome. Rich --~--~-~--~~~---~--~

Re: Problem installing clojure-dev with Eclipse

2009-02-07 Thread Laurent PETIT
Yes, it's weird. Your problem, as stated, is that it can't manage to find the antlr required dependency. Maybe it's your eclipse installation, maybe it's the plugin (can't be 100% sure it's not the plugin, because I haven't tested it on Vista). In order to make you install clojuredev, I've added

Re: What profilers are you using?

2009-02-07 Thread David Powell
Newer versions of JDK 1.6, eg Update 11, have an application called 'jvisualvm' in the bin directory. It lets you attach to any running Java process and it has a profiler that you can switch on at runtime. It seems quite good. It does profiling via instrumentation, and yet doesn't slow the app d

Compiler information

2009-02-07 Thread Laurent PETIT
Hello, Rich & all, I'd like to implement problem markers in text editors in clojuredev. For this to work, it would be interesting to be able to get the fully qualified named of the file where the error occurs. Currently, it seems to me that only the name of the file is printed in the message. It

Re: Question about clojure.lang.Compiler.writeClassFile()

2009-02-07 Thread Rich Hickey
On Feb 6, 2:42 pm, Laurent PETIT wrote: > Hello, > > I could test the patch, it works really well. With it, no need to implement > periodic polling, which is really a bad solution when on e can avoid it! > > Still don't know if there could be a performance impact that would require > to have th

Re: General form of apply

2009-02-07 Thread Konrad Hinsen
On 07.02.2009, at 10:48, Meikel Brandmeyer wrote: >>> >>> user> (apply + 1 2 3 [4 5]) >> Exactly - except that it doesn't work for me! > > Do you mabe have some more specific information > than "it doesn't work"? This form works for me and > in fact always did. On my home machine, it works as we

Random elements

2009-02-07 Thread Jeffrey Straszheim
Is there a function, perhaps in contrib somewhere, when given a collection, returns a single random element? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cloj

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-07 Thread David Nolen
> > On the issue list there is a patch for per-defmulti hierarchies, > waiting for Rich's approval. Although it's not predicate dispatch > it might help to bridge the time until the SoC project gives us > predicate dispatch. > > Sincerely > Meikel > > +1 for this, without this the usefulness of mak

Re: New York Hadoop User Group, Feb. 10

2009-02-07 Thread Stuart Sierra
On Feb 6, 2:16 am, H Durer wrote: > That's a shame.  Do you have any links, docs, whatever to show what > you have done with this, what can be done, how, etc.? Well, all my code is open-source :) http://github.com/lawcommons Most of the Clojure code is in the "altlaw-backend" project. I'll try

Re: ANN: clojure.contrib.error-kit

2009-02-07 Thread David Nolen
Nice I will most definitely be checking this out and get back with thoughts. I've been fearing the need to define custom Java Exception for my code and this looks most useful for people who wish to code as much as possible in pure Clojure. On Fri, Feb 6, 2009 at 9:10 PM, Chouser wrote: > > It's

Re: Questions about a Clojure Datalog

2009-02-07 Thread John Fries
I agree with Jeffrey that there is no reason to have just one option. Sometimes you want your reasoner to find a single model; sometimes you want it to find all models (assuming you are reasoning over a finite set). I've appended a long rant about SAT-based reasoners and open-world semantics. I h

Re: Random elements

2009-02-07 Thread Jason Wolfe
Not yet, but perhaps soon. Code is here: http://code.google.com/p/clojure-contrib/issues/detail?id=8 -Jason On Feb 7, 8:51 am, Jeffrey Straszheim wrote: > > Is there a function, perhaps in contrib somewhere, when given a collection, > returns a single random element? > --~--~-~--~--

Re: What type of arguments are passed to a macro exactly?

2009-02-07 Thread Michael Wood
On Fri, Feb 6, 2009 at 11:51 PM, CuppoJava wrote: > > Ah thank you that works perfectly! > > I actually have a reading list i'm about to set out upon, and Paul > Graham's OnLisp is on it. > > I'm just wondering from your perspective which book do you think I > should start on? For someone with ma

Newbie: applying arguments into a macro

2009-02-07 Thread samppi
Let's say I have a macro: (defmacro foo [& args] ...) I want to do something equivalent to this: (defn bar-fn [factor arg] (apply foo (replicate factor arg))) ...but since I can't take values of macros, I have to do something like this, right? (defmacro bar [factor arg] `(foo ~@(replicate

Re: Newbie: applying arguments into a macro

2009-02-07 Thread Meikel Brandmeyer
Hi, Am 07.02.2009 um 22:19 schrieb samppi: (defmacro bar [factor arg] `(foo ~@(replicate factor arg))) ...but then when I use it I get a ClassCastException if I try to do something like (bar (dec 5) something), because then Clojure tries to evaluate (replicate '(dec 5) 'something). So how sh

Re: Newbie: applying arguments into a macro

2009-02-07 Thread Laurent PETIT
Hello, Is it theoretical, or do you have a concrete use case we could try to help you with ? 2009/2/7 samppi > > Let's say I have a macro: > > (defmacro foo [& args] ...) > > I want to do something equivalent to this: > (defn bar-fn [factor arg] > (apply foo (replicate factor arg))) > > ...bu

Re: IntelliJ Plugin -- Wonderful News!

2009-02-07 Thread Howard Lewis Ship
I'm trying to build this locally; I haven't built an IDEA plugin before. Anyway, I've downloaded the 8.0.1 dev kit and installed it, but class com.intellij.openapi.module.JavaModuleType doesn't exist, although this a JAR with other classes from that package. I must have the wrong version of the

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-07 Thread mikel
On Feb 6, 5:18 pm, David Nolen wrote: > > I built 4 iterations of a model/protocol/thing system, accumulating > > more requirements for it with each iteration. This discussion has had > > the nice side-effect of grooming my requirements into a tidy state > > that I can use for reference. What I

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-07 Thread mikel
On Feb 7, 12:32 pm, David Nolen wrote: > > On the issue list there is a patch for per-defmulti hierarchies, > > waiting for Rich's approval. Although it's not predicate dispatch > > it might help to bridge the time until the SoC project gives us > > predicate dispatch. > > > Sincerely > > Meike

Re: Got a Clojure library?

2009-02-07 Thread James Reeves
Name: Rend URL: http://github.com/weavejester/rend Author: James Reeves Categories: strings, testing License: EPL Dependencies: None Description: Rend is a library for generating random strings from regular expressions. Useful for generating test data. --~--~-

Re: Newbie: applying arguments into a macro

2009-02-07 Thread samppi
You mean there's no way to define bar? Here's some context. I had a metafunction, conc: (defn conc [& subrules] (fn [tokens] (loop [subrule-queue (seq subrules), remaining-tokens (seq tokens), products []] (if (nil? subrule-queue) [products remaining-tokens] (let [[su

Re: Trying to make a recursive parser, puzzling over certain behavior

2009-02-07 Thread samppi
Oh, cool. That's a lot like my fnparse library: http://github.com/joshua-choi/fnparse/. I never did figure out exactly why the behavior above occurred, but I found a solution for my problem at http://groups.google.com/group/clojure/browse_thread/thread/8c78b993402638a1. On Feb 7, 6:19 am, James

pmap issues

2009-02-07 Thread Jeffrey Straszheim
Are there any knows problems with nesting calls to pmap inside of other calls to pmap ? --~--~-~--~~~---~--~~ 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 To

Re: Trying to make a recursive parser, puzzling over certain behavior

2009-02-07 Thread James Reeves
On Feb 7, 11:43 pm, samppi wrote: > I never did figure out exactly why the behavior above occurred, but I > found a solution for my problem at > http://groups.google.com/group/clojure/browse_thread/thread/8c78b9934 Yep, if you want to refer to a var that hasn't been defined, wrap your rule

Minor bug report: (merge-with f) returns nil, not {}

2009-02-07 Thread Jason Wolfe
merge-with says it returns a map, but if you give it no arguments it gives you back nil instead of the empty map. In my code, I had something like: ((apply merge-with concat maps) key) and got NPE rather than "nil" when "maps" was empty. It looks like "merge" has the same issue too. Cheers, J

Re: pmap issues

2009-02-07 Thread Jeffrey Straszheim
With the help of the IRC folks I solved my own problem. I thought I'd share my findings: You cannot safely call pmap inside of another pmap function. Because pmap is implemented on top of agents, the actual calls to your function are agent sends. When a send happens *inside* of another agent f