Lisp50@OOPSLA

75 views
Skip to first unread message

Dustin Withers

unread,
Oct 21, 2008, 12:38:54 PM10/21/08
to Clojure
Rich,

I just wanted to thank you for your presentation at Lisp50. The
excitement that was created from your presentation was amazing. I
believe that this is the beginning of a resurgence of Lisp in the
market and I think Clojure is leading the way. After last nights
events I hope to see more people coming in with diverse interests and
abilities.

Again, thank you for the presentation and thank you for Clojure!

-dustin

Eric

unread,
Oct 21, 2008, 11:49:07 PM10/21/08
to Clojure
I second the thanks.

The presentation was perfectly timed. The presentations that preceded
it built the perfect mood. The idea in the air was that Lisp was
about innovation and making programming easier. That Common Lisp was
never meant to be the end. That Lisp needs something new. And here
comes Clojure.

I look forward to working on Clojure.

Eric

Eric

unread,
Oct 22, 2008, 12:02:40 AM10/22/08
to Clojure
I second the thanks.

The Clojure presentation was perfectly timed. After a whole day of
talking about how Lisp was always about innovation. That Common Lisp
was never supposed to be an end---it was a practical compromise not a
technical ideal. That Lisp needs something new. Then you talked
about Clojure.

And the older Lisp guys were feeling the buzz of excitement. I felt
that they passed the baton.

Good luck.

Eric

On Oct 21, 11:38 am, Dustin Withers <fadedd...@gmail.com> wrote:

Krukow

unread,
Oct 22, 2008, 8:15:53 AM10/22/08
to Clojure
Rich,

Was this presentation recorded? Any chance you can upload the slides
and/or video for those of us that didn't participate in Lisp50.

Thanks
- Karl

David Hilton

unread,
Nov 2, 2008, 11:35:06 PM11/2/08
to Clojure
I'd also be interested in seeing the Lisp50 presentation (I missed it
because I had SV hours scheduled at the time).

I just noticed that the Boston Lisp presentation on Clojure has been
posted (http://clojure.blogspot.com/). How similar were the two
presentations?

David

Rich Hickey

unread,
Nov 3, 2008, 6:34:39 AM11/3/08
to Clojure
The Boston Lisp presentation, at 4x the length, was significantly more
detailed and interactive, and what I would recommend if you have the
time. If you've already seen it, the Lisp50 talk won't add much -
probably most interesting in the context of the entire day's talks.

I didn't record the Lisp50 talk, but all of the talks were recorded
and will eventually end up somewhere, I'll post when I know they are
available.

Rich

Stephen Gilardi

unread,
Nov 15, 2008, 10:39:38 PM11/15/08
to clo...@googlegroups.com
Clojure does not currently allow programs to define new reader macros. That is unlikely to change.

There are more details here:

http://groups.google.com/group/clojure/search?group=clojure&q=reader+macro&qt_g=Search+this+group

There is a clever technique described on the wiki that allows Clojure Shebang scripts:

http://en.wikibooks.org/wiki/Clojure_Programming#Shebang_Scripting_in_Clojure

(There's a link there that points to a posting that explains how it works.)

--Steve

On Saturday, November 15, 2008, at 07:52PM, "Jeff Rose" <ros...@gmail.com> wrote:
>
>Hi, I'm finding comments talking about reader macros, but nothing about
>defining them. Does anyone know of an example for adding new read
>macros? I'd like to define a #! macro that passes over the rest of the
>line so we can use clojure scripts just as easily as a ruby script would
>be. If anyone knows another way to do this, that would be great too.
>
>Thanks,
>Jeff

Jeff Rose

unread,
Nov 16, 2008, 7:59:30 AM11/16/08
to clo...@googlegroups.com
Thanks for responding. I had already seen the shebang script hack on
the wiki, and although impressive I don't think it's a solution. It's
shocking to me that someone who is into lisp would even think of getting
rid of read macros though. For sure, there is a potential for abuse,
but I don't think it actually happens much. The tone set forth by the
built-in libraries will probably have more to do than anything with
these types of policies. I've never experienced the pain from this, so
maybe I'm just lucky and/or naive, but I always considered read macros
one of the primary reasons that lisp is such a wonderful place to
explore language ideas.

Anyways, I don't want to get into a debate for now. In the meantime how
about defining #! to read through until the end of the line? Hell, it
could even be restricted to the first line of the first file. This
change shouldn't effect anything else, but it will make clojure programs
as easily runnable as any other script, which should really be a must
have for a new language on the scene. People coming to lisp, say from
Ruby, Python or Pearl, already have to rewire their brains a bit, and
making them substitute this garbage:

#^:shebang '[
exec java -cp "$HOME/src/clj/clojure/clojure.jar" clojure.lang.Script
"$0" -- "$@"

for this:

#!/usr/bin/env clj

makes it seem like a big hack. For that matter, a standard clj script
or executable should probably be a part of the package too. How about
it? For the children. Oh, and if the read table is getting modified, I
vote for Ruby like string evaluation too :-)

Cheers,
Jeff

Mark Volkmann

unread,
Nov 16, 2008, 8:45:09 AM11/16/08
to clo...@googlegroups.com
On Sun, Nov 16, 2008 at 6:59 AM, Jeff Rose <ros...@gmail.com> wrote:
>
> For that matter, a standard clj script
> or executable should probably be a part of the package too.

A big +1! Everybody shouldn't have to write this script themselves or
copy it from the Wiki. It could require that certain environment
variables be set such as CLOJURE_HOME, CLOJURE_CP, and maybe
JLINE_HOME. The last one could go away if Clojure shipped with a JLine
.jar file.

--
R. Mark Volkmann
Object Computing, Inc.

Rich Hickey

unread,
Nov 16, 2008, 8:55:16 AM11/16/08
to Clojure
> >http://groups.google.com/group/clojure/search?group=clojure&q=reader+...
>
> > There is a clever technique described on the wiki that allows Clojure Shebang scripts:
>
> >http://en.wikibooks.org/wiki/Clojure_Programming#Shebang_Scripting_in...
>
> > (There's a link there that points to a posting that explains how it works.)
>
> > --Steve
>
> > On Saturday, November 15, 2008, at 07:52PM, "Jeff Rose" <ros...@gmail.com> wrote:
> >> Hi, I'm finding comments talking about reader macros, but nothing about
> >> defining them. Does anyone know of an example for adding new read
> >> macros? I'd like to define a #! macro that passes over the rest of the
> >> line so we can use clojure scripts just as easily as a ruby script would
> >> be. If anyone knows another way to do this, that would be great too.
>

I've added #! as a to-end-of-line comment, like ;


Rich

Dudley Flanders

unread,
Nov 16, 2008, 10:50:54 AM11/16/08
to clo...@googlegroups.com

On Nov 16, 2008, at 7:45 AM, Mark Volkmann wrote:

>
> On Sun, Nov 16, 2008 at 6:59 AM, Jeff Rose <ros...@gmail.com> wrote:
>>
>> For that matter, a standard clj script
>> or executable should probably be a part of the package too.
>
> A big +1! Everybody shouldn't have to write this script themselves or
> copy it from the Wiki. It could require that certain environment
> variables be set such as CLOJURE_HOME, CLOJURE_CP, and maybe
> JLINE_HOME. The last one could go away if Clojure shipped with a JLine

> jar file.

Mine's here if you want to avoid writing one: http://github.com/dudleyf/clojure-bin
. It'll detect JLine on the classpath and use the ConsoleRunner
accordingly.

:dudley

Peter Wolf

unread,
Nov 16, 2008, 11:14:21 AM11/16/08
to clo...@googlegroups.com
Hello, I'm feeling dumb...

I set up SLIME/SWANK/Clojure on my Linux system, but indentation isn't
working.

The doc says that indentation should "just work"... but nothing
happens. I tried "indent-region", "indent-sexp" and
"slime-update-indentation"

What's the trick?

Thanks
P

Peter Wolf

unread,
Nov 16, 2008, 11:26:19 AM11/16/08
to clo...@googlegroups.com
OK, I think I found the problem. When I start SLIME I get this... See
below for my .emacs

It looks like SWANK is sending the progn to Clojure which complains.
What did I do wrong?

Thanks
P


(progn (load "/usr/share/slime-2008-11-15/swank-loader.lisp" :verbose t)
(funcall (read-from-string "swank-loader:init")) (funcall
(read-from-string "swank:start-server") "/tmp/slime.27190"
:coding-system "iso-latin-1-unix"))

Listening for transport dt_socket at address: 8888
Clojure
user=> java.lang.Exception: Unable to resolve symbol: progn in this context
clojure.lang.Compiler$CompilerException: NO_SOURCE_FILE:1: Unable to
resolve symbol: progn in this context
at clojure.lang.Compiler.analyze(Compiler.java:3713)
at clojure.lang.Compiler.analyze(Compiler.java:3671)
at clojure.lang.Compiler.access$100(Compiler.java:37)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:2634)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3860)
at clojure.lang.Compiler.analyze(Compiler.java:3698)
at clojure.lang.Compiler.analyze(Compiler.java:3671)
at clojure.lang.Compiler.access$100(Compiler.java:37)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:3384)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:3231)
at clojure.lang.Compiler$FnMethod.access$1200(Compiler.java:3142)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:2766)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3856)
at clojure.lang.Compiler.analyze(Compiler.java:3698)
at clojure.lang.Compiler.eval(Compiler.java:3889)
at clojure.lang.Repl.main(Repl.java:75)
Caused by: java.lang.Exception: Unable to resolve symbol: progn in this
context
at clojure.lang.Compiler.resolveIn(Compiler.java:4019)
at clojure.lang.Compiler.resolve(Compiler.java:3972)
at clojure.lang.Compiler.analyzeSymbol(Compiler.java:3955)
at clojure.lang.Compiler.analyze(Compiler.java:3686)
... 15 more
user=>


.emacs

(add-to-list 'load-path "/usr/share/clojure/clojure-mode")
(add-to-list 'load-path "/usr/share/slime-2008-11-15/") ; your SLIME
directory

(setq inferior-lisp-program "/usr/share/clojure/clojure") ; your Lisp system
(setq swank-clojure-binary "clojure")

(require 'clojure-auto)
(require 'swank-clojure)
(require 'slime)
(slime-setup)

Stephen C. Gilardi

unread,
Nov 16, 2008, 1:09:06 PM11/16/08
to clo...@googlegroups.com

On Nov 16, 2008, at 8:55 AM, Rich Hickey wrote:

I've added #! as a to-end-of-line comment, like ;

Very cool, thanks!

Now, with Clojure compiled into its jar and the associated faster launching, it's reasonable to think of using Clojure for more tasks that might otherwise be done with bash/perl/python.

That would require a way (ideally built into the standard clojure.jar) for Clojure to read a script from stdin, execute it, and exit. Would this be best done by enhancing clojure.lang.Script or by providing a new "main" tailor made for it?

I'm in favor enhancing clojure.lang.Script.

Does anyone have any thoughts about this?

Does anyone with a Contributor Agreement in place already have code for it they'd like to propose?

--Steve

Stuart Sierra

unread,
Nov 16, 2008, 1:21:29 PM11/16/08
to Clojure
On Nov 16, 1:09 pm, "Stephen C. Gilardi" <squee...@mac.com> wrote:
> Now, with Clojure compiled into its jar and the associated faster  
> launching, it's reasonable to think of using Clojure for more tasks  
> that might otherwise be done with bash/perl/python.
>
> That would require a way (ideally built into the standard clojure.jar)
> for Clojure to read a script from stdin, execute it, and exit. Would
> this be best done by enhancing clojure.lang.Script or by providing a
> new "main" tailor made for it?

Yes, yes! My suggestion would be to modify clojure.lang.Script to
make it work like bash/perl/ruby; i.e., script is first argument,
command-line args follow, if no args at all read script from STDIN.

I would like both the REPL and Script to be callable from the same main
(), i.e. you should just be able to call java -jar clojure.jar without
naming a class. Default behavior would be to run a script, as with
bash/perl/ruby, use a special command-line arg to run a REPL. Or
maybe imitate python, and run a REPL if there are no command-line
args. Either way is cool by me.

If I have time today, I'll cook up some code for this.

-Stuart Sierra

Peter Wolf

unread,
Nov 16, 2008, 2:40:55 PM11/16/08
to clo...@googlegroups.com
This is for the other NOOBs...

Apparently to use SLIME with Clojure, you need to install a Common Lisp.

I assumed that SLIME was written in EMACS Lisp, but apparently not. In
his Blog, Bill did say

"If you already use a CL implementation with SLIME
<http://common-lisp.net/project/slime/> and Emacs, then getting setup
with Clojure is pretty straight-forward."

http://bc.tech.coop/blog/081023.html

But I didn't realize that meant SLIME was dependent on CL.

I used CMUCL and everything works now.

Thanks
Peter

Matt Revelle

unread,
Nov 16, 2008, 3:10:50 PM11/16/08
to clo...@googlegroups.com
On Nov 16, 2008, at 2:40 PM, Peter Wolf <opu...@gmail.com> wrote:

>
> This is for the other NOOBs...
>
> Apparently to use SLIME with Clojure, you need to install a Common
> Lisp.

This is not the case.

>
>
> I assumed that SLIME was written in EMACS Lisp, but apparently not.
> In
> his Blog, Bill did say

You need to install SLIME, but not a Common Lisp. SLIME includes
swank implementations for a variety of Common Lisps but not Clojure.
The swank-clojure project is what allows Clojure to communicate with
SLIME.

Howard Lewis Ship

unread,
Nov 16, 2008, 4:16:32 PM11/16/08
to clo...@googlegroups.com
On Sun, Nov 16, 2008 at 10:21 AM, Stuart Sierra
<the.stua...@gmail.com> wrote:
>
>
> I would like both the REPL and Script to be callable from the same main
> (), i.e. you should just be able to call java -jar clojure.jar without
> naming a class.

+1


--
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

Jeff Rose

unread,
Nov 16, 2008, 4:30:22 PM11/16/08
to clo...@googlegroups.com
Rich Hickey wrote:
> I've added #! as a to-end-of-line comment, like ;

rosejn@meld:~/projects/languages/clojure$ cat foo
#!/usr/bin/env clj

(println "Hello World!")
rosejn@meld:~/projects/languages/clojure$ chmod u+x foo
rosejn@meld:~/projects/languages/clojure$ ./foo
Hello World!

-------------------------------

Awesome. Thanks Rich.

-Jeff

Stephen C. Gilardi

unread,
Nov 16, 2008, 4:46:21 PM11/16/08
to clo...@googlegroups.com

On Nov 16, 2008, at 1:21 PM, Stuart Sierra wrote:

I would like both the REPL and Script to be callable from the same main
(), i.e. you should just be able to call java -jar clojure.jar without
naming a class.  Default behavior would be to run a script, as with
bash/perl/ruby, use a special command-line arg to run a REPL.  Or
maybe imitate python, and run a REPL if there are no command-line
args.  Either way is cool by me.

If I have time today, I'll cook up some code for this.

One canonical, flexible main sounds good to me too. I was mistaken about how things work now, though. With Rich's change today, the following already works as an executable script (hello.clj):

#!/usr/bin/env java -cp /sq/ext/clojure/clojure.jar clojure.lang.Script
(println "Hello, cores!")

For me, that launches and runs in about 1.1 seconds of real time.

Cool!

--Steve

David Nolen

unread,
Nov 16, 2008, 6:02:30 PM11/16/08
to clo...@googlegroups.com
I think the latest version of clojure and swank-clojure also requires something like this line in your emacs file:

(setq swank-clojure-extra-classpaths (list "/path/to/clojure/classes"))

Personally I use the clojure git mirror hosted on github as well as git clone's of clojure-mode and swank-clojure.  This way I can just git pull to make sure everything is the latest.

David

Bill Clementson

unread,
Nov 16, 2008, 6:11:42 PM11/16/08
to clo...@googlegroups.com
Hi Peter,

On Sun, Nov 16, 2008 at 11:40 AM, Peter Wolf <opu...@gmail.com> wrote:
>
> This is for the other NOOBs...
>
> Apparently to use SLIME with Clojure, you need to install a Common Lisp.

This is not correct. You don't need to install a Common Lisp in order
to use SLIME with Clojure.

> I assumed that SLIME was written in EMACS Lisp, but apparently not. In
> his Blog, Bill did say
>
> "If you already use a CL implementation with SLIME
> <http://common-lisp.net/project/slime/> and Emacs, then getting setup
> with Clojure is pretty straight-forward."
>
> http://bc.tech.coop/blog/081023.html

I was saying that it was easy to get started with Clojure & SLIME if
you were already using SLIME with a CL (since you would already have
SLIME installed and would already be accustomed to using it). Sorry if
you interpreted this differently.

> But I didn't realize that meant SLIME was dependent on CL.

SLIME isn't dependent on CL. The SLIME install is made up of an Emacs
Lisp component plus a SWANK component (that are written for the
underlying Lisp implementation that you are using). There are separate
SWANK components for several different CL implementations, at least
one Scheme implementation, and Clojure.

> I used CMUCL and everything works now.

SLIME works with CMUCL, but that has nothing to do with whether you
are able to get SLIME working with Clojure.

- Bill

Michael Wood

unread,
Nov 17, 2008, 3:07:49 AM11/17/08
to clo...@googlegroups.com
Hi

Using the shebang line like this is not portable. See the following
post for details:

http://lists.freebsd.org/pipermail/freebsd-arch/2005-February/003525.html

To summarise the above post, on many operating systems if you ran a
script called scriptname.clj that started with the following shebang
line:

#!/usr/bin/env java -cp /sq/ext/clojure/clojure.jar clojure.lang.Script

it would be as if you had written:

$ /usr/bin/env "java -cp /sq/ext/clojure/clojure.jar
clojure.lang.Script" scriptname.clj

which would give you an error like:

/usr/bin/env: java -cp /sq/ext/clojure/clojure.jar
clojure.lang.Script: No such file or directory

I've just tried this on Linux with a 2.6 kernel and that's exactly what I got.

--
Michael Wood <esio...@gmail.com>

mb

unread,
Nov 17, 2008, 3:19:34 AM11/17/08
to Clojure
Hi,

On 17 Nov., 09:07, "Michael Wood" <esiot...@gmail.com> wrote:
> #!/usr/bin/env java -cp /sq/ext/clojure/clojure.jar clojure.lang.Script

Most systems only allow one argument to the command.
scsh solved this issue with the special \ argument and
block comment #! ... !#

#! /usr/bin/scsh \
-m ore -o ptions -g o -h ere
!#

So when encountering a \ in the command-line options,
scsh reads the second line and parses it as additional
commandline args.

However, this leads to the usual problems with #! scripts:
hardcoded path, env hack doesn't work and the interpreter
(/usr/bin/scsh in this case) must not be a script itself!

Sincerely
Meikel

Reply all
Reply to author
Forward
0 new messages