Re: How to setup IntelliJ with Leiningen?

2011-06-06 Thread Vicente Bosch
Hi Phil,

Yeah, I can load my actual code files on the IDEs repl but that is half of
the deal. No? ( sorry if it sounds to oppinionated).

Are we supposed to go outside the ide to the console and launch "lein run"
or is the a way to have the IntelliJ Leiningen plugin run the project ? ( I
am perfectly fine the command console, just thought there would be a more
integrated way).

How do you load your Leiningen created projects into intelliJ ? ( I mean the
actual steps) Do you create a new one and indicate the folder where the
generated code is or do an "import/open" project and select a .clj ?

I have the feeling I am missing something like there must be a nice way to
do this and that IntelliJ will understand the depencies, load clojure
mode... make dinner for me.

Deeply appreciate the help.

Best,
Vicente


On 7 June 2011 02:05, Phil Hagelberg  wrote:

> On Jun 6, 2:47 pm, Vicente Bosch Campos 
> wrote:
> > 1) Create project with Leiningen on the command console: lein new
> monkeyproject
> > 2) If I select to open an existing project and point out to the
> project.clj:
> > - I have to add manually the lib folder to the dependencies
> otherwise running wont work.
> > - It does not add directly the clojure "aspect" or tooling
> > 3) When I select run on the project.clj it indicates me:
> >
> > /Users/vbosch/Programming/Clojure/hello/project.clj
> > Exception in thread "main" java.lang.Exception: Unable to resolve symbol:
> defproject in this context
>
> The project.clj file is just meant to be used by Leiningen. Your
> project's actual code should go in src/. Can you load any of the files
> in there?
>
> -Phil
>
> --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: porting an old project - where to begin?

2011-06-06 Thread Daniel
Meh.  I'm more or less giving up.  Being stuck on a peripheral problem
I have neither ability or desire to solve is about as fun as hacking a
four-year old program already written using java2d (having fun being
the main objective here)


On Jun 6, 7:32 pm, yair  wrote:
> I'm using processing in a Java2D program.  It doesn't have to be 3D...
>
> On Jun 4, 5:24 pm, Daniel  wrote:
>
>
>
>
>
>
>
> > I suppose the noob tag is appropriate ie I was around sometime last
> > year and earlier but RLing got in the way of doing anything useful
> > with this lovely language.
>
> > Anyway, I've got this old project (https://github.com/doubleagent/
> > Magic--legacy- ) which I've recently gained a renewed interest in, and
> > simultaneously am less concerned about the potential legal issues
> > which made me disinterested enough to drop it 4 years ago.  I'm proud
> > that it still builds and runs, but don't take the readme too
> > seriously, and I highly doubt the perl scripts work anymore.  The
> > intent was to write a program which assisted MTG (Magic: The
> > Gathering) players by providing them with robust deck building tools
> > and a way to compete over a network using the honor system.  Several
> > features are still unimplemented, and some were removed in this
> > version because the java2d worked too poorly to accommodate them.
>
> > I'd like to port it to Clojure, but in the process I'd also like to
> > solve some fundamental problems.  More specifically, real estate.  In
> > a real game you would not be able to see any of the cards in great
> > detail, but get an overall view of the board, and be able to inspect
> > cards more closely by zooming and panning (over the whole board - I
> > find Wotc's way of zooming on individual cards undesirable).  This is
> > even more critical when there are a lot of cards on the field eg some
> > decks can blast tokens onto the field which number into the hundreds.
>
> > I'm unsure how to approach this core problem in Clojure.  clj-
> > processing looks interesting, but I would prefer something more high
> > level b/c 3d graphics is difficult for me to wrap my head around.  In
> > particular, mapping a mouse click to the nearest movable object in 3d
> > space and ensuring proper draw updates on the object with dragging
> > *head asplode*
>
> > But I'm sure to be missing plenty.  Suggestions?

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


RE: Emacs - marmalade package install and .emacs file entries

2011-06-06 Thread Bhinderwala, Shoeb
Hi Phil

A lot of my problems went away when I downloaded Emacs version 24.

Also I am able to successfully use swank-clojure from emacs now using 
clojure-jack-in.

Thanks
Shoeb

-Original Message-
From: clojure@googlegroups.com [mailto:clojure@googlegroups.com] On Behalf Of 
Bhinderwala, Shoeb
Sent: Monday, June 06, 2011 5:42 PM
To: clojure@googlegroups.com
Subject: RE: Emacs - marmalade package install and .emacs file entries

Hi Phil -

I am on Windows XP with Emacs version 23.3

Don't know what is meant by install of package.el. I simply followed 
instructions at: 

   http://marmalade-repo.org/

and copied package.el to my ~/.emacs.d directory and added the following to my 
.emacs file:

(add-to-list 'package-archives 
   '("marmalade" . "http://marmalade-repo.org/packages/";))

If emacs version 23 is not supported, where can I get version 24? The gnu 
website does not list version 24 in the downloads:

   http://ftp.gnu.org/gnu/emacs/windows/


Thanks
Shoeb

-Original Message-
From: clojure@googlegroups.com [mailto:clojure@googlegroups.com] On Behalf Of 
Phil Hagelberg
Sent: Monday, June 06, 2011 4:40 PM
To: Clojure
Subject: Re: Emacs - marmalade package install and .emacs file entries

On Jun 6, 8:39 am, "Bhinderwala, Shoeb" 
wrote:
>   (add-to-list 'load-path "~/.emacs.d/elpa/clojure-mode-1.9.2/")
>   (require 'clojure-mode)
>
> If I don't add the above entry clojure mode does not work.

It sounds like this is a bug in package.el; this should all be handled
for you. If you are using Emacs 24 then maybe you could try M-x report-
emacs-bug since package.el is part of Emacs now. Otherwise it would
take some further debugging; package.el works in Emacs 23 but is not
officially supported. What's your OS and version of Emacs? How did you
install package.el?

-Phil

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: CSV Handling

2011-06-06 Thread Miki
http://clojars.org/search?q=csv

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: How to setup IntelliJ with Leiningen?

2011-06-06 Thread Matt Hoyt
 Run: 
lein pom

Then in intellij goto file->open project and goto the directory of the project 
and click on the pom.xml file.

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: porting an old project - where to begin?

2011-06-06 Thread yair
I'm using processing in a Java2D program.  It doesn't have to be 3D...

On Jun 4, 5:24 pm, Daniel  wrote:
> I suppose the noob tag is appropriate ie I was around sometime last
> year and earlier but RLing got in the way of doing anything useful
> with this lovely language.
>
> Anyway, I've got this old project (https://github.com/doubleagent/
> Magic--legacy- ) which I've recently gained a renewed interest in, and
> simultaneously am less concerned about the potential legal issues
> which made me disinterested enough to drop it 4 years ago.  I'm proud
> that it still builds and runs, but don't take the readme too
> seriously, and I highly doubt the perl scripts work anymore.  The
> intent was to write a program which assisted MTG (Magic: The
> Gathering) players by providing them with robust deck building tools
> and a way to compete over a network using the honor system.  Several
> features are still unimplemented, and some were removed in this
> version because the java2d worked too poorly to accommodate them.
>
> I'd like to port it to Clojure, but in the process I'd also like to
> solve some fundamental problems.  More specifically, real estate.  In
> a real game you would not be able to see any of the cards in great
> detail, but get an overall view of the board, and be able to inspect
> cards more closely by zooming and panning (over the whole board - I
> find Wotc's way of zooming on individual cards undesirable).  This is
> even more critical when there are a lot of cards on the field eg some
> decks can blast tokens onto the field which number into the hundreds.
>
> I'm unsure how to approach this core problem in Clojure.  clj-
> processing looks interesting, but I would prefer something more high
> level b/c 3d graphics is difficult for me to wrap my head around.  In
> particular, mapping a mouse click to the nearest movable object in 3d
> space and ensuring proper draw updates on the object with dragging
> *head asplode*
>
> But I'm sure to be missing plenty.  Suggestions?

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: How to setup IntelliJ with Leiningen?

2011-06-06 Thread Phil Hagelberg
On Jun 6, 2:47 pm, Vicente Bosch Campos 
wrote:
> 1) Create project with Leiningen on the command console: lein new 
> monkeyproject
> 2) If I select to open an existing project and point out to the project.clj:
>             - I have to add manually the lib folder to the dependencies 
> otherwise running wont work.
>             - It does not add directly the clojure "aspect" or tooling
> 3) When I select run on the project.clj it indicates me:
>
> /Users/vbosch/Programming/Clojure/hello/project.clj
> Exception in thread "main" java.lang.Exception: Unable to resolve symbol: 
> defproject in this context          

The project.clj file is just meant to be used by Leiningen. Your
project's actual code should go in src/. Can you load any of the files
in there?

-Phil

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Emacs - marmalade package install and .emacs file entries

2011-06-06 Thread David
I'm using GNU Emacs 23.3.1 (i386-mingw-nt6.1.7600)
 of 2011-03-10 on 3249CTO

Here's the relevant section of my init.el

(load "package")
(add-to-list 'package-archives '("marmalade" . "http://marmalade-
repo.org/packages/"))
(package-initialize)

I've got to load "package" explicitly to prevent a warning about a
nonexistent var:  package-archives.

I have to call  (package-initialize) explicitly.

Hope this helps,
-dms

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


How to setup IntelliJ with Leiningen?

2011-06-06 Thread Vicente Bosch Campos

Hi,

I am a newbie on clojure have decided to try it out after many years doing Ruby 
mostly.

I have been trying lately some basic tutorials and I am also reading the joy of 
clojure.

Anyways in the process I am trying to decide on a suitable project creation 
workflow with Leiningen and IntelliJ with out much luck.
What I am trying to do is to understand what are the steps in order to have the 
project correctly working on intelliJ so that REPL and the dependencies are 
caught etc.

I have currently the following SW:

- Leiningen 1.5.2
- IntelliJ 10.5
- LA Clojure latest plugin
- Leiningen-IntelliJ plugin installed and configured to point to the binary.

I have currently tried the following.

1) Create project with Leiningen on the command console: lein new monkeyproject
2) If I select to open an existing project and point out to the project.clj:
- I have to add manually the lib folder to the dependencies 
otherwise running wont work.
- It does not add directly the clojure "aspect" or tooling
3) When I select run on the project.clj it indicates me:

/Users/vbosch/Programming/Clojure/hello/project.clj
Exception in thread "main" java.lang.Exception: Unable to resolve symbol: 
defproject in this context   

I understand that is part of the Leiningen project and of course it is not 
indicated anywhere in the project.clj so maybe Leiningen know how to treat the 
file and that "intelligence" is missing in intellij
(or maybe just my intelligence... ).

What is the correct way to setup a project with Leiningen and intelliJ? 

How should the execution workflow go ? ( I can launch REPL and load files to 
it, no issues but should I do a lein run from outside the IDE to launch the 
full project or what ? )

Sorry for my legthy email. ( I promise I have looked at guides like 
http://blog.kartikshah.info/2010/12/how-to-intellij-idea-for.html ... but no 
luck )

Regards,
Vicente

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: swank-clojure/lein/emacs

2011-06-06 Thread John Toohey
I had this problem on OSX. To fix it, I removed the swank dependency
from my project.clj file, then I ran lein deps to clear any old
copies. Follow that with lein plugin install clojure-swank 1.3.1 and
finally lein swank.

On Sun, Jun 5, 2011 at 17:26, Bhinderwala, Shoeb
 wrote:
> Yes it is 4005. But I am just using the defaults. Does the problem have
> anything to do with the number 4005?
>
> Again, I am just following simple instructions outlined to get swank running
> using lein, so that I can connect to it using emacs. I am not doing anything
> special or different. As a newcomer to clojure I am just struggling with
> getting a basic setup so I can use a repl in emacs and connect to swank
> launched by lein.
>
> Did anybody face similar problem/error? Are there any more detailed clearer
> instructions anywhere else?
>
> Thanks
> Shoeb
>
> -Original Message-
> From: clojure@googlegroups.com on behalf of Ambrose Bonnaire-Sergeant
> Sent: Sun 6/5/2011 3:56 PM
> To: clojure@googlegroups.com
> Subject: Re: swank-clojure/lein/emacs
>
> On Mon, Jun 6, 2011 at 3:46 AM, Bhinderwala, Shoeb <
> sabhinderw...@wellington.com> wrote:
>
>>
>> Exception in thread "main" java.lang.IllegalArgumentException: No value
>> supplied for key: 4005 (NO_SOURCE_FILE:1)
>>
>
> Might be a coincidence, isn't the swank port 4005?
>
> Ambrose
>
> --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en



-- 
~JT

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Which Clojure environments support arglist-on-space?

2011-06-06 Thread pmbauer
Slimv supports this for clojure via swank.

http://www.vim.org/scripts/script.php?script_id=2531

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

RE: Emacs - marmalade package install and .emacs file entries

2011-06-06 Thread Bhinderwala, Shoeb
Hi Phil -

I am on Windows XP with Emacs version 23.3

Don't know what is meant by install of package.el. I simply followed 
instructions at: 

   http://marmalade-repo.org/

and copied package.el to my ~/.emacs.d directory and added the following to my 
.emacs file:

(add-to-list 'package-archives 
   '("marmalade" . "http://marmalade-repo.org/packages/";))

If emacs version 23 is not supported, where can I get version 24? The gnu 
website does not list version 24 in the downloads:

   http://ftp.gnu.org/gnu/emacs/windows/


Thanks
Shoeb

-Original Message-
From: clojure@googlegroups.com [mailto:clojure@googlegroups.com] On Behalf Of 
Phil Hagelberg
Sent: Monday, June 06, 2011 4:40 PM
To: Clojure
Subject: Re: Emacs - marmalade package install and .emacs file entries

On Jun 6, 8:39 am, "Bhinderwala, Shoeb" 
wrote:
>   (add-to-list 'load-path "~/.emacs.d/elpa/clojure-mode-1.9.2/")
>   (require 'clojure-mode)
>
> If I don't add the above entry clojure mode does not work.

It sounds like this is a bug in package.el; this should all be handled
for you. If you are using Emacs 24 then maybe you could try M-x report-
emacs-bug since package.el is part of Emacs now. Otherwise it would
take some further debugging; package.el works in Emacs 23 but is not
officially supported. What's your OS and version of Emacs? How did you
install package.el?

-Phil

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Aw: Re: Aw: Which Clojure environments support arglist-on-space?

2011-06-06 Thread Scott Jaderholm
if you follow the instructions on swank-clojure readme then yes I think you
get that.
Scott


On Mon, Jun 6, 2011 at 5:08 PM, Lee Spector  wrote:

>
> On Jun 6, 2011, at 4:58 PM, Scott Jaderholm wrote:
>
> > I don't know of a step by step guide that includes autodoc. You need an
> older version of slime that includes the contrib autodoc (i.e. not
> package.el version which lacks that contrib). I use 10-15-2009.
>
> Thanks for the pointers, although winging an installation process using old
> versions of things is not something that I want to deal with... However, if
> I ignore the autodoc part and go with one (any?) of the emacs/slime
> installation recipes that have been posted here (and if all goes well this
> time) then I should end up with arglist-on-space?
>
>  -Lee
>
> --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Aw: Re: Aw: Which Clojure environments support arglist-on-space?

2011-06-06 Thread Lee Spector

On Jun 6, 2011, at 4:58 PM, Scott Jaderholm wrote:

> I don't know of a step by step guide that includes autodoc. You need an older 
> version of slime that includes the contrib autodoc (i.e. not package.el 
> version which lacks that contrib). I use 10-15-2009.

Thanks for the pointers, although winging an installation process using old 
versions of things is not something that I want to deal with... However, if I 
ignore the autodoc part and go with one (any?) of the emacs/slime installation 
recipes that have been posted here (and if all goes well this time) then I 
should end up with arglist-on-space?

 -Lee

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Aw: Re: Aw: Which Clojure environments support arglist-on-space?

2011-06-06 Thread Scott Jaderholm
I don't know of a step by step guide that includes autodoc. You need an
older version of slime that includes the contrib autodoc (i.e. not
package.el version which lacks that contrib). I use 10-15-2009.

Scott


On Mon, Jun 6, 2011 at 4:38 PM, Lee Spector  wrote:

>
> On Jun 6, 2011, at 4:24 PM, Scott Jaderholm wrote:
>
> > You mean in addition to Emacs right? Of course emacs with slime does
> this. If you use autodoc then you don't even have to press space, the
> arglists will update in the echo area as you move the cursor around source.
> >
> > See http://www.youtube.com/watch?v=lf_xI3fZdIg
> >
> > As for showing args of functions in arg position, if you're in an apply
> form it will show the args for the function being applied.
>
> Wonderful. I didn't know for sure if this worked in Emacs with Clojure
> because I didn't get this in my own installation but I knew that my
> installation was at least half botched (on multiple occasions... so
> cumulatively it may have been more than half botched :-). Will one of the
> emacs/slime installation recipes that have been posted here reliably get me
> this functionality (including the autodoc part -- I don't know how to get
> that but it looks great)? Is there one you'd point to in particular?
>
> Thanks so much!
>
>  -Lee
>
> --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Emacs - marmalade package install and .emacs file entries

2011-06-06 Thread Phil Hagelberg
On Jun 6, 8:39 am, "Bhinderwala, Shoeb" 
wrote:
>   (add-to-list 'load-path "~/.emacs.d/elpa/clojure-mode-1.9.2/")
>   (require 'clojure-mode)
>
> If I don't add the above entry clojure mode does not work.

It sounds like this is a bug in package.el; this should all be handled
for you. If you are using Emacs 24 then maybe you could try M-x report-
emacs-bug since package.el is part of Emacs now. Otherwise it would
take some further debugging; package.el works in Emacs 23 but is not
officially supported. What's your OS and version of Emacs? How did you
install package.el?

-Phil

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Aw: Re: Aw: Which Clojure environments support arglist-on-space?

2011-06-06 Thread Lee Spector

On Jun 6, 2011, at 4:24 PM, Scott Jaderholm wrote:

> You mean in addition to Emacs right? Of course emacs with slime does this. If 
> you use autodoc then you don't even have to press space, the arglists will 
> update in the echo area as you move the cursor around source. 
> 
> See http://www.youtube.com/watch?v=lf_xI3fZdIg
> 
> As for showing args of functions in arg position, if you're in an apply form 
> it will show the args for the function being applied.

Wonderful. I didn't know for sure if this worked in Emacs with Clojure because 
I didn't get this in my own installation but I knew that my installation was at 
least half botched (on multiple occasions... so cumulatively it may have been 
more than half botched :-). Will one of the emacs/slime installation recipes 
that have been posted here reliably get me this functionality (including the 
autodoc part -- I don't know how to get that but it looks great)? Is there one 
you'd point to in particular?

Thanks so much!

 -Lee

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Which Clojure environments support arglist-on-space?

2011-06-06 Thread Phil Hagelberg
On Jun 6, 10:35 am, Lee Spector  wrote:
> Aside from the near miss with VimClojure (and its presence in MCLIDE) does 
> this exist in other Clojure environments?

SLIME has it too.

-Phil

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Aw: Re: Aw: Which Clojure environments support arglist-on-space?

2011-06-06 Thread Scott Jaderholm
You mean in addition to Emacs right? Of course emacs with slime does this.
If you use autodoc then you don't even have to press space, the arglists
will update in the echo area as you move the cursor around source.

See http://www.youtube.com/watch?v=lf_xI3fZdIg

As for showing args of functions in arg position, if you're in an apply form
it will show the args for the function being applied.

Cheers,
Scott


On Mon, Jun 6, 2011 at 1:35 PM, Lee Spector  wrote:

>
> On Jun 6, 2011, at 12:04 PM, Meikel Brandmeyer wrote:
> >> Am Montag, 6. Juni 2011 17:53:37 UTC+2 schrieb Lee:
> >> I don't think automatic insertion would be a good thing, BTW.
> > There are for example several snippet plugins for Vim in the wild, which
> do exactly that. And things like textmate also advertise such functionality
> (inserting snippets), AFAIK. That said, I'm not sure it's a good idea
> either. There are a tick too many edge-cases for my taste. If at all, it
> would be possible to turn this off.
>
> Granted, snippet pasting tools may be useful, but I guess my response
> should just have been to clarify that this isn't what I meant by
> artlist-on-space. The beauty of the arglist-on-space functionality that I
> know and love is that it is unobtrusive in its automatic helpfulness.
>
> Aside from the near miss with VimClojure (and its presence in MCLIDE) does
> this exist in other Clojure environments?
>
> Thanks,
>
>  -Lee
>
> --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: CSV Handling

2011-06-06 Thread Base
Incanter also has CSV support

http://liebke.github.com/incanter/io-api.html



On Jun 6, 1:08 pm, octopusgrabbus  wrote:
> Is there a core Java library that handles .csv files or do I need to
> download something like OpenCsv? Thanks.

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: CSV Handling

2011-06-06 Thread Steve Miner

On Jun 6, 2011, at 2:08 PM, octopusgrabbus wrote:

> Is there a core Java library that handles .csv files or do I need to
> download something like OpenCsv? Thanks.

I've been using csvclj successfully.  It's on clojars.org.

 [com.github.jonase.csv/csvclj "1.0.0-SNAPSHOT"]

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


CSV Handling

2011-06-06 Thread octopusgrabbus
Is there a core Java library that handles .csv files or do I need to
download something like OpenCsv? Thanks.

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Aw: Re: Aw: Which Clojure environments support arglist-on-space?

2011-06-06 Thread Lee Spector

On Jun 6, 2011, at 12:04 PM, Meikel Brandmeyer wrote:
>> Am Montag, 6. Juni 2011 17:53:37 UTC+2 schrieb Lee:
>> I don't think automatic insertion would be a good thing, BTW.
> There are for example several snippet plugins for Vim in the wild, which do 
> exactly that. And things like textmate also advertise such functionality 
> (inserting snippets), AFAIK. That said, I'm not sure it's a good idea either. 
> There are a tick too many edge-cases for my taste. If at all, it would be 
> possible to turn this off.

Granted, snippet pasting tools may be useful, but I guess my response should 
just have been to clarify that this isn't what I meant by artlist-on-space. The 
beauty of the arglist-on-space functionality that I know and love is that it is 
unobtrusive in its automatic helpfulness.

Aside from the near miss with VimClojure (and its presence in MCLIDE) does this 
exist in other Clojure environments?

Thanks,

 -Lee

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


RE: swank-clojure/lein/emacs

2011-06-06 Thread Bhinderwala, Shoeb
I figured out the cause of my problem. It is the presence of incanter!

Having it in leiningen project.clj file as a dependency causes "lein swank" to 
throw the following error:

 C:\projects\pasclj>lein swank
 Exception in thread "main" java.lang.IllegalArgumentException: No value
 supplied for key: 4005 (NO_SOURCE_FILE:1)
 at clojure.lang.Compiler.eval(Compiler.java:5440)
 at clojure.lang.Compiler.eval(Compiler.java:5414)
 at clojure.lang.Compiler.eval(Compiler.java:5415)
 at clojure.lang.Compiler.eval(Compiler.java:5391)
 at clojure.core$eval.invoke(core.clj:2382)

When I remove [incanter "1.2.3"] from my project.clj file the problem goes away.

Obviously there is some incompatibility between incanter and swank-clojure. 

Anybody else face this issue or know of how to make incanter work with 
swank-clojure?

Thanks
Shoeb

-Original Message-
From: clojure@googlegroups.com [mailto:clojure@googlegroups.com] On Behalf Of 
Phil Hagelberg
Sent: Monday, June 06, 2011 12:16 AM
To: Clojure
Subject: Re: swank-clojure/lein/emacs

On Jun 5, 9:09 am, "Bhinderwala, Shoeb" 
wrote:
> I installed clojure-mode from marmalade. I added the following to my
> .emacs file:
>
>   (add-to-list 'load-path "~/.emacs.d/elpa/clojure-mode/")
>   (require 'clojure-mode)

This is not necessary; if you install via marmalade then the autoloads
will handle this for you.

> And also added the following to my lein project.clj file:
>
>   :dev-dependencies [[swank-clojure "1.2.1"]]  

This is a rather old version of swank. You should stick with 1.3.1 at
least.

> When I perform step 3 from within EMACS, and specify the path to my lein
> project.clj file,  I get the following error:
>
>   Starting swank server...
>   cd c:/projects/pasclj && lein jack-in 1187: exited abnormally with
> code 1.

This is probably due to the old swank version.

> Also when I execute the following command "lein swank" from the command
> line, I get the following error:
>
> C:\projects\pasclj>lein swank
> Exception in thread "main" java.lang.IllegalArgumentException: No value
> supplied for key: 4005 (NO_SOURCE_FILE:1)
>         at clojure.lang.Compiler.eval(Compiler.java:5440)
>         at clojure.lang.Compiler.eval(Compiler.java:5414)
>         at clojure.lang.Compiler.eval(Compiler.java:5415)
>         at clojure.lang.Compiler.eval(Compiler.java:5391)
>         at clojure.core$eval.invoke(core.clj:2382)
>         

There's also a bug when mismatched versions are in lib/dev vs ~/.lein/
plugins that can cause behaviour like this. It's best not to put swank
in dev-deps at all but just stick with "lein plugin install". Just
inspect ~/.lein/plugins to make sure only 1.3.1 is in there. I'll
update the readme to explain this issue.

-Phil

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Aw: Re: Aw: Which Clojure environments support arglist-on-space?

2011-06-06 Thread Meikel Brandmeyer
Hi,

Am Montag, 6. Juni 2011 17:53:37 UTC+2 schrieb Lee:
>
> I don't think automatic insertion would be a good thing, BTW.
>

Well, this is not obviously decidable. There are for example several snippet 
plugins for Vim in the wild, which do exactly that. And things like textmate 
also advertise such functionality (inserting snippets), AFAIK. That said, 
I'm not sure it's a good idea either. There are a tick too many edge-cases 
for my taste. If at all, it would be possible to turn this off.

Sincerely
Meikel

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Aw: Which Clojure environments support arglist-on-space?

2011-06-06 Thread Lee Spector

On Jun 6, 2011, at 11:35 AM, Meikel Brandmeyer wrote:
> VimClojure shows argument lists and (optionally) docstrings on 
> omni-completion if Vim is configured accordingly. One can possibly remap 
>  in insert mode to the get the desired effect, although things get a 
> bit clumsy there. First  would show the menu, second  would 
> insert the actual . So one has to check whether the completion menu is 
> visible. Not an entirely trivial task, but doable I think. A more involved 
> implementation could insert the retrieved argument list as placeholders which 
> are replaced as you type. This could be too much, however, considering the 
> argument list of defn for example...

Interesting -- thanks.

I don't think automatic insertion would be a good thing, BTW. The idea is just 
to get unobtrusive, completely automatic reminders of arguments and argument 
order as one types code in the normal way.

 -Lee

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Emacs - marmalade package install and .emacs file entries

2011-06-06 Thread Bhinderwala, Shoeb
I am new to emacs and not sure how to automatically get the right
entries created in .emacs file after I install packages from marmalade.

Once I install a package using marmalade (e.g. clojure-mode-1.9.2) I
have to manually edit my .emacs file to add a "load-path" and "require"
entry:

Example entry in .emacs file:

  (add-to-list 'load-path "~/.emacs.d/elpa/clojure-mode-1.9.2/")
  (require 'clojure-mode)

If I don't add the above entry clojure mode does not work. Similarly,
after I install the packages slime and slime-repl, I have to manually
add entries otherwise emacs doesn't recognize my command
"slime-connect". I am not even sure what the right entries are and how
many "require" statements I have to add. So am a bit lost.

Is there any way to have emacs/marmalade automatically add the right
entries into the .emacs configuration file?

-- Shoeb

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Aw: Which Clojure environments support arglist-on-space?

2011-06-06 Thread Meikel Brandmeyer
Hi,

VimClojure shows argument lists and (optionally) docstrings on 
omni-completion if Vim is configured accordingly. One can possibly remap 
 in insert mode to the get the desired effect, although things get a 
bit clumsy there. First  would show the menu, second  would 
insert the actual . So one has to check whether the completion menu 
is visible. Not an entirely trivial task, but doable I think. A more 
involved implementation could insert the retrieved argument list as 
placeholders which are replaced as you type. This could be too much, 
however, considering the argument list of defn for example...

Sincerely
Meikel

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Which Clojure environments support arglist-on-space?

2011-06-06 Thread Lee Spector

Which Clojure environments currently support arglist-on-space, either in a REPL 
or an editor (or both)?

By "arglist-on-space" I mean (minimally) that when one types a space, after 
having typed "(" and then a function/macro name, the arglist(s) of the 
function/macro appear in a mini-buffer (without requiring the user to do or 
type anything else).

I find this to be a fantastically useful feature. I know that MCLIDE does this 
(and I came to love it in Common Lisp environments previously) but I don't know 
what other Clojure editors/REPLs/IDEs might... I've tried several but I'm not 
completely up to date on most of them.

BTW it's possible that in Clojure one would want to retrieve arglists even if 
the function/macro name isn't preceded by a "(", since functions often occur in 
other positions when passing them as arguments... and there are probably other 
possible variations/edge-cases too, but mostly I'd like to know which 
environments support some version of this feature.

Thanks,  -Lee



-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Using slurp to read changing JSON string

2011-06-06 Thread Thomas
Hi All,

I recently started playing with Clojure and loving it... and finding
of course the usual problem(s). In my little program I am reading a
JSON string that changes regularly, up to once every 15 seconds or so,
through HTTP. I know that the string changes, I can see that in my
browser and I can see things change in another (web)app that consumes
the string. My current code looks like this:

(def url "http://.x.xx"; )
(def location (ref nil))
(dosync (ref-set location (read-json (slurp url

My problem is, that once I have started the program it reads the
string successfully, but subsequent reads are the same, even though I
know that the string has changed. What should I do differently?  (I
loop through the function with a bit of code from Rich Hickeys
ants.clj)

TIA
Thomas

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Parsing HTML in clojure

2011-06-06 Thread Mukul

Hi,

I have worked on a similar project before and have found the following 
link useful


http://blog.prashanthellina.com/2009/07/27/extracting-relevant-text-from-html-pages/

Best regards
~ Mukul Joshi

Director & CEO,
SpotOn Software Pvt. Ltd.
_SpotOn : One stop spot for your mobile development_

On 6/6/2011 6:31 AM, Base wrote:

hi all,

I am working on an app that will parse web pages to do some NLP and
statistics.  I am able to parse the HTML using several different tool
( enlive, HTML parser, etc).  However I would like to discard all the
rest of the junk in the web page that is not pertinent (I.e. Ads).
Does anyone have any experience doing this?  Any tips On how to do
this - or even better, tools that you can recommend?   I have been
digging around on this for a while now and am stuck!

Thanks!

Base



--
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Parsing HTML in clojure

2011-06-06 Thread Rasmus Svensson
2011/6/6 Base :
> hi all,
>
> I am working on an app that will parse web pages to do some NLP and
> statistics.  I am able to parse the HTML using several different tool
> ( enlive, HTML parser, etc).  However I would like to discard all the
> rest of the junk in the web page that is not pertinent (I.e. Ads).
> Does anyone have any experience doing this?  Any tips On how to do
> this - or even better, tools that you can recommend?   I have been
> digging around on this for a while now and am stuck!
>
> Thanks!
>
> Base

In Enlive there are at least two approaches available:

The first approach is to use the 'select' function to pick out the
interesting part of the element tree. You use CSS-style selectors to
describe the element.

The second approach is to use the 'at' macro. You give it an element
tree and pairs of selectors and transformations. For each
selector-transformation pair, the transformation is applied to all
elements that matches the selector. A transformation takes a node and
returns what it should be replaced with. You can do almost anything
with them, including removing the element (which might be useful for
the ads in your case) or extracting the text of the node (the matching
nodes deepest in the tree are processed first). The result of the 'at'
form is the element tree with all transformations applied.

Both 'select' and 'at' accepts a element tree which you can create
with the html-resource function which accepts, among other things,
URLs.

You probably need to write some html element processing functions, so
it's probably a good idea to get familiar with the data format of the
nodes:

Element: {:tag :a, :attrs {:href "http://example.com/"}, :content
}
Text: "text node"
Comment: {:type :comment, :data "comment node"}

I found the wiki of Enlive very useful. The "Getting Started" explains
what's there and how to use it very well, I think.
https://github.com/cgrand/enlive/wiki/_pages

I should also mention David Nolen's comprehensive tutorial which
begins with scraping: https://github.com/swannodette/enlive-tutorial

// raek

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Best Installation Option

2011-06-06 Thread flebber

Thanks all for the excellent advice.

Sayth

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Parsing HTML in clojure

2011-06-06 Thread Base
Hi All -

Thanks for your help!   I found this last night and it looks pretty
promising.  It is apparently part of Apache Tika (which I have never
heard of until now) that has a lot of interesting functionality!

https://boilerpipe-web.appspot.com/

Thanks!

On Jun 5, 11:14 pm, Bruce Williams  wrote:
> I looked at HtmlCleaner and it pretty cleans up the 'syntax' of the
> html but does nothing with the 'semantics'   - ads,etc
>
> Bruce Williams
> Concepts, like individuals, have their histories and are just as  incapable of
> withstanding the ravages of time as are individuals.  But in and
> through all this
> they retain a kind of homesickness  for the scenes of their childhood.
> Soren Kierkegaard
>
> On Sun, Jun 5, 2011 at 8:04 PM, Andreas Kostler
>
>
>
>
>
>
>
>  wrote:
> > There's a Java library called HtmlCleaner. You might wanna give that a shot.
> > Btw, I'm working on quite a similar project so if you like email me and we 
> > can maybe join forces.
> > Andreas
>
> > On 06/06/2011, at 11:01 AM, Base wrote:
>
> >> hi all,
>
> >> I am working on an app that will parse web pages to do some NLP and
> >> statistics.  I am able to parse the HTML using several different tool
> >> ( enlive, HTML parser, etc).  However I would like to discard all the
> >> rest of the junk in the web page that is not pertinent (I.e. Ads).
> >> Does anyone have any experience doing this?  Any tips On how to do
> >> this - or even better, tools that you can recommend?   I have been
> >> digging around on this for a while now and am stuck!
>
> >> Thanks!
>
> >> Base
>
> >> --
> >> 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 group, send email to
> >> clojure+unsubscr...@googlegroups.com
> >> For more options, visit this group at
> >>http://groups.google.com/group/clojure?hl=en
>
> > --
> > 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 group, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/clojure?hl=en

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: interval trees..

2011-06-06 Thread Sunil S Nandihalli
A simple googling revealed that interval trees can be implemented using
finger-trees .. but hmm. they are not ready yet.. :(
Sunil.

On Mon, Jun 6, 2011 at 5:05 PM, Sunil S Nandihalli <
sunil.nandiha...@gmail.com> wrote:

> Hello everybody,
>  Is there any implementation of Interval 
> Trees in
> Clojure. I found this Java 
> implementation 
> but
> it does not have remove operation. Even some other Java Implementation would
> do.
> Thanks,
> Sunil.
>

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

interval trees..

2011-06-06 Thread Sunil S Nandihalli
Hello everybody,
 Is there any implementation of Interval
Trees in
Clojure. I found this Java
implementation
but
it does not have remove operation. Even some other Java Implementation would
do.
Thanks,
Sunil.

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Best Installation Option

2011-06-06 Thread faenvie
i am also using ccw for eclipse but then cake instead of
leiningen.  this has the main-advantage of having
an incredible fast development-cycle (running tests
after change via commandline). this is  because cake
runs a persistent JVM, eliminating start-up overhead.

(minor-)drawback: cake currently depends on the installation
of ruby for managing the persistent JVM.

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Parsing HTML in clojure

2011-06-06 Thread Bruce Williams
I looked at HtmlCleaner and it pretty cleans up the 'syntax' of the
html but does nothing with the 'semantics'   - ads,etc

Bruce Williams
Concepts, like individuals, have their histories and are just as  incapable of
withstanding the ravages of time as are individuals.  But in and
through all this
they retain a kind of homesickness  for the scenes of their childhood.
Soren Kierkegaard



On Sun, Jun 5, 2011 at 8:04 PM, Andreas Kostler
 wrote:
> There's a Java library called HtmlCleaner. You might wanna give that a shot.
> Btw, I'm working on quite a similar project so if you like email me and we 
> can maybe join forces.
> Andreas
>
> On 06/06/2011, at 11:01 AM, Base wrote:
>
>> hi all,
>>
>> I am working on an app that will parse web pages to do some NLP and
>> statistics.  I am able to parse the HTML using several different tool
>> ( enlive, HTML parser, etc).  However I would like to discard all the
>> rest of the junk in the web page that is not pertinent (I.e. Ads).
>> Does anyone have any experience doing this?  Any tips On how to do
>> this - or even better, tools that you can recommend?   I have been
>> digging around on this for a while now and am stuck!
>>
>> Thanks!
>>
>> Base
>>
>> --
>> 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 group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
> --
> 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 group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Hierarchical Agglomerative Clustering

2011-06-06 Thread Andreas Kostler
Hi all, 
Please find below my take on the hac algorithm. I'd like to hear how I could 
improve on it. 
Especially the get-closest-pair function is ugly. I also don't like that I need 
transform the cluster to something vijual can draw. 
It would be much nicer to simply represent the tree as a nested vector (or 
list) but then I can't think of a way to do efficient removal of clusters.
Cheers
Andreas




(ns clj-sentiment.clustering.hac
  (:require [clj-sentiment.core :as core]))

;;; A bunch of sparse vector functions. Sparse vectors are represented as maps.

(defn div [v n]
  "Divide sparse vec v by n"
  (reduce (fn [m [k val]] (assoc m k (/ val n))) {} v))

(defn sum [a b]
  "Component wise sum of a and b"
  (merge-with + a b))

(defn average [& vecs]
  "Calculate the average over vecs."
  (let [n (count vecs)]
(reduce sum (map #(div % n) vecs

(defn diff-squared [a b]
  "Component wise difference of a and b"
  (merge-with (fn [a b] (let [diff (- a b)] (* diff diff))) a b))

(defn eucl-dist [v1 v2]
  (Math/sqrt (reduce + (vals  (diff-squared v1 v2)

;;; Enough sparse vector stuff ... Below is the actual algorighm...

;; "Uses memoization to remember distance calculations."
(def distance
  (memoize (fn [x y metric] (metric x y

(defn get-closest-pair [l metric]
  "Gets the closest vector pair according to metric."
  (first (sort-by peek
  (map (fn [[id1 vec1 id2 vec2]]
 [id1 id2 (distance vec1 vec2 metric)])
   (for [[id1 cl1 :as a] l [id2 cl2 :as b] (rest l) :when 
(not= a b)] [id1 (:vec cl1) id2 (:vec cl2)])

(defn create-cluster [{label :id :as document} id]
  (hash-map id {:label label :vec (core/get-feature-vec document) :left nil 
:right nil :dist nil}))

(defn create-initial-clusters [l]
  "Initially, there is one cluster per document. Clusters are stored in a map 
identified by their id for fast lookup."
  (apply merge (map create-cluster l (iterate inc 1

(defn hac [l metric]
  "Hierarchical agglomerative clustering algorithm."
  (loop [clust (create-initial-clusters l) id -1]
(if (<= (count clust) 1) clust
(let [[idi idj dist] (get-closest-pair clust metric)
  clusti (clust idi)
  clustj (clust idj)
  mergevec (average (:vec clusti) (:vec clustj))
  newclust {:left {idi clusti} :right {idj clustj} :dist dist :vec 
mergevec}]
  (recur (-> clust (dissoc idi) (dissoc idj) (assoc id newclust)) (dec 
id))

(defn tree-vis [[id {l :left r :right label :label} :as node] acc]
  (cond (nil? node) acc
(and (nil? l) (nil? r)) label
:else (conj acc (tree-vis (first r) acc) (tree-vis (first l) acc) '*)))

(vijual/draw-binary-tree (tree-vis (first (hac/hac l hac/eucl-dist)) ()))

 +---+
  |  * |
 +---+
 / \___  
/  \ 
   +---++---+
   | * || *   |
   +---++---+
  / \  / \  
 /   \/  \ 
+---+  +---+  +---+ +---+
| D ||  E |   | C |   | *  |
+---+  +---+  +---+ +---+
 / \  
/   \ 
   +---+  +---+
   | A  | | B |
   +---+   +---+

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en