Re: My non-ELPA Emacs swank-clojure setup

2010-04-07 Thread Phil Hagelberg
On Wed, Apr 7, 2010 at 7:57 PM, Brent Millare  wrote:
> http://tentclube.blogspot.com/
>
> I made a blog post on this a while ago, but I've simplified the
> process now. I'm still working on making it easier to deploy on
> different systems though.

Both those options sound like an awful lot of work. I'm curious as to
what advantages there are to this method over the original
installation instructions.

Do you realize that package.el is going to be included in Emacs 24?

-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

To unsubscribe, reply using "remove me" as the subject.


Re: A syntax question: positional & keyword

2010-04-07 Thread Adrian Cuthbertson
> I hereby cast my vote into the void: release often; release 1.2
> soon. :-)

(inc (fetch void))

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

To unsubscribe, reply using "remove me" as the subject.


Re: My non-ELPA Emacs swank-clojure setup

2010-04-07 Thread Brent Millare
http://tentclube.blogspot.com/

I made a blog post on this a while ago, but I've simplified the
process now. I'm still working on making it easier to deploy on
different systems though.

-Brent

On Apr 7, 5:12 pm, Ævar Arnfjörð Bjarmason  wrote:
> I stubbornly refuse to use ELPA. I keep my ~/.emacs and associated
> libraries in Git[1][2] and don't like deviating from that with ELPA by
> running the clojure code from an unversioned directory that isn't
> automatically there when I set up my Emacs configuration from Git.
>
> I couldn't find any documentation for setting up Emacs + Clojure +
> Swank without ELPA. What follows are the steps I had to do to get my
> setup working so that I can use both SBCL and Clojure with SLIME.
>
> First checkout the needed clojure code into my ~/g/elisp library:
>
>     git submodule add git://github.com/technomancy/slime.git slime
>     git submodule add git://github.com/technomancy/clojure-mode.git 
> clojure-mode
>     git submodule add git://github.com/jochu/swank-clojure.git swank-clojure
>     git submodule add git://github.com/richhickey/clojure.git clojure
>     git submodule add git://github.com/richhickey/clojure-contrib.git clojure
>
> Build clojure:
>
>     cd clojure && ant
>     cd clojure-contrib && mvn package
>
> Add this in my ~/.emacs to load the libraries:
>
>     (add-to-list 'load-path "~/g/elisp/clojure-mode")
>     (add-to-list 'load-path "~/g/elisp/swank-clojure")
>     (add-to-list 'load-path "~/g/elisp/slime")
>     (add-to-list 'load-path "~/g/elisp/slime/contrib")
>
> Add autoloads + massive hack to get all of this to work:
>
>     (autoload 'clojure-mode "clojure-mode" nil t)
>     (autoload 'clojure-test-mode "clojure-test-mode" nil t)
>     (defvar package-activated-list nil "Hack: used in
> `slime-changelog-date' but not defined anywhere")
>     (progn
>       (autoload 'swank-clojure-init "swank-clojure")
>       (autoload 'swank-clojure-slime-mode-hook "swank-clojure")
>       (autoload 'swank-clojure-cmd "swank-clojure")
>       (autoload 'swank-clojure-project "swank-clojure"))
>
>     (setq clojure-src-root (expand-file-name "~/g/elisp"))
>
>     ;; Java starves programs by default
>     (setq swank-clojure-extra-vm-args (list "-Xmx1024m"))
>
> This part is very suboptimal, it would be nice if swank-clojure had
> better support for running out-of-Git so I wouldn't have to do
> this. Maybe it does and I haven't found the relevant bits:
>
>     (defun clojure-slime-config (&optional src-root)
>       "Hacky copy of slime-clojure's `clojure-slime-config' to do what I 
> want."
>
>       (if src-root (setq clojure-src-root src-root))
>
>       (add-to-list 'load-path (concat clojure-src-root "/slime"))
>       (add-to-list 'load-path (concat clojure-src-root "/slime/contrib"))
>       (add-to-list 'load-path (concat clojure-src-root "/swank-clojure"))
>
>       (require 'slime-autoloads)
>
>       (slime-setup '(slime-fancy))
>
>       (setq swank-clojure-classpath
>             (list
>              (concat clojure-src-root "/clojure/clojure.jar")
>              ;; Hack: Expand the name of the .jar with some Emacs glob 
> function
>              (concat clojure-src-root
> "/clojure-contrib/target/clojure-contrib-1.2.0-SNAPSHOT.jar")
>              (concat clojure-src-root "/swank-clojure/src")
>              (concat clojure-src-root "/clojure/test/clojure/test_clojure")))
>       (eval-after-load 'slime
>         '(progn (require 'swank-clojure)
>                 (setq slime-lisp-implementations
>                       (cons `(clojure ,(swank-clojure-cmd) :init
>                                       swank-clojure-init)
>                             (remove-if #'(lambda (x) (eq (car x) 'clojure))
>                                        slime-lisp-implementations))
>
>     ;;; Setup clojure
>     (clojure-slime-config)
>
> Finally set it up to play nice so that I can do M-x run-sbcl or M-x
> run-clojure to run Common Lisp or Clojure:
>
>     ;;http://groups.google.com/group/clojure/browse_thread/thread/e70ac373b...
>     (eval-after-load 'slime
>       '(progn
>          (add-to-list 'slime-lisp-implementations
>                       '(sbcl ("/usr/bin/sbcl")
>
>     (defun pre-slime ()
>       "Stuff to do before SLIME runs"
>       (clojure-slime-config)
>       (slime-setup))
>
>     (defun run-clojure ()
>       "Starts clojure in Slime"
>       (interactive)
>       (pre-slime)
>       (slime 'clojure))
>
>     (defun run-sbcl ()
>       "Starts SBCL in Slime"
>       (interactive)
>       (pre-slime)
>       (slime 'sbcl))
>
> Of course all of this was such a pain that I pretty much stopped there
> and haven't actually /done/ anything with clojure aside from a Hello
> World :)
>
> 1.http://github.com/avar/dotemacs
> 2.http://github.com/avar/elisp

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

Re: A syntax question: positional & keyword

2010-04-07 Thread MarkSwanson


On Apr 6, 6:23 pm, Stuart Halloway  wrote:
> Have you seen destructuring of rest args in the current master branch?
>
> (defn foo [& {:keys [a b c]}] [a b c])
>
> (foo :a 1 :c 3)
> => [1 nil 3]

... that's beautiful.

I hereby cast my vote into the void: release often; release 1.2
soon. :-)

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

To unsubscribe, reply using "remove me" as the subject.


Re: question about "into"

2010-04-07 Thread Per Vognsen
The second case is equivalent to (into [] [{:a 1 :b 2}]). You're
passing a singleton list containing a single element which happens to
be a map.

-Per

On Thu, Apr 8, 2010 at 7:35 AM, Base  wrote:
> Hi All -
>
> I have a question about into.
>
> When you run the into against a map you get a vector of
>
> (into [] {:a 1 :b 2})
>
> => [[:a 1] [:b 2]]
>
> However when you use a for in front of this you get the full map.
>
> (into [] (for [_ (range 1)] {:a 1 :b 2}))
>
> => [{:a 1, :b 2}]
>
> Why is this?  I would have expected them both to yield the same
> results...
>
> Thanks
>
> Bassel
>
> --
> 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
>
> To unsubscribe, reply using "remove me" as the subject.
>

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


question about "into"

2010-04-07 Thread Base
Hi All -

I have a question about into.

When you run the into against a map you get a vector of

(into [] {:a 1 :b 2})

=> [[:a 1] [:b 2]]

However when you use a for in front of this you get the full map.

(into [] (for [_ (range 1)] {:a 1 :b 2}))

=> [{:a 1, :b 2}]

Why is this?  I would have expected them both to yield the same
results...

Thanks

Bassel

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

To unsubscribe, reply using "remove me" as the subject.


New clojure support in Polyglot Maven

2010-04-07 Thread Antony Blakey
I've just pushed a major update to the Clojure support in pmaven to 
http://github.com/sonatype/polyglot-maven. It now covers 100% of maven by 
reflecting over the maven object model. Examples are in the tests and in the 
reader.clj source file. It includes leiningen support e.g. mvn -f project.clj 
install should work.

Antony Blakey
-
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

The ultimate measure of a man is not where he stands in moments of comfort and 
convenience, but where he stands at times of challenge and controversy.
  -- Martin Luther King


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

To unsubscribe, reply using "remove me" as the subject.


My non-ELPA Emacs swank-clojure setup

2010-04-07 Thread Ævar Arnfjörð Bjarmason
I stubbornly refuse to use ELPA. I keep my ~/.emacs and associated
libraries in Git[1][2] and don't like deviating from that with ELPA by
running the clojure code from an unversioned directory that isn't
automatically there when I set up my Emacs configuration from Git.

I couldn't find any documentation for setting up Emacs + Clojure +
Swank without ELPA. What follows are the steps I had to do to get my
setup working so that I can use both SBCL and Clojure with SLIME.

First checkout the needed clojure code into my ~/g/elisp library:

git submodule add git://github.com/technomancy/slime.git slime
git submodule add git://github.com/technomancy/clojure-mode.git clojure-mode
git submodule add git://github.com/jochu/swank-clojure.git swank-clojure
git submodule add git://github.com/richhickey/clojure.git clojure
git submodule add git://github.com/richhickey/clojure-contrib.git clojure

Build clojure:

cd clojure && ant
cd clojure-contrib && mvn package

Add this in my ~/.emacs to load the libraries:

(add-to-list 'load-path "~/g/elisp/clojure-mode")
(add-to-list 'load-path "~/g/elisp/swank-clojure")
(add-to-list 'load-path "~/g/elisp/slime")
(add-to-list 'load-path "~/g/elisp/slime/contrib")

Add autoloads + massive hack to get all of this to work:

(autoload 'clojure-mode "clojure-mode" nil t)
(autoload 'clojure-test-mode "clojure-test-mode" nil t)
(defvar package-activated-list nil "Hack: used in
`slime-changelog-date' but not defined anywhere")
(progn
  (autoload 'swank-clojure-init "swank-clojure")
  (autoload 'swank-clojure-slime-mode-hook "swank-clojure")
  (autoload 'swank-clojure-cmd "swank-clojure")
  (autoload 'swank-clojure-project "swank-clojure"))

(setq clojure-src-root (expand-file-name "~/g/elisp"))

;; Java starves programs by default
(setq swank-clojure-extra-vm-args (list "-Xmx1024m"))

This part is very suboptimal, it would be nice if swank-clojure had
better support for running out-of-Git so I wouldn't have to do
this. Maybe it does and I haven't found the relevant bits:

(defun clojure-slime-config (&optional src-root)
  "Hacky copy of slime-clojure's `clojure-slime-config' to do what I want."

  (if src-root (setq clojure-src-root src-root))

  (add-to-list 'load-path (concat clojure-src-root "/slime"))
  (add-to-list 'load-path (concat clojure-src-root "/slime/contrib"))
  (add-to-list 'load-path (concat clojure-src-root "/swank-clojure"))

  (require 'slime-autoloads)

  (slime-setup '(slime-fancy))

  (setq swank-clojure-classpath
(list
 (concat clojure-src-root "/clojure/clojure.jar")
 ;; Hack: Expand the name of the .jar with some Emacs glob function
 (concat clojure-src-root
"/clojure-contrib/target/clojure-contrib-1.2.0-SNAPSHOT.jar")
 (concat clojure-src-root "/swank-clojure/src")
 (concat clojure-src-root "/clojure/test/clojure/test_clojure")))
  (eval-after-load 'slime
'(progn (require 'swank-clojure)
(setq slime-lisp-implementations
  (cons `(clojure ,(swank-clojure-cmd) :init
  swank-clojure-init)
(remove-if #'(lambda (x) (eq (car x) 'clojure))
   slime-lisp-implementations))

;;; Setup clojure
(clojure-slime-config)


Finally set it up to play nice so that I can do M-x run-sbcl or M-x
run-clojure to run Common Lisp or Clojure:

;; 
http://groups.google.com/group/clojure/browse_thread/thread/e70ac373b47d7088
(eval-after-load 'slime
  '(progn
 (add-to-list 'slime-lisp-implementations
  '(sbcl ("/usr/bin/sbcl")

(defun pre-slime ()
  "Stuff to do before SLIME runs"
  (clojure-slime-config)
  (slime-setup))

(defun run-clojure ()
  "Starts clojure in Slime"
  (interactive)
  (pre-slime)
  (slime 'clojure))

(defun run-sbcl ()
  "Starts SBCL in Slime"
  (interactive)
  (pre-slime)
  (slime 'sbcl))

Of course all of this was such a pain that I pretty much stopped there
and haven't actually /done/ anything with clojure aside from a Hello
World :)


1. http://github.com/avar/dotemacs
2. http://github.com/avar/elisp

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

To unsubscribe, reply using "remove me" as the subject.


Re: let's all link to the "getting started" pages!

2010-04-07 Thread Avi Schwartz
On March 30th Eric Thorsen released version 1.1 of the Enclojure plugin for
NetBeans and posted to the enclojure group the following information. You
may want to update the information about Enclojure and NetBeans:

Requirements:
Netbeans 6.8

To use the new release:
1. If you already have Enclojure installed, go to the Tools->Plugins-
>Installed and click on "Show Details".  Find the Clojure plugin and
Uninstall it.
This should be the last time you'll need to do this now that the
update site is in place.

2. Setup the autoupdate for Enclojure
There is an autoupdate URL that you can use that will keep you up to
date with releases from now on.  You'll need to set this up 1x by
going into the Tools->Plugins->Settings and click "Add".
Call the Update Center "Enclojure" and use the following URL:
http://www.enclojure.org/file/view/Autoupdate_Site.xml.gz

3. Install the plugin
Again, in the Tools->Plugins dialog:
Go to "Available Plugins" and select the "Enclojure Clojure Plugin"
and click install.
This will download the plugin and take you through the install
process.

>From now on, the releases will be done via the update center.


Thanks,
Avi

On Tue, Apr 6, 2010 at 10:55 AM, Stuart Halloway
wrote:

> People getting started with Clojure have struggled to find an up-to-date
> source for information on getting their editor of choice up and running.
> This is unfortunate, since there is good support in a bunch of different
> editors.
>
> The "Getting Started" page on Assembla (
> http://www.assembla.com/wiki/show/clojure/Getting_Started) should
> ameliorate this problem. A bunch of people have contributed or tested
> instructions for Netbeans/Enclojure, Eclipse/Counterclockwise, IDEA/La
> Clojure, Emacs, Vim, and Leiningen.
>
> Now we just need to make this page more google-findable. If you have a
> blog/twitter/whatever-the-kids-use-these-days, please link out to the
> Assembla page, especially if you written up your own getting started
> instructions.
>
> Also, if you think the instructions suck please let me know how to make
> them better.
>
> Big thanks to everyone who wrote or tested the setup instructions, and to
> the unsung heroes who implemented the editor support modes.
>
> Thanks,
> Stu
>
> --
> 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
>
> To unsubscribe, reply using "remove me" as the subject.
>

-- 
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: let's all link to the "getting started" pages!

2010-04-07 Thread Sean Devlin
Anyone have instructions for CLR?

On Apr 7, 2:50 pm, Meikel Brandmeyer  wrote:
> Hi,
>
> On Wed, Apr 07, 2010 at 01:53:47PM -0400, Wilson MacGyver wrote:
> > I noticed there is no section or link on using clojure with gradle. What
> > can I do to help make that happen?
>
> Will add it.
>
> 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

To unsubscribe, reply using "remove me" as the subject.


Re: let's all link to the "getting started" pages!

2010-04-07 Thread Meikel Brandmeyer
Hi,

On Wed, Apr 07, 2010 at 01:53:47PM -0400, Wilson MacGyver wrote:

> I noticed there is no section or link on using clojure with gradle. What
> can I do to help make that happen?

Will add it.

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

To unsubscribe, reply using "remove me" as the subject.


Re: let's all link to the "getting started" pages!

2010-04-07 Thread Wilson MacGyver
I noticed there is no section or link on using clojure with gradle. What
can I do to help make that happen?

On Tue, Apr 6, 2010 at 11:55 AM, Stuart Halloway
 wrote:
> People getting started with Clojure have struggled to find an up-to-date
> source for information on getting their editor of choice up and running.
> This is unfortunate, since there is good support in a bunch of different
> editors.
>
> The "Getting Started" page on Assembla
> (http://www.assembla.com/wiki/show/clojure/Getting_Started) should
> ameliorate this problem. A bunch of people have contributed or tested
> instructions for Netbeans/Enclojure, Eclipse/Counterclockwise, IDEA/La
> Clojure, Emacs, Vim, and Leiningen.
>
> Now we just need to make this page more google-findable. If you have a
> blog/twitter/whatever-the-kids-use-these-days, please link out to the
> Assembla page, especially if you written up your own getting started
> instructions.
>
> Also, if you think the instructions suck please let me know how to make them
> better.
>
> Big thanks to everyone who wrote or tested the setup instructions, and to
> the unsung heroes who implemented the editor support modes.
>
> Thanks,
> Stu
>
> --
> 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
>
> To unsubscribe, reply using "remove me" as the subject.
>



-- 
Omnem crede diem tibi diluxisse supremum.

-- 
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: A syntax question: positional & keyword

2010-04-07 Thread Armando Blancas
> Just curious
>   - what folks think of fixed-positional-keyword params
>   - whether it was considered for Clojure

It's difficult to image that keyword params will be considered in
languages where they aren't folklore, as they are in Smalltalk,
Objective-C, and Self. Unlike Smtalltalk and Self, where keywords do
real work --they name the selector and are separators at the call
place-- in other languages they'd be annotations and maybe perceived
as redundant, e.g. a call like: (circle x y radius) is readable
without keywords.

In Smtalltalk a single-arg keyword message is readable because the
syntax gets the received out of the way to the left: 5.0 raisedTo: 3
where #raisedTo: is both the selector and keyword. In Clojure it
wouldn't look as simple and it'd introduce the inconsistency that the
first argument isn't "keyed".

Another aspect is of course high-order functions, where keywords make
things difficult at the call place and imposible inside the called
function. Having to make a feature optional when things get tough
using it usualy gets it scrapped. Smalltalk's "high-order methods"
don't have a problem because a method to call is passed using its
symbol (ie, its keywords) not as value. BTW, which Smalltalk do you
use? I've never seen the prefix you mentioned. AFAIK, a keyword
selector is just the concat of its keys.

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

To unsubscribe, reply using "remove me" as the subject.


Re: Trying to set emacs for some clojure coding

2010-04-07 Thread Stefan Kamphausen
Hi,

On 31 Mrz., 18:29, Stefan Kamphausen  wrote:
> Hi,
>
> On 31 Mrz., 13:52, Pelayo Ramón  wrote:
>
> just to add one more to the list...  Note however, that this is what
> worked *for me* and it means going against the grain.  So if there is
> anything wrong with that setup don't ask the authors of the fine
> software used, go and blame me ;-)
> Uh, and Clojure 1.1 only.
>
> With that being said, here 
> goes.http://www.skamphausen.de/cgi-bin/ska/My_Clojure_Setup

just for the record: I found today that the docs on my site are not
valid anymore, since the clojure-1.1-branch of swank-clojure is not
available anymore.  The page now says so and I will see whether I can
fix it in due time.

Of course it contains a link to the Getting Started page :-)

Cheers,
Stefan

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

To unsubscribe, reply using "remove me" as the subject.


Re: Trying to set emacs for some clojure coding

2010-04-07 Thread Phil Hagelberg
2010/4/7 Pelayo Ramón :
>> If you have any idea or inkling why swank-clojure wasn't able to
>> automatically download the jars please let me know; I'd like to get it
>> fixed.
>
> I don't have any idea. My emacs knowledge tends to 0. ¿Something I
> could check to give you some information? ¿Any logging file?

Try commenting out your fix, turning on M-x toggle-debug-on-error, and
then doing M-x slime. You should see a stacktrace. If not check the
*Messages* buffer. Also include which Emacs version you're using.

-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

To unsubscribe, reply using "remove me" as the subject.


Re: A syntax question: positional & keyword

2010-04-07 Thread David Nolen
The runtime cost of destructuring is not worth getting worked up
about. It's easy to check this yourself with (time ...)

David

On Wednesday, April 7, 2010, Sophie  wrote:
> On Apr 6, 7:03 pm, ataggart  wrote:
>> See:
>>
>> http://richhickey.github.com/clojure-contrib/def-api.html#clojure.con...
>
> Ah, thank you (all).
>
> Will this be in 1.2? Is run-time cost expected to be minor, and will
> passing unrecognized keys be an error?
>
> --
> 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
>
> To unsubscribe, reply using "remove me" as the subject.
>

-- 
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: Proxy and the "do" special form / var question

2010-04-07 Thread Per Vognsen
On Wed, Apr 7, 2010 at 7:40 PM, Alex Osborne  wrote:
> "msapp...@web.de"  writes:
>
> If it's truly immutable -- you never want to change or reload maps while
> game is running and initialize-game only ever gets called once, I'd
> personally probably say that's okay.

I'd say it's the kind of thing that's convenient during development
but will likely need to change later on. As such, I'd recommend he
goes through the var with explicit dereferencing, or a functional
interface with a similar level of indirection, so he can easily swap
it out for a ref later on when it becomes necessary.

-Per

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

To unsubscribe, reply using "remove me" as the subject.


Re: Proxy and the "do" special form / var question

2010-04-07 Thread Alex Osborne
"msapp...@web.de"  writes:

> (defn initialize-game [container]
> do(
(Log/info "INIT FN START")
[...]
> )
> )

> Why does it throw the exception?

The 'do' should be inside the parens, not before them.  Your indentation
also appears to be messed up which makes it harder to spot the problem.

The reason you get a NullPointerException is Log/info returns nil/null,
so you're effectively doing this:

(nil ...)

Calling nil causes a NullPointerException.

> 2. Question:
> I read this in on clojure.org:
>
> I have to initialize a tiled-map (special map created with the
> tiled.org mapeditor) once.
> So I want to create a var.  (If question 1 is resolved and I can use
> initialize ... )
>
> Should I use refs or is it okay to use (def ...) in initialize?
>
> Because the values specified in "initialize-game" should not be
> mutable!

If it's truly immutable -- you never want to change or reload maps while
game is running and initialize-game only ever gets called once, I'd
personally probably say that's okay.

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

To unsubscribe, reply using "remove me" as the subject.


Proxy and the "do" special form / var question

2010-04-07 Thread msapp...@web.de
Hi I have been using clojure for a week now and I am working on
http://slick.cokeandcode.com/ to create games.

I use a proxy for BasicGame , which supplies me with (init) and the
game loop.

I have to initialize image-based resources either in the game loop or
at init so I defined everything @ init:

/ CODE:

(ns test
(:import (org.newdawn.slick BasicGame GameContainer Graphics
SlickException AppGameContainer)
   (org.newdawn.slick.tiled TiledMap)
   (org.newdawn.slick.util Log))
)


(def map-file  "data/randmap.tmx")

(defn initialize-game [container]
do(
(Log/info "INIT FN START")
(def tiled-map (TiledMap. map-file))
(Log/info (str "tiled-map: " tiled-map))
(def tile-size (. tiled-map getTileWidth))
(Log/info (str "tiled-size: " tile-size))
(def ground-layer-index (. tiled-map getLayerIndex "ground"))

; caculate some layout values for rendering the tilemap. How many
tiles
; do we need to render to fill the screen in each dimension and how
far
; is
; it from the centre of the screen

(def display-height-in-tiles (/ (. container getHeight) tile-size))
(def display-width-in-tiles (/ (. container getWidth) tile-size))

; Hier enstehen kleine Ungereimtheiten wenn man den topOffset abzieht
; er aber 20,4 anstatt von z.b. 20 beträgt -> 0,4 verschobene map !

(def top-offset-in-tiles (int (/ display-height-in-tiles 2)))
(def left-offset-in-tiles (int (/ display-width-in-tiles 2)))

(def top-offset-in-tiles-buffer (- top-offset-in-tiles (/ display-
height-in-tiles 2)))

(def left-offset-in-tiles-buffer (- left-offset-in-tiles (/ display-
width-in-tiles 2)))

(Log/info "INIT FN FIN")
)
)

; image-based resources have to be loaded as part of init or the
gameloop
(def simple-test

(proxy [BasicGame] ["SimpleTest"]

(init [container] (initialize-game container) )

(update [container delta] (println "update called"))

(render [container g] (do (println "render
called!") ))
))


(def container (new AppGameContainer simple-test))

(.start container)

/ CODE

1. Question:
This simplified code above throws a nullpointer exception.
Here is the exception (after the initialize do is completed, as you
can see with the LOG message):

user=> (use 'test)
Wed Apr 07 10:49:27 CEST 2010 INFO:Slick Build #230
Wed Apr 07 10:49:27 CEST 2010 INFO:LWJGL Version: 2.1.0
Wed Apr 07 10:49:27 CEST 2010 INFO:OriginalDisplayMode: 1280 x 800 x
32 @60Hz
Wed Apr 07 10:49:27 CEST 2010 INFO:TargetDisplayMode: 640 x 480 x 0
@0Hz
0
Wed Apr 07 10:49:27 CEST 2010 INFO:Starting display 640x480
Wed Apr 07 10:49:27 CEST 2010 INFO:Controllers not available
Wed Apr 07 10:49:27 CEST 2010 INFO:INIT FN START
Wed Apr 07 10:49:28 CEST 2010 INFO:tiled-map:
org.newdawn.slick.tiled.tiled...@b
aa466
Wed Apr 07 10:49:28 CEST 2010 INFO:tiled-size: 48
Wed Apr 07 10:49:28 CEST 2010 INFO:INIT FN FIN
java.lang.NullPointerException (test.clj:0)

The exception points to the last row of the do of initialize-game.

user=> (. *e printStackTrace)
java.lang.NullPointerException (test.clj:0)
at clojure.lang.Compiler.eval(Compiler.java:4543)
at clojure.lang.Compiler.load(Compiler.java:4857)
at clojure.lang.RT.loadResourceScript(RT.java:326)
at clojure.lang.RT.loadResourceScript(RT.java:317)
at clojure.lang.RT.load(RT.java:395)
at clojure.lang.RT.load(RT.java:367)
at clojure.core$load__5058$fn__5061.invoke(core.clj:3734)
at clojure.core$load__5058.doInvoke(core.clj:3733)
at clojure.lang.RestFn.invoke(RestFn.java:413)
at clojure.core$load_one__5010.invoke(core.clj:3578)
at clojure.core$load_lib__5031.doInvoke(core.clj:3615)
at clojure.lang.RestFn.applyTo(RestFn.java:147)
at clojure.core$apply__3243.doInvoke(core.clj:390)
at clojure.lang.RestFn.invoke(RestFn.java:443)
at clojure.core$load_libs__5043.doInvoke(core.clj:3641)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply__3243.doInvoke(core.clj:390)
at clojure.lang.RestFn.invoke(RestFn.java:460)
at clojure.core$use__5052.doInvoke(core.clj:3711)
at clojure.lang.RestFn.invoke(RestFn.java:413)
at user$eval__1.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:4532)
at clojure.core$eval__3990.invoke(core.clj:1728)
at clojure.main
$repl__5813$read_eval_print__5825.invoke(main.clj:176)
at clojure.main$repl__5813.doInvoke(main.clj:193)
at clojure.lang.RestFn.invoke(RestFn.java:426)
at clojure.main$repl_opt__5853.invoke(main.clj:247)
at clojure.main$legacy_repl__5878.invoke(main.clj:288)
at clojure.lang.Var.invoke(Var.java:346)
at clojure.main.legacy_repl(main.java:29)
at clojure.lang.Repl.main(Repl.java:20)
Caused by: java.lang.NullPointerException
at test$initialize_game__7.invoke(te

Re: A syntax question: positional & keyword

2010-04-07 Thread Laurent PETIT
I think defnk is deprecated by the new feature mentioned by Stuart.
As far as I remember, positional arguments in defnk do not allow to be
used either prefixed by their name, either without, so I guess defnk
didn't solve your problem definition.

2010/4/7 Sophie :
> On Apr 6, 7:03 pm, ataggart  wrote:
>> See:
>>
>> http://richhickey.github.com/clojure-contrib/def-api.html#clojure.con...
>
> Ah, thank you (all).
>
> Will this be in 1.2? Is run-time cost expected to be minor, and will
> passing unrecognized keys be an error?
>
> --
> 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
>
> To unsubscribe, reply using "remove me" as the subject.
>

-- 
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: let's all link to the "getting started" pages!

2010-04-07 Thread Alex Ott
Hello Stuart

Stuart Halloway  at "Tue, 6 Apr 2010 11:55:26 -0400" wrote:
 SH> People getting started with Clojure have struggled to find an up-to-
 SH> date source for information on getting their editor of choice up and 
running. This is
 SH> unfortunate, since there is good support in a bunch  of different editors.

What kind of information do you want to put into ClojureMaven page?  How to
setup maven to work with clojure, including instructions for editing of
pom.xml, or just list of commands, provided by clojure-maven-plugin?

 SH> The "Getting Started" page on Assembla
 SH> (http://www.assembla.com/wiki/show/clojure/Getting_Started
 SH> ) should ameliorate this problem. A bunch of people have contributed or 
tested
 SH> instructions for Netbeans/Enclojure, Eclipse/ Counterclockwise, IDEA/La 
Clojure, Emacs,
 SH> Vim, and Leiningen.

 SH> Now we just need to make this page more google-findable. If you have a
 SH> blog/twitter/whatever-the-kids-use-these-days, please link out to the  
Assembla page,
 SH> especially if you written up your own getting started  instructions.


-- 
With best wishes, Alex Ott, MBA
http://alexott.blogspot.com/   http://alexott.net
http://alexott-ru.blogspot.com/

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

To unsubscribe, reply using "remove me" as the subject.


Re: Trying to set emacs for some clojure coding

2010-04-07 Thread Pelayo Ramón
On Tue, Apr 6, 2010 at 6:06 PM, Phil Hagelberg  wrote:
> 2010/4/6 Pelayo Ramón :
>> Installed with ELPA clojure-mode and swank-clojure. But slime couldn't
>> find the swank-clojure.jar so I  downloaded it and setted the
>> classpath in .emacs to the directory where I stored it along with
>> clojure.jar and clojure-contrib.jar
>>
>> the emacs line is:
>>
>> (setq swank-clojure-extra-
>>  classpaths
>>  (list
>>  "/home/user/.clojure"))
>
> If you have any idea or inkling why swank-clojure wasn't able to
> automatically download the jars please let me know; I'd like to get it
> fixed.
>
> -Phil
>

I don't have any idea. My emacs knowledge tends to 0. ¿Something I
could check to give you some information? ¿Any logging 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

To unsubscribe, reply using "remove me" as the subject.


Re: Mutually-referencing structures

2010-04-07 Thread Laurent PETIT
2010/4/7 Michael Gardner :
> On Apr 6, 2010, at 9:01 AM, Laurent PETIT wrote:
>
>>    * BUT : isn't the real problem that one will not content
>> [him/her]/self with playing with in-memory data ? One will want to
>> make the data persistent (outside-of-process, aka
>> storage-persistance). And with this kind of problem, one will have a
>> graph of identities containing references to other identities (the
>> needed level(s) of indirection). How does one painlessly store/unstore
>> those graphs to databases ?
>
> XML with ID/IDREFs seems the obvious choice.

Yes, but while in memory, the ref is a unique java instance, not just
a String representing an unique value.
So you need some mechanism to serialize your ref into a unique value
as in IDREF (and ensure that everywhere the ref isntance is used as a
value, the same IDREF is used).
And when you want to deserialize, you need a mechanism to create a
single ref instance for each IDREF, and ensure that this unique ref
instance for the IDREF is placed in each appropriate value of other
identities ...

I would love to see this handled by the core language (probably in a
polymorphic way).

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