Re: Clojure for VS2010

2010-09-23 Thread Shawn Hoover
On Thu, Sep 23, 2010 at 4:20 PM, Will Kennedy parset...@gmail.com wrote:

 Some background: I've been spending some of my free time providing by
 basic Clojure support in VS 2010. To be honest, I'm a bit of a Clojure
 newbie, so I figured something that would require me to build a lexer
 and parser for the language and delve into the clojure source would be
 a great way to learn while creating something other people might find
 valuable. For adoption, having first-class support in VS for clojure-
 clr would be huge.

 I've built syntax highlighting, brace matching, and some basic
 formatting helpers. I'm working on the REPL window and project/build
 system next. My hope is to get it to the point where a user can
 download the plugin, create a new project, get some basic boilerplate,
 build, execute and debug all from within Visual Studio. People who are
 using emacs won't be abandoning it, but I hope it'll help people with
 a .Net background get going quickly.

 I'm looking for input about what features I should focus on and just
 general comments on the worthiness of the project. I figure I'm bound
 to make mistakes by approaching this from a C/C++/C# programmer's
 perspective, and this might preclude that.

 Thanks.


Hi Will,

This is absolutely worthy. It's VS or die in the .NET world. Syntax
highlighting, indentation, the REPL (including sending expressions from the
editor), and the project system are most important. After that, I think some
combination of integrating the editor with the REPL's doc function, .NET
intellisense, and Clojure intellisense. There's some effort going on to
potentially unify the REPL servers used by the IDEs, so keep an eye on that,
as well.

Shawn

-- 
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: Compilation fails in Clojure Box 1.2.0

2010-08-23 Thread Shawn Hoover
It's because slime-compile-file (C-c M-k) doesn't do anything unless the
optional load parameter is true, and when you run the function from the
keyboard shortcut, it doesn't get set. C-c C-k ends up calling that function
with load=true. The distinction between to the two is false in Clojure
anyway, because compiling also loads, so keep using C-c C-k and you should
be fine. I think compile without load shouldn't even appear in the menu when
connected to Clojure, but I don't know where the right place would be to fix
that.

Shawn

On Sat, Aug 21, 2010 at 10:56 AM, Arie van Wingerden xapw...@gmail.comwrote:

 Hi,

 when i compile the following little snippet (which i explicitly have saved
 before compiling) with C-c C-k (Compile/Load file) it always succeeds;
 however, when I use C-c M-k (Compile File) compilation always fails (i am
 sure i did save the file before compiling it).

 snip
 (ns nsp.tst
   (:refer-clojure)
   (:gen-class))

 (defn dubbel [x]
   (* 2 x))

 (defn -main []
   (println (dubbel 20)))
 /snip

 Any ideas?

 Regards,
Arie

 --
 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.comclojure%2bunsubscr...@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: Windows distribution for Leiningen 1.3.0

2010-08-20 Thread Shawn Hoover
Works for me, thanks!

On Fri, Aug 20, 2010 at 5:35 AM, Shantanu Kumar kumar.shant...@gmail.comwrote:

 Hi,

 I have created a Windows distribution for Leiningen 1.3.0 (by pruning
 and modifying the lein.bat file a bit) that can be downloaded from
 here:

 http://github.com/downloads/kumarshantanu/leiningen/leiningen-1.3.0.zip

 To install,
 1. Download the bundle and unzip into a folder of your choice
 2. Include the Leiningen folder in your PATH.

 In my initial tests on Windows XP 32-bit/JDK 1.6, it seems to be
 working okay. Please let me know how it behaves at your end.

 Regards,
 Shantanu

 --
 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.comclojure%2bunsubscr...@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: Feedback on Clojure web development post

2010-07-26 Thread Shawn Hoover
On Sat, Jul 24, 2010 at 3:30 AM, Mark McGranaghan mmcgr...@gmail.comwrote:

 Hi All,

 I recently posted to my blog on the process of developing and
 deploying a simple Clojure web application:


 http://mmcgrana.github.com/2010/07/develop-deploy-clojure-web-applications.html

 The purpose of this post is twofold. The first is to provide some
 documentation in the form of a complete, deployable Clojure web app
 and associated commentary and instructions. To that end I hope you
 find the post useful and that you feel free to ask any questions you
 may have.

 The second purpose is to elicit feedback from the community on how
 they would or have approached the problem of developing and deploying
 Clojure web applications.


Mark, thanks for writing this. I can speak to goal one, that the full
writeup is indeed very useful. I'm stumbling my way through local
development of a Compojure/Ring web service, picking off tips from the
source, API docs, and Brian Carper's informative blog source [1] as I go.
Seeing the contents of this tutorial in one place, I learned a lot about
rounding out an entire app, as you say, and making it deployable.

Even though I don't need HTML for my service and I'll be deploying to a
Windows server (relax, let me worry about that feature/bug!), the way you
broke it down makes it trivial to tweak for any environment. The command
line jetty startup approach is a nice complement to Chas Emerick's
maven-style deployment tips [2] for those who don't want or have to plug in
to existing Java server infrastructure (another top to bottom tutorial based
on WAR files would probably be appreciated by folks who are in that camp).

I especially appreciate the middleware demonstrations, as the ability to
whip up a little function to augment or change the behavior of the entire
app is a strength of Ring-based development. I half-assumed
wrap-bounce-favicon was built in, but then you busted out in a few lines
right there and it didn't really matter if it existed or not.

[1] http://github.com/briancarper/cow-blog/
[2] http://muckandbrass.com/web/x/RQBP

-- 
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: newline and println on windows

2010-06-30 Thread Shawn Hoover
On Wed, Jun 30, 2010 at 7:39 AM, David Powell djpow...@djpowell.net wrote:


 I raised a ticket a while ago regarding newline and println on Windows.

 http://www.assembla.com/spaces/clojure/tickets/300-newline-should-output-
 platform-specific-newline-sequence

 Currently these functions always output ASCII 10 line feeds.  I believe
 that
 they should output the platform default line-endings as Java does, so on
 Windows they would output ASCII 13 10.

 http://java.sun.com/j2se/1.4.2/docs/api/java/io/BufferedWriter.html

 If you are currently writing code like (println hello world\r), in order
 to
 work around the situation on Windows, then you will need to remove that
 work-
 around, but I'd think that that is pretty unlikely.  The patch wouldn't
 affect
 the behaviour of code such as (print hello world\r\n).

 Any opposition?


I never had a need for it, but I don't see a reason to oppose either. I
tested your patch with cmd.exe, cygwin bash, and emacs modes, and it worked
fine. The only thing that messed up was the swank-clojure REPL, showing ^M
in any lines that were printed with println, but I think the swank-clojure
server could bind the proposed var back to \n and all would be well.

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: How to: an anonymous recursive function

2010-06-30 Thread Shawn Hoover
On Wed, Jun 30, 2010 at 1:44 AM, Tim Robinson tim.blacks...@gmail.comwrote:

 So I am reading On Lisp + some blogs while learning Clojure (I know,
 scary stuff :)

 Anyway, I've been playing around to see if I can get an anonymous
 recursive function to work, but alas I am still a n00b and not even
 sure what Clojure's approach to this would be.

 How would I do this in Clojure?:

 My first attempt:

 ((fn [x]
   (if (= x 0)
   1
   (* 2 (recur (dec z) 5)

 Then my second:

 ((fn [x]
   (let [z (if (= x 0)
   1
   (* 2 x))]
  (recur (dec z  5)

 Ideally one could do:

 ((recursive-fn #( if (= % 0) 1 (* 2 %)) (recur it))  5)


 Obviously none work, and I believe I understand why. I just don't
 understand how to actually do this or if for some reason Clojure
 avoids this for some reason.

 I am not actually trying to accomplish a specific task, so the example
 was made to be simple not meaningful. I'm just playing around to learn
 recursive functions and Clojure style.


Hi Tim,

You're running into an error that you can only recur from the tail position?
That's because you're trying to use the result of recur to do further
computation. Clojure doesn't allow this with recur, because recur is more of
a loop or goto construct behind the scenes. If you really want to run your
algorithm that way you just have to give the fn a name and then call the
name.

This should work:

((fn my-fn [x]
  (if (= x 0)
  1
  (* 2 (my-fn (dec x) 5)

That accomplishes the question as asked, but you may also want to look into
calling reduce as a different approach to the problem.

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

Can't send from agent error handler?

2010-06-23 Thread Shawn Hoover
My first thought for an agent error handler was to send the exception to
another agent.

user= (let [handler (agent nil)
a (agent 42
 :error-handler
 (fn [_ ex] (send handler
  (fn [_] (println ex)]
  (send a (fn [_] (throw (Exception. bad news
  (await a)
  @a)
42
;; No println!
user=

Is this the way it should work? I saw some stuff about it in the wiki [1],
but it's hard to tell what was decided explicitly.

Shawn

[1] http://www.assembla.com/wiki/show/clojure/Agent_exception_handlers

-- 
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: working with agents and atoms - a beginner question

2010-06-15 Thread Shawn Hoover
On Tue, Jun 15, 2010 at 12:01 PM, Ryan Waters ryan.or...@gmail.com wrote:

 I'm working with the code at the following gist and also pasted below:

 http://gist.github.com/421550

 I'd like to have execution of a separate thread (agent) continue
 running until it sees the atom 'running' change to false.

 Unfortunately, the program doesn't return from the send-off but
 to my understanding it should.  Why won't it return?  I'm using
 clojure 1.1.

 TIA

 

 (ns nmanage)

 (def running (atom true))

 (defn process
  []
  (when @running
(prn hi)
(Thread/sleep 1000))
  (recur))

 ;;;
 (send-off (agent nil) (process))

 (do
  (prn this won't print - execution doesn't make it this far)
  (Thread/sleep 2000)
  (reset! running false))


It looks like you're passing the result of calling (process) as an argument
to send-off. Try just (send-off (agent nil) process) to pass the process fn
as a value.

-- 
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 box: Problem with classpath (noob question)

2010-04-30 Thread Shawn Hoover
On Thu, Apr 29, 2010 at 6:58 PM, Rainer wolf.rai...@gmail.com wrote:

 Hello,

 I'm stuck with Programming Clojure on page 37 on a Windows 7
 machine. After downloading the examples dir into C:/clojure, I
 typed:

 user (require 'examples.introduction)

 and I got

 ; Evaluation aborted.

 java.io.FileNotFoundException: Could not locate examples/
 introduction__init.class or examples/introduction.clj on classpath:
 (NO_SOURCE_FILE:0)

 My .emacs file looks like this:

 (setq swank-clojure-extra-classpaths
(list C:/Clojure))


I'm not sure what version of Clojure Box you have, but in 1.1 you should set
swank-clojure-classpath, not swank-clojure-extra-classpaths.

Shawn

-- 
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: labrepl, making Clojure more accessible

2010-03-24 Thread Shawn Hoover
On Wed, Mar 24, 2010 at 11:59 AM, invis invi...@gmail.com wrote:

 I am trying to start labrepl with emacs.
 Labrepl is working nice, but I cant slime-connect :(
 Have this message:
 open-network-stream: make client process failed: connection
 refused, :name, SLIME Lisp, :buffer, nil, :host, 127.0.0.1, :service,
 4005
 Could you tell me how to fix it ?


It seems the swank server is not being started. I fixed it for Windows here:
http://github.com/shoover/labrepl/commit/f27f97536f6e584c284b898ad4abd732c424684e

I didn't test unix, but it might work with this change.

-- 
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 from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: Protocols and Types

2010-03-03 Thread Shawn Hoover
On Wed, Mar 3, 2010 at 8:43 AM, Andrea Tortorella elian...@gmail.comwrote:

 Hi everyone,

 if I run this code:

 (defprotocol P
  (foo [x]))

 (deftype T []
  P
  (foo [] dummy))

 (extends? P T)
 ;== nil
 (satisfies? P T)
 ;== nil
 (extenders P)
 ;==nil

 are they not yet implemented?


Nil means the tests fail, that T does not extend or satisfy P. It looks like
you're missing the argument on the foo function in the definition of T. If
you put an argument in there, do you get the results you expect?

-- 
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: ClojureCLR under slime / emacs?

2010-02-14 Thread Shawn Hoover
On Sat, Feb 13, 2010 at 11:43 PM, Mike K mbk.li...@gmail.com wrote:

 Does anyone have ClojureCLR running under emacs via slime?

 Failing that, can anyone give me some pointers as to how I might
 hacking swank-clojure.el (or whatever) to get this to work?

   Mike


Hi Mike,

I've not heard of anyone doing this. The changes to swank-clojure.el would
involve changing how it sets up the Clojure process. Instead of calling Java
with a classpath, it needs to call ClojureCLR's executable. The real work
would be in the swank-clojure clj sources. Every use of a Java standard
library class would have to be replaced with an appropriate CLR base class
library class.

Shawn

-- 
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: Clojars question

2010-02-03 Thread Shawn Hoover
On Tue, Feb 2, 2010 at 2:35 PM, Meikel Brandmeyer m...@kotka.de wrote:

 PS: On Windows deployment to Clojars does not work due to scp trouble. Only
 Unix/Mac OS X supported at the moment for deployment.


If that's a blocker for anyone on Windows, they should parameterize the
Clojars scp program and set it to pscp.exe from the Putty folks. It's a
champ.

-- 
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 box 1.0 failed to connect to emacs server

2010-01-31 Thread Shawn Hoover
On Sat, Jan 30, 2010 at 10:11 PM, Shawn Hoover shawn.hoo...@gmail.comwrote:


 On Sat, Jan 30, 2010 at 5:48 PM, Rollo rollo.toma...@gmail.com wrote:

 Hi Shawn,

 Just tried with 1.1.RC1 - no luck. Emacs server won't start and system
 will start spawning thousands of cmdproxy processes again.
 Where does that bad condition comes from?
 Let me know if I can help diagnose or test further.

 Thanks,
 Rollo


 Ok, I suggested RC1 because I thought the original poster said it worked. I
 may have misread. Anyway, I develop and test Clojure Box on XP, where I
 haven't had the problem, so I have no idea where it's coming from. I'll try
 to test on 7 soon and see what's up.


Sorry, folks, but I can't recreate this issue.

What happens if you run c:\program files\clojure
box\emacs\emacs\bin\emacs.exe, avoiding the client process run by the
installed Clojure Box shortcut?

-- 
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 box 1.0 failed to connect to emacs server

2010-01-30 Thread Shawn Hoover
On Sat, Jan 30, 2010 at 5:48 PM, Rollo rollo.toma...@gmail.com wrote:

 Hi Shawn,

 Just tried with 1.1.RC1 - no luck. Emacs server won't start and system
 will start spawning thousands of cmdproxy processes again.
 Where does that bad condition comes from?
 Let me know if I can help diagnose or test further.

 Thanks,
 Rollo


Ok, I suggested RC1 because I thought the original poster said it worked. I
may have misread. Anyway, I develop and test Clojure Box on XP, where I
haven't had the problem, so I have no idea where it's coming from. I'll try
to test on 7 soon and see what's up.

Shawn

-- 
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: classpath in clojure box

2010-01-14 Thread Shawn Hoover
On Thu, Jan 14, 2010 at 3:17 AM, brian brw...@gmail.com wrote:

 The above didn't work, but apparently it doesn't pick up my .emacs file,
 which has

 (setq swank-clojure-classpath
(list c:/shcloj-code/code/examples))

 itknows where home is, when it boots up, the default is my home dir, where
 .emacs is


 when i do C-h v

 swank-clojure-classpath is a variable defined in `swank-clojure.el'.
 Its value is
 (c:/Program Files/Clojure Box/emacs/site-lisp/../../swank-clojure/src
 c:/shcloj-code/code/examples c:/Program Files/Clojure
 Box/lib/clojure-contrib.jar c:/Program Files/Clojure Box/lib/clojure.jar
 c:/Program Files/Clojure Box/lib/commons-codec-1.3.jar c:/Program
 Files/Clojure Box/lib/commons-fileupload-1.2.1.jar c:/Program
 Files/Clojure Box/lib/commons-io-1.4.jar c:/Program Files/Clojure
 Box/lib/compojure.jar c:/Program Files/Clojure
 Box/lib/grizzly-http-servlet-1.9.10.jar c:/Program Files/Clojure
 Box/lib/grizzly-http-webserver-1.9.10.jar c:/Program Files/Clojure
 Box/lib/jetty-6.1.15.jar c:/Program Files/Clojure
 Box/lib/jetty-util-6.1.15.jar c:/Program Files/Clojure
 Box/lib/servlet-api-2.5-20081211.jar)


Actually it's there, buried between the swank-clojure/src and
clojure-contrib.jar. It's Clojure Box's fault on the ordering, but it would
only matter if you were trying to put your own version of swank-clojure on
the classpath.
-- 
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: classpath in clojure box

2010-01-13 Thread Shawn Hoover
On Tue, Jan 12, 2010 at 10:05 PM, brian brw...@gmail.com wrote:

 Hi all,


 I put the example code from Programming Clojure book
 here:

 C:\shcloj-code\code\examples

 I verified that introduction.clj  is there.

 This is cut and pasted from my .emacs file located in c:\program
 files\brian


 (setq swank-clojure-classpath
(list c:\shcloj-code\code\examples)


Assuming that your HOME environment variable is set to c:\program
files\brian and your .emacs is actually being loaded (I mention that because
normally .emacs is under your Documents and Settings or Users directory, but
it should respect %HOME%), I think the problem is the \ in your classpath
need to be escaped. Try converting them to / or \\.

Shawn
-- 
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: trying to call jar files in clojure box

2010-01-13 Thread Shawn Hoover
On Tue, Jan 12, 2010 at 8:20 PM, brian brw...@gmail.com wrote:

 Hi,

 I am not sure if this is a Clojure Box problem or a compojure problem but
 in an attempt to try calling external jars files in clojure box,and wanting
 to try compojure, to eliminate any possible path problems, I've put
 compojure and all dependancies in the Clojure Box/lib  directory.

 When I try to run

 (use 'compojure)

   (defroutes my-app
 (GET /
   (html [:h1 Hello World]))
 (ANY *
   (page-not-found)))

   (run-server {:port 8080}
 /* (servlet my-app))


 java.lang.Exception: Unable to resolve symbol: defroutes in this context
 (NO_SOURCE_FILE:1)
  [Thrown class clojure.lang.Compiler$CompilerException]

 I get the same problem when I setq in my .emacs.


Putting all the jars in Clojure Box/lib works for me, so there may be
something else whacky with your classpath. What does (System/getProperty
java.class.path) return?

Shawn
-- 
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: classpath in clojure box

2010-01-13 Thread Shawn Hoover
On Wed, Jan 13, 2010 at 8:38 PM, brian brw...@gmail.com wrote:


 I was wondering if this is the right statement for setting the external
  classpath?

 setq swank-clojure-classpath


That's the right variable. You can set it, and then Clojure Box's setup
appends to it to make sure clojure, contrib, and swank are on the classpath
when starting the REPL.
-- 
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: classpath in clojure box

2010-01-13 Thread Shawn Hoover
On Wed, Jan 13, 2010 at 8:38 PM, brian brw...@gmail.com wrote:


 I was wondering if this is the right statement for setting the external
  classpath?

 setq swank-clojure-classpath


Another way is to use M-x swank-clojure-project. You enter a directory and
it automatically adds that directory/src to the classpath. You could drop
all of the shcloj-code\code into, say, c:\projects\shcloj\src. M-x
swank-clojure-project and at the prompt c:\projects\shcloj. Then try
(require 'examples.introduction).

If that doesn't work, check the value of swank-clojure-classpath after the
REPL starts: C-h v swank-clojure-classpath. Make sure it looks good and then
fire up SysInternals ProcMon and filter on *.clj and see where the system is
really looking.
-- 
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 Box 1.1

2010-01-11 Thread Shawn Hoover
On Mon, Jan 11, 2010 at 2:01 PM, Chris Jenkins cdpjenk...@gmail.com wrote:

 PS: FYI here's the full text that I see in my *inferior-lisp* buffer:

 (require 'swank.swank)

 (swank.swank/ignore-protocol-version nil)

 (do (.. java.net.InetAddress getLocalHost getHostAddress)
 nil)(swank.swank/start-server
 c:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/slime.5668 :encoding
 iso-latin-1-unix)

 Clojure 1.1.0
 user= java.lang.ClassFormatError: JVMCFRE114 field name is invalid;
 class=clojure/contrib/pprint/PrettyWriter, offset=0 (pprint.clj:6)
 user= user= java.lang.Exception: No such var:
 swank.swank/ignore-protocol-version (NO_SOURCE_FILE:3)
 user= user= nil
 java.lang.Exception: No such var: swank.swank/start-server
 (NO_SOURCE_FILE:5)
 user= user=


Out of curiosity, what configuration do you have in place that's causing
clojure.contrib.pprint to be loaded?

Shawn
-- 
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 Box 1.1

2010-01-11 Thread Shawn Hoover
On Mon, Jan 11, 2010 at 3:49 PM, Chris Jenkins cdpjenk...@gmail.com wrote:

 Out of curiosity, what configuration do you have in place that's causing
 clojure.contrib.pprint to be loaded?


 I'm not sure - all I did was to install Clojure Box and then I immediately
 saw the error message when it started up. Do you know how I could learn more
 about the configuration?

 Cheers,

 Chris


I see you got it working. I was about to say I was thinking of user.clj,
which Clojure loads if you have one in a directory that is on the classpath.
Also, if you have jars in $HOME/.clojure they are added to the classpath by
swank-clojure and then .clojure is searched for user.clj.

Shawn
-- 
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 box value as variable is void ?

2010-01-11 Thread Shawn Hoover
On Mon, Jan 11, 2010 at 5:36 PM, brian brw...@gmail.com wrote:


 (setq swank-clojure-classpath

 (list “c:/dev/project/src” “c:/dev/my-lib.jar”))



 and I get this error when I bring clojure box up:

 Warning (initialization): An error occurred while loading `c:/Documents and
 Settings/brian/.emacs':

 Symbol's value as variable is void: “c:/dev/project/src”


The problem is the curly quotes. Replace them with normal  and it should
work. I'll see if I can fix that doc.

Shawn
-- 
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: Having difficulties with compilation in slime, emacs and clojure-project

2010-01-08 Thread Shawn Hoover
On Thu, Jan 7, 2010 at 11:37 PM, Joel jboehl...@gmail.com wrote:

 Hello,
 I have an emacs setup on OSX using elpa with the latest clojure-mode,
 swank-clojure, slime, slime-repl all from ELPA. When I upgraded to the
 latest swank-clojure in ELPA (swank-clojure-1.1.0), I began to get
 this error as well:

  Searching for program: no such file or directory, lisp
 

 I traced it back a bit, and found that the before advice on slime-read-
 interactive-args wasn't being called. It apparently wasn't activated.
 I evaluated the following form:
 (ad-activate 'slime-read-interactive-args)

 And now all seems to be working well. I'm not sure why this advice
 hasn't been activated. On the prior versions of swank-clojure, I
 didn't have this problem. Loading order issue maybe? Anyhow, try
 explicitly activating that advice and see if that fixes your problem.

 Cheers,
 Joel


In updating Clojure Box to the latest I found that the defadvice form has to
be loaded before slime is loaded. (I didn't know about ad-activate.) This
would be a problem if you somehow require slime before the ELPA's
package-initialize is called, which loads the swank-clojure autoloads, which
includes the defadvice.

Shawn
-- 
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: Having difficulties with compilation in slime, emacs and clojure-project

2010-01-08 Thread Shawn Hoover
On Fri, Jan 8, 2010 at 4:39 AM, Zef Hemel zefhe...@gmail.com wrote:

 After I do the swank clojure project command, enter the directory and
 press return my Emacs gets stuck doing this: http://imgur.com/Ap8mo
 When I just go to the Slime CLI that works fine. Any idea what could
 be wrong there?

 Zef


Check your inferior-lisp buffer. There may be some errors in there
indicating clojure.main or swank.swank is missing.

swank-clojure-project won't work unless all dependencies live in appropriate
places under the project directory. Here's how I hacked Clojure Box startup
to not wipe out the entire classpath and build it from scratch:
http://bitbucket.org/shoover/clojure-box/src/8015172a1dc3/default.el#cl-33

Shawn
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: swank-clojure installation failure via ELPA

2010-01-02 Thread Shawn Hoover
Hi Mike,

Is there anything useful going on in *messages*?

On Sat, Jan 2, 2010 at 9:07 AM, Mike K mbk.li...@gmail.com wrote:

 Hi all,

 I'm trying to get all the latest and greatest swank-clojure 1.1.0
 goodness via ELPA, but no joy.  I'm starting with an absolutely clean
 slate.  I'm running a freshly installed emacs 23.1.1 on Windows 7.  I
 have a blank .emacs file and no elpa subdirectory under .emacs.d.

 I install elpa and do a package-list-packages.  I mark swank-clojure
 1.1.0 for installation and install it.  I restart emacs and type M-x
 slime.  I get [No match].  Package-list-packages indicates that
 slime, slime-repl, clojure-mode, and swank-clojure are all installed.
 Huh?

 Please advise.

   Thanks,
   Mike

 --
 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.comclojure%2bunsubscr...@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: swank-clojure installation failure via ELPA

2010-01-02 Thread Shawn Hoover
I believe you're running into the same coding issue that I did with ELPA on
Windows. slime.el declares in its local variables that it has unix line
endings, but ELPA's download process is saving it with windows line endings.

Here's the pseudopatch I submitted to ELPA. You can hack up your
.emacs.d/elpa.package.el and then reinstall those packages.

(defun package-write-file-no-coding (file-name excl)
 (setq buffer-file-coding-system 'no-conversion)
 (write-region (point-min) (point-max) file-name nil nil nil excl))

(defun package-unpack-single (file-name version desc requires)
 Install the contents of the current buffer as a package.
 (let* ((dir (file-name-as-directory package-user-dir)))
   ;; Special case package.
   (if (string= file-name package)
-(write-region (point-min) (point-max) (concat dir file-name .el)
-  nil nil nil nil)
+   (package-write-file-no-coding (concat dir file-name .el) nil)
 (let ((pkg-dir (file-name-as-directory
 (concat dir file-name - version
   (make-directory pkg-dir t)
-(write-region (point-min) (point-max)
-  (concat pkg-dir file-name .el)
-  nil nil nil 'excl)
+   (package-write-file-no-coding (concat pkg-dir file-name .el)
'excl)

On Sat, Jan 2, 2010 at 12:35 PM, Mike K mbk.li...@gmail.com wrote:

 On Jan 2, 9:13 am, Shawn Hoover shawn.hoo...@gmail.com wrote:
  Hi Mike,
 
  Is there anything useful going on in *messages*?

 Here is the contents of *Messages*:

 Contacting host: tromey.com:80
 Reading [text/plain]... 4k of 4k (100%)
 Reading... done.
 Reading [text/plain]... 54k of 54k (100%)
 Saving file c:/mbk/.emacs.d/elpa/package.el...
 Wrote c:/mbk/.emacs.d/elpa/package.el
 Loading c:/mbk/.emacs.d/elpa/package.el (source)...done
 Saving file c:/mbk/_emacs...
 Delete excess backup versions of c:/mbk/_emacs? (y or n)
 Wrote c:/mbk/_emacs
 Contacting host: tromey.com:80
 Reading [text/plain]... 9k of 9k (100%)
 Saving file c:/mbk/.emacs.d/elpa/archive-contents...
 Wrote c:/mbk/.emacs.d/elpa/archive-contents
 Reading [text/plain]... 575 bytes of 563 bytes (102%)
 Saving file c:/mbk/.emacs.d/elpa/builtin-packages...
 Wrote c:/mbk/.emacs.d/elpa/builtin-packages
 Contacting host: tromey.com:80
 Reading [text/plain]... 25k of 25k (100%)
 Wrote c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode.el
 Wrote c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode-pkg.el
 Warning: defvar ignored because generated-autoload-file is let-bound
 Wrote c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode-autoloads.el
 Generating autoloads for clojure-mode-pkg.el...done
 Generating autoloads for clojure-mode.el...done
 Saving file c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode-
 autoloads.el...
 Wrote c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode-autoloads.el
 (No changes need to be saved)
 (No files need saving)
 Checking c:/mbk/.emacs.d/elpa/clojure-mode-1.6/... [2 times]
 Compiling c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode-
 pkg.el...done
 Wrote c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode-pkg.elc
 Checking c:/mbk/.emacs.d/elpa/clojure-mode-1.6/...
 Compiling c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode.el...done
 Wrote c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode.elc
 Checking c:/mbk/.emacs.d/elpa/clojure-mode-1.6/...
 Done (Total of 2 files compiled, 1 skipped)
 Contacting host: tromey.com:80
 Reading [text/plain]... 347k of 347k (100%)
 Wrote c:/mbk/.emacs.d/elpa/slime-20091016/slime.el
 Wrote c:/mbk/.emacs.d/elpa/slime-20091016/slime-pkg.el
 Wrote c:/mbk/.emacs.d/elpa/slime-20091016/slime-autoloads.el
 Generating autoloads for slime-pkg.el...done
 hack-local-variables: Local variables entry is missing the suffix


 Here is the contents of *Compile-Log*:

 Compiling file c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode-
 pkg.el at Sat Jan 02 10:30:21 2010

 Compiling file c:/mbk/.emacs.d/elpa/clojure-mode-1.6/clojure-mode.el
 at Sat Jan 02 10:30:21 2010

 In clojure-mode:
 clojure-mode.el:196:34:Warning: reference to free variable `paredit-
 mode'
 clojure-mode.el:196:51:Warning: reference to free variable `paredit-
 version'

 In clojure-font-lock-extend-region-def:
 clojure-mode.el:232:33:Warning: reference to free variable `font-lock-
 beg'
 clojure-mode.el:239:30:Warning: assignment to free variable `font-lock-
 beg'
 clojure-mode.el:240:33:Warning: reference to free variable `font-lock-
 end'
 clojure-mode.el:242:19:Warning: assignment to free variable `font-lock-
 end'

 In clojure-font-lock-extend-region-comment:
 clojure-mode.el:257:26:Warning: reference to free variable `font-lock-
 beg'
 clojure-mode.el:254:49:Warning: reference to free variable `font-lock-
 end'
 clojure-mode.el:258:17:Warning: assignment to free variable `font-lock-
 beg'
 clojure-mode.el:262:17:Warning: assignment to free variable `font-lock-
 end'

 In clojure-indent-function:
 clojure-mode.el:397:33:Warning: reference to free variable
`calculate

Re: Deprecate replicate?

2009-12-17 Thread Shawn Hoover
On Thu, Dec 17, 2009 at 7:50 PM, Sean Devlin francoisdev...@gmail.comwrote:

 Hey everyone,
 I just noticed that replicate's functionality is now duplicated by
 repeat.  Should this function be deprecated?

 Sean


This was discussed before [1] as part of another issue [2], but I don't know
what happened to the separate issue of removing replicate.

1
http://groups.google.com/group/clojure/browse_thread/thread/bb2bd6ad6986fedf/88894a8cc8dbbbd7?lnk=gstq=replicate+repeat#88894a8cc8dbbbd7
2
http://code.google.com/p/clojure/issues/detail?id=55can=1q=replicatecolspec=ID%20Type%20Status%20Priority%20Reporter%20Owner%20Summary

-- 
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: variation of time macro

2009-12-14 Thread Shawn Hoover
On Mon, Dec 14, 2009 at 3:18 PM, Sean Devlin francoisdev...@gmail.comwrote:

 Could you add support for stdev as well, or better yet a helper macro
 to return a vector of run times?

 I don't want Zed to find out...

 Read at your own risk:
 http://www.zedshaw.com/essays/programmer_stats.html


Uh oh, I *have *read that, and then forgot it at my peril. If Zed finds me
I'm a goner.

My main goal was to write the simplest thing to avoid manually typing
dotimes as people often do, and then the average slipped in there. Maybe I
should just take out the average to avoid temptation to microbenchmark.

Shawn

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

variation of time macro

2009-12-13 Thread Shawn Hoover
I see usages of the time macro that wrap the expression of interest in a
call to dotimes. Is there any interest in an overload of time that takes an
additional parameter for a number of iterations, evaluates the expression
that many times, and prints the average time in the report?

Usage:
user (time 10 (* 21 2))
Elapsed time: 0.201 msecs, Average: 0.0201 msecs
42
user

Shawn

-- 
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: Help with closures

2009-10-09 Thread Shawn Hoover
On Fri, Oct 9, 2009 at 10:37 PM, Mark Tomko mjt0...@gmail.com wrote:

 ; a returns a new similarity function that applies the provided
 transform function
 ; before comparing a pair of collections
 (defn make-coll-similarity-fn [coll-transform]
  (fn [coll1 coll2] coll-similarity [coll1 coll2 coll-transform]))

 ; makes an n-gram similarity function using the provided value for 'n'
 (defn make-n-gram-similarity [n] (make-coll-similarity-fn (make-n-gram-
 fn n)))

 Then use my new similarity function generator:

 (def bigram-similarity (make-coll-similarity-fn (make-n-gram-fn 2)))

 (bigram-similarity abcde abc)

 I get the following:

 [abcde abc #similarity$make_n_gram_fn__114$fn__116
 org.ricercata.similarity$make_n_gram_fn__114$fn__...@219ba640]

 I must be missing something obvious, but I can't see it.


It looks like you're missing parens in make-coll-similarity-fn. It does
nothing with coll-similarity and then returns a vector. Should it be more
like this?

(defn make-coll-similarity-fn [coll-transform]
 (fn [coll1 coll2] (coll-similarity coll1 coll2 coll-transform)))

--~--~-~--~~~---~--~~
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: ClojureCLR and CLR structs

2009-10-01 Thread Shawn Hoover
Works for me. Thanks!

On Thu, Oct 1, 2009 at 1:24 AM, David Miller dmiller2...@gmail.com wrote:


 Should be fixed in the latest commit.
 Any of the following will work.


 (System.Reflection.Assembly/Load WindowsBase, Version=3.0.0.0,
 Culture=neutral, PublicKeyToken=31bf3856ad364e35)
 (import '(System.Windows.Media Matrix))
 (defn b [m] (doto m (.Scale 2.0 3.0)))
 (defn a1 [] (b (Matrix.)))
 (defn a2 [] (doto (Matrix.) (.Scale 2.0 3.0)))
 (defn a3 [] (let [m (Matrix.)] (doto m (.Scale 2.0 3.0
 (defn a4 [] (let [m (Matrix.)] (doto m (.Scale 2.0 3.0)) m))
 (defn a5 [] (let [m (Matrix.)] (.Scale m 2.0 3.0) m))
 (defn a6 [] (let [m (Matrix.)] (. m (Scale 2.0 3.0)) m))
 (defn a7 [] (let [#^Matrix m (Matrix.)] (. m (Scale 2.0 3.0)) m))
 (def a (Matrix.))
 (defn a8 [] (let [ m a] (. m (Scale 2.0 3.0)) m))
 (defn a9 [] (let [#^Matrix m a] (. m (Scale 2.0 3.0)) m))


 -David
 


--~--~-~--~~~---~--~~
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: ClojureCLR installation?

2009-09-30 Thread Shawn Hoover
On Wed, Sep 30, 2009 at 1:39 PM, John Harrop jharrop...@gmail.com wrote:

 On Tue, Sep 29, 2009 at 7:21 PM, David Miller dmiller2...@gmail.comwrote:

 Mono:
   - One BigDecimal implementation away from getting serious about
 this.


 Why doesn't Mono have a BigDecimal analogue? It shouldn't, in principle, be
 difficult to create an open-source-friendly implementation backed by GMP.


The BigDecimal used by ClojureCLR is not a CLR data type, which I think is
why it doesn't exist on Mono already. Rather, it comes from Microsoft's J#
library, for which it's been stated there's a massive lack of interest on
Mono [1]. Prior discussion of the work involved to implement from scratch:
[2].

[1]
http://social.msdn.microsoft.com/Forums/en-US/visualjsharpgeneral/thread/05ba5833-7049-475c-a13d-8dd2471962f6
[2]
http://groups.google.com/group/clojure/browse_thread/thread/f3a3cfca94debbac/4582ff46e136f3ef?q=bigdecimal+group:clojure+clojureclr#4582ff46e136f3ef

--~--~-~--~~~---~--~~
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: ClojureCLR and CLR structs

2009-09-30 Thread Shawn Hoover
Hey, you're one up on IronRuby, which had a bug where one couldn't create an
instance of a CLR struct!
http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=1788

On Wed, Sep 30, 2009 at 3:45 AM, David Miller dmiller2...@gmail.com wrote:


 Short answer: It's a bug.
 Longer answer:  It's a problem with type propagation in let.  It'll
 take me a day or so to fix it.

 The handling of non-primitive value types by the compiler still has
 some problems. Any place where the JVM compiler is discriminating
 between primitive types and reference types, the CLR compiler needs to
 discriminate between primitive types, non-primitive value types and
 reference types.  I need to make a pass back through the compiler code
 and make sure I catch all the places where it matters.  I'll put this
 at the top of the list.

 Boring detail for the very curious: At the moment, your (a) works
 because it uses reflection and (a2) fails because it is trying to do
 the right thing.  The (doto) expands into a let that introduces a box
 followed by a cast that causes the struct to be copied.  The .Scale is
 applied to the copy.  That's why you don't see the change.  In C#, the
 compiled code looks like:

 (a) looks like:
object target = new Matrix();
object[] args = new object[] {2.0, 3.0 };
Reflector.CallInstanceMethod(Scale, target, args);
return target;

 (a2) looks like:

   object obj2 = new Matrix();
((Matrix) obj2).Scale(2.0, 3.0);
return obj2;

 I need to make (a2) look like:

   Matrix obj2 = new Matrix();
obj2.Scale(2.0, 3.0);
return obj2;


 -David




 On Sep 29, 9:55 am, Shawn Hoover shawn.hoo...@gmail.com wrote:
  Updates to local CLR struct instances seem to be lost as soon as they're
  made. Is this expected? In the test below, function a2 returns the
 identity
  matrix despite my attempt to scale it. Function a passes the newly
  constructed matrix to another function to do the scaling, and it returns
 the
  scaled matrix as desired. UriBuilder is a class and works either way.
 
  (System.Reflection.Assembly/Load WindowsBase, Version=3.0.0.0,
  Culture=neutral, PublicKeyToken=31bf3856ad364e35)
  (import '(System.Windows.Media Matrix))
  (import '(System UriBuilder))
 
  ; Test struct
  (defn b [matrix] (doto matrix (.Scale 0.5 -0.5)))
  (defn a [] (b (Matrix.)))
 
  (defn a2 [] (doto (Matrix.) (.Scale 0.5 -0.5)))
 
  ; Test class
  (defn b3 [builder] (doto builder (.set_Port 9090)))
  (defn a3 [] (b3 (UriBuilder.)))
 
  (defn a4 [] (doto (UriBuilder.) (.set_Port 9090)))
 
  (println Matrix struct (a) (a2)
   (= (a) (a))
   (= (a2) (a2))
   (= (a) (a2))) ; True True False
  (println UriBuilder class (a3) (a4)
   (= 9090 (.Port (a3)) (.Port (a3)))
   (= 9090 (.Port (a4)) (.Port (a4)))
   (= 9090 (.Port (a3)) (.Port (a4 ; True True True
 


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



ClojureCLR and CLR structs

2009-09-29 Thread Shawn Hoover
Updates to local CLR struct instances seem to be lost as soon as they're
made. Is this expected? In the test below, function a2 returns the identity
matrix despite my attempt to scale it. Function a passes the newly
constructed matrix to another function to do the scaling, and it returns the
scaled matrix as desired. UriBuilder is a class and works either way.

(System.Reflection.Assembly/Load WindowsBase, Version=3.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35)
(import '(System.Windows.Media Matrix))
(import '(System UriBuilder))

; Test struct
(defn b [matrix] (doto matrix (.Scale 0.5 -0.5)))
(defn a [] (b (Matrix.)))

(defn a2 [] (doto (Matrix.) (.Scale 0.5 -0.5)))

; Test class
(defn b3 [builder] (doto builder (.set_Port 9090)))
(defn a3 [] (b3 (UriBuilder.)))

(defn a4 [] (doto (UriBuilder.) (.set_Port 9090)))

(println Matrix struct (a) (a2)
 (= (a) (a))
 (= (a2) (a2))
 (= (a) (a2))) ; True True False
(println UriBuilder class (a3) (a4)
 (= 9090 (.Port (a3)) (.Port (a3)))
 (= 9090 (.Port (a4)) (.Port (a4)))
 (= 9090 (.Port (a3)) (.Port (a4 ; True True True

--~--~-~--~~~---~--~~
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: ClojureCLR installation?

2009-09-28 Thread Shawn Hoover
On Mon, Sep 28, 2009 at 9:58 AM, Sean Devlin francoisdev...@gmail.comwrote:


 Hey guys,
 I recently found a need to use the CLR.  As such, I've got some
 general questions about ClojureCLR

 1.  Is there a ClojureCLRBox or anything similar?


No, just the instructions on the github wiki.


 2.  Does anyone know of some good articles about the differences
 between the two platforms?  Will contrib behave differently?  E.g.
 String utils, duck streams, etc?


Contrib will behave differently (not work) in any case where it relies on
the java standard library.


 3.  Does SLIME work?


No, due to same issues as 2. Theoretically inferior-lisp should work if you
change the inferior lisp command to run clojure.main.exe and set the
environment variable clojure.load.path.


 4.  Has anyone run ClojureCLR in mono?


David Miller, ClojureCLR's author was looking into this, but I'm not sure
the dependency on Microsoft's Visual J# Redist has been solved yet for Mono
compatibility.

5.  How close is edge CLR to edge JVM?


The status is here: http://wiki.github.com/richhickey/clojure-clr/to-do. Not
everything is done, but the things that are done tend to stay up to date
within a few weeks.


 6.  Has anyone run compojure, clojureQL, etc on the CLR?


Not that I know of. Again, any Java library dependencies would be blockers.


 7.  Is there a way to detect if my Clojure code is running on the CLR
 vs the JVM?


I don't know of an official way to tell, but in the meantime it would be
pretty safe to check for the existence of a standard CLR class: (def
clojureclr (when (ns-resolve 'clojure.core 'System.AppDomain) true))

Shawn

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



ClojureCLR NullReferenceException

2009-09-16 Thread Shawn Hoover
I'm trying to run the celsius sample recently committed to ClojureCLR. It
works fine when I run Clojure.Main from Visual Studio, but from a command
line I get this:
c:\Users\Shawn\clojure-clr\Clojure\Clojure.Main\bin\Debug
Clojure.Main.exe
Clojure 1.1.0-alpha-SNAPSHOT
user= (import '(System.Windows.Forms Form))
System.NullReferenceException: Object reference not set to an instance of an
obj
ect.
   at clojure.lang.Util.NameForType(Type t) in
C:\Users\Shawn\clojure-clr\Clojure\Clojure\Lib\Util.cs:line 397
   at clojure.lang.Namespace.importClass(Type t) in
C:\Users\Shawn\clojure-clr\Clojure\Clojure\Lib\Namespace.cs:line 266
   at lambda_method(Closure )
   at AFunction_impl.invoke()
   at REPLCall(Closure )
user=

I ran ProcMon to see if it was failing to find an important file, but I
couldn't see any activity between when it loaded the last bootstrap file and
when the error occurred.

Any tips?

Shawn

--~--~-~--~~~---~--~~
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: ClojureCLR NullReferenceException

2009-09-16 Thread Shawn Hoover
On Wed, Sep 16, 2009 at 12:28 PM, Shawn Hoover shawn.hoo...@gmail.comwrote:

 I'm trying to run the celsius sample recently committed to ClojureCLR. It
 works fine when I run Clojure.Main from Visual Studio, but from a command
 line I get this:
 c:\Users\Shawn\clojure-clr\Clojure\Clojure.Main\bin\Debug
 Clojure.Main.exe
 Clojure 1.1.0-alpha-SNAPSHOT
 user= (import '(System.Windows.Forms Form))
 System.NullReferenceException: Object reference not set to an instance of
 an obj
 ect.
at clojure.lang.Util.NameForType(Type t) in
 C:\Users\Shawn\clojure-clr\Clojure\Clojure\Lib\Util.cs:line 397
at clojure.lang.Namespace.importClass(Type t) in
 C:\Users\Shawn\clojure-clr\Clojure\Clojure\Lib\Namespace.cs:line 266
at lambda_method(Closure )
at AFunction_impl.invoke()
at REPLCall(Closure )
 user=


Ah, it's just that the assembly with the class was not loaded into the
process. This works:

user= (System.Reflection.Assembly/Load System.Windows.Forms,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
#Assembly System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
user= (import '(System.Windows.Forms Form))
System.Windows.Forms.Form
user=

--~--~-~--~~~---~--~~
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 doesn't regex implement ifn?

2009-08-28 Thread Shawn Hoover
On Thu, Aug 27, 2009 at 9:05 PM, Chas Emerick cemer...@snowtide.com wrote:



 On Aug 27, 2009, at 1:34 PM, Chouser wrote:

  The benefits of # producing a real java.util.regex.Pattern
  object instead of some Clojury wrapper will decrease as it
  becomes more common to write Clojure code that can run on
  non-JVM platforms.  So although this idea has come up and
  then been abandoned several times before, I think it's worth
  bringing up again periodically to see what makes sense.

 Why wouldn't # produce whatever the corollary regex object is on
 each host platform?


I had a couple suggestions on clojure-dev for ClojureCLR that line up with
the produce the corollary idea:
http://groups.google.com/group/clojure-dev/browse_thread/thread/d4286dac9f1cf8ba/7e05daa7b782c075
.
http://groups.google.com/group/clojure-dev/browse_thread/thread/d4286dac9f1cf8ba/7e05daa7b782c075


 Tangentially, if I think ahead a couple of 'moves', I'd think that
 perhaps there's a desire to have clojure code that is thoroughly
 portable between, say, Java and .NET host platforms.


Essentially, as Chouser noted, # and re-seq as currently defined in
Clojure get you pretty far as a portable API. However, unless the platforms
agree on literal regex syntax (they don't, beyond the basic asdf|[0-9]+
features) will prevent true portability of the literals.

Shawn

--~--~-~--~~~---~--~~
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: Getting .NET Version of Clojure to run

2009-08-26 Thread Shawn Hoover
On Sat, Aug 15, 2009 at 8:36 AM, David Miller dmiller2...@gmail.com wrote:

 Clojure.Compile is just for AOT-compilation.  It will compile whatever
 libs are on the command line.  As you state, it is used to bootstrap,
 i.e. compile core.clj and the rest of the bootstap clojure code into
 assemblies, which can then be loaded quickly by Clojure.Main.

 If you follow all the directions on the wiki, specifically,

 http://wiki.github.com/richhickey/clojure-clr/installing-clojureclr
 http://wiki.github.com/richhickey/clojure-clr/compiling-clojureclr
 http://wiki.github.com/richhickey/clojure-clr/running-clojureclr

 you should get up-and-running.


David,
I wrote a post-build event script for Clojure.Compile that automates
everything in compiling-clojureclr. If you're interested, I'll contribute
it.

The downside is that in order to copy files in a hierarchy with limited
extensions (clj, dll, pdb) I used robocopy.exe, which is standard on Vista
but not XP. Or:
- I could port it to xcopy to make it more portable (not hard--just requires
several xcopy commands for one robocopy)
- Developers on XP could install the Resource Kit that includes robocopy
- Developers on XP could manually copy the files around as before

Shawn

--~--~-~--~~~---~--~~
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 box - loading book examples from Programming Clojure

2009-07-08 Thread Shawn Hoover
On Wed, Jul 8, 2009 at 2:55 AM, dumb me dumb...@gmail.com wrote:


 Hi All,

 I am a dumb around here. my first post among many to come :)

 I setup clojurebox to work thru the book. I am a newbie to emacs and
 to clojure. I don't mind the learning curve to emacs.

 I am completely blank  about configuring Clojurebox.
 Here's what I want to do:

 1) load all the code-examples and the related jar-files of the book -
 when I load ClojureBox.


This requires putting the example source directly and all the jars into the
Emacs Lisp variable swank-clojure-extra-classpaths (or writing some code to
scoop them all up and generate a value to put in a variable). See the
Customization section of the README.rtf that installs with Clojure Box.
There should be a shortcut in the Start menu.


 2) Where do I find the .emacs for Clojure Box? As I understand that I
 will have to modify this file to include the libraries/folder-path. I
 don't see one...


C-x C-f ~/.emacs. More info in the Customization section of the README.rtf
that installs with Clojure Box.


 3) I have been trying to do (load-file
 code.examples.introduction.clj) [my home directory being c:\emacs
 and the code folder inside the emacs folder.] and I always get the
 File-not-found exception.


Once the classpath is set up correctly using the above techniques, in the
REPL you can type (use 'code.examples.introduction) or leave off code. or
code.examples. depending on what part you actually put on your classpath.

Shawn

--~--~-~--~~~---~--~~
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 box - loading book examples from Programming Clojure

2009-07-08 Thread Shawn Hoover
Oh, here's an example snippet I just saw from Daniel Lyon on another thread
(note how it cleverly grabs all the jars from the ~/.clojure directory--you
could add another one of these for another directory of jars):

(setq swank-clojure-extra-classpaths
  (cons /Users/fusion/Projects/Languages/Clojure/classes
   (cons /Users/fusion/Projects/Languages/Clojure
 (directory-files ~/.clojure t \.jar$
(eval-after-load 'clojure-mode '(clojure-slime-config))
(setq swank-clojure-extra-vm-args '(-Dclojure.compile.path=/Users/
fusion/Projects/Languages/Clojure/classes))


On Wed, Jul 8, 2009 at 2:02 PM, Shawn Hoover shawn.hoo...@gmail.com wrote:


 On Wed, Jul 8, 2009 at 2:55 AM, dumb me dumb...@gmail.com wrote:


 Hi All,

 I am a dumb around here. my first post among many to come :)

 I setup clojurebox to work thru the book. I am a newbie to emacs and
 to clojure. I don't mind the learning curve to emacs.

 I am completely blank  about configuring Clojurebox.
 Here's what I want to do:

 1) load all the code-examples and the related jar-files of the book -
 when I load ClojureBox.


 This requires putting the example source directly and all the jars into the
 Emacs Lisp variable swank-clojure-extra-classpaths (or writing some code to
 scoop them all up and generate a value to put in a variable). See the
 Customization section of the README.rtf that installs with Clojure Box.
 There should be a shortcut in the Start menu.


 2) Where do I find the .emacs for Clojure Box? As I understand that I
 will have to modify this file to include the libraries/folder-path. I
 don't see one...


 C-x C-f ~/.emacs. More info in the Customization section of the
 README.rtf that installs with Clojure Box.


 3) I have been trying to do (load-file
 code.examples.introduction.clj) [my home directory being c:\emacs
 and the code folder inside the emacs folder.] and I always get the
 File-not-found exception.


 Once the classpath is set up correctly using the above techniques, in the
 REPL you can type (use 'code.examples.introduction) or leave off code. or
 code.examples. depending on what part you actually put on your classpath.

 Shawn


--~--~-~--~~~---~--~~
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 box - loading book examples from Programming Clojure

2009-07-08 Thread Shawn Hoover
On Wed, Jul 8, 2009 at 2:56 PM, Mani dumb...@gmail.com wrote:


 Thanks Shawn, Robert.
 From Robert's post, I am bit confused here. I also read that .emacs is
 in %appdata% folder (vista), but all I see is .emacs.d folder (which I
 guess is for the emacs server). I tried creating one C-x C-f
 ~/.emacs - under my home-directory (C:\emacs). Should i just create
 a .emacs under %appdata%/.emacs.d  OR right under %appdata%?


Wherever the files goes after C-x C-f ~/.emacs and then C-x C-s is where
emacs thinks your home directory is. I would just go with that. It's
normally in %appdata%, but it won't be there until you create it and save
it.

For ideas for a .emacs from scratch, you can look at
http://bitbucket.org/shoover/emacs/src/tip/init.el.

Shawn

--~--~-~--~~~---~--~~
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: Questions / guidelines for adopting Clojure

2009-07-07 Thread Shawn Hoover
On Tue, Jul 7, 2009 at 11:47 AM, Chouser chou...@gmail.com wrote:


 On Tue, Jul 7, 2009 at 8:08 AM, Roman
 Roelofsenroman.roelof...@googlemail.com wrote:
  * Real-world macros *
 
  Correct me if I am wrong, but it seems that people often use macros
  for lazy evaluation of parameters. In Scala, it is quite easy to
  accomplish the same via by-name parameters. E.g.
 
  def maybe(lazyarg: = Unit) = if (...) lazyarg
 
  lazyarg will be evaluated in the if clause, not when the method
  'maybe' gets invoked. I know that macros in clojure are much more
  powerful. But what are selling points in pratice? What is a unique
  feature of clojure's macro that you don't want to miss?

 Lazy args are an approachable example, but probably not my
 main usage of macros.  If that's all you want, 'delay' might
 be a better option.

 I use macros anytime I have patterns in my code that I want
 to factor out but for which functions are insufficient.
 I know that's a bit vague, but I'm not sure how else to
 generalize it.


I would generalize that by saying you can use a macro to extract a pattern
involving language keywords, or, in the case of Clojure, special forms, that
are otherwise difficult to manipulate without passing a fn.

For example, Java doesn't have language support like C#'s using statement
for executing some block of code and deterministically cleaning up an object
at the end. You could implement that as a function (in many languages) and
call it like this:
(defn do-and-close [o f]
  (try
(f)
(finally (.close o
(let [file (FileInputStream. todo.txt]
  (do-and-close file
(fn []
  (do stuff with file

In Clojure this was made cleaner with a simple macro,
clojure.core/with-open. Usage:
(with-open [file (FileInputStream. todo.txt]
  (do stuff with file))

You could write the macro yourself if it wasn't included. Programming
Clojure does a good job of explaining this, as well as when not to use
macros.

Shawn

--~--~-~--~~~---~--~~
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: loneclojurian at ICFP programming contest

2009-07-03 Thread Shawn Hoover
On Fri, Jul 3, 2009 at 9:29 AM, igorrumiha igorrum...@gmail.com wrote:


 On Jul 2, 7:13 pm, Nicolas Oury nicolas.o...@gmail.com wrote:

 You can also try to replace the arithmetic by unchecked arithmetic. (Is it
  correct from the point of view of the semantic of the VM you are
  implementing?).

 I didn't get to that yet because my profiling shows that the amount of
 time spent getting values from an array (even when using getDouble)
 surpasses by far the time spent in any other operation. Of course, my
 understanding of the JVM profiler logs may be wrong.


Interesting. Maybe I'm crazy, but when running java -server, replacing
vectors/assoc with arrays/aset slowed my project down from 4000
iterations/second to 100! Similarly, removing multimethods for each
instruction and loop/recur to churn through them and replacing with one big
fn generated up front resulted in a massive slowdown. I haven't profiled
yet, but I plan to do so because I'm so surprised by the results.

Shawn

--~--~-~--~~~---~--~~
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: loneclojurian at ICFP programming contest

2009-07-01 Thread Shawn Hoover
Another one: http://bitbucket.org/shoover/icfp. Like Jeff we had fun on the
VM but didn't get to post a solution :)

On Wed, Jul 1, 2009 at 1:34 AM, Jeff Foster dr.jeff.fos...@gmail.comwrote:


 I looked at the ICFP Contest too.  I didn't even get as far as solving
 the first problem, but I did implement a virtual machine that appeared
 to work.  I really enjoyed the coding, though I didn't get very far
 with the physics!  I tried a couple of approaches but settling on the
 functional side.  Performance was not bad (from what I've seen it was
 vaguely comparable to the Python implementations, but was completely
 blown away by C/C++ implementations).  I really wish I'd had the time
 to do a visualizer!

 My code is on github too (http://github.com/fffej/ClojureProjects/tree/
 1494815e83febebe9af28b0cb08b812a63df9e96/icfp/uk/co/fatvathttp://github.com/fffej/ClojureProjects/tree/%0A1494815e83febebe9af28b0cb08b812a63df9e96/icfp/uk/co/fatvat)
 and
 there's a write-up on my blog (http://www.fatvat.co.uk/2009/06/icfp-
 contest-this-time-its-functional.htmlhttp://www.fatvat.co.uk/2009/06/icfp-%0Acontest-this-time-its-functional.html
 ).

 Again, I'd appreciate any guidance on anything that I could improve!

 Cheers

 jeff

 On Jun 30, 11:02 pm, igorrumiha igorrum...@gmail.com wrote:
  Greetings everyone,
 
  I didn't actually plan it but I ended up participating in the ICFP
  programming contest (http://www.icfpcontest.org). This year the task
  was to move satellites from one orbit to another, to meet with other
  satellites etc. Quite interesting, and to start it all you need to
  implement a virtual machine for the physics simulator.
 
  I used Clojure and managed to solve the first of the four problems,
  which means I didn't get really far. I was simply too slow to get to
  the really interesting stuff. I have written a rather long article
  describing my solution so I hope some of you may find it interesting:
 
  http://igor.rumiha.net/tag/icfp/
 
  I have also put the code on github:
 http://github.com/irumiha/icfp-loneclojurian/tree/master
 
  I hope someone has the interest and the time to take a look at the
  code. I consider myself a Clojure beginner and any suggestions are
  welcome, especially considering possible speed improvements to the
  virtual machine. According to some of the people on the #icfp-contest
  channel my VM implementation is 500x to 1000x slower than a typical
  implementation written in C. It is, on the other hand, in the same
  performance range as some VMs written in Python. Some people claim
  that the JVM can give you C-like performance, but I would be more than
  happy if I got my VM to be 10x slower than the C ones :)
 
  Igor.
 


--~--~-~--~~~---~--~~
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: Updating a running app

2009-06-11 Thread Shawn Hoover
On Thu, Jun 11, 2009 at 5:06 AM, rb raphi...@gmail.com wrote:


 HI,

 in his post Macro design, by example [1], Meikel Brandmeyer
 mentioned that it is possible to reload a function (in contrast to a
 macro) in a running application:

 Now all you have to do is to just reload the single function in the
 running application. This can be easily done by environments like
 SLIME or VimClojure. Et voila. The next time the function is called
 you already get the benefit. Without recompilation of the whole app...
 

 Is achieving this a general possibility for any app, or are there
 limitations to updating running applications?
 For example, is it necessary to start the app in a REPL to be able to
 update it while it's running? Or is it possible to open a REPL
 attached to a running application?


Clojure loads code only when you tell it to via require, use, and load (or
their equivalents in an ns definition), so you do need a way to tell it to
reload. Currently that could happen via a REPL or Slime or any other I/O
mechanism you could build into your app to take input and load code. It's
pretty easy to launch an app and a REPL using the built-in command line
arguments of clojure.main: java -cp clojure.jar --init myapp.clj --repl.
Opening a slime connection in your init script is also pretty easy.


 I'm very curious about this (possibly compared to Erlang's hot code
 update possibilities) and would appreciate any pointer or example.

 Thanks!

 Raphael


A big difference with Erlang's hot code loading is that in Erlang the
runtime tracks multiple versions of code by module, and there's a well
defined way for your code to indicate whether it always wants the latest
version of a function it calls or whether only new Erlang processes see the
new code. With Clojure it's more granular and forceful. As soon as a given
function is loaded, the new version is visible globally to the program
(except where a particular thread may have purposely set up a thread-local
binding in its current context). If you're updating multiple functions with
changes in their signatures or meaning, you have to be very careful. There
was an interesting query on the group [1] about the possibility of
supporting multiple versions of scripts by using dynamic classloaders, but
it didn't generate discussion.

Shawn

[1]
http://groups.google.com/group/clojure/browse_thread/thread/e05f73854549a25d/7c22e8472ff738a4

--~--~-~--~~~---~--~~
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: (Potentially stupid) Question about recursion / trampoline

2009-06-10 Thread Shawn Hoover
On Tue, Jun 9, 2009 at 6:04 PM, arasoft t...@arasoft.de wrote:


 I tried this:

 (declare F)

 (defn M [n]
  (if (zero? n)
0
(- n (F (M (dec n))

 (defn F [n]
  (if (zero? n)
1
(- n (M (F (dec n))

 and for large n I got the expected stack overflow. Then I tried to
 trampoline the functions:

 (declare F)

 (defn M [n]
  (if (zero? n)
0
#(- n (F (M (dec n))

 (defn F [n]
  (if (zero? n)
1
#(- n (M (F (dec n))

 Now (trampoline #(M 7)) yields
 java.lang.ClassCastException: user$M__760$fn__762 cannot be cast to
 java.lang.Number (NO_SOURCE_FILE:0)

 Does anybody have an idea to get this to work?


I don't know how to make it work, but I can tell you why you're getting a
ClassCastException. In the definition of M, you have (F (M (dec n)). This is
returned in a fn, which is fine until it gets called. When called, the inner
M could return a fn, which gets passed to F, which assumes it's a number and
tries to use it in a subtraction operation.

Shawn

--~--~-~--~~~---~--~~
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: You know you've been writing too much Clojure when...

2009-06-02 Thread Shawn Hoover
On Tue, Jun 2, 2009 at 9:52 AM, Michael Reid kid.me...@gmail.com wrote:


 On Fri, May 29, 2009 at 2:51 PM, Paul Stadig p...@stadig.name wrote:
  You meant to type disclosure, but instead you typed disclojure.
 
  Paul
 
 How about when you try to write code in other languages, and
 reflexively place parentheses before function/method names?

 (len 'Foo') -- not valid Python. :(

 /mike.


Don't forget, commas are NOT optional!

irb(main) a = [1 2 3]
SyntaxError: compile 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
-~--~~~~--~~--~--~---



Re: ClojureCLR updated

2009-06-01 Thread Shawn Hoover
On Mon, Jun 1, 2009 at 4:15 PM, Konrad Hinsen konrad.hin...@laposte.netwrote:


 On 01.06.2009, at 19:57, David Miller wrote:

  : It'd be much easier to play with if you provide a precompiled
  : executable :)
 
  I thought about that.  Adding assembilies of my code  as a download is
  easy enough.  However, to get the thing running, you also need vjslib
  from the J# Redistributatable library plus DLLs generated from the DLR
  source -- care to advise me about the legal ramifications of me doing
  that directly?  :)

 I remember reading that Mono now supports DLR. Would it be
 envisageable to supply a fully Mono-based precompiled executable?
 That would also be nice for us non-Windows users...

 BWT, ClojureCLR is a very interesting development for me, as
 colleagues of mine have a lot of .NET code (running under Linux with
 Mono).

 Konrad.


If Mono supports the DLR, the only thing I see holding back that dream is
the Visual J# dependency. Even that could go away if ClojureCLR had a
BigInteger implementation, or something similar that enables Clojure's
arbitrarily large integers.

--~--~-~--~~~---~--~~
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: ClojureCLR updated

2009-05-31 Thread Shawn Hoover
On Sun, May 31, 2009 at 4:08 AM, dmiller dmiller2...@gmail.com wrote:


 I've posted a major update to the ClojureCLR code to clojure-contrib.
 However, if you want to stay up with the latest changes, I recommend
 gitting the code at http://github.com/dmiller/ClojureCLR.  Consult the
 wiki there for information on installing / compiling / running.

 This release brings the code up to revision 1370 of the JVM version,
 about a week ago.  This means that all the lazy changes have been
 incorporated.  The latest version of the DLR is used.

 The compiler has been completely rewritten.  It now follows the JVM
 version very closely, though it still uses the DLR (specifically,
 Expression Trees V2) for most code generation.  Type hints are
 followed.  Most important, AOT-compilation now works and loading and
 compiling are pretty complete.   Because the bootstrap files such as
 core.clj can be AOT-compiled into CLR assemblies, the startup time has
 been significantly reduced.

 Of the bootstrap files, core.clj is 95% complete.  core_print, set,
 and zip are at 100%.  And main.clj loads, so the standard REPL is
 available.  Proxying and genclass haven't been attempted yet.

 Speed is still an issue.   For basic code generation, the MSIL
 produced by the ClojureCLR compiler is as close as possible to the
 bytecodes produced by the Clojure(JVM) compiler.   The next phase f
 work is to do IL-level comparisons of the compiler output of each
 implementation.   If anyone has some *.clj benchmarks to recoommend,
 let me know.

 Overall, this release is a very large step forward in performance and
 functionality.  There are still enough rough edges and gaps in testing
 that daily use cannot be recommended, but those wanting to play and
 test will find this release much easier to deal with.  Bon appetit.

 David Miller


Wow, great work! I followed the instructions and it worked as stated except
for one missing detail: nothing happened because I didn't realize I had to
pass arguments to the bootstrapcompiler. I recommend adding a note to
compile-run doc that you need command line arguments like clojure.core
clojure.set clojure.zip clojure.main. Once I got that working, it spat out
dlls and subsequent startup went from about 9 seconds on my laptop down to
2!

Shawn

--~--~-~--~~~---~--~~
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: Weird Clojure Box - library issue

2009-05-29 Thread Shawn Hoover
On Tue, May 26, 2009 at 4:24 AM, hoeck i_am_wea...@kittymail.com wrote:




 On 20 Mai, 14:25, Shawn Hoover shawn.hoo...@gmail.com wrote:
  I can't help with COM, but this patch might help slime automatically
 connect
  to the REPL on Windows XP:
 http://bitbucket.org/shoover/clojure-box-swank-clojuremq/src/tip/hack...

 Hi Shawn,

 thanks for this patch, now starting swank-clojure on windows works
 like a charm.
 (Though it leaves my mind in an uncomfortable state when thinking
 about windows and the side-effect-voodoo)

 Erik


Yeah I do wish I had a better answer. It has to do with initializing
something in the Java hash/crypto stuff, but I could never get a grip on why
it behaves that way. The patch is not necessary on Vista, so maybe it's a
bug in XP or Java 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: Weird Clojure Box - library issue

2009-05-20 Thread Shawn Hoover
On Wed, May 20, 2009 at 3:32 AM, hoeck i_am_wea...@kittymail.com wrote:


  i tried importing those two classes from a recent jacob with slime,
 xemacs and w2k and exactly the same is happening here. I have a
 similar problem when starting slime, my emacs blocks and doesn't start
 the repl until i evaluate some random stuff in the *inferior-lisp*
 buffer. Same when loading the jacob classes. But it works without any
 problems in the *inferior-lisp* buffer.
 I guess its some really strange threading/locking/blocking problem
 with windows/(x)emacs and maybe some anti virus thing someone
 installed on my machine while I was away (slime had worked without
 blocking before). Even weirder, the whole jvm freezes (well, except
 the clojure repl in *inferior-lisp*), including the processexplorer
 and the attached jvisualvm.


I can't help with COM, but this patch might help slime automatically connect
to the REPL on Windows XP:
http://bitbucket.org/shoover/clojure-box-swank-clojuremq/src/tip/hack-repl-hang

--~--~-~--~~~---~--~~
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
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: Getting slime-edit-definition to work with Clojure

2009-05-11 Thread Shawn Hoover
On Fri, May 8, 2009 at 5:43 AM, Baishampayan Ghose b.gh...@ocricket.comwrote:


 Stephen C. Gilardi wrote:

  I've simplified my .emacs file and clojure launch script to only what's
  required for my slime setup to work with swank-clojure. With this
  simplified setup, I confirmed that slime's repl works and that M-. after
  typing (+ brings me to the definition of + in clojure.core.
 
  The way I use slime/swank is to handle all Classpath issues myself in my
  swank-clojure-binary launch script. I've found that setup to break
  only very rarely with slime/swank/clojure updates. Other strategies may
  perform equally well or better, but I haven't tried them.
 
  In the setup below, /sq/ext is a directory where I keep third party
  source controlled package. I'm running all from the HEAD of their Source
  Control repository. I did a fresh update just now.
 
  Are you able to duplicate this setup to try?

 Many thanks for taking out some time to help me. I have good news, and
 bad news.

 Bad news first.

 I duplicated your setup and even then it didn't work.

 And that made me suspect my ~/.emacs file itself. It's working for you
 and it's working for Phil (and everybody else), but not me. There must
 be something wrong with my config.

 The Good news.

 I started with a bare .emacs file and it worked! Then I analysed each
 and every line of my 5 year old .emacs and finally zeroed in to one line.

 (add-to-list 'auto-coding-alist '(. . utf-8))

 Yes. That line screwed up everything for me. I removed it and everything
 is working fine now.

 Now I need to find out why that line was causing the problem.

 Thanks a lot Stephen  Phil. You guys (as well as the Clojure community)
 made my day.

 Regards,
 BG


I'm not sure if this is related, but in case someone else is stuck on a
similar problem, here's how I patched swank-clojure for Clojure Box to
support slime-edit-definition when the source code is in a jar on Windows:
http://bitbucket.org/shoover/clojure-box-swank-clojuremq/src/tip/edit-definition

--~--~-~--~~~---~--~~
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
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: stumped by class not found (vista)

2009-05-11 Thread Shawn Hoover
On Mon, May 11, 2009 at 7:13 PM, tarvydas
tarvy...@visualframeworksinc.comwrote:


 - Where does the output from println go?  I put println's in the proxy
 callbacks, but I don't see the output in the slime repl nor in the
 *Messages* buffer (I know that the callbacks are working, because they
 also alter components of the gui - and that can be seen).


Is it in your *inferior-lisp* buffer? If so, you need to run M-x
slime-redirect-inferior-output or (add-hook 'slime-connected-hook
'slime-redirect-inferior-output).

--~--~-~--~~~---~--~~
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
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: Printing to REPL from other threads in Slime

2009-05-06 Thread Shawn Hoover
On Tue, May 5, 2009 at 11:18 PM, Mark Engelberg mark.engelb...@gmail.comwrote:


 I'm using Clojure Box's Emacs/Slime setup.   When I invoke println
 from a newly-spun thread, I don't see the output in the REPL.

 Suggestions?


It's going to the *inferior-lisp* buffer. If you run M-x
slime-redirect-inferior-output it will go to your REPL. I haven't figured
out yet if something changed with swank-clojure lately to change that
behavior.

Shawn

--~--~-~--~~~---~--~~
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
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: HTTP clients in clojure

2009-05-06 Thread Shawn Hoover
I was recently tipped off to this nascent project:
http://github.com/technomancy/clojure-http-client/tree/master

On Wed, May 6, 2009 at 8:34 PM, Eric Tschetter eched...@gmail.com wrote:


 Last I checked the various clojure libraries, it seemed like noone has
 publicized a set of wrappers/clojure-native implementation of an http
 client.  I'm wonder if such a thing exists, or has everyone basically
 just rolled their own wrapper on top of their favorite Java HTTP
 client library?

 --Eric Tschetter

 


--~--~-~--~~~---~--~~
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
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: Getting slime-edit-definition to work with Clojure

2009-04-28 Thread Shawn Hoover
On Mon, Apr 27, 2009 at 3:08 AM, Baishampayan Ghose b.gh...@ocricket.comwrote:


 Phil,
  It works for me. Are you trying to look up a built-in clojure function
  or one from your own application? How did you install SLIME and
  swank-clojure etc?

 It doesn't work for either. When I try looking up a clojure-contrib
 function, I get let*: Search failed:   clojure/contrib/str_utils.clj$

 In case of a function that I wrote somewhere in a file and loaded in
 SLIME, I get an exception - java.lang.StringIndexOutOfBoundsException:
 String index out of range: -1 (NO_SOURCE_FILE:0) (in *Messages* I get
 funcall: Synchronous Lisp Evaluation aborted)


I don't know what your clojure binary looks like, but is the code for these
functions on your Java classpath?

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



contrib mercurial mirror is back up

2009-04-23 Thread Shawn Hoover
My bitbucket contrib mirror is public again at
http://bitbucket.org/shoover/clojure-contrib-mirror. Thanks to bitbucket for
munging unrecognized email addresses per my request.

Shawn

--~--~-~--~~~---~--~~
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
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: DISCUSS: clojure.contrib.java-utils/with-system-properties

2009-04-05 Thread Shawn Hoover
I was wondering if anyone would ever need this functionality. Knock yourself
out. In retrospect a map is definitely the way to go.

Shawn

On Sun, Apr 5, 2009 at 12:36 PM, Stuart Halloway s...@thinkrelevance.comwrote:

 Don't work with the yucky properties API, just install a map of properties
 for the duration of a block!

 -
 clojure.contrib.java-utils/with-system-properties
 ([settings  body])
 Macro
  setting = property-name value

  Sets the system properties to the supplied values, executes the body, and
  sets the properties back to their original values. Values of nil are
  translated to a clearing of the property.
 -

 CREDITS:

 This function is a refactoring of Shawn Hoover's with-properties. Shawn, if
 my changes offend in any way let me know and I will fix it.

 NOTES:

 (1) You will need to build contrib from source to see this.

 (2) Name changed from with-properties to with-system-properties

 (3) Expected argument is now a map, not a vector, which I believe is more
 logical and convenient for callers.

 (4) Uses the-str so that property keys can be Clojure keywords or symbols.




--~--~-~--~~~---~--~~
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
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: March 20th 2009 Rich Hickey Appreciation Day!

2009-03-21 Thread Shawn Hoover
On Fri, Mar 20, 2009 at 2:26 PM, Rayne disciplera...@gmail.com wrote:


 I Anthony Simpson, with the support of fellow Clojurists hereby
 declare March 20th, the first day of spring, Rich Hickey appreciation
 day!


The first day of spring is very fitting for this occasion. Rich, the
pragmatism, objectivity, clarity of thought, and excellent design taste you
bring to the language and the community with no excuses or compromise are a
breath of fresh air. Thanks!

Shawn

--~--~-~--~~~---~--~~
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
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: SLIME: evaluating forms?

2009-03-17 Thread Shawn Hoover
On Tue, Mar 17, 2009 at 6:40 AM, Elena egarr...@gmail.com wrote:


 I'm writing a Clojure source file. I thought that C-M-x (slime-eval-
 defun) would send the current toplevel form to the REPL but I was
 wrong. For instance, if I evaluate:

 (ns test
(:import (java.net InetAddress)))

 from the source file and then I evaluate *ns* at the REPL, I get:

 #Namespace user

 whilst if I copy and paste the form at the REPL and then I evaluate
 *ns* , I get:

 #Namespace test

 which is what I would have expected in the first instance. What am I
 missing? (I'm a SLIME newbie)

 Thanks


Elena, you can think of C-M-x as restoring the original *ns* after
evaluating the form. After evaluating that ns form, you can evaluate
(find-ns 'test) in the REPL and see that the test namespace was created;
it's just that the REPL thread was never changed into test. In addition, if
you evaluate another form like (defn hi [] :hi) test/hi will be available
for future evaluations. If you want to set the REPL package from your .clj
buffer, use C-c M-p (slime-repl-set-package).

Shawn

--~--~-~--~~~---~--~~
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
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: Improving the test suite

2009-03-17 Thread Shawn Hoover
On Tue, Mar 17, 2009 at 12:03 AM, Phil Hagelberg p...@hagelb.org wrote:



 OK, so I've posted a fair amount of smack talk about test suites and
 how important they are--I figure it's time to help out.

 What are some ways in which test-clojure is lacking? How can I help
 improve the coverage?

 -Phil


Tests are lacking for the reference types. There are lots of behaviors in
agents, transactions, commute, alter, in-transaction values, etc., where the
rest of us scratch our head and guess until Rich issues a one-line
eye-opener to clear it up, until we forget the next time. It would be great
to have tests to ensure the quality of those statements going forward, with
a side effect being examples of correct usage.

Shawn

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



Re: swank-clojure-extra-classpaths troubles

2009-03-16 Thread Shawn Hoover
On Tue, Mar 10, 2009 at 7:21 AM, Tassilo Horn tass...@member.fsf.orgwrote:

   user (require 'examples.introduction)

 I get this exception:

 ,
 | java.io.FileNotFoundException: Could not locate \
 |  examples/introduction__init.class or \
 |  examples/introduction.clj on classpath:  (NO_SOURCE_FILE:0)
 |   [Thrown class clojure.lang.Compiler$CompilerException]
 `

 When I use the repl.sh script that comes with the examples and start it
 from /home/horn/repos/programming-clojure/ it works (. is in the -cp
 argument), but I guess that's exactly what those extra classpaths of
 clojure-swank are meant for.

 Is this a bug in swank-clojure?  (And if so, is that the right place to
 ask for help with clojure tool support anyway?)

 Bye and thanks for any pointers,
 Tassilo


Tassilo,

I was able to reproduce this on my Windows box when I tried hacking in an
extra classpath to an already-running emacs that had already started slime.
It turns out the extra classpaths are only checked when swank is first
loaded and then the value is cached; I had to manually clear
slime-lisp-implementations or restart emacs to fix it.

Are you still having this problem?

Shawn

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



Re: swank-clojure-extra-classpaths troubles

2009-03-16 Thread Shawn Hoover
On Mon, Mar 16, 2009 at 2:39 PM, Tassilo Horn tass...@member.fsf.orgwrote:

 Yes, for me having directories in `swank-clojure-extra-classpaths'
 doesn't work at all.  Everything except jar files are discarded.  So
 that's the general problem for me, the examples are one specific case
 which bites me.

 Bye,
 Tassilo


Hmm, that is a new one to me. The only other things I can think of:

   1. Inspect the value of slime-lisp-implementations (C-h v) and make sure
   the java command line options look like you expect, including the classpath
   directories you added and the path separator appropriate for your operating
   system.
   2. Try it with and without the trailing / on your strings that add to
   swank-clojure-extra-classpaths. Both work on Windows, but I'm not sure if
   other file systems are picky about that.

Shawn

--~--~-~--~~~---~--~~
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
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 Web Framework, what I want to add

2009-03-16 Thread Shawn Hoover
On Mon, Mar 16, 2009 at 9:18 PM, Stuart Sierra
the.stuart.sie...@gmail.comwrote:


 On Mar 16, 7:17 pm, BerlinBrown berlin.br...@gmail.com wrote:
  After many years (decade) of web development, here are the things that
  I want in a framework, mostly based in clojure:
 
  What do you think and what you add.  This is ambitious and just a
  ideas of what I would add.  What would you want from your ideal
  framework?

 Nothing much to add, but I'm doing well with a combination of Restlet,
 StringTemplate, Derby, and Solr.

 After a couple of years with Rails, I felt that I wanted to work
 closer to the metal, with the metal, in this case, being HTTP.
 Javascript/CSS-generation was more trouble than it was worth.

 -Stuart Sierra


Stuart, thanks for mentioning your stack. I've played with StringTemplate
from Clojure, but I hadn't seen it in use in a project before. Your
implementation is great, and at 88 lines of mainly imports and tests it's a
great example of using Java (and clojure-contrib). Stringify the keys and
away you go!

Shawn

--~--~-~--~~~---~--~~
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
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: 08 and 09 are invalid numbers, but 01 through 07 are fine?

2009-03-12 Thread Shawn Hoover
On Thu, Mar 12, 2009 at 5:13 PM, Meikel Brandmeyer m...@kotka.de wrote:

 Hi,

 Am 12.03.2009 um 22:08 schrieb levand:

  Seems like there's a bug here. All the digits less than 8 work. If
 leading zeros aren't allowed, at least the behavior ought to be
 consistent.


 Leading zeros indicate octal, which has no digits like 8 or 9...

 In so far it's not a bug nor is it inconsistent, I guess.


Indeed. And if you just use 0-7 and it's all good:
user 010
8

--~--~-~--~~~---~--~~
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
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: Workflow poll?

2009-03-11 Thread Shawn Hoover
On Sat, Mar 7, 2009 at 4:53 PM, Mark Engelberg mark.engelb...@gmail.comwrote:


 I've been using the Clojure-in-a-box setup for Windows, which was
 absolutely instrumental in getting me to try out Clojure.  But if I
 keep downloading the latest versions of Clojure, it drifts out of sync
 with the included SLIME development environment and everything breaks.
  I haven't yet figured out how to set everything up in such a way that
 everything keeps up-to-date and working.


fyi, I just uploaded a new Clojure Box to http://clojure.bighugh.com with
the latest Clojure, including lazier sequences. In the future I'll consider
adding an update function similar to the Emacs Starter Kit, but it's tricky
anytime the tools trail the language on some breaking change.

 Also, I still haven't
 figured out how to get debugging working in the emacs environment.


swank-clojure doesn't support any emacs built in step/breakpoint debugging,
but it's possible to change the REPL initialization args to open a debug
socket attachable from jswat. I have this in my .emacs
(swank-clojure-config) form (for Clojure Box this would have to be patched
into c:/Program Files/Clojure Box/emacs/site-lisp/default.el):

 (setq swank-clojure-extra-vm-args
   (list -Xdebug

-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=)))


 And I still don't fully understand how to set up complex projects,
 rather than just one-off scripts.


I suggest taking a look at the clojure-contrib and swank-clojure sources.
They're both sizable projects that use several namespaces for organization.

Shawn

--~--~-~--~~~---~--~~
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
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: Privacy problems with clojure-contrib mirrors

2009-03-09 Thread Shawn Hoover
Konrad, I wish you had used a normal Google account instead of one with your
personal email address--I didn't know Google allowed that, but or course
there's no changing the past commits now. Since Bitbucket is ignoring my
request to display email addresses the way Google Code does, I've made my
repository private until they fix it or I can find a way myself.

Clojure Contrib Mercurial users, I'm sorry for the inconvenience of taking
down this repo. If you're desperate in the meantime it's not the hardest
thing in the world to install Python and hgsvn on your private system. If
anyone's up for patching hgsvn, it may be as simple as rewriting
u...@example.com to user u...@example.com. I'll try that when I can.

Shawn

On Tue, Feb 24, 2009 at 9:46 AM, Konrad Hinsen konrad.hin...@laposte.netwrote:


 There are a couple of mirrors of clojure-contrib out there, for example:

 http://bitbucket.org/shoover/clojure-contrib-mirror/overview/
 (Mercurial)
 http://github.com/kevinoneill/clojure-contrib/commits/ (git)

 While it is nice to have clojure-contrib accessible through different
 version control systems, I am not at all happy with the fact that my
 e-mail address (which is also my Google account) is contained in full
 in all these mirrors. I already get a few hundred spam messages per
 day and I am not looking forward to getting more.

 The Google Code server carefully displays only a part of the address.
 Could the administrators of the mirrors set up their servers to do
 the same please? It's not difficult to recognize an e-mail address
 and transform it, either when importing the changes from Google's
 subversion server or when displaying author information through a Web
 interface.

 Konrad.


 


--~--~-~--~~~---~--~~
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
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: On the importance of recognizing and using maps

2009-03-08 Thread Shawn Hoover
On Sun, Mar 8, 2009 at 6:13 PM, Dan redalas...@gmail.com wrote:


  I'm pretty sure structs are only appropriate for when you need to eek
  the absolute last iota of performance out of a collection, in which case
  they can provide greater speed than maps. But since the list of keys is
  fixed, it means it's more effort to add or rename a key than it is with
  a map.

 Not really, I can assoc and dissoc as I wish and leave blank values I
 wish. Any function can treat it as a map.


Close... you can assoc new keys into a struct instance, but you can't dissoc
any of the basis 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
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 infinite loop

2009-03-06 Thread Shawn Hoover
On Fri, Mar 6, 2009 at 12:24 AM, mike.farn...@gmail.com 
mike.farn...@gmail.com wrote:


 So, I downloaded clojure and started it up with the command:
 java -cp clojure.jar clojure.lang.Repl

 The docs indicate: This will bring up a simple read-eval-print loop
 (REPL).

 Is this truly an infinite loop?

 I tried a number of commands to exit.
 So, I just hit ctrl-C. (This is on Windows).


You can also stop it by typing (System/exit 0).

Anyhow, one other question, since clojure can access Java classes,
 I should be able to open a database connection and do all of the good
 DB things, right?


Sure. Here's an example of some Java interop: http://clojure.org/jvm_hosted.
There's a Clojure interface to jdbc in the clojure-contrib project:
http://code.google.com/p/clojure-contrib/source/browse/trunk/src/clojure/contrib/sql.clj
.

Shawn

--~--~-~--~~~---~--~~
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
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: Adding strings

2009-02-26 Thread Shawn Hoover
On Thu, Feb 26, 2009 at 11:11 AM, Peter Wolf opus...@gmail.com wrote:


 Hey all,

 What is the idiomatic way to concatenate strings?  Here are some things
 that I expected to work, but didn't

(+ foo bah)
(conj foo bah)
(into foo bah)

 For the moment I am doing

(.concat foo bah)

 But it seems wrong

 Thanks
 P


Try (str foo bah).

--~--~-~--~~~---~--~~
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
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: Contributing

2009-02-19 Thread Shawn Hoover
On Thu, Feb 19, 2009 at 9:44 AM, Joshua jhaw...@gmail.com wrote:


 Thanks, Ill see what I can do.

 Joshua


If you decide to pitch in, be sure to read http://clojure.org/contributing.
Discuss on this list before getting too far into something, to make sure the
direction is acceptable and that there's no duplicate effort.

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



Re: how to learn clojure ?

2009-02-18 Thread Shawn Hoover
On Wed, Feb 18, 2009 at 9:04 AM, Joshua Fox joshuat...@gmail.com wrote:

 Try this book http://www.pragprog.com/titles/shcloj/programming-clojure


Agreed, that book is a good introduction to Lisp and Clojure for programmers
from other backgrounds, as are the Clojure for Java Programmers screencasts
at http://clojure.blip.tv.

--~--~-~--~~~---~--~~
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
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: Concurrency and file writing

2009-02-15 Thread Shawn Hoover
On Sat, Feb 14, 2009 at 5:44 PM, James Reeves weavejes...@googlemail.comwrote:


 On Feb 14, 5:30 pm, Dan redalas...@gmail.com wrote:
  What about making the file an agent and sending write actions to it?

 I don't see how that would solve the problem, unless you're suggesting
 that I have a single agent to handle all reads and writes?

 - James


Temp files is probably the simplest way to go for immutable files. I tried
a temporary agent per file, and it got a little long. To support multiple
writes with interleaved reads and figuring out when to dissoc the agent
would probably make it even longer.

(ns safe-write
  (:import (java.io File))
  (:use [clojure.contrib.duck-streams :as ds]))

(def writers (ref {}))

(defn noop
  Sends a noop action to an agent and awaits it.
  [agt]
  (send-off agt #(identity %))
  (await agt))

(defn await-writer
  Waits for f's writer agent to finish if there is one and returns it. Else
  returns nil.
  [f]
  (when-let [agt (@writers f)]
(while (not (= @agt :done))
  (noop agt))
agt))

(defn exists?
  [f]
  (.exists (File. f)))

(defn waiting-read
  Reads f, waiting for it to be written if another thread is writing it.
  [f]
  (await-writer f)
  (when (exists? f)
(slurp f)))

(defn create-writer
  Creates an agent to write f and returns it. Returns nil if such an agent
  already exists.
  [f]
  (dosync
   (when-not (@writers f)
 (let [agt (agent :working)]
   (alter writers assoc f agt)
   agt

(defn safe-write-once
  Writes contents to f, but only if it doesn't exist and no other thread is
  writing it.
  [f contents]
  (when-not (exists? f)
(when-let [writer (create-writer f)]
  (send-off writer (fn [_]
 ;;(Thread/sleep 2000)
 (spit f contents)
 :done))
  (await writer)
  (dosync (alter writers dissoc f)

(defn do-test
  []
  (let [f /tmp/test4.txt]
(.delete (File. f))
(.start (Thread. #(safe-write-once f crino)))
(Thread/sleep 0)
(waiting-read f)))

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



with-properties macro

2009-02-15 Thread Shawn Hoover
In testing some code in clojure.main I needed a macro to set system
properties, run the test, and pop off the properties. If others find this
useful, we can make it more accessible in contrib. Look here if you're
interested:
http://code.google.com/p/clojure-contrib/source/browse/trunk/src/clojure/contrib/test_clojure/main.clj?spec=svn471r=467
.

Shawn

--~--~-~--~~~---~--~~
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
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: error running example

2009-02-11 Thread Shawn Hoover
On Wed, Feb 11, 2009 at 3:10 PM, Harrison Maseko lis...@gmail.com wrote:


 Hi everyone,
 I just downloaded Clojure Box today and tried to run the example found
 at http://clojure.org/jvm_hosted and I get the error below. What is
 the problem?
 Harrison

 java.lang.Exception: Unable to resolve symbol: setLayout in this
 context (NO_SOURCE_FILE:17)
  [Thrown class clojure.lang.Compiler$CompilerException]


I just pasted the code in the Clojure Box REPL and it worked fine. How are
you getting the code in there? Any chance you're losing the dot in the line
below?

(.setLayout (GridLayout. 2 2 3 3))

--~--~-~--~~~---~--~~
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
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: newbie question on compilation

2009-02-10 Thread Shawn Hoover
On Tue, Feb 10, 2009 at 10:07 AM, Lennart Staflin lstaf...@gmail.comwrote:




 On Feb 10, 2:45 pm, Tzach tzach.livya...@gmail.com wrote:

  I got error in process filter: Wrong number of arguments: nil, 3.
  What am I missing here?

 Are you using Emacs with slime?


Psychic debugging skills in action :)

--~--~-~--~~~---~--~~
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
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: newbie question on compilation

2009-02-10 Thread Shawn Hoover
On Tue, Feb 10, 2009 at 11:32 AM, Tzach tzach.livya...@gmail.com wrote:


 Thanks for the response
 Yes, I'm using Emacs SLIM.

 what should be the relation between the file (hello.clj) path to the
 classpath?
 Is the compile work on the file name, or on the function? in other
 word, should I evaluate the function on the REPL before compile?

 Thanks
 Tzach


The error you reported typically happens with out-of-sync slime and
swank-clojure. I would recommend using the latest source code from each
project (and latest clojure from source).

In the specific case of compiling clojure.examples.hello, the compiler will
look for a file clojure/examples/hello.clj on the classpath, meaning your
java -cp or (in emacs) swank-clojure-extra-classpath should include the
directory above clojure/.

Hope this helps,
Shawn

--~--~-~--~~~---~--~~
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
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: General form of apply

2009-02-06 Thread Shawn Hoover
On Fri, Feb 6, 2009 at 1:19 PM, Konrad Hinsen konrad.hin...@laposte.netwrote:


 The doc string of apply says:

([f args* argseq])
Applies fn f to the argument list formed by prepending args to
 argseq.

 This looks like I could pass in several argument PLUS one sequence of
 arguments, which just happens to be what I want in a specific case.
 But it doesn't seem to work.

 I looked at the definition of apply, which uses an undocumented
 private function spread whose purpose and result I don't quite
 understand.

 Can anyone give an example of how the argseq argument can be used?

 Konrad.


This seems to work correctly:

user (apply + 1 2 3 [4 5])
15

Is that what you're looking for?

--~--~-~--~~~---~--~~
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
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: Stumped - Java hangs when using Swing in Slime

2009-02-05 Thread Shawn Hoover
On Thu, Feb 5, 2009 at 4:52 AM, David dsieg...@yahoo.com wrote:


 I've got the same problem as srolls24 and CuppoJava on Windows XP,
 using Emacs 23
 and versions of Clojure, Slime and Swank fetched today.

 Also, when starting Slime, it opens a connection to *inferior-lisp*,
 but keeps polling
 for Swank until I hit return in the inferior-lisp buffer.  After that,
 it very quickly connects
 the slime-repl.

 Any thoughts?


David, I had that problem on Windows XP as well. I can't figure out the real
issue, but it started when Clojure's Ref.java stopped calling
UUID.randomUUID. I had to patch swank-clojure like this to work around it:
http://bitbucket.org/shoover/clojure-box-swank-clojuremq/src/11bec919b978/hack-repl-hang

The current release of Clojure Box (http://clojure.bighugh.com) contains
that change.

Shawn

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



Indy .NET programmers discover parentheses

2009-01-29 Thread Shawn Hoover
Heartland Clojure Users,

I'm giving a presentation on Clojure next month for the Indianapolis
ALT.NETgroup. The talk is aimed at .NET programmers, introducing
Clojure and
showing them why they might care.

More description and meeting details:
http://indyalt.net/cms/meeting/february-2009/clojure

Now if only Chouser will join the fun and correct all of my misinformation
and omissions...

Shawn

--~--~-~--~~~---~--~~
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
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: changes to test_clojure and test_contrib

2009-01-28 Thread Shawn Hoover
On Wed, Jan 28, 2009 at 11:18 AM, Frantisek Sodomka fsodo...@gmail.comwrote:


 Shawn, I keep wondering where is the best place to put tests for bug fixes.
 One way would be to create a separate file (bugs.clj) and put all these
 tests there. Another way is to include these tests into their respective
 categories - although I wonder for example test for (= () []) = true  ...
 where should it go? Should it go equality.clj or to sequences.clj???
 Any suggestions/opinions about where is the best place for bug fixes???

 Thank you, Frantisek


Frantisek,

I considered the same questions and decided to organize my tests alongside
existing ones by topic. My reasoning was that the goal is a unified
maintainable test suite, and I was just plugging a couple holes. A test in a
bugs.clj script is likely to be duplicated as another developer fills out
the tests for a related topic unawares. The fact that a given test
originated in response to a bug report is a minor historical artifact, which
I felt merited no more structure than a small comment next to the test (and
a comment in the Google bug tracker).

As for locating specific topics, currently the suite is organized by top
level clojure.org topics. Sometimes you just have to pick (I wasn't clear on
evaluation vs. reader in some cases). The equality example you mentioned
could go in data_structures or a specific vectors file.

Shawn

--~--~-~--~~~---~--~~
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
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: repeat and replicate

2009-01-28 Thread Shawn Hoover
On Wed, Jan 28, 2009 at 4:36 PM, Stephen C. Gilardi squee...@mac.comwrote:


 On Jan 28, 2009, at 10:17 AM, Christian Vest Hansen wrote:

 Or replicate could go away.

 More likely, I think one of them could take multiple arities and make
 the other obsolete.


 I like repeat with multiple arities and remove replicate.

 --Steve


Me too. I'm just waiting for some hammer to drop about args ordering or
partial application or 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
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
-~--~~~~--~~--~--~---



repeat and replicate

2009-01-27 Thread Shawn Hoover
Why do we have both repeat and replicate? I can sort of keep them straight,
but as they only differ by arity I wonder if they can be combined... or if
I'm missing a subtle reason for separate names. A user in IRC threw out the
possibility of infinite vs. finite functions, but interleave and map seem to
blur that line.

Shawn

--~--~-~--~~~---~--~~
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
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: changes to test_clojure and test_contrib

2009-01-26 Thread Shawn Hoover
On Sun, Jan 25, 2009 at 6:51 PM, Frantisek Sodomka fsodo...@gmail.comwrote:

 I have some tests ready for test_clojure. I asked Rich for SVN access
 rights. There is gonna be more tests soon :-)

 Frantisek


Contrib Stewards,

I have a few tests in the works and am lacking commit access as well. Should
test contributions follow the procedure of group discussion, then file an
issue, then post a patch? If so, what would you like to know about the
patch(es)?

Shawn

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



Regression tests for contrib consideration

2009-01-26 Thread Shawn Hoover
I've written a few tests for bug fixes from the main line of Clojure, and I
would like to get feedback and contribute them to contrib if they're useful.
I have patches to clojure.contrib.test-clojure for the following topics:

reader: numeric constants of different types don't overwrite each other
r1157;
   - Long reads as Long, not BigInteger; added test for reading BigInteger
r1190

evaluation: key symbols with metadata flow through find r1175

compile-path respects java property r1177 (this one requires its own JVM
startup options--I'm open to suggestions for how to fit this into Stuart
Halloway's recent test_clojure build target)

agents: handle OOM in agent r1198

sequences: pmap regression;
- vectors equal other seqs by items equality r1208

I will post patches to issues separated by topic. I appreciate any feedback
on the concepts or implementation.

Shawn

--~--~-~--~~~---~--~~
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
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: Newbie problem

2009-01-17 Thread Shawn Hoover
On Sat, Jan 17, 2009 at 9:09 AM, mbrodersen morten.broder...@gmail.comwrote:


 Hi

 I am having fun learning Clojure but have a problem with the following
 code. If you run the code with the ;OK removed then it works. If you
 run the code with ;ERROR removed then it doesn't.

 The code is my own implementation of splitting a string into
 individual words (just a learning exercise). The error message is:

 java.lang.IllegalArgumentException: No matching method found:
 isWhitespace (error.clj:0)

 Which is strange because the ;ERROR line has nothing to do with
 isWhitespace?

 Any help would be appreciated.

 Thanks
 Morten
 -

 (defn line-skip-ws [line]
(cond
(not (first line))

(Character/isWhitespace (first line))   (line-skip-ws (rest
 line))
true
(apply str line)))

 (defn line-split-1 [word line]
(let [c (first line)]
(println line-split-1 word: word line: line c: c
 class: (class c))
(cond
(not c)
 [word ]
(Character/isWhitespace c)  [word (apply str
 line)]
true
  (line-split-1 (str word c) (rest line)

 (defn line-split [line]
(let [split (line-split-1  (line-skip-ws line))]
(if (= (first split) )
[]
 ;ERROR  (concat [(first split)] (line-split (rest split))
 ;OK (concat [(first split)] []

 (doseq [x (line-split   Hello   world!  )] (println (format \%s\
 x)))


Hi Morten,

When you call line-split with (rest split), you're passing a Clojure
sequence of characters, not a string. Then line-skip-ws calls isWhitespace
with the sequence and Java doesn't know what to do with it. Try converting
(rest split) to a string using (apply str (rest split)).

Shawn

--~--~-~--~~~---~--~~
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
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: File organization bootstrapping

2009-01-07 Thread Shawn Hoover
On Wed, Jan 7, 2009 at 12:34 PM, Greg Harman ghar...@gmail.com wrote:


 This is frustrating - with a fresh REPL I'm back to the compile
 problem. I can't think of anything I changed that would cause it to
 work intermittently, and I don't know what file it's looking for...
 the source files are on the classpath (it requires just fine) and
 the directory in *compile-path* is also on the cp (via add-
 classpath).

 It's not the load operation that caused it - I removed that entirely
 and just put a placeholder (defn foo [] true), and the compilation
 still crashes on this line.


Are your files still called package1/foo.clj and package2/bar.clj? If so you
would need to (compile 'package1.foo) and (compile 'package2.bar).

Also, make sure the directory named by *compile-path* exists on the file
system. Compilation creates subdirs, but not *compile-path* itself.

Shawn

--~--~-~--~~~---~--~~
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
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: File organization bootstrapping

2009-01-07 Thread Shawn Hoover
On Wed, Jan 7, 2009 at 1:45 PM, Greg Harman ghar...@gmail.com wrote:


 Bingo - *compile-path* was a relative dir. Defining it as the full
 path did the trick.

 Thanks!

  Also, make sure the directory named by *compile-path* exists on the file
  system. Compilation creates subdirs, but not *compile-path* itself.


You're welcome!

Clojure developers, would it be a good idea for Compiler.java or
clojure.core/compile to check if *compile-path* exists, else throw an
exception specific to that problem?

Shawn

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



Re: Emacs / Slime questions

2008-12-08 Thread Shawn Hoover
On Sun, Dec 7, 2008 at 10:03 PM, Mark Engelberg [EMAIL PROTECTED]wrote:


 Thanks for all the info.  I've searched my whole hard drive for a
 .emacs file, and can't find one.  Can someone tell me where Clojure
 Box stores this file, or whether it's called something entirely
 different?


Clojure Box's startup is controlled by default.el in the emacs\site-start
directory under the installation. You can put your own initialization in
.emacs, but you have to create it. Type C-x C-f and enter ~/.emacs. Edit the
file and save it with C-x C-s. The ~ in the file name will most likely
expand to the application data directory under your user profile.

Shawn

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: agents and hanging clojure.lang.Script

2008-11-26 Thread Shawn Hoover
On Wed, Nov 26, 2008 at 1:41 PM, Vincent Foley [EMAIL PROTECTED] wrote:


 I was toying around with agents today, and I got a weird behavior:
 agents hang clojure.lang.Script.  Here's a simple demo script; if you
 run this script, it'll print the vector and the program will be
 hung.


The agent threadpools hang around and keep the process alive. Try calling
shutdown-agents at the end of your script.

Shawn

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure Box, alpha

2008-11-24 Thread Shawn Hoover
On Mon, Nov 24, 2008 at 9:50 AM, mosi [EMAIL PROTECTED] wrote:


 Hi,
 thank you in the name of all noobz who, like me, just want to have a
 quick ride with closure.
 The installation worked almost perfectly.
 The dialog window: outside Emacs, waiting for connection to server ...
 (swank) didn`t finish.
 The result: no response from server. What is the purpose of the
 dialog?

 Your clojurebox Emacs runs great with swank, slime and closure.

 Thanx a lot!
 Best regards,
 mosi


Mosi, I'm not sure exactly what dialog you're seeing, but perhaps there is a
problem launching Clojure Box at the end of the installer. I'll try a tweak
in the next version. Either way, I'm glad to hear it works for you.

Shawn

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Clojure Box, alpha

2008-11-23 Thread Shawn Hoover
Here's a first pass at a Windows installer for a Clojure environment in
Emacs: http://clojure.bighugh.com/clojure-box-r1109-setup.exe.

The general idea is that of the Lispbox: you simply install and run this one
thing, and you get a REPL and all the syntax and editing goodies from
clojure-mode and Slime.

Specifically this version of the installer packages the following
components:
- Clojure source and jar from svn r1110
- Clojure Contrib source and jar from svn r253
- Compatible clojure-mode and swank-clojure from github.com/jochu
- Latest patched EmacsW32 from ourcomments.org
- A tiny bit of Emacs startup to set up clojure-mode and start a Slime REPL

It associates .clj files with Emacs. There are options for adding shortcuts
in the standard locations.

The best I could do for now was 29MB in size.

I still would like to add icons, the javadoc elisp functions that have been
floating around on the group lately, and other handy tools like a shortcut
to launch a REPL or script in a shell. When Clojure is released, I will make
a version based on that release.

Give it a whirl!

Shawn

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure Box (was Working combination of .emacs, Aquamacs, swank-clojure, clojure-mode?)

2008-11-21 Thread Shawn Hoover
On Fri, Nov 21, 2008 at 7:57 AM, Chouser [EMAIL PROTECTED] wrote:


 On Fri, Nov 21, 2008 at 7:39 AM, Rich Hickey [EMAIL PROTECTED] wrote:
 
  I'm sure a lot of people will appreciate this, thanks, although I have
  to admit to a pang of sadness that tiny Clojure comes in a box 100x
  its size :(

 I would hate to discourage this in any way (or let my vim roots show
 too much) but jEdit is a 2 or 3MB download.  I bet it wouldn't be very
 hard to get a Clojure REPL in there.

 --Chouser


Thanks for the feedback, folks. The size does bother me a little (adding
Emacs is like adding another Java runtime or JDK, in terms of size and
learning), but given the interest shown so far and the usefulness of the
Lispbox, I think this will serve some subset of users. I'll see what I can
do. If someone publishes a tidy jEdit package that's easier to get started
with, I'm all for that too.

Shawn

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Clojure Box (was Working combination of .emacs, Aquamacs, swank-clojure, clojure-mode?)

2008-11-20 Thread Shawn Hoover
On Thu, Nov 20, 2008 at 8:27 AM, Daniel Renfer [EMAIL PROTECTED] wrote:

 perhaps what we need is a clojure-in-a-box solution. We could create a
 package containing a version of clojure, emacs, slime, swank-clojure,
 clojure-mode, and clojure-contrib. This could be as simple as a zip
 file, but even better would be to have a simple installer exe.

 All a new user would have to would be to download the exe, run it, and
 choose emacs from their start menu. Everything would already be
 configured to work with whatever version these tools were built
 against. You could even install links to clojure
 documentation/resource sites. (clojure.org, the wiki, the irc logs,
 projecture, etc.)

 I, of course, focus on Windows users because they are the people that
 would most appreciate an all-in-one installer package. You could
 easily create packages for OSX and distros of Linux.

 This wouldn't help those that already have a running version emacs
 that they're trying to set up, but that's what the other documentation
 sites are for.

 Does anyone have experience in creating windows installers like this?
 I could look into it if people think it's a good idea, but I'm
 inexperienced in these matters.


I made a first pass at a Windows installer today. It's similar to the
Lispbox from gigamonkeys.com, targeting Windows users who want to try
Clojure and are willing to learn Emacs at the same time (I wouldn't think
this would include many users, but then again it worked out for me with the
Lispbox). Components include a recent Emacs 23 from the EmacsW32 project and
the latest CVS/Subversion/Git versions of Clojure, Clojure Contrib,
clojure-mode, swank-clojure, and Slime. Once Clojure has a release I would
want to use that and all the compatible tools.

There is a single MSI that installs the programs and code, creates a
shortcut, associates clj files, launches with minimal emacs configuration
(hides the GNU splash screen!), and automatically starts a REPL. I couldn't
get inferior-lisp to launch today (Java just wasn't liking my
inferior-lisp-program). I think slime is fine for new users as long as they
don't have to configure it. The benefit of tab-completion at the REPL makes
it worth it. And what better welcome to Clojure than Connected. Hack and be
merry!

The result so far packs all of the above features in a 46MB installer. I'm
willing to pursue finishing it (and possibly making it smaller) if it would
be useful to others and if I can find a place to put it up.

Shawn

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Can functions be decompiled?

2008-11-18 Thread Shawn Hoover
On Tue, Nov 18, 2008 at 12:37 PM, Konrad Hinsen
[EMAIL PROTECTED]wrote:


 Is there a way to recover readable source code from a compiled
 function in Clojure? Debugging things like [EMAIL PROTECTED] is
 not much fun. It would already be a great help to be able to find out
 from where in the source code the function was compiled.

 Konrad.


For functions defined in libs that you load into Clojure, you can find out
the file and line from the metadata. For functions you define in the REPL,
this trick won't help. Say you have (defn myfn [] :test) in the user
namespace. ^#'user/myfn gets the metadata from the var that holds the
function. To get the file try (:file ^#'user/myfn). And for the line number,
(:line ^#'user/myfn).

Shawn

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: ikvm and .NET

2008-10-22 Thread Shawn Hoover
On Wed, Oct 22, 2008 at 8:30 AM, Mark J P [EMAIL PROTECTED] wrote:


 Steps for running clojure as a .NET app and instantiating .NET types.

 - I converted the clojure.jar to clojure.dll: ikvmc -target:library c:
 \path\to\clojure.jar  (this creates clojure.dll)
 - Convert mscorlib.dll to mscorlib.jar: ikvmstub mscorlib.dll
 - Create a .net c# console app, and add reference to clojure.dll


By the way, this is great for embedding Clojure in your .NET app. If all you
want is a REPL, you can skip the C# app step and use the -target:exe switch
to get a clojure.exe.

The topic has also been explored in a past thread:
http://groups.google.com/group/clojure/browse_thread/thread/e48b64f3dc1f09fb/09919e06ebe95d85?lnk=gst
.

Shawn

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Clojure's first year

2008-10-16 Thread Shawn Hoover
On Thu, Oct 16, 2008 at 9:36 AM, Rich Hickey [EMAIL PROTECTED] wrote:


 A year ago today I 'released' Clojure, by sending a message to my jFli
 and Foil mailing lists. It got blogged, picked up by Planet Lisp and
 redditted in the course of a day or so, and has been a wild ride ever
 since. I couldn't have possibly imagined the year Clojure (and I) have
 had.


Released in the same month of the year as Lisp 50 years ago. Nice work.

Shawn

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Problem with Slime on Windows

2008-10-02 Thread Shawn Hoover
On Thu, Oct 2, 2008 at 4:16 AM, Hans Hübner [EMAIL PROTECTED] wrote:


 Hi,

 I am using Clojure from SVN with Slime from CVS.  Things work in
 general, but Slime repeatably crashes when I try to display some data
 that I have read using the XML parser:

 user= (clojure.contrib.zip-filter.xml/xml- (clojure.zip/xml-zip
 (clojure.xml/parse http://planet.lisp.org/rss20.xml;)))

 sends me to the Emacs debugger (see below).

 Am I alone with this problem?  Does this work for other people who run
 Slime+Clojure on Windows?


Hi Hans,

I'm having trouble getting clojure.contrib.zip-filter loaded into my REPL,
but I can get the inner part to work with no error: (clojure.zip/xml-zip
(clojure.xml/parse http://planet.lisp.org/rss20.xml;))

Are you able to get that far? If not, please paste the error somewhere that
preserves the spacing and line breaks (like http://paste.lisp.org).

--Shawn

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



  1   2   >