Re: newbie question casting java classes/interfaces

2010-07-28 Thread Tobias Ivarsson
Yes, this is a perfectly valid error, it simply means what it says. That it's impossible to cast an instance of EmbeddedGraphDatabase to the NeoService interface. The reason for this is of course that EmbeddedGraphDatabase does not implement the NeoService interface. As you said, you were mixing in

Re: Log SQL in clojure.contrib.sql

2010-07-28 Thread ngocdaothanh
I found: http://code.google.com/p/log4jdbc/ On Jul 27, 11:31 pm, ngocdaothanh wrote: > Hi, > > I would like to ask if there is a way to log SQL generated by > clojure.contrib.sql to console for inspection. > > Thanks. -- You received this message because you are subscribed to the Google Groups

Re: Idea for personal Clojure project

2010-07-28 Thread Cameron Pulsford
A very good place to start searching about edit distances between words and some related stuff can be found on Peter Norvigs site at: http://norvig.com/spell-correct.html Also, try to find some wikipedia articles about the bm25 ranking algorithm, I used clojure for an assignment at school that

Re: newbie question casting java classes/interfaces

2010-07-28 Thread Sandeep Puri
Sorry didn't answer your question.. The error I got was "Cannot cast GraphDBService to NeoService" On Jul 28, 8:54 pm, Sandeep Puri wrote: > It's not the JPA one. It's the meta-model work-in-progress for the > neo4j project. > > It so happens I was using neo4j-1.1-snapshot with an older meta-mode

Re: newbie question casting java classes/interfaces

2010-07-28 Thread Sandeep Puri
It's not the JPA one. It's the meta-model work-in-progress for the neo4j project. It so happens I was using neo4j-1.1-snapshot with an older meta-model implementation. I pulled the meta-model-0.9 snapshot which seems to work.fine. But the above question is still valid in a generic sense.. On Ju

Re: Idea for personal Clojure project

2010-07-28 Thread Daniel E. Renfer
On 7/28/10 5:34 PM, Mark Engelberg wrote: > Wordnet is the main existing thing that comes to mind as related to your > idea. > You might also want to look into Freebase. Here's a Clojure client you can use to query their data. http://github.com/rnewman/clj-mql signature.asc Description: OpenPG

Re: Idea for personal Clojure project

2010-07-28 Thread Luke VanderHart
This is a hard problem. If you go by degrees and shades of synonymity, it can (and has been) done manually - see Visual Thesaurus (http:// www.visualthesaurus.com/). But for grouping based on the same semantic topics - that's pretty difficult. You could do it based on co-location in a corpus, but

Re: A bug in clojure.core/bean?

2010-07-28 Thread Armando Blancas
Looks like a bug to me. Fixed it locally with the change below, after the Java implementations where atVal(x) delegates to atVal(x,null). --- src/clj/clojure/core_proxy.clj |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/clj/clojure/core_proxy.clj b/src/clj/clojure/

Re: Idea for personal Clojure project

2010-07-28 Thread Mark Engelberg
Wordnet is the main existing thing that comes to mind as related to your idea. -- 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 moderated - please be pat

Idea for personal Clojure project

2010-07-28 Thread Daniel
I want to write a clojure program that searches for similarities of words in the english language and places them in a graph, where the distance between nodes indicates their similarity. I don't mean syntactical similarity. Related contextual meaning is closer to the mark. For instance: "fish" a

Re: Feedback on Clojure web development post

2010-07-28 Thread Daniel
Excellent job! It's great that you're willing to devote the time to help others learn more quickly & easily! On Jul 27, 9:42 am, Savanni D'Gerinel wrote: > I thought this was pretty awesomely informative, including the > deployment to Amazon Cloud.  I already playing through and doing > developm

Re: bit-and type hint

2010-07-28 Thread Peter Ryan
thanks! that worked. the cast to int makes sense is since the jvm will convert the byte value to an int for the & computation On Jul 27, 2:47 pm, Joost wrote: > Peter Ryan wrote: > > I am trying to avoid a reflective callback with this function: > > > (defn unsign-byte-from-buffer [#^java.nio.Byt

Re: slime-fancy

2010-07-28 Thread Dave
Thanks Alex, that worked. -- 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 moderated - please be patient with your first post. To unsubscribe from this

todays project.

2010-07-28 Thread bOR_
Hi all, Todays' project involved modelling what happens if an infected flea enters a burrow of gerbils. The biology is as follows: fleas feed daily on gerbils, and drop off after every meal, only to climb on one of the gerbils again. There is a small chance that a feeding flee infects a gerbil wit

Re: slime-fancy

2010-07-28 Thread Alex Ott
Re Dave at "Wed, 28 Jul 2010 10:25:13 -0700 (PDT)" wrote: D> If I use lein swank and have (slime-setup '(slime-repl)) in my .emacs, D> the repl doesn't work (try (+ 1 2)). Changing this to (slime-setup D> '(slime-repl)) fixes the problem. Anyone know why this should be? D> SBCL, CCL64, KAWA

slime-fancy

2010-07-28 Thread Dave
If I use lein swank and have (slime-setup '(slime-repl)) in my .emacs, the repl doesn't work (try (+ 1 2)). Changing this to (slime-setup '(slime-repl)) fixes the problem. Anyone know why this should be? SBCL, CCL64, KAWA and QiII work fine with (slime-setup '(slime-repl)). -- You received this

Re: Dynamic defrecord

2010-07-28 Thread Armando Blancas
> It seem to me there should be some way to load a record at run time > without breaking the immutability laws.    Once the dynamic data is > loaded, the record becomes immutable and will never be changed > again. Actually, that's how records work and is exactly the behavior of the initial (foo. n

Re: generating a list of random numbers

2010-07-28 Thread Sanel Zukan
> (repeatedly 100 #(rand-int 10)) Hm... on 1.1.: user=> (repeatedly 100 #(rand-int 10)) java.lang.IllegalArgumentException: Wrong number of args passed to: core$repeatedly (NO_SOURCE_FILE:0) user=> but, could be solved with: user=> (take 100 (repeatedly #(rand-int 10))) -- You received th

Re: Dynamic defrecord

2010-07-28 Thread Stuart Halloway
Hi Bill, Are your looking for something as simple as this: (defrecord Foo [x]) (defn load-a-record-at-runtime "Loads a record value from a file" [f] (Foo. (slurp f))) Or is there some subtlety here? Stu > The confusion over type and instance was a sloppy example. Sorry. > > But in yo

Re: Dynamic defrecord

2010-07-28 Thread Laurent PETIT
Hi, 2010/7/28 WoodHacker > The confusion over type and instance was a sloppy example. Sorry. > > But in your solution I'm confused by one thing. You create and > instance of Foo in the let and then assoc the new value of List1 to > it. > This has two problems. One is that the loaded data i

A bug in clojure.core/bean?

2010-07-28 Thread gfrlog
Hey folks, It was suggested to me in IRC to check here before filing a bug report. I've noticed that the mappish object returned by clojure.core/ bean will throw an NPE if you try to access a missing key. Since normal maps don't do this, and I can't think of any reason you would want that behavior

Re: Newbie style question - implementing binary search

2010-07-28 Thread Dave Snowdon
Thanks. That does look clearer. Dave On Jul 27, 4:15 pm, Joost wrote: > > I think the main thing that's confusing here is that you're messing > with offsets and split collections at once. At least is was confusing > to me. :) > > I think for binary search (which implies random lookup is ~ O(n) >

Re: destructuring using :as in fn arg vector

2010-07-28 Thread Cameron
Ahhh! It's so obvious now that I'm almost embarrassed. Thank you Randy Cam On Jul 27, 4:17 pm, Randy Hudson wrote: > The form you're looking for is (defn foo [ & [a b :as c]] ...) > > On Jul 27, 2:57 pm, Cameron wrote: > > > > > Hey all, just wondering if this is normal or not. There seems to

Re: generating a list of random numbers

2010-07-28 Thread Nikita Beloglazov
Hi, bOR_ Yes, there is easier variant: (repeatedly 100 #(rand-int 10)) On Wed, Jul 28, 2010 at 10:24 AM, bOR_ wrote: > Hi all, > > I have the nagging feeling that I'm missing a simple solution. Say I > want a list of a 100 rand-int 10 numbers. Currently, I create that by > doing (map (fn [_] (ra

Re: Clojure finally on SPOJ!

2010-07-28 Thread Cachou
Maybe SPOJ treat clojure as script language. In fact, though clojure is quite fast, loading the clojure.jar library takes a bit of time. And SPOJ count the class loading time into the running time. If the Judge Machine is similar to ideone.com, maybe the clojure.jar loading time is about 0.6~0.7s.

Re: Dynamic defrecord

2010-07-28 Thread WoodHacker
The confusion over type and instance was a sloppy example. Sorry. But in your solution I'm confused by one thing. You create and instance of Foo in the let and then assoc the new value of List1 to it. This has two problems. One is that the loaded data is not permanent. The other is that th

Re: newbie question casting java classes/interfaces

2010-07-28 Thread Chas Emerick
What error or other message do you get? Also, which MetaModelImpl is this? I assume it's not the JPA one. - Chas On Jul 27, 2010, at 2:38 PM, Sandeep Puri wrote: The snippet below works fine GraphDatabaseService neo = new EmbeddedGraphDatabase(dbpath); MetaModel model = new MetaModelImpl((

Re: generating a list of random numbers

2010-07-28 Thread bOR_
Ah. A sneaky difference between repeat and repeatedly there then :). Good to remember! On Jul 28, 9:35 am, Laurent PETIT wrote: > Hi, > > You could do: > > (repeatedly 100 #(rand-int 10)) > > HTH, > > -- > Laurent > > 2010/7/28 bOR_ > > > > > Hi all, > > > I have the nagging feeling that I'm mis

Re: fast development through clojure repl

2010-07-28 Thread Jeff Rose
You mention one use case of the repl, but I think that's just one part of a typical workflow. Say you decide to write a function, you start half way and then you realize that you need to group pairs of items in a vector and then turn these pairs into a vector of maps. Oh, but what order are the a

Re: generating a list of random numbers

2010-07-28 Thread Michael Wood
On 28 July 2010 09:24, bOR_ wrote: > Hi all, > > I have the nagging feeling that I'm missing a simple solution. Say I > want a list of a 100 rand-int 10 numbers. Currently, I create that by > doing (map (fn [_] (rand-int 10)) (range 100)). Is there an easier > way? I think Laurent's answer is bet

Re: generating a list of random numbers

2010-07-28 Thread Laurent PETIT
Hi, You could do: (repeatedly 100 #(rand-int 10)) HTH, -- Laurent 2010/7/28 bOR_ > Hi all, > > I have the nagging feeling that I'm missing a simple solution. Say I > want a list of a 100 rand-int 10 numbers. Currently, I create that by > doing (map (fn [_] (rand-int 10)) (range 100)). Is th

Re: fast development through clojure repl

2010-07-28 Thread nickikt
I never used emacs but in some videos I sah people doing cool stuff in it. So I started learning. I'm still a noob but I really like it already better then any IDE I have used. It makes working with the repl easy. On Jul 28, 1:49 am, Josh Stratton wrote: > > If you're rather looking for overall w

generating a list of random numbers

2010-07-28 Thread bOR_
Hi all, I have the nagging feeling that I'm missing a simple solution. Say I want a list of a 100 rand-int 10 numbers. Currently, I create that by doing (map (fn [_] (rand-int 10)) (range 100)). Is there an easier way? -- You received this message because you are subscribed to the Google Groups