Lau | 1 Jun 12:18 2008
Picon

Advanced Emacs intregration


Hi Group,

I'm in the process of transition from SBCL to Clojure. First step was
to integrate Clojure into my Emacs environment, using the advanced
clojure-mode and swank-clojure. This works so far as the REPL is
actually running and is able to evaluate statements. The problem is,
that whenever I press space, as in (+<SPACE>2<SPACE>2), Emacs will pop-
up an error saying

"Unable to resolve symbol: user in this context"
[Thrown class.java.lang.Exception].

The user in this case is probably a references to the REPL prompt
which is "user>".
Quite annoying - Does anybody know how to resolve this?

/Lau
walt rarus | 1 Jun 16:06 2008
Picon

compilation failure at rev 887


   [1]   ~/java/clojure $ svn up
At revision 887.
~/java/clojure $ mvn -e install
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
------------------------------------------------------------------------
[INFO] Building clojure-lang
[INFO]    task-segment: [install]
[INFO]
------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Compiling 4 source files to /home/walt/java/clojure/target/
classes
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Compilation failure

/home/walt/java/clojure/src/jvm/clojure/lang/Compiler.java:[23,0]
package org.objectweb.asm does not exist

/home/walt/java/clojure/src/jvm/clojure/lang/Compiler.java:[24,33]
package org.objectweb.asm.commons does not exist

(Continue reading)

Rich Hickey | 1 Jun 16:18 2008
Picon

Re: compilation failure at rev 887


On Jun 1, 10:06 am, walt rarus <geeked... <at> gmail.com> wrote:
>    [1]   ~/java/clojure $ svn up
> At revision 887.

Rev 887 has the checkin comment:

"interim checkin - DO NOT USE!"

So, stick with 886 for now, thanks.

Rich
Michael Reid | 1 Jun 16:21 2008
Picon

Re: Advanced Emacs intregration


Hi,

> that whenever I press space, as in (+<SPACE>2<SPACE>2), Emacs will pop-
> up an error saying
>
> "Unable to resolve symbol: user in this context"
> [Thrown class.java.lang.Exception].
>

Not sure how you ended up in this situation but it sounds like the
'user' namespace has not been referred to the clojure namespace (where
+ is defined). Normally when starting clojure.lang.Repl this is done
automatically upon entering the REPL, so I'm not sure how you are
launching this.

But entering the following form at the REPL should bring it into scope:

  (clojure/refer 'clojure)

Cheers,
/mike.

walt rarus | 1 Jun 16:22 2008
Picon

Re: compilation failure at rev 887


On Jun 1, 10:18 am, Rich Hickey <richhic... <at> gmail.com> wrote:
> Rev 887 has the checkin comment:
>
> "interim checkin - DO NOT USE!"
>
> So, stick with 886 for now, thanks.

Oops. Sorry for the noise and thanks for Clojure.
gedden | 1 Jun 16:38 2008
Picon

recursion and JVM stack


Hi,

I am new to clojure and lisp coming from functional programming where
I have played with mainly erlang for a while. But what I really want
is to have functional programming on the JVM

One of the issues I have had with java and functional programming  is
that the calling stack is so small in the JVM. With the default
stacksize A recursive program breaks down after just a few thousand
recursions.

A program that would process a little file on a character by character
basis will be impossible, if the file is larger than 5k.

Of course, you can increase the stack with a JVM startup parameter,
but this will apply to every thread in your program and seems to be
kind of preallocated, so it will soon eat all resources in your
system.

This, I percieve as a major roadblock for using the JVM for functional
programming. If you have to start thinking about workarounds for
recursion every time you need to process a list, then you have quickly
lost the productivity gains ...

Recently, I  noticed Clojure, and thought, great, this will solve my
problems. But it seems, the use of stack space is just as
simpleminded.

First thing I implemented was foldr, (similar to reduce but starting
(Continue reading)

gedden | 1 Jun 16:47 2008
Picon

Re: recursion and JVM stack


Sorry, a little correction,

What I meant was:

How do you closure-lispers get around the stack limitations?

(and not, how do you live with the lack of tail recursion)

gedden

On 1 Jun., 16:38, gedden <sgronv... <at> gmail.com> wrote:
> Hi,
>
> I am new to clojure and lisp coming from functional programming where
> I have played with mainly erlang for a while. But what I really want
> is to have functional programming on the JVM
>
> One of the issues I have had with java and functional programming  is
> that the calling stack is so small in the JVM. With the default
> stacksize A recursive program breaks down after just a few thousand
> recursions.
>
> A program that would process a little file on a character by character
> basis will be impossible, if the file is larger than 5k.
>
> Of course, you can increase the stack with a JVM startup parameter,
> but this will apply to every thread in your program and seems to be
> kind of preallocated, so it will soon eat all resources in your
> system.
(Continue reading)

Chouser | 1 Jun 18:28 2008
Picon

Re: recursion and JVM stack


On Sun, Jun 1, 2008 at 10:38 AM, gedden <sgronvald <at> gmail.com> wrote:
> First thing I implemented was foldr, (similar to reduce but starting
> from the back of the list). foldr is not tail recursive. My recursive
> call breaks down (stack overflow) after just 4-5000 recursions.

(defn foldr [f s] (reduce f (reverse s))

Of course that's just one case, but it is a useful example.  In this
case the problem of deep recursion is avoided by using a
tail-recursive function (reverse) to build the data structure we need
so that we can use another tail-recursive function (reduce) to get our
answer.

In other cases you may be able to solve the problem using lazy functions.

In practice it turns out to be rare that you have to break down and
use iteration.

--Chouser

Lau B. Jensen | 1 Jun 19:13 2008
Picon

Re: Advanced Emacs intregration

Hey,

Very nice of you to write back Mike. I'm sorry though, because I dont think I made myself clear. (+ 2 2) was just an example, it does not matter WHAT I write in REPL, whenever I hit space, it fires an error. Im not sure how I got in this situation, but I'm thinking its somehow related to the fact that normally I use emacs with SBCL instead of Clojure.

The command (clojure/refer 'clojure) returned "nil" and did not fix the issue. This is how I started clojure:

(defun clojure-boot ()
  (interactive)
  (require 'slime)
  (setq slime-net-coding-system 'utf-8-unix)
  (slime-setup)
  (define-key slime-mode-map [f5] 'switch-to-buffer)
  (define-key slime-repl-mode-map [f5] 'switch-to-buffer)
  (define-key slime-mode-map [f8] 'slime-eval-buffer)
  (define-key slime-mode-map [f9] 'slime-eval-defun)
  (define-key slime-repl-mode-map [f9] 'slime-eval-last-expression-display-output)
  (define-key slime-mode-map [C-return] 'slime-close-all-sexp)

  (add-to-list 'load-path "/home/jacksmack/programming/lisp/clojure/emacs/clojure-mode")
  (require 'clojure-mode)
  (setq auto-mode-alist (cons '("\\.clj" . clojure-mode) auto-mode-alist))
  (setq slime-lisp-implementations '((clojure ("~/programming/lisp/clojure/start.sh") :init clojure-init)))
  (add-to-list 'load-path "~/programming/lisp/swank-clojure")
  (require 'swank-clojure)
  (setq inferior-lisp-program "~/programming/lisp/clojure/start.sh")
  (setq slime-net-coding-system 'utf-8-unix)
  (require 'slime-autoloads)
  (require 'slime)
  (cua-mode t)
  (slime))


Any pointers would be great, because the REPL is almost useless as is.

/Lau


Michael Reid wrote:
Hi,
that whenever I press space, as in (+<SPACE>2<SPACE>2), Emacs will pop- up an error saying "Unable to resolve symbol: user in this context" [Thrown class.java.lang.Exception].
Not sure how you ended up in this situation but it sounds like the 'user' namespace has not been referred to the clojure namespace (where + is defined). Normally when starting clojure.lang.Repl this is done automatically upon entering the REPL, so I'm not sure how you are launching this. But entering the following form at the REPL should bring it into scope: (clojure/refer 'clojure) Cheers, /mike.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Clojure" group.
To post to this group, send email to clojure <at> googlegroups.com
To unsubscribe from this group, send email to clojure-unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

darren.austin | 1 Jun 20:45 2008
Picon

Re: Advanced Emacs intregration


I had the same problem yesterday and contacted the author.  He has
fixed the problem, so you should pull the latest version from github
and see if that fixes it for you as well.

--Darren

On Jun 1, 10:13 am, "Lau B. Jensen" <lau.jen... <at> bestinclass.dk> wrote:
> Hey,
> Very nice of you to write back Mike. I'm sorry though, because I dont think I made myself clear. (+ 2 2) was
just an example, it does not matter WHAT I write in REPL, whenever I hit space, it fires an error. Im not sure
how I got in this situation, but I'm thinking its somehow related to the fact that normally I use emacs with
SBCL instead of Clojure.
> The command (clojure/refer 'clojure) returned "nil" and did not fix the issue. This is how I started clojure:
> (defun clojure-boot ()
>   (interactive)
>   (require 'slime)
>   (setq slime-net-coding-system 'utf-8-unix)
>   (slime-setup)
>   (define-key slime-mode-map [f5] 'switch-to-buffer)
>   (define-key slime-repl-mode-map [f5] 'switch-to-buffer)
>   (define-key slime-mode-map [f8] 'slime-eval-buffer)
>   (define-key slime-mode-map [f9] 'slime-eval-defun)
>   (define-key slime-repl-mode-map [f9] 'slime-eval-last-expression-display-output)
>   (define-key slime-mode-map [C-return] 'slime-close-all-sexp)
>   (add-to-list 'load-path "/home/jacksmack/programming/lisp/clojure/emacs/clojure-mode")
>   (require 'clojure-mode)
>   (setq auto-mode-alist (cons '("\\.clj" . clojure-mode) auto-mode-alist))
>   (setq slime-lisp-implementations '((clojure ("~/programming/lisp/clojure/start.sh") :init clojure-init)))
>   (add-to-list 'load-path "~/programming/lisp/swank-clojure")
>   (require 'swank-clojure)
>   (setq inferior-lisp-program "~/programming/lisp/clojure/start.sh")
>   (setq slime-net-coding-system 'utf-8-unix)
>   (require 'slime-autoloads)
>   (require 'slime)
>   (cua-mode t)
>   (slime))
> Any pointers would be great, because the REPL is almost useless as is.
> /Lau
> Michael Reid wrote:Hi,that whenever I press space, as in (+<SPACE>2<SPACE>2), Emacs will pop- up an
error saying "Unable to resolve symbol: user in this context" [Thrown class.java.lang.Exception].Not
sure how you ended up in this situation but it sounds like the 'user' namespace has not been referred to the
clojure namespace (where + is defined). Normally when starting clojure.lang.Repl this is done
automatically upon entering the REPL, so I'm not sure how you are launching this. But entering the
following form at the REPL should bring it into scope: (clojure/refer 'clojure) Cheers, /mike.

Gmane