Re: Best Clojure Learning Resource for Lisper

2012-05-07 Thread Larry Travis

Sean and Lee:
In general, I have considered the difference between Aquamacs and GNU 
Emacs to be that the former prioritizes computer-user interaction via 
mouse, command-bars and menus (which requires a lot of hand movement 
between keyboard and mouse, but enables the user to dispense with 
memorizing the meanings of dozens of key chords) -- while the latter 
minimizes user need to move hands off the keyboard thus facilitating 
fast touch typing (using key combinations to move point, set mark, copy 
region, etc.)


Whether key bindings (especially those that involve the Apple command 
key) conform to Apple style helps if you are used to them from other Mac 
applications, but is a secondary difference. By the way, I can't find 
just what bindings to the command key Emacs 24 (for Os X) does use. 
(Aquamacs comes with 41!) The Emacs-24 _C-h b_ listing doesn't seem to 
show them.


A difference that I find very useful is the use of tabs in Aquamacs for 
rapidly controlling which buffers are being displayed. (One can create a 
new buffer either in a new frame or under a new tab in an existing frame.)


There are other differences, but none of the differences between 
Aquamacs and GNU Emacs (including the ones just mentioned) are critical 
to what makes a good Emacs-based Clojure IDE, and I will be perfectly 
happy with either Aquamacs or GNU Emacs as the base of a "Mac Clojure 
Box" downloadable as are many Mac applications (from the Mac Apps 
Store?) and installable simply by dragging an icon into the applications 
folder.


Talk about being a parasitic noobie.  I wish I had the expertise to help 
Phil Hagelberg and other swank-clojure and Leiningen contributors toward 
achieving this goal.  What they have developed so far takes us a long 
way toward it  (whether or not it is one of the goals they have 
explicitly in mind).

  --Larry




On 5/7/12 10:40 PM, Sean Corfield wrote:

On Mon, May 7, 2012 at 8:21 PM, Lee Spector  wrote:

My recollection was that Aquamacs had more support for Mac OS native menus and 
other GUI elements too...

Probably, yes. I installed it last year and I seem to recall some
native chrome and a menubar - but then folks recommended using Emacs
24 so I switched and haven't had any problems. I expand Emacs to
near-fullscreen and I like the lack of distractions (lack of chrome)
since I work in it all day.


What I should have said would be "really wonderful," more precisely, is something with 
"close to single click download/install of a complete [emacs] Clojure programming 
environment"

That's certainly true. Any Emacs-based approach is a multi-step setup
right now and everyone seems to have their own favorite way to set
things up. I've helped a number of Mac users get Emacs 24 + Starter
Kit + Leiningen + Swank-Clojure up and running and I always seem to
forget some minor step and have to redo _something_ :)


--
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 Clojure Learning Resource for Lisper

2012-05-07 Thread Sean Corfield
On Mon, May 7, 2012 at 8:21 PM, Lee Spector  wrote:
> My recollection was that Aquamacs had more support for Mac OS native menus 
> and other GUI elements too...

Probably, yes. I installed it last year and I seem to recall some
native chrome and a menubar - but then folks recommended using Emacs
24 so I switched and haven't had any problems. I expand Emacs to
near-fullscreen and I like the lack of distractions (lack of chrome)
since I work in it all day.

> What I should have said would be "really wonderful," more precisely, is 
> something with "close to single click download/install of a complete [emacs] 
> Clojure programming environment"

That's certainly true. Any Emacs-based approach is a multi-step setup
right now and everyone seems to have their own favorite way to set
things up. I've helped a number of Mac users get Emacs 24 + Starter
Kit + Leiningen + Swank-Clojure up and running and I always seem to
forget some minor step and have to redo _something_ :)
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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 Clojure Learning Resource for Lisper

2012-05-07 Thread Lee Spector

On May 7, 2012, at 11:02 PM, Sean Corfield wrote:
> On Mon, May 7, 2012 at 6:57 PM, Lee Spector  wrote:
>> 
>> FWIW I've often thought that it would be really wonderful to have real 
>> Aquamacs support/polish for swank-clojure/SLIME, especially if it could be 
>> packaged in form that permitted something close to single click 
>> download/install of a complete Aquamacs Clojure programming environment. I 
>> would probably migrate to such a thing (for my research and teaching, which 
>> are linked) if it existed.
> 
> I'm curious - what does Aquamacs give you over Emacs 24 from
> http://emacsforosx.com/builds ? cmd-x / c / v all work in Emacs 24.
> cmd-a for select all. page up / down. back / forward word. cmd-z for
> undo.

My recollection was that Aquamacs had more support for Mac OS native menus and 
other GUI elements too... but maybe that's not right and I'm making a bigger 
distinction than I should between Aquamacs and other Mac OS emacs builds. What 
I should have said would be "really wonderful," more precisely, is something 
with "close to single click download/install of a complete [emacs] Clojure 
programming environment" and also with as much native GUI convention support as 
possible, to ease the discovery of features and minimize the need to memorize 
emacs key combinations, especially for newbies (but also for me and I've been 
using emacs in some ways for decades).

 -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: Best Clojure Learning Resource for Lisper

2012-05-07 Thread Sean Corfield
On Mon, May 7, 2012 at 6:57 PM, Lee Spector  wrote:
> On May 7, 2012, at 3:10 PM, Larry Travis wrote:
>> If you are not into the intricacies of Emacs multi-key chording, using 
>> Aquamacs helps a bit. (Despite the statement in the README that 
>> "Swank-clojure and SLIME are only tested with GNU Emacs; forks such as 
>> Aquamacs  ... are not officially supported", use of the Aquamacs Emacs fork 
>> does work.)
> FWIW I've often thought that it would be really wonderful to have real 
> Aquamacs support/polish for swank-clojure/SLIME, especially if it could be 
> packaged in form that permitted something close to single click 
> download/install of a complete Aquamacs Clojure programming environment. I 
> would probably migrate to such a thing (for my research and teaching, which 
> are linked) if it existed.

I'm curious - what does Aquamacs give you over Emacs 24 from
http://emacsforosx.com/builds ? cmd-x / c / v all work in Emacs 24.
cmd-a for select all. page up / down. back / forward word. cmd-z for
undo.
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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 Clojure Learning Resource for Lisper

2012-05-07 Thread Lee Spector

On May 7, 2012, at 3:10 PM, Larry Travis wrote:

> Lee's comments ring true for me so let me extend them.
> 
> Before I discovered Clojure, my experience as a programmer had been mainly in 
> the area of artificial-intelligence experimental programming.  I was once a 
> reasonably proficient Lisp programmer, but pre-CL and pre-CLOS, that is, 
> mainly using Xerox PARC's Interlisp.

Ah, Interlisp! We're definitely on the same page. (Although I later worked a 
fair bit with CL and CLOS.)

> ...
> If you are not into the intricacies of Emacs multi-key chording, using 
> Aquamacs helps a bit. (Despite the statement in the README that 
> "Swank-clojure and SLIME are only tested with GNU Emacs; forks such as 
> Aquamacs  ... are not officially supported", use of the Aquamacs Emacs fork 
> does work.)

FWIW I've often thought that it would be really wonderful to have real Aquamacs 
support/polish for swank-clojure/SLIME, especially if it could be packaged in 
form that permitted something close to single click download/install of a 
complete Aquamacs Clojure programming environment. I would probably migrate to 
such a thing (for my research and teaching, which are linked) if it existed.

> I agree with Lee that, if you don't know Emacs (or don't want to be learning 
> it at the same time you are learning Clojure), the clooj IDE should be useful 
> as a starter -- maybe eventually something more as features like SLIME's 
> debugging aids are added to it.

Clooj is still pretty rudimentary, but it's getting better all the time. I use 
it for real work (research programming and teaching).

> There are several excellent books useful as Clojure learning aids. (I 
> particularly recommend Halloway and Bedra, "Programming Clojure"; Fogus and 
> Hauser, "The Joy of Clojure"; and Emerick, Carper, and Grand, "Clojure 
> Programming".) Unfortunately, none of them contain a chapter that has yet to 
> be written by somebody: "Everything a Clojure programmer who has never used 
> Java needs to know about it."

On "Programming Clojure": I learned from and then taught with the first edition 
and I liked it very much, but in the present context it's worth noting that the 
running example used through the book involves the development a build tool -- 
exactly the wrong sort of thing for someone coming mostly from the Lisp side of 
things.

 -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: [ANN] Exploding Fish: A URI Library for Clojure

2012-05-07 Thread Walter Tetzner

>Provided examples look very much like 
https://github.com/michaelklishin/urly. Does e-f handle
>relative resolution, parsing of broken (technically invalid) URLs?

Yes, it handles relative resolution, as well as normalizing paths:

user> (normalize-path "http://www.test.net/some/uri/../path/./here?x=y&a=w";)
"http://www.test.net/some/path/here?x=y&a=w";
user> (resolve-path "http://www.test.net/some/uri/../path/./here?x=y&a=w"; 
"new/path")
"http://www.test.net/some/path/new/path?x=y&a=w";
user> (resolve-path "http://www.test.net/some/uri/../path/./here?x=y&a=w"; 
"/new/path")
"http://www.test.net/new/path?x=y&a=w";

As for parsing broken URLs, that depends. URLs can be broken in a lot
of ways, which means it's not clear how a broken URL should be
parsed. It will allow technically invalid characters (which
java.net.URI and URL will not), but doesn't go beyond that.

I noticed that Urly will parse a URI such as
"https://http://broken-cms.com"; as if it were
"http://broken-cms.com";. Having this be automatic behavior when
parsing makes me nervous. Maybe that "https" was important, and it
should have been parsed as "https://broken-cms.com";. In some
applications, it might make sense to have "https" always win. In
others, like some sort of proxy, it might depend on the scheme of
another URL, so you can keep the schemes of the URLs on either side in
sync.

Having functionality that allows you to deal with broken URLs is
great, but having it be built into the URL parser seems
dangerous. It's probably best to fail by default, so the programmer
can determine the behavior they need for the broken cases as they come
accross them.

Also, it's good that you brought this up, because I just tried some
things with Exploding Fish, and I need to add some better error
checking :).


On Monday, May 7, 2012 9:48:02 AM UTC-4, Michael Klishin wrote:

-- 
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: why can i not shut-down my pc from Java?

2012-05-07 Thread Jim - FooBar();

On 07/05/12 23:34, Softaddicts wrote:

I am guessing here, Multics ? DOS/360 ? MVS ? NOS/BE ? TOPS-10/20 ?
RSX-11 ? RT-11 ? VMS ? U*x ? Did I left any ? Oh, I forgot MS-DOS...

:)


...for the love of god!!! :-X

Jim



--
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: why can i not shut-down my pc from Java?

2012-05-07 Thread Softaddicts
I am guessing here, Multics ? DOS/360 ? MVS ? NOS/BE ? TOPS-10/20 ?
RSX-11 ? RT-11 ? VMS ? U*x ? Did I left any ? Oh, I forgot MS-DOS...

:)

Luc


> On 07/05/12 21:59, Aaron Cohen wrote:
> > You invoke your multimethod with 2 arguments. You need to change your 
> > dispatch function to take 2 arguments (it can ignore them if you don't 
> > need them).
> 
> Thanks Aaron - it did the trick! I did not realize that multi-methods 
> cannot be overloaded...
> 
> > Also... do you actually find this easier to read? How many OSes are 
> > you eventually planning to support?
> >
> Well, i hate nested ifs so yeah this is a bit clearer and more 
> extensible. You know very well that there is really only one OS... 
> and stinky windows of course! ;-)
> 
> Jim
> 
> -- 
> 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
> 
--
Softaddicts sent by ibisMail!

-- 
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: why can i not shut-down my pc from Java?

2012-05-07 Thread Jim - FooBar();

Ok, a couple of things...

I think we can all agree that if there is one thing that OO is doing 
right is polymorphism (well...almost!)...the whole notion of 
multiple-dispatch allows us to make decisions on a higher level - one 
closer to our mental perspective...personally, whenever i see some piece 
of code which is more or less a series of ifs and for-loops after 3-4 
minutes i start to feel stupid - my brain starts to melt!!!...you can do 
that in any OO language and people do do that!


if you 're talking about performance i totally get your point...on the 
other hand, that particular multi-method i wrote will never seek 
performance. In other, words noone will ever ask to turn his computer 
off more than once, let alone in a tight loop...in fact this 
function/multi-method will never see the light of day - i was just 
messing about...


I have to grant you this however : i do come from a OO background but it 
is not really my fault is it?...that is what they teach you at 
practically all universities - nothign else. Basically this is what the 
industry expects from you (so you can be replaceable - just as Rich said)...


Peace...

Jim

ps: looking forward to that essay of yours :-)

On 07/05/12 22:37, Aaron Cohen wrote:
I know this is a very common paradigm in OO (with principles such as 
"prefer polymorphism to nested ifs"). I want to write a longer essay 
here on my feelings about when to use polymorphism in clojure but not 
on my iPhone ;)


Suffice it to say, there are definitely cases where polymorphism makes 
sense in clojure, particularly when working with datatypes. I'd 
recommend thinking about when it's appropriate though, particularly if 
it's a lingering OO impulse that is causing you to reach for this tool.


--
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: why can i not shut-down my pc from Java?

2012-05-07 Thread Aaron Cohen
On Monday, May 7, 2012, Jim - FooBar(); wrote:

> On 07/05/12 21:59, Aaron Cohen wrote:
>
>> You invoke your multimethod with 2 arguments. You need to change your
>> dispatch function to take 2 arguments (it can ignore them if you don't need
>> them).
>>
>
> Thanks Aaron - it did the trick! I did not realize that multi-methods
> cannot be overloaded...
>
> They can be, you just use either an overloaded or varargs dispatch
function.


>>  Well, i hate nested ifs so yeah this is a bit clearer and more
> extensible. You know very well that there is really only one OS... and
> stinky windows of course! ;-)
>

I know this is a very common paradigm in OO (with principles such as
"prefer polymorphism to nested ifs"). I want to write a longer essay here
on my feelings about when to use polymorphism in clojure but not on my
iPhone ;)

Suffice it to say, there are definitely cases where polymorphism makes
sense in clojure, particularly when working with datatypes. I'd recommend
thinking about when it's appropriate though, particularly if it's a
lingering OO impulse that is causing you to reach for this tool.

--Aaron

-- 
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: why can i not shut-down my pc from Java?

2012-05-07 Thread Jim - FooBar();

On 07/05/12 21:59, Aaron Cohen wrote:
You invoke your multimethod with 2 arguments. You need to change your 
dispatch function to take 2 arguments (it can ignore them if you don't 
need them).


Thanks Aaron - it did the trick! I did not realize that multi-methods 
cannot be overloaded...


Also... do you actually find this easier to read? How many OSes are 
you eventually planning to support?


Well, i hate nested ifs so yeah this is a bit clearer and more 
extensible. You know very well that there is really only one OS... 
and stinky windows of course! ;-)


Jim

--
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: why can i not shut-down my pc from Java?

2012-05-07 Thread Allen Johnson
The function passed to (defmulti) must take the same args as (defmethod).

Try this:

(defmulti halt
  (fn [_ _]
(let [os (System/getProperty "os.name")]
  (if (.startsWith os "Mac OS") :Linux  (keyword os)

AJ

On Mon, May 7, 2012 at 4:53 PM, Jim - FooBar();  wrote:
> Following my earlier post, i tried converting the working shutdown
>  function into a multi-method in order to make it cleaner to read... However
> for some reason the compiler is complaining and i can't pinpoint wheere the
> problem is! This is the multi-method:
> 
> (defmulti halt
> (fn []
> (let [os (System/getProperty "os.name")]
>   (if (.startsWith os "Mac OS") :Linux  (keyword os)
>
> (defmethod halt :Linux [root-pwd minutes-after]
>    (clojure.java.shell/sh
>    "sudo" "-S" "shutdown" (str "+" minutes-after) :in (str root-pwd "\n")))
>
> (defmethod halt :Windows [_ minutes-after]
>    (clojure.java.shell/sh "shutdown" "-s" "-t"  (str minutes-after)))
>
> (defmethod halt :Solaris [root-pwd seconds-after]
>    (clojure.java.shell/sh "shutdown" "-S" "-y" (str "-g" seconds-after) "-i"
> "S" :in (str root-pwd "\n")))
>
> (defmethod halt :default [] (println "Unsupported operating system!"))
> -
>
> when calling (halt "some-password" 1) i'm getting this:
>
> java.lang.IllegalArgumentException: Wrong number of args (2) passed to:
> user$eval664$fn (NO_SOURCE_FILE:0)
>
> the same happens no matter how many args i pass in! this is very strange!
>
> thanks in advance...
>
> Jim
>
>
>
>
>
>
>
>
> On 07/05/12 19:52, Jim - FooBar(); wrote:
>
> Good stuff... :-)
>
> Jim
>
> On 07/05/12 19:51, Armando Blancas wrote:
>>
>> Can someone please verify that it works on windows as well???
>>
>
> It works on XP.
>
> --
> 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: why can i not shut-down my pc from Java?

2012-05-07 Thread Aaron Cohen
On Mon, May 7, 2012 at 4:53 PM, Jim - FooBar(); wrote:

>  Following my earlier post, i tried converting the working shutdown
>  function into a multi-method in order to make it cleaner to read...
> However for some reason the compiler is complaining and i can't pinpoint
> wheere the problem is! This is the multi-method:
>
> 
> (defmulti halt
> (fn []
>

Your dispatch function takes 0 arguments.


> (let [os (System/getProperty "os.name")]
>   (if (.startsWith os "Mac OS") :Linux  (keyword os)
>

<...>


> when calling (halt "some-password" 1) i'm getting this:
>

You invoke your multimethod with 2 arguments. You need to change your
dispatch function to take 2 arguments (it can ignore them if you don't need
them).

Also... do you actually find this easier to read? How many OSes are you
eventually planning to support?

--Aaron

-- 
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: why can i not shut-down my pc from Java?

2012-05-07 Thread Jim - FooBar();

Following my earlier post, i tried converting the working shutdown
 function into a multi-method in order to make it cleaner to read... 
However for some reason the compiler is complaining and i can't pinpoint 
wheere the problem is! This is the multi-method:


(defmulti halt
(fn []
(let [os (System/getProperty "os.name")]
  (if (.startsWith os "Mac OS") :Linux  (keyword os)

(defmethod halt :Linux [root-pwd minutes-after]
   (clojure.java.shell/sh
   "sudo" "-S" "shutdown" (str "+" minutes-after) :in (str root-pwd "\n")))

(defmethod halt :Windows [_ minutes-after]
   (clojure.java.shell/sh "shutdown" "-s" "-t"  (str minutes-after)))

(defmethod halt :Solaris [root-pwd seconds-after]
   (clojure.java.shell/sh "shutdown" "-S" "-y" (str "-g" seconds-after) 
"-i" "S" :in (str root-pwd "\n")))


(defmethod halt :default [] (println "Unsupported operating system!"))
-

when calling (halt "some-password" 1) i'm getting this:

java.lang.IllegalArgumentException: Wrong number of args (2) passed to: 
user$eval664$fn (NO_SOURCE_FILE:0)


the same happens no matter how many args i pass in! this is very strange!

thanks in advance...

Jim







On 07/05/12 19:52, Jim - FooBar(); wrote:

Good stuff... :-)

Jim

On 07/05/12 19:51, Armando Blancas wrote:


Can someone please verify that it works on windows as well???

It works on XP.

--
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: updated Brief Beginner's Guide

2012-05-07 Thread Phil Hagelberg
On Mon, May 7, 2012 at 12:13 PM, John Gabriele  wrote:
> I updated the [Brief Beginner's
> Guide](http://www.unexpected-vortices.com/clojure/brief-beginners-guide/index.html).
> Some changes:

This looks like a useful resource; thanks. A few notes:

* Most of the "Distributing" page repeats `lein help tutorial`; would
be better to delegate here.

* When you link to things like the Leiningen sample project.clj or
tutorial, it would be good to mention they're available via `lein
help`

* If you instruct people to edit their skeleton project.clj files to
add clojure 1.4.0, the guide will be out of date soon once the
skeleton is updated.

* A few places it says that Leiningen copies jars into the project
dir, this is no longer true.

* IMO ClojureSphere should have a more prominent mention on the
"Available Clojure Libraries" page.

* The list of Leiningen tasks explained in Chapter 9 (install, deps,
search) is probably ill-chosen since these either aren't typically
needed in daily development (install, deps) or are potentially
frustrating to new users (search is super slow on the first run). I'd
recommend covering repl, test, and jar instead since that's the
minimum needed to get something working and deployed to Clojars.

* Covering how to set up a terminal (Chapter 4) has nothing to do with
Clojure and feels really out of place.

Apart from that it looks pretty solid.

-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


updated Brief Beginner's Guide

2012-05-07 Thread John Gabriele
Hi,

I updated the [Brief Beginner's
Guide](http://www.unexpected-vortices.com/clojure/brief-beginners-guide/index.html).
Some changes:

  * updated for Leiningen 2 and Clojure 1.4
  * now has syntax highlighting for any Clojure code therein
  * added notes about reloading code in the repl while working
  * removed chapter on creating libs (didn't really belong there
anything, I think)
  * added chapter on generating docs via lein-marginalia
  * slightly nicer html rendering

Feedback welcome, of course.

Thanks,
---John

-- 
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 Clojure Learning Resource for Lisper

2012-05-07 Thread Larry Travis

Lee's comments ring true for me so let me extend them.

Before I discovered Clojure, my experience as a programmer had been 
mainly in the area of artificial-intelligence experimental programming.  
I was once a reasonably proficient Lisp programmer, but pre-CL and 
pre-CLOS, that is, mainly using Xerox PARC's Interlisp.


Fast prototyping is central to such experimental programming, and Lisp  
REPL's and IDE's have contributed as much to Lisp's pre-eminent 
usability for experimental programming as has the language itself.


So, when starting to use Clojure, my major frustrations were wrt Java 
interop and (to quote Lee) "... setup, editing environments, build tools 
and configurations, dependencies, classpaths, etc."


What I found of most use to begin with was Clojure Box (see 
http://clojure.bighugh.com), " an all-in-one installer for Clojure 
 on Windows. It's inspired by the Lispbox 
: you simply install and run this 
one thing, and you get a REPL  and all the 
syntax highlighting and editing goodies from clojure-mode and Slime, 
plus all the power of Emacs under the hood." Unfortunately, it has not 
been upgraded to Clojure 1.3.0 and is no longer being maintained -- and, 
anyway, I wanted to work on a Mac.


And something almost as good as Clojure Box is now available for Macs 
(as well as for Windows and Linux systems). See


https://github.com/technomancy/swank-clojure/blob/master/README.md

If you are not into the intricacies of Emacs multi-key chording, using 
Aquamacs helps a bit. (Despite the statement in the README that 
"Swank-clojure and SLIME are only tested with GNU Emacs; forks such as 
Aquamacs  ... are not officially supported", use of the Aquamacs Emacs 
fork does work.)


I agree with Lee that, if you don't know Emacs (or don't want to be 
learning it at the same time you are learning Clojure), the clooj IDE 
should be useful as a starter -- maybe eventually something more as 
features like SLIME's debugging aids are added to it.


There are several excellent books useful as Clojure learning aids. (I 
particularly recommend Halloway and Bedra, "Programming Clojure"; Fogus 
and Hauser, "The Joy of Clojure"; and Emerick, Carper, and Grand, 
"Clojure Programming".) Unfortunately, none of them contain a chapter 
that has yet to be written by somebody: "Everything a Clojure programmer 
who has never used Java needs to know about it."


I hope this helps.
  --Larry




On 5/7/12 9:34 AM, Lee Spector wrote:


On May 7, 2012, at 12:37 AM, HelmutKian wrote:


Hey there,

I'm a fairly experienced Common Lisp programmer.  By that I mean I've read PAIP, On Lisp, 
Let Over Lambda, and written several "real world" CL applications and taught 
the principles of FP using Racket as a TA.

Now I'm looking to learn Clojure. What would be the best resource for someone 
who is already pretty comfortable with Lisp?

For me, coming to Clojure ore from Common Lisp and Scheme than from Java, the biggest 
hurdles weren't the language itself but rather the issues with setup, editing 
environments, build tools and configurations, dependencies, classpaths, etc. Many of the 
concepts underlying these things were foreign to me, at least in their Java-world guises. 
If any of this rings true to you then I'd recommend starting with the clooj lightweight 
IDE, which makes a lot of these issues go away (for me at least), in conjunction with 
leiningen (invoked from the command line after adding dependencies to your project.clj) 
to manage dependencies. You can get clooj here: https://github.com/arthuredelstein/clooj 
-- I'd download the latest "standalone" jar, double click it to launch the IDE, 
create a project, and begin working there. If you do your Lisping in emacs then there's 
great support for that route in Clojure too, and maybe that's where you want to end up, 
but I (and others) have found setup and configuration to be nontrivial. Doubtless others 
on this list will disagree with that :-), and of course YMMV, but that's my 2cents.

On the language itself I recommend watching Rich Hickey's "Clojure for Lisp Programmers" 
talk (part 1 is here: http://blip.tv/clojure/clojure-for-lisp-programmers-part-1-1319721) for 
starters. After that I personally used Stuart Halloway's "Programming Clojure" text but 
there are now several others that are also good.

  -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: why can i not shut-down my pc from Java?

2012-05-07 Thread Jim - FooBar();

Good stuff... :-)

Jim

On 07/05/12 19:51, Armando Blancas wrote:


Can someone please verify that it works on windows as well???

It works on XP.

--
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: why can i not shut-down my pc from Java?

2012-05-07 Thread Armando Blancas

>
> Can someone please verify that it works on windows as well??? 
>
>  
It works on XP.

-- 
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: why can i not shut-down my pc from Java?

2012-05-07 Thread Jim - FooBar();

Well, clojure.java.shell/sh did the trick...thanks for your time guys!

The correct function now is:
---

(defn shutdown-pc [root-pwd minutes-after]
(let [op-system  (System/getProperty "os.name")]
(cond
(or (.startsWith op-system "Linux")
(.startsWith op-system "Mac OS"))
 (clojure.java.shell/sh "sudo" "-S" "shutdown" (str "+" 
minutes-after) :in (str root-pwd "\n"))

(.startsWith op-system "Windows")
 (clojure.java.shell/sh "shutdown" "-s" "-t"  (str 
minutes-after))

:else (throw (RuntimeException. "Unsupported operating system!")


Notice the "\n" after the password string  - it is needed otherwise it 
won't accept it as correct!
Can someone please verify that it works on windows as well??? IT is 
really hard for me to find a windows machine!


Thanks again...

Jim


On 07/05/12 16:32, Craig Brozefsky wrote:

"Jim - FooBar();"  writes:


In preference to using Runtime/exec, you can use
clojure.java.shell/sh and write your password to the stdin of the
process using its :in argument.

Now that sounds more sensible but it means that the consumer has to
have clojure...what if i was to aot-compile the function with
gen-class  to pretend it is plain Java?

The consumer would not need clojure, he is not suggesting you use some
clojure shell command, but rather the clojure.java.shell/sh function
which lets you write to stdin (and read stdout) from a shell process you
call from your Java program.

Also, you will need to invoke sudo with the -S argument so it reads from
stdin, and not from a pty.




--
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: why can i not shut-down my pc from Java?

2012-05-07 Thread Jim - FooBar();

On 07/05/12 16:32, Craig Brozefsky wrote:

"Jim - FooBar();"  writes:


In preference to using Runtime/exec, you can use
clojure.java.shell/sh and write your password to the stdin of the
process using its :in argument.

Now that sounds more sensible but it means that the consumer has to
have clojure...what if i was to aot-compile the function with
gen-class  to pretend it is plain Java?

The consumer would not need clojure, he is not suggesting you use some
clojure shell command, but rather the clojure.java.shell/sh function
which lets you write to stdin (and read stdout) from a shell process you
call from your Java program.

Also, you will need to invoke sudo with the -S argument so it reads from
stdin, and not from a pty.




 ok sorry i misunderstood!!!

will try that...

Jim

--
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: why can i not shut-down my pc from Java?

2012-05-07 Thread Craig Brozefsky
"Jim - FooBar();"  writes:

>> In preference to using Runtime/exec, you can use
>> clojure.java.shell/sh and write your password to the stdin of the
>> process using its :in argument.
>
> Now that sounds more sensible but it means that the consumer has to
> have clojure...what if i was to aot-compile the function with
> gen-class  to pretend it is plain Java?

The consumer would not need clojure, he is not suggesting you use some
clojure shell command, but rather the clojure.java.shell/sh function
which lets you write to stdin (and read stdout) from a shell process you
call from your Java program.

Also, you will need to invoke sudo with the -S argument so it reads from
stdin, and not from a pty.


-- 
Craig Brozefsky 
Premature reification is the root of all evil

-- 
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: why can i not shut-down my pc from Java?

2012-05-07 Thread Jim - FooBar();

So you mean something like :

(str
"#!/bin/bash  echo " root-pwd " |" " sudo -S shutdown -h +" minutes-after)

?

Jim

On 07/05/12 16:20, Moritz Ulrich wrote:

I'm not familiar with .exec, so this is a guess:

What you try to do is piping some text to some other program. This is
a shell feature, and I think .exec doesn't start a shell so you just
run 'echo' with some arguments. Try running a shell withing exec,
passing the commands as an argument to the shell.

On Mon, May 7, 2012 at 5:08 PM, Jim - FooBar();  wrote:

Hello everyone,

I was just messing about with the following function and cannot figure out
why it won't work...
I know that the command I'm passing to the runtime object is a valid unix
command...i can execute it on my terminal no problem! Java however refuses
send the "halt" signal to my ubuntu shell...any ideas?
-
(defn shutdown-pc [root-pwd minutes-after]
(let [op-system  (System/getProperty "os.name")
  enviroment (Runtime/getRuntime)]
(cond
(or (.startsWith op-system "Linux")
(.startsWith op-system "Mac OS"))
 (.exec enviroment (str "echo " root-pwd " |" " sudo -S shutdown
-h +" minutes-after))
(.startsWith op-system "Windows")
 (.exec enviroment (str "shutdown -s -t " minutes-after))
:else (throw (RuntimeException. "Unsupported operating system!"
--

Thanks in advance...


Jim

--
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: why can i not shut-down my pc from Java?

2012-05-07 Thread Jim - FooBar();

On 07/05/12 16:16, Craig Brozefsky wrote:

You should checkout proces output to make sure, but I'm betting that
sudo is opening a tty to read the password and not getting it from
stdout.  The properly solution here, here, may be to define shutdown as
a sudo action for your user ID which does not require a password.


Well yeah but then only me can use it...it will not work on another machine!

On 07/05/12 16:16, Aaron Cohen wrote:
Another alternative might be to configure your /etc/sudoers to not 
require a password when running the shutdown command for the user that 
is making this call.


Same here...i want this function to work across different 
machines/op-systems.


I think input redirection (the "|" you have there) is a construct of 
your shell rather than the OS, so you have to wrap that in a call to 
bash or whatever shell you prefer. 


How would i do that? I thought the command i need to pass in ".exec()" 
is simply the command i would type in my terminal (windows or 
unix)...and i know that the command works at least on my ubuntu...



In preference to using Runtime/exec, you can use clojure.java.shell/sh 
and write your password to the stdin of the process using its :in 
argument.


Now that sounds more sensible but it means that the consumer has to have 
clojure...what if i was to aot-compile the function with gen-class  to 
pretend it is plain Java?



Jim


--
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: why can i not shut-down my pc from Java?

2012-05-07 Thread Moritz Ulrich
I'm not familiar with .exec, so this is a guess:

What you try to do is piping some text to some other program. This is
a shell feature, and I think .exec doesn't start a shell so you just
run 'echo' with some arguments. Try running a shell withing exec,
passing the commands as an argument to the shell.

On Mon, May 7, 2012 at 5:08 PM, Jim - FooBar();  wrote:
> Hello everyone,
>
> I was just messing about with the following function and cannot figure out
> why it won't work...
> I know that the command I'm passing to the runtime object is a valid unix
> command...i can execute it on my terminal no problem! Java however refuses
> send the "halt" signal to my ubuntu shell...any ideas?
> -
> (defn shutdown-pc [root-pwd minutes-after]
> (let [op-system  (System/getProperty "os.name")
>      enviroment (Runtime/getRuntime)]
> (cond
>    (or (.startsWith op-system "Linux")
>        (.startsWith op-system "Mac OS"))
>             (.exec enviroment (str "echo " root-pwd " |" " sudo -S shutdown
> -h +" minutes-after))
>        (.startsWith op-system "Windows")
>             (.exec enviroment (str "shutdown -s -t " minutes-after))
>    :else (throw (RuntimeException. "Unsupported operating system!"
> --
>
> Thanks in advance...
>
>
> Jim
>
> --
> 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



-- 
Moritz Ulrich

-- 
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: IllegalStateException in ns macro

2012-05-07 Thread dgrnbrg
The :refer-clojure clause has fixed my problem; however, I have 22+
symbols that I need to exclude in every namespace. Is there a way that
I can ease this exclusion, as this code is a library that I'll be
including in numerous files (and I'd like to have a form to simplify
using it).

I am not sure if this is something that I could do with a custom
leiningen plugin that rewrites all the ns macros before evaluating the
file, or if I can do something else a bit less extreme.

Thanks!
David

On May 7, 10:28 am, "Meikel Brandmeyer (kotarak)" 
wrote:
> Hi again,
>
> Am Montag, 7. Mai 2012 16:26:48 UTC+2 schrieb Meikel Brandmeyer (kotarak):
>
> > (ns piplin.test.math
> >   (:refer-clojure :exclude [not=])
> >   (:use ...)
> >   (:import ...))
>
> You should do the same in piplin.math, btw.
>
> Kind regards
> 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: why can i not shut-down my pc from Java?

2012-05-07 Thread Aaron Cohen
On Mon, May 7, 2012 at 11:08 AM, Jim - FooBar(); wrote:

> Hello everyone,
>
> I was just messing about with the following function and cannot figure out
> why it won't work...
> I know that the command I'm passing to the runtime object is a valid unix
> command...i can execute it on my terminal no problem! Java however refuses
> send the "halt" signal to my ubuntu shell...any ideas?
> --**--**
> --**--**-
> (defn shutdown-pc [root-pwd minutes-after]
> (let [op-system  (System/getProperty "os.name")
>  enviroment (Runtime/getRuntime)]
> (cond
>(or (.startsWith op-system "Linux")
>(.startsWith op-system "Mac OS"))
> (.exec enviroment (str "echo " root-pwd " |" " sudo -S
> shutdown -h +" minutes-after))
>


I think input redirection (the "|" you have there) is a construct of your
shell rather than the OS, so you have to wrap that in a call to bash or
whatever shell you prefer.

In preference to using Runtime/exec, you can use clojure.java.shell/sh and
write your password to the stdin of the process using its :in argument.

Another alternative might be to configure your /etc/sudoers to not require
a password when running the shutdown command for the user that is making
this call.

--Aaron

-- 
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: why can i not shut-down my pc from Java?

2012-05-07 Thread Craig Brozefsky
"Jim - FooBar();"  writes:

> -
> (defn shutdown-pc [root-pwd minutes-after]
> (let [op-system  (System/getProperty "os.name")
>   enviroment (Runtime/getRuntime)]
> (cond
> (or (.startsWith op-system "Linux")
> (.startsWith op-system "Mac OS"))
>  (.exec enviroment (str "echo " root-pwd " |" " sudo -S 
> shutdown -h +" minutes-after))
> (.startsWith op-system "Windows")
>  (.exec enviroment (str "shutdown -s -t " minutes-after))
> :else (throw (RuntimeException. "Unsupported operating system!"
> --

You should checkout proces output to make sure, but I'm betting that
sudo is opening a tty to read the password and not getting it from
stdout.  The properly solution here, here, may be to define shutdown as
a sudo action for your user ID which does not require a password.


-- 
Craig Brozefsky 
Premature reification is the root of all evil

-- 
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


why can i not shut-down my pc from Java?

2012-05-07 Thread Jim - FooBar();

Hello everyone,

I was just messing about with the following function and cannot figure 
out why it won't work...
I know that the command I'm passing to the runtime object is a valid 
unix command...i can execute it on my terminal no problem! Java however 
refuses send the "halt" signal to my ubuntu shell...any ideas?

-
(defn shutdown-pc [root-pwd minutes-after]
(let [op-system  (System/getProperty "os.name")
  enviroment (Runtime/getRuntime)]
(cond
(or (.startsWith op-system "Linux")
(.startsWith op-system "Mac OS"))
 (.exec enviroment (str "echo " root-pwd " |" " sudo -S 
shutdown -h +" minutes-after))

(.startsWith op-system "Windows")
 (.exec enviroment (str "shutdown -s -t " minutes-after))
:else (throw (RuntimeException. "Unsupported operating system!"
--

Thanks in advance...


Jim

--
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 Clojure Learning Resource for Lisper

2012-05-07 Thread Lee Spector

On May 7, 2012, at 12:37 AM, HelmutKian wrote:

> Hey there,
> 
> I'm a fairly experienced Common Lisp programmer.  By that I mean I've read 
> PAIP, On Lisp, Let Over Lambda, and written several "real world" CL 
> applications and taught the principles of FP using Racket as a TA.  
> 
> Now I'm looking to learn Clojure. What would be the best resource for someone 
> who is already pretty comfortable with Lisp?

For me, coming to Clojure ore from Common Lisp and Scheme than from Java, the 
biggest hurdles weren't the language itself but rather the issues with setup, 
editing environments, build tools and configurations, dependencies, classpaths, 
etc. Many of the concepts underlying these things were foreign to me, at least 
in their Java-world guises. If any of this rings true to you then I'd recommend 
starting with the clooj lightweight IDE, which makes a lot of these issues go 
away (for me at least), in conjunction with leiningen (invoked from the command 
line after adding dependencies to your project.clj) to manage dependencies. You 
can get clooj here: https://github.com/arthuredelstein/clooj -- I'd download 
the latest "standalone" jar, double click it to launch the IDE, create a 
project, and begin working there. If you do your Lisping in emacs then there's 
great support for that route in Clojure too, and maybe that's where you want to 
end up, but I (and others) have found setup and configuration to be nontrivial. 
Doubtless others on this list will disagree with that :-), and of course YMMV, 
but that's my 2cents.

On the language itself I recommend watching Rich Hickey's "Clojure for Lisp 
Programmers" talk (part 1 is here: 
http://blip.tv/clojure/clojure-for-lisp-programmers-part-1-1319721) for 
starters. After that I personally used Stuart Halloway's "Programming Clojure" 
text but there are now several others that are also good. 

 -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: IllegalStateException in ns macro

2012-05-07 Thread Meikel Brandmeyer (kotarak)
Hi again,

Am Montag, 7. Mai 2012 16:26:48 UTC+2 schrieb Meikel Brandmeyer (kotarak):
>
>
> (ns piplin.test.math
>   (:refer-clojure :exclude [not=])
>   (:use ...)
>   (:import ...))
>
>
You should do the same in piplin.math, btw.

Kind regards
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: IllegalStateException in ns macro

2012-05-07 Thread Meikel Brandmeyer (kotarak)
Hi,

Am Montag, 7. Mai 2012 16:15:44 UTC+2 schrieb dgrnbrg:
>
> I haven't been able to figure out how to consistently repro it--it 
> happens when I evaluate it with VimClojure, and sometimes from the 
> lein repl, but I don't have a clear repro case :(.  Here's the 
> repository that the code lives in: https://github.com/dgrnbrg/piplin/ 
>
> Here's the (ns) form I'm using: 
>
> (ns piplin.test.math 
>   (:use clojure.test) 
>   (:import slingshot.ExceptionInfo) 
>   (:use [slingshot.slingshot :only [throw+]]) 
>   (:require [clojure.core :as clj]) 
>   (:use [piplin types math modules sim])) 
>

Try the following:

(ns piplin.test.math
  (:refer-clojure :exclude [not=])
  (:use ...)
  (:import ...))

This should exclude not= from core and prevent any clashes. I pay close 
attention in vimclojure to load namespace the way the are intended, that is 
via their ns clause. When the problem still persists in vimclojure while it 
works in other repls, please open a ticket in the issues section of 
http://bitbucket.org/kotarak/vimclojure.

Kind regards,
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: IllegalStateException in ns macro

2012-05-07 Thread Moritz Ulrich
Your ns-statement doesn't exclude clojure.core. When :refer-clojure
isn't present, it refers clojure.core by default, even when you
require it prefixed. Take a look at the documentation:
http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/ns

On Mon, May 7, 2012 at 4:15 PM, David Greenberg  wrote:
> Hello Clojurians,
> I do not understand why this error happens. It appears to not want me
> to refer to not= after it's been referred to once before, even though
> it's the same not= that I'm referring to! I have tried using
> refer-clojure instead of require to no avail.
>
> I haven't been able to figure out how to consistently repro it--it
> happens when I evaluate it with VimClojure, and sometimes from the
> lein repl, but I don't have a clear repro case :(.  Here's the
> repository that the code lives in: https://github.com/dgrnbrg/piplin/
>
> Here's the (ns) form I'm using:
>
> (ns piplin.test.math
>  (:use clojure.test)
>  (:import slingshot.ExceptionInfo)
>  (:use [slingshot.slingshot :only [throw+]])
>  (:require [clojure.core :as clj])
>  (:use [piplin types math modules sim]))
>
> Here's the error I get when I evaluate it multiple times (the first
> evaluation usually works):
>
> java.lang.IllegalStateException: not= already refers to:
> #'piplin.math/not= in namespace: piplin.test.math
>                Namespace.java:88 clojure.lang.Namespace.warnOrFailOnReplace
>               Namespace.java:110 clojure.lang.Namespace.reference
>               Namespace.java:168 clojure.lang.Namespace.refer
>                    core.clj:3775 clojure.core/refer
>                  RestFn.java:410 clojure.lang.RestFn.invoke
>                       math.clj:2 piplin.test.math/eval3649[fn]
>                       math.clj:2 piplin.test.math/eval3649
>               Compiler.java:6465 clojure.lang.Compiler.eval
>               Compiler.java:6455 clojure.lang.Compiler.eval
>               Compiler.java:6431 clojure.lang.Compiler.eval
>                    core.clj:2795 clojure.core/eval
>                     repl.clj:163 vimclojure.repl/run[fn]
>                     repl.clj:136 vimclojure.repl/with-repl*[fn]
>                     AFn.java:159 clojure.lang.AFn.applyToHelper
>                     AFn.java:151 clojure.lang.AFn.applyTo
>                     core.clj:600 clojure.core/apply
>                    core.clj:1769 clojure.core/with-bindings*
>                  RestFn.java:425 clojure.lang.RestFn.invoke
>                     repl.clj:132 vimclojure.repl/with-repl*
>                     repl.clj:160 vimclojure.repl/run
>                    nails.clj:252 vimclojure.nails/Repl[fn]
>                     util.clj:118 vimclojure.util/with-command-line*
>                    nails.clj:235 vimclojure.nails/Repl[fn]
>                     nails.clj:85 vimclojure.nails/nail-driver[fn]
>                     nails.clj:81 vimclojure.nails/nail-driver
>                    nails.clj:235 vimclojure.nails/Repl
>                     Var.java:401 clojure.lang.Var.invoke
>                     Nail.java:61 vimclojure.Nail.nailMain
>                 (Unknown Source) sun.reflect.NativeMethodAccessorImpl.invoke0
>  NativeMethodAccessorImpl.java:57 sun.reflect.NativeMethodAccessorImpl.invoke
> DelegatingMethodAccessorImpl.java:43
> sun.reflect.DelegatingMethodAccessorImpl.invoke
>                  Method.java:601 java.lang.reflect.Method.invoke
>               NGSession.java:294 vimclojure.nailgun.NGSession.run
>
> --
> 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



-- 
Moritz Ulrich

-- 
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


IllegalStateException in ns macro

2012-05-07 Thread David Greenberg
Hello Clojurians,
I do not understand why this error happens. It appears to not want me
to refer to not= after it's been referred to once before, even though
it's the same not= that I'm referring to! I have tried using
refer-clojure instead of require to no avail.

I haven't been able to figure out how to consistently repro it--it
happens when I evaluate it with VimClojure, and sometimes from the
lein repl, but I don't have a clear repro case :(.  Here's the
repository that the code lives in: https://github.com/dgrnbrg/piplin/

Here's the (ns) form I'm using:

(ns piplin.test.math
  (:use clojure.test)
  (:import slingshot.ExceptionInfo)
  (:use [slingshot.slingshot :only [throw+]])
  (:require [clojure.core :as clj])
  (:use [piplin types math modules sim]))

Here's the error I get when I evaluate it multiple times (the first
evaluation usually works):

java.lang.IllegalStateException: not= already refers to:
#'piplin.math/not= in namespace: piplin.test.math
Namespace.java:88 clojure.lang.Namespace.warnOrFailOnReplace
   Namespace.java:110 clojure.lang.Namespace.reference
   Namespace.java:168 clojure.lang.Namespace.refer
core.clj:3775 clojure.core/refer
  RestFn.java:410 clojure.lang.RestFn.invoke
   math.clj:2 piplin.test.math/eval3649[fn]
   math.clj:2 piplin.test.math/eval3649
   Compiler.java:6465 clojure.lang.Compiler.eval
   Compiler.java:6455 clojure.lang.Compiler.eval
   Compiler.java:6431 clojure.lang.Compiler.eval
core.clj:2795 clojure.core/eval
 repl.clj:163 vimclojure.repl/run[fn]
 repl.clj:136 vimclojure.repl/with-repl*[fn]
 AFn.java:159 clojure.lang.AFn.applyToHelper
 AFn.java:151 clojure.lang.AFn.applyTo
 core.clj:600 clojure.core/apply
core.clj:1769 clojure.core/with-bindings*
  RestFn.java:425 clojure.lang.RestFn.invoke
 repl.clj:132 vimclojure.repl/with-repl*
 repl.clj:160 vimclojure.repl/run
nails.clj:252 vimclojure.nails/Repl[fn]
 util.clj:118 vimclojure.util/with-command-line*
nails.clj:235 vimclojure.nails/Repl[fn]
 nails.clj:85 vimclojure.nails/nail-driver[fn]
 nails.clj:81 vimclojure.nails/nail-driver
nails.clj:235 vimclojure.nails/Repl
 Var.java:401 clojure.lang.Var.invoke
 Nail.java:61 vimclojure.Nail.nailMain
 (Unknown Source) sun.reflect.NativeMethodAccessorImpl.invoke0
 NativeMethodAccessorImpl.java:57 sun.reflect.NativeMethodAccessorImpl.invoke
DelegatingMethodAccessorImpl.java:43
sun.reflect.DelegatingMethodAccessorImpl.invoke
  Method.java:601 java.lang.reflect.Method.invoke
   NGSession.java:294 vimclojure.nailgun.NGSession.run

-- 
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 Clojure Learning Resource for Lisper

2012-05-07 Thread Jim - FooBar();
Well, if you already know CL and  can understand bit of Java (for 
interop), you're good to go!!!
Make sure you know about Clojure's immutable data-structures before 
anything else...this is the BIG difference between Clojure vs CL 
(Clojure wins here!) other than that,  prepare yourself for a wonderful 
ride with less parens and truly immutable collections! :-)


Have fun...

Jim

ps: check the clojure wiki and also there are 2 new books out 
there...the oreilly one is more than 600 pages!



On 07/05/12 05:37, HelmutKian wrote:

Hey there,

I'm a fairly experienced Common Lisp programmer.  By that I mean I've 
read /PAIP/, /On Lisp/, /Let Over Lambda/, and written several "real 
world" CL applications and taught the principles of FP using Racket as 
a TA.


Now I'm looking to learn Clojure. What would be the best resource for 
someone who is already pretty comfortable with Lisp?


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 


--
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 Clojure Learning Resource for Lisper

2012-05-07 Thread Jay Fields
I'd recommend The Joy of Clojure. You'll probably be able to skip some early 
chapters, but overall I feel like its the right book for someone with a decent 
working knowledge of lisp. 

Sent from my iPad

On May 7, 2012, at 12:37 AM, HelmutKian  wrote:

> Hey there,
> 
> I'm a fairly experienced Common Lisp programmer.  By that I mean I've read 
> PAIP, On Lisp, Let Over Lambda, and written several "real world" CL 
> applications and taught the principles of FP using Racket as a TA.  
> 
> Now I'm looking to learn Clojure. What would be the best resource for someone 
> who is already pretty comfortable with Lisp?
> 
> 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

-- 
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

Overtone GSoC project

2012-05-07 Thread Jon Rose
 

Hello,

Unfortunately I missed David's thread announcing accepted GSoC projects 
while I was moving and without internet so i wanted to introduce my self 
and my project. First off though, like the other accepted students I am 
extremely grateful to Google Summer of Code but most of all to the 
Clojure/dev team and David. It is very humbling and exciting to be a part 
of the first Clojure GSoC class and I can't wait to see how all the 
projects turn out.

The goal of the Overtone sketchpad project will be to create a light 
weight editor environment inspired by the Processing  
and Aruduino  editors. Ideally this will provide 
a cross platform and ready to go overtone configuration for beginners 
and students while also giving experienced users more features specific 
to sound design (including incorporating GUI elements which already may 
exist in the Overtone project). As the project is in the early stages 
feedback is invaluable so please share any thoughts and suggestions. If 
anyone is interested in following the Overtone sketchpad project I 
have created the Github repo<
https://github.com/ghostandthemachine/overtone-sketchpad>as well as added 
a wiki<
https://github.com/ghostandthemachine/overtone-sketchpad/wiki/Suggestions-and-Feature-Requests>page
 
where people can contribute ideas for features. I will also have a project 
blog where I will be posting updates and milestones in the project. 

I also wanted to say a big thanks to Jeff and Sam who have been 
awesome through the proposal process and tremendous resources and again 
to Clojure/dev and David for the opportunity. I look forward to 
hearing everyones feedback and can't wait to get hacking!



Jon Rose



-- 
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

Best Clojure Learning Resource for Lisper

2012-05-07 Thread HelmutKian
Hey there,

I'm a fairly experienced Common Lisp programmer.  By that I mean I've read *
PAIP*, *On Lisp*, *Let Over Lambda*, and written several "real world" CL 
applications and taught the principles of FP using Racket as a TA.  

Now I'm looking to learn Clojure. What would be the best resource for 
someone who is already pretty comfortable with Lisp?

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: clojure call dom4j has a problem

2012-05-07 Thread winkywoos...@gmail.com


On Sunday, May 6, 2012 6:36:41 AM UTC-6, zyboost wrote:
>
> why call  DocumentHelper.createDocument(string name) error?
>

dom4j's DocumentHelper.createDocument either takes no arguments, or an 
Element argument—there's no createDocument() method for a String argument.

http://dom4j.sourceforge.net/dom4j-1.6.1/apidocs/org/dom4j/DocumentHelper.html 

-- 
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: [ANN] Exploding Fish: A URI Library for Clojure

2012-05-07 Thread Michael Klishin
Walter Tetzner:

> The source and some documentation (in the README) can be found at
> https://github.com/wtetzner/exploding-fish.

Provided examples look very much like https://github.com/michaelklishin/urly. 
Does e-f handle
relative resolution, parsing of broken (technically invalid) URLs?

MK

-- 
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


ANN: syntactic-closure 0.1.0 is released

2012-05-07 Thread Shogo Ohta
Hi,

I have released syntactic-closure 0.1.0, a Clojure library that
provides
some facilities to define hygienic macros with syntactic closures.
It aims to implement a hygienic macro system interoperable with
Clojure's
macro system.

It's available from Clojars as [syntactic-closure "0.1.0"]. Please
check out
the README for more details at https://github.com/athos/syntactic-closure.

The blog entry about it is here (in Japanese, though):
http://d.hatena.ne.jp/athos/20120506/syntactic_closure_in_clojure

-- 
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


Plan for http://clojure.org/libraries

2012-05-07 Thread Kevin Ilchmann Jørgensen
Hey

What's the plan for http://clojure.org/libraries?

Maybe some form of "deprecated" warning?


/Kevin

-- 
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: Nonprinting characters in string

2012-05-07 Thread DAemon
Ah, thanks. It just seemed like there should be something that did this!

- D

On Mon, May 7, 2012 at 7:38 PM, David Powell  wrote:

>
> Clojure doesn't seem to explicitly escape non-printable characters in
> String literals when you try to print them.
> You could always do it yourself with something like:
>
> (require 'clojure.string)
>
> (defn escape-nonprintable [s]
>   (clojure.string/join
>  (map (fn [c] (if (Character/isISOControl c)
>(str "\\" (format "%03o" (int c))) c))
>s)))
>
>
>
> On Thu, May 3, 2012 at 11:49 AM, DAemon  wrote:
> > This seems like a really silly question, but if I have a string like
> > "abc\000def", how do I print it in such a way that it shows "abc\000def"?
> >
> > I've tried playing around with prn and *print-readably*, but that doesn't
> > seem to do what I want.
> >
> > Thanks!
> >
> > - DAemon
> >
> > --
> > 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: Nonprinting characters in string

2012-05-07 Thread David Powell
Clojure doesn't seem to explicitly escape non-printable characters in
String literals when you try to print them.
You could always do it yourself with something like:

(require 'clojure.string)

(defn escape-nonprintable [s]
  (clojure.string/join
 (map (fn [c] (if (Character/isISOControl c)
   (str "\\" (format "%03o" (int c))) c))
   s)))


On Thu, May 3, 2012 at 11:49 AM, DAemon  wrote:
> This seems like a really silly question, but if I have a string like
> "abc\000def", how do I print it in such a way that it shows "abc\000def"?
>
> I've tried playing around with prn and *print-readably*, but that doesn't
> seem to do what I want.
>
> Thanks!
>
> - DAemon
>
> --
> 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