Re: compojure stop server?

2010-02-20 Thread Jeff Schwab

Brian Wolf wrote:


Is there something like a (stop-server) I don't see anything here


Are you just looking for compojure/stop?

$ cat hello.clj
(ns hello)

(use 'compojure)

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

(defserver srv {:port 8080} (servlet rts))

$ repl
Clojure 1.2.0-master-SNAPSHOT
user= (use 'compojure)
nil
user= (use 'hello)
2010-02-20 14:10:24.291::INFO:  Logging to STDERR via 
org.mortbay.log.StdErrLog

nil
user= (start srv)
2010-02-20 14:10:32.269::INFO:  jetty-6.1.15
2010-02-20 14:10:32.294::INFO:  Started socketconnec...@0.0.0.0:8080
nil
user= (stop srv)
nil

--
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: Question about how I got run?

2010-02-16 Thread Jeff Schwab

Mike Meyer wrote:


Is there any way to tell if inside a .clj file if it was invoked as a
script by clojure.main, vs. being loaded for use elsewhere?


Use a shebang line that calls a wrapper script, e.g. clj-script, that 
passes a command-line arg to tell the code it's being run as a script.


$ ls
clj-script  example.clj

$ cat clj-script
#!/bin/bash
clj $@ --script

$ cat example.clj
#!/usr/bin/env clj-script
(ns example)
(println
  (if *command-line-args*
I am a script.
I am not a script.))

$ PATH=$PWD:$PATH ./example.clj
I am a script.

$ repl
Clojure 1.2.0-master-SNAPSHOT
user= (use 'example)
I am not a script.
nil

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

2010-02-11 Thread Jeff Schwab

Joel Westerberg wrote:
You can work with java objects. But clojure itself is not object 
oriented, because it's functional, and object orientation requires state 
manipulation.


By whose definition?  Are you saying there is no such thing as an 
immutable object?


Other lisps support object orientation, common-lisp for 
example.


Clojure is not purely functional.  In fact, it has special support for 
managing mutable state in coherent ways.


--
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 for system administration

2010-02-06 Thread Jeff Schwab

Phil Hagelberg wrote:

On Thu, Feb 4, 2010 at 8:33 AM, Stuart Sierra
the.stuart.sie...@gmail.com wrote:

Clojure can certainly do these things; clojure-contrib contains many
file and io-related utilities.  But remember that Clojure, like any
Java program, takes more time to start up than scripting languages
like Perl/Bash/Ruby/Python, so it may be less suitable for programs
that you intend to run at the command-line.


Also relevant is the fact that launching Clojure from the command-line
is very inconvenient compared to scripting languages. If you want
something simple you can just put on your path, you'll need to wrap it
in a bash (or other language) script anyway to handle the classpath,
etc. The combination of startup time and the need to roll your own
bash script even for simple things has kept me from wanting to use
Clojure as a perlish-replacement.


http://martiansoftware.com/nailgun/

--
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.contrib compile fail

2010-02-01 Thread Jeff Schwab

Stuart Sierra wrote:

On Jan 30, 9:07 am, Jeff Schwab j...@schwabcenter.com wrote:



The clojure-contrib I just pulled from github fails to compile, with an
error that the ColumnWriter class extended by PrintWriter is not found.



This has been fixed now.


Thanks.  I see that you made an end-run around Maven.  I didn't know you 
could use gen-class that way.


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


clojure.contrib compile fail

2010-01-30 Thread Jeff Schwab

Hi:

What is the right place to report a clojure-contrib compile failure, or 
to look for information?


The clojure-contrib I just pulled from github fails to compile, with an 
error that the ColumnWriter class extended by PrintWriter is not found. 
 The relevant source directory does define ColumnWriter.  I tried 
twiddling my CLASSPATH, but it made no difference.  Googling the error 
turns up the following page, which shows exactly the same problem I'm 
seeing, but with no links, bug reports, or further information:


http://paste.lisp.org/display/94135

My best SWAG is that ColumnWriter needs to be compiled before 
PrintWriter, and that the dependence on ordering creates a race 
condition, such that the error appears on some platforms but not others. 
 I tried passing file and namespace names to maven, trying to adjust 
the build order, but maven just sneered at me.  Any ideas?


Thanks,
Jeff

--
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: Request for Feedback: Improve VimClojure's documentation

2010-01-30 Thread Jeff Schwab

Meikel Brandmeyer wrote:


Please send me your suggestions for FAQ and other tips via private email or add a ticket 
in the bb tracker for the documentation component.


Hope you don't mind if I add to this thread instead.  By the way, can 
you suggest a forum for reporting VimClojure bugs and contributing patches?


Suggestion 1:  The default filetype detection that comes with VimClojure 
uses setfiletype clojure, which is fine most of the time, but fails 
when Vim has already identified the file type as something else; for 
example, if your first line is #!/usr/bin/env clj, Vim will already 
have set ft=conf.  To make VimClojure override those settings, change 
~/.vim/ftdetect/clojure.vim:


1c1
 au BufNewFile,BufRead *.clj setfiletype clojure
---
 au BufNewFile,BufRead *.clj set filetype=clojure


Suggestion 2:  The default indentation from VimClojure tries to line up 
the beginning of new lines with unrecognized words on previous lines. 
If you prefer consistent indentation to this kind of heuristic, make the 
following change to ~/.vim/indent/clojure.vim:


162,172c162
   if lispwords =~ '\' . w . '\'
   return paren[1] + shiftwidth - 1
   endif

   normal! w
   if paren[0]  line(.)
   return paren[1] + shiftwidth - 1
   endif

   normal! ge
   return col(.) + 1
---
   return paren[1] + shiftwidth - 1

--
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.contrib compile fail

2010-01-30 Thread Jeff Schwab

Mike Mazur wrote:


   http://paste.lisp.org/display/94135


The automated build is also broken:

http://build.clojure.org/job/clojure-contrib/lastFailedBuild/console


Thanks, I didn't know about that.  Looks like I guessed right about the 
ordering issue, though:


http://groups.google.com/group/clojure-maven-plugin/browse_thread/thread/40150bb45270b322

--
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: Style for mutable data

2010-01-30 Thread Jeff Schwab

Johann Hibschman wrote:

Does anyone have style suggestions for distinguishing the states from
the refs to mutable data?

Let's say I'm manipulating a cell in a lattice, or doing dynamic
programming, or something. In any case, I have a cell.

;; Current convention: use cell- as the type of the state of a
cell.
(defstruct cell- :location :data)

(defn make-cell [location data]
  (ref (struct-map cell- :location location :data data))

(defn print-cell- [cell-state]
  (prn cell-state))

(defn print-cell [cell]
  (print-cell- @cell))

The details don't matter that much, but what would people name these
arguments? Is the cell- convention good? I'd use something like cell
% if I were in scheme, but that's not legal in Clojure. What should I
name function arguments to distinguish the ones that take the refs
from the ones that take the states?

Clearly, I can come up with something that keeps me happy, but I was
wondering if the community's evolved a standard or has an opinion.


I'm a stranger here myself, but from what I've seen, the trailing hyphen 
convention is already commonly used to mean something is private to a 
namespace, or is a function that defines such private somethings.


This may be a dumb question, but why bother defining separate functions 
to define the refs?  It seems like print-cell should actually accept a 
cell.  It's straightforward to deref in the client code:


  (print-cell @cell)

If it gives you frissons, you can spell it like this:

  (print-cell@ cell)

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

2010-01-27 Thread Jeff Schwab

Joseph Smith wrote:

+1 Lincoln/Omaha Nebraska.   :)


Mr. Buffet?  Is that you?  Have you, too, decided to invest in Clojure?

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


Re: Clojure Conference Poll

2010-01-24 Thread Jeff Schwab

+1 Boston.

Brent Millare wrote:

Weekend, and East coast, either near the DC area or New York Area,
maybe Boston area is OK too.

On Jan 22, 12:36 pm, dysinger t...@dysinger.net wrote:

We will be organizing a conference in the next month for 2010
(probably in the fall).  One question I would like to ask is, given
the conference is probably going to be a 2-day conference, would you
rather have it during the week or weekend ?

I would think a weekend (meet  greet friday night, saturday  sunday)
would work good.

-Tim




--
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: compojure/defservlet

2010-01-20 Thread Jeff Schwab

James Reeves wrote:

Compojure's
documentation is generally not in the best of states; however, I'm
holding off fixing it until I finish work on the next version in a
couple of months.


Fair enough, thanks.

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

compojure/defservlet

2010-01-19 Thread Jeff Schwab

Hi:

The compojure wikibook claims that compojure provides a defservlet 
function, along with other syntactic conveniences that I seem to be 
missing.  Grepping the git log didn't turn up anything relevant, so I'm 
wondering:  Is compojure supposed to provide defservlet, or should I fix 
the wikibook?


http://en.wikibooks.org/wiki/Compojure/Core_Libraries

-- 
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: Recommendation for Clojure Indentation tool

2010-01-09 Thread Jeff Schwab

Gabi wrote:

I really hate emacs.

...

Any other way to format lisp/clojure ?


http://www.vim.org/scripts/script.php?script_id=2501

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