Re: pretty-print by default?

2011-07-01 Thread Tom Faulhaber
To do this from a simple command line, just do: java -cp clojure.main -e "(require 'clojure.pprint) (clojure.main/repl :print clojure.pprint/pprint)" modify to taste. I once figured how to do this in Slime, too, but when I look at my (quite dated) copy, it looks like pr-str is hard-coded. Tom

Re: about lazy-seq

2011-07-01 Thread Alan Malloy
(count coll) needs to realize the whole sequence all at once in order to see how big it is. Depending on how much of this you want to do "by hand", something like the following is how I would write it: (defn slice [low high coll] (lazy-seq (cond (pos? low) (slice (dec low) (dec high)

Re: Please stand firm against Steve Yegge's "yes language" push

2011-07-01 Thread .Bill Smith
Whereas when Steve Yegge writes: "which means that everyone (including > me!) who is porting Java code to Clojure (which, by golly, is a good > way to get a lot of people using Clojure) is stuck having to rework > the code semantically rather than just doing the simplest possible > straight p

about lazy-seq

2011-07-01 Thread kawas
Hi, As a clojure beginner I'm practicing my understanding of the language but at some point the use of lazy-seq get blurry. Imagine that I want to write a lazy function to extract a slice of a collection something like this : (defn slice [coll low high] (drop (dec low) (take high coll))) .

Re: Most concise way to determine that a sequence is consecutive integers starting with one?

2011-07-01 Thread Rob Lachlan
Using map-indexed: (defn f [xs] (every? true? (map-indexed #(= (inc %1) %2) xs))) On Jul 1, 12:28 pm, ".Bill Smith" wrote: > I want a concise function that, given an arbitrary length sequence, > determines whether the sequence is of consecutive integers starting with > one.  So: > >  (f [1 2 3]

Re: swank-clojure/lein/emacs

2011-07-01 Thread Adam
I have the identical problem to Shoeb. Toohey's suggestion did not work for me. But I got it to work. What I found is that "lein deps" downloaded the wrong version of swank-clojure. Note that previous to this I had done "lein plugin install swank-clojure 1.3.1" That installed "swank-clojure-1.3.1.

Re: Please stand firm against Steve Yegge's "yes language" push

2011-07-01 Thread Gregg Reynolds
On Fri, Jul 1, 2011 at 2:59 PM, James Keats wrote: > > ... > > Whereas when Steve Yegge writes: Who? -- 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 a

Re: pretty-print by default?

2011-07-01 Thread Sean Corfield
In IRC I asked Phil about this and he suggested putting (require 'clojure.pprint) in ~/.lein/user.clj with :repl-options [:print clojure.pprint/pprint] and that does indeed work for now. Sean On Fri, Jul 1, 2011 at 1:10 PM, Shantanu Kumar wrote: >> You can set :repl-options [:print clojure.contr

Re: Most concise way to determine that a sequence is consecutive integers starting with one?

2011-07-01 Thread Alan Malloy
On Jul 1, 1:41 pm, David Nolen wrote: > On Fri, Jul 1, 2011 at 4:04 PM, Chouser wrote: > > (defn f [xs] (every? true? (map = xs (iterate inc 1 > > > --Chouser > > Also, > > (defn f [xs] (every? #{1} (map - xs (iterate inc 0 This has problems before 1.3 if you go beyond Integer/MAX_VALUE:

Re: Most concise way to determine that a sequence is consecutive integers starting with one?

2011-07-01 Thread .Bill Smith
Thanks everyone. -- 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, se

Re: Most concise way to determine that a sequence is consecutive integers starting with one?

2011-07-01 Thread David Nolen
On Fri, Jul 1, 2011 at 4:04 PM, Chouser wrote: > (defn f [xs] (every? true? (map = xs (iterate inc 1 > > --Chouser > Also, (defn f [xs] (every? #{1} (map - xs (iterate inc 0 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this g

Re: Most concise way to determine that a sequence is consecutive integers starting with one?

2011-07-01 Thread Ken Wesson
I see some more clever ways have been posted. Perhaps a more interesting, general problem: detect if the input is an arithmetic sequence at all. Here's a few implementations to get you started. Straightforward: (let [diffs (map - xs (rest xs))] (every? identity (map = diffs (rest diffs U

Re: pretty-print by default?

2011-07-01 Thread Shantanu Kumar
> You can set :repl-options [:print clojure.contrib/pprint], but that > depends on pprint being required before the repl launches, and I can't > think of a straightforward way to do that. Perhaps adding an :eval-init > entry in project.clj which can contain needed requires like this? +1 -- You r

Re: Most concise way to determine that a sequence is consecutive integers starting with one?

2011-07-01 Thread David Nolen
On Fri, Jul 1, 2011 at 4:04 PM, Chouser wrote: > (defn f [xs] (every? true? (map = xs (iterate inc 1 > > --Chouser Hrm, shoulda thought 'o that :) David -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cloj

Re: Most concise way to determine that a sequence is consecutive integers starting with one?

2011-07-01 Thread Chouser
On Fri, Jul 1, 2011 at 3:51 PM, David Nolen wrote: > On Fri, Jul 1, 2011 at 3:28 PM, .Bill Smith > wrote: >> >> I want a concise function that, given an arbitrary length sequence, >> determines whether the sequence is of consecutive integers starting with >> one.  So: >>  (f [1 2 3]) returns true

RE: Most concise way to determine that a sequence is consecutive integers starting with one?

2011-07-01 Thread Bhinderwala, Shoeb
Here is another way: (defn f [xs] (and (= 1 (first xs)) (apply = (map - (rest xs) xs From: clojure@googlegroups.com [mailto:clojure@googlegroups.com] On Behalf Of David Nolen Sent: Friday, July 01, 2011 3:51 PM To: clojure@googlegroups.

Please stand firm against Steve Yegge's "yes language" push

2011-07-01 Thread James Keats
Hi all. I've been looking at Clojure for the past month, having had a previous look at it a couple of years ago and then moved on to other things only to return to it now. Over the past decade I have looked at many languages and many ways of doing things. People may say this language or that lang

Re: Most concise way to determine that a sequence is consecutive integers starting with one?

2011-07-01 Thread David Nolen
On Fri, Jul 1, 2011 at 3:28 PM, .Bill Smith wrote: > I want a concise function that, given an arbitrary length sequence, > determines whether the sequence is of consecutive integers starting with > one. So: > > (f [1 2 3]) returns true > > (f [1 2 4]) returns false > > (f [0 1 2]) returns fals

Re: Most concise way to determine that a sequence is consecutive integers starting with one?

2011-07-01 Thread Ken Wesson
The other way around, actually -- the second and third will hang (in "count") on infinite seqs, the first stopping on any non-matching item. Sorry, in a hurry here. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to c

Re: Most concise way to determine that a sequence is consecutive integers starting with one?

2011-07-01 Thread Ken Wesson
On Fri, Jul 1, 2011 at 3:28 PM, .Bill Smith wrote: > I want a concise function that, given an arbitrary length sequence, > determines whether the sequence is of consecutive integers starting with > one.  So: >  (f [1 2 3]) returns true >  (f [1 2 4]) returns false >  (f [0 1 2]) returns false > My

Most concise way to determine that a sequence is consecutive integers starting with one?

2011-07-01 Thread .Bill Smith
I want a concise function that, given an arbitrary length sequence, determines whether the sequence is of consecutive integers starting with one. So: (f [1 2 3]) returns true (f [1 2 4]) returns false (f [0 1 2]) returns false My first try, which I am not proud of, follows: (defn f [numb

Re: More sane emacs for clojure

2011-07-01 Thread logan
I don't know if "ergo" is the right name to describe this project. Most of the default emacs key-bindings are very ergonomic, assuming you remap your ctrl to your caps lock. Most of the commands that you use most frequently can be entered in with just your left hand, with your little finger on the

Re: pretty-print by default?

2011-07-01 Thread Jeffrey Schwab
Thank! Why -r? The (clojure.main/repl) call seems to start a new repl. (In fact, it took me a minute to figure out that this really needs to be the last thing in repl-init.clj.) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group

Re: pretty-print by default?

2011-07-01 Thread Phil Hagelberg
Sean Corfield writes: > If you use lein repl, is there an easy equivalent? You can set :repl-options [:print clojure.contrib/pprint], but that depends on pprint being required before the repl launches, and I can't think of a straightforward way to do that. Perhaps adding an :eval-init entry in p

Re: Russ olsen's Clojure Book

2011-07-01 Thread Russ Olsen
Sayth, First, imagine my surprise when I saw just the title of your post show up in a search... Second, thanks for the kind words about the books that I actually have written (so far). For what it's worth, I have thought about doing a clojure book, but so far it is only in the back of the napkin

Re: pretty-print by default?

2011-07-01 Thread Sean Corfield
If you use lein repl, is there an easy equivalent? On Fri, Jul 1, 2011 at 9:53 AM, David Powell wrote: > > user.clj is old, and isn't ideally suited for pre-loading handy things into > a repl. > An alternative might be to put your repl init stuff in a file, such as: > /home/repl-init.clj: > (requ

Re: How To Supply Multiple Values To Function In Map

2011-07-01 Thread John Palgut
map actually accepts any number of collections, as show in the official documentation. Your function passed to map just needs to accept parameters equal to the number of collections passed. So you could write something li

org.clojure/java.jdbc 0.0.3 available on Maven Central

2011-07-01 Thread Sean Corfield
Includes a fix for generated keys on PostgreSQL / MS SQL Server: http://dev.clojure.org/jira/browse/JDBC-10 -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ "Perfe

Re: pretty-print by default?

2011-07-01 Thread David Powell
user.clj is old, and isn't ideally suited for pre-loading handy things into a repl. An alternative might be to put your repl init stuff in a file, such as: /home/repl-init.clj: (require 'clojure.pprint) (clojure.main/repl :print clojure.pprint/pprint) And then change your repl startup script to

Re: Any ways to prevent protocol functions from being hardcoded in?

2011-07-01 Thread Aaron Cohen
On Fri, Jul 1, 2011 at 9:20 AM, David McNeil wrote: > On Jun 30, 7:54 am, Stuart Sierra wrote: >> Recently the received wisdom has been: protocols are a low-level >> implementation detail. Actual APIs should be built with normal functions >> that call the protocol methods. > > Stuart- I am a bit

Re: pretty-print by default?

2011-07-01 Thread Jeffrey Schwab
I tried adding (clojure.main/repl :print pprint) to my user.clj, but clojure then reports an error, because clojure.main/repl does not (yet) exist. Is there any work-around for this? Maybe a way to register onLoad style hooks that will be executed once the repl is running? Here's my current

Re: pretty-print by default?

2011-07-01 Thread Kevin Downey
pprint by default would be excellent, except it deref's vars On Fri, Jul 1, 2011 at 8:59 AM, Jeffrey Schwab wrote: > Thank you!  That is exactly what I needed. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email

Re: pretty-print by default?

2011-07-01 Thread Jeffrey Schwab
Thank you! That is exactly what I needed. -- 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 unsub

Re: pretty-print by default?

2011-07-01 Thread David Powell
On Fri, Jul 1, 2011 at 2:32 PM, Jeffrey Schwab wrote: > Is there any way to make the Clojure repl pretty-print by default? > > I have a bunch of little functions that return things like directory > listings and git output, mostly as seqs of lines or Files. I could > change the functions to pretty

Re: pretty-print by default?

2011-07-01 Thread Sean Devlin
Or maybe the repl could have a *printer* variable On Jul 1, 9:32 am, Jeffrey Schwab wrote: > Is there any way to make the Clojure repl pretty-print by default? > > I have a bunch of little functions that return things like directory > listings and git output, mostly as seqs of lines or Files.  I

Integrating Clojure-CLR w/ VS

2011-07-01 Thread Sean Devlin
I'm trying to use Clojure in the .NET world. I've got the binary distribution downloaded, and this VS plugin http://visualstudiogallery.msdn.microsoft.com/fb895809-2ae0-48aa-8a96-3c0d5b8e1fdc/ installed. I'm trying to build my first "Hello World" executable. However, when I try to run I get he

pretty-print by default?

2011-07-01 Thread Jeffrey Schwab
Is there any way to make the Clojure repl pretty-print by default? I have a bunch of little functions that return things like directory listings and git output, mostly as seqs of lines or Files. I could change the functions to pretty-print (rather than return) their results, but I often want to p

Re: Any ways to prevent protocol functions from being hardcoded in?

2011-07-01 Thread David McNeil
On Jun 30, 7:54 am, Stuart Sierra wrote: > Recently the received wisdom has been: protocols are a low-level > implementation detail. Actual APIs should be built with normal functions > that call the protocol methods. Stuart- I am a bit confused by this statement, and judging by this thread others

Re: Current state of clojure-contrib?

2011-07-01 Thread Aaron Bedra
You can find your answers at http://dev.clojure.org/display/design/Contrib+Library+Names As to where things are going or have ended up. The most used libs are logging and jdbc, so an project.clj file that used these would look like [org.clojure/java.jdbc "0.0.2"] [org.clojure/tools.logging "

Re: Continuations or monads or something

2011-07-01 Thread Dave Ray
I read about it and didn't see how to map my idea onto it so I stormed ahead. I'll take another look thought. This is probably one of those cases where you don't see the perfectly good wheel right in front of you until you invent one of your own. :) Dave On Fri, Jul 1, 2011 at 2:16 AM, Meikel Br

Intresting project....Ozma: extending Scala with Oz concurrency

2011-07-01 Thread Base
Found at: http://lambda-the-ultimate.org/node/4300 Scala ported to run on the Mozart VM. -- 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 - pl

Current state of clojure-contrib?

2011-07-01 Thread Mark Derricutt
Hey all, Whats the current state of clojure-contrib for 1.3? I remember seeing a wiki post or something awhile ago with new package layouts/maven settings etc but can't seem to find it now ;( Mark -- "Great artists are extremely selfish and arrogant things" — Steven Wilson, Porcupine Tree --