Re: leiningen - a Clojure build tool

2009-11-18 Thread ngocdaothanh
Lein is super easy to install and use!

To demonstrate the ease of installation, the Installation part in
README should say:
1. Download only one file: wget 
http://github.com/technomancy/leiningen/raw/master/bin/lein
2. chmod +x lein
3. ./lein self-install

Thanks for the work.


On Nov 18, 4:41 pm, David Nolen dnolen.li...@gmail.com wrote:
 Awesomeness.

 On Wed, Nov 18, 2009 at 2:29 AM, Phil Hagelberg p...@hagelb.org wrote:

  I'm pleased to announce the initial release of Leiningen.

  Leiningen is a build tool for Clojure designed to not set your hair on
  fire.

  Building Clojure projects with tools designed for Java can be an
  exercise in frustration. If you use Ant, you end up copying around a
  lot of the same tasks around between XML files on all your projects;
  there's a lot of repetition. Maven avoids repetition, but provides
  very little transparency into what's really going on behind the scenes
  and forces you to become a Maven expert to script a nontrivial
  build. Either way you end up writing far more XML than is necessary.

  With Leiningen, your build is described using Clojure. You can put any
  code you like in your project.clj file; the only requirement is that
  it includes a call to defproject. You can define your own tasks in
  there if you need to, but the majority of projects should be able to
  get by on the tasks that are provided with Leiningen. If you do find a
  common task that you need to add, you can implement it as a plugin
  rather than copying and pasting among each of your projects.

  Projects are defined with Clojure syntax, (not XML!) in project.clj:

     (defproject leiningen 0.5.0
       :description A build tool designed not to set your hair on fire.
       :main leiningen.core
       :dependencies [[org.clojure/clojure 1.1.0-alpha-SNAPSHOT]
                      [org.clojure/clojure-contrib 1.0-SNAPSHOT]
                      [ant/ant-launcher 1.6.2]
                      [org.apache.maven/maven-ant-tasks 2.0.10]]
       :dev-dependencies [[org.clojure/swank-clojure 1.0]])

  A number of tasks are provided:

     $ lein deps # install dependencies in lib/

     $ lein test [PRED] # run the project's tests, optionally filtered on
  PRED

     $ lein compile # ahead-of-time compile into classes/

     $ lein repl # launch a REPL with the project classpath configured

     $ lein clean # remove all build artifacts

     $ lein jar # create a jar of the project

     $ lein uberjar # create a standalone jar that contains all dependencies

     $ lein pom # output a pom.xml file for interop with Maven

     $ lein install # install in local repo (currently requires mvn)

     $ lein help [TASK] # show a list of tasks or help for a given TASK

  Leiningen is extensible, you can define new tasks in project.clj or in
  plugins. Add your plugin as a dev-dependency of your project, and you'll
  be able to call lein $YOUR_COMMAND. See the lein-swank directory for
  an example of a plugin.

  To install simply download the shell script, place it somewhere on your
  $PATH, and run lein self-install:

   http://github.com/technomancy/leiningen/raw/master/bin/lein

  Many people have expressed frustration at trying to use a tool designed
  for Java with their Clojure projects, especially when dealing with
  dependencies. I hope this can move things forward and ease the
  pain. Note that it's still a very young project, (started about two
  weeks ago), but in classic Clojure fashion it is able to leverage a lot
  of functionality from other JVM tools.

  Please try it out and let me know how it works for your project!

  thanks,
  Phil

  Bonus: Leiningen also integrates with the Clojars open-source
  clojure-specific repository coming soon athttp://clojars.org.

  --
  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: leiningen - a Clojure build tool

2009-11-18 Thread Shantanu Kumar
Is any IDE support planned for this? As it turns out, many people
(including me) stick with Ant just because the IDE support is
fantastic.

Regards,
Shantanu

On Nov 18, 12:29 pm, Phil Hagelberg p...@hagelb.org wrote:
 I'm pleased to announce the initial release of Leiningen.

 Leiningen is a build tool for Clojure designed to not set your hair on fire.

 Building Clojure projects with tools designed for Java can be an
 exercise in frustration. If you use Ant, you end up copying around a
 lot of the same tasks around between XML files on all your projects;
 there's a lot of repetition. Maven avoids repetition, but provides
 very little transparency into what's really going on behind the scenes
 and forces you to become a Maven expert to script a nontrivial
 build. Either way you end up writing far more XML than is necessary.

 With Leiningen, your build is described using Clojure. You can put any
 code you like in your project.clj file; the only requirement is that
 it includes a call to defproject. You can define your own tasks in
 there if you need to, but the majority of projects should be able to
 get by on the tasks that are provided with Leiningen. If you do find a
 common task that you need to add, you can implement it as a plugin
 rather than copying and pasting among each of your projects.

 Projects are defined with Clojure syntax, (not XML!) in project.clj:

     (defproject leiningen 0.5.0
       :description A build tool designed not to set your hair on fire.
       :main leiningen.core
       :dependencies [[org.clojure/clojure 1.1.0-alpha-SNAPSHOT]
                      [org.clojure/clojure-contrib 1.0-SNAPSHOT]
                      [ant/ant-launcher 1.6.2]
                      [org.apache.maven/maven-ant-tasks 2.0.10]]
       :dev-dependencies [[org.clojure/swank-clojure 1.0]])

 A number of tasks are provided:

     $ lein deps # install dependencies in lib/

     $ lein test [PRED] # run the project's tests, optionally filtered on PRED

     $ lein compile # ahead-of-time compile into classes/

     $ lein repl # launch a REPL with the project classpath configured

     $ lein clean # remove all build artifacts

     $ lein jar # create a jar of the project

     $ lein uberjar # create a standalone jar that contains all dependencies

     $ lein pom # output a pom.xml file for interop with Maven

     $ lein install # install in local repo (currently requires mvn)

     $ lein help [TASK] # show a list of tasks or help for a given TASK

 Leiningen is extensible, you can define new tasks in project.clj or in
 plugins. Add your plugin as a dev-dependency of your project, and you'll
 be able to call lein $YOUR_COMMAND. See the lein-swank directory for
 an example of a plugin.

 To install simply download the shell script, place it somewhere on your
 $PATH, and run lein self-install:

  http://github.com/technomancy/leiningen/raw/master/bin/lein

 Many people have expressed frustration at trying to use a tool designed
 for Java with their Clojure projects, especially when dealing with
 dependencies. I hope this can move things forward and ease the
 pain. Note that it's still a very young project, (started about two
 weeks ago), but in classic Clojure fashion it is able to leverage a lot
 of functionality from other JVM tools.

 Please try it out and let me know how it works for your project!

 thanks,
 Phil

 Bonus: Leiningen also integrates with the Clojars open-source
 clojure-specific repository coming soon athttp://clojars.org.

-- 
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: leiningen - a Clojure build tool

2009-11-18 Thread ngocdaothanh
Which IDE and Ant plugin do you use?

I think you can use lein pom to have an pom.xml file for use with
Maven. Hope that your fantastic IDE supports Maven.


On Nov 18, 5:39 pm, Shantanu Kumar kumar.shant...@gmail.com wrote:
 Is any IDE support planned for this? As it turns out, many people
 (including me) stick with Ant just because the IDE support is
 fantastic.

 Regards,
 Shantanu

 On Nov 18, 12:29 pm, Phil Hagelberg p...@hagelb.org wrote:

  I'm pleased to announce the initial release of Leiningen.

  Leiningen is a build tool for Clojure designed to not set your hair on fire.

  Building Clojure projects with tools designed for Java can be an
  exercise in frustration. If you use Ant, you end up copying around a
  lot of the same tasks around between XML files on all your projects;
  there's a lot of repetition. Maven avoids repetition, but provides
  very little transparency into what's really going on behind the scenes
  and forces you to become a Maven expert to script a nontrivial
  build. Either way you end up writing far more XML than is necessary.

  With Leiningen, your build is described using Clojure. You can put any
  code you like in your project.clj file; the only requirement is that
  it includes a call to defproject. You can define your own tasks in
  there if you need to, but the majority of projects should be able to
  get by on the tasks that are provided with Leiningen. If you do find a
  common task that you need to add, you can implement it as a plugin
  rather than copying and pasting among each of your projects.

  Projects are defined with Clojure syntax, (not XML!) in project.clj:

      (defproject leiningen 0.5.0
        :description A build tool designed not to set your hair on fire.
        :main leiningen.core
        :dependencies [[org.clojure/clojure 1.1.0-alpha-SNAPSHOT]
                       [org.clojure/clojure-contrib 1.0-SNAPSHOT]
                       [ant/ant-launcher 1.6.2]
                       [org.apache.maven/maven-ant-tasks 2.0.10]]
        :dev-dependencies [[org.clojure/swank-clojure 1.0]])

  A number of tasks are provided:

      $ lein deps # install dependencies in lib/

      $ lein test [PRED] # run the project's tests, optionally filtered on 
  PRED

      $ lein compile # ahead-of-time compile into classes/

      $ lein repl # launch a REPL with the project classpath configured

      $ lein clean # remove all build artifacts

      $ lein jar # create a jar of the project

      $ lein uberjar # create a standalone jar that contains all dependencies

      $ lein pom # output a pom.xml file for interop with Maven

      $ lein install # install in local repo (currently requires mvn)

      $ lein help [TASK] # show a list of tasks or help for a given TASK

  Leiningen is extensible, you can define new tasks in project.clj or in
  plugins. Add your plugin as a dev-dependency of your project, and you'll
  be able to call lein $YOUR_COMMAND. See the lein-swank directory for
  an example of a plugin.

  To install simply download the shell script, place it somewhere on your
  $PATH, and run lein self-install:

   http://github.com/technomancy/leiningen/raw/master/bin/lein

  Many people have expressed frustration at trying to use a tool designed
  for Java with their Clojure projects, especially when dealing with
  dependencies. I hope this can move things forward and ease the
  pain. Note that it's still a very young project, (started about two
  weeks ago), but in classic Clojure fashion it is able to leverage a lot
  of functionality from other JVM tools.

  Please try it out and let me know how it works for your project!

  thanks,
  Phil

  Bonus: Leiningen also integrates with the Clojars open-source
  clojure-specific repository coming soon athttp://clojars.org.

-- 
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.xml/parse of XHTML yields a 503 on the DTD

2009-11-18 Thread David Brown
On Tue, Nov 17, 2009 at 10:12:19AM -0800, David Brown wrote:
On Tue, Nov 17, 2009 at 08:03:59AM -0800, pkw wrote:

I'm having this same problem.  Did you find a way around it?
I want to try changing the User-Agent, but I can't figure out
how to do that.

I suspect that the Sax parser by default is configured to not allow
fetching of the DTD over the net.

I worked around this by replacing the URL in the DOCTYPE declaration
with a file one and fetching the files myself.  But, admittedly
that's not a good solution.

BTW, the emitter in clojure.xml doesn't produce valid xml, either,
unless your xml is very simple.  It certainly doesn't work round-trip.

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: Proposal: Extend behavior of hash-map

2009-11-18 Thread David Brown
On Tue, Nov 17, 2009 at 03:24:46PM -0800, Richard Newman wrote:

Baby, bathwater. Making a persistent map out of a Java map is
expensive. Not everything that implements Map is concrete; e.g.,
spending several seconds making a local persistent Clojure map out of
a distributed hash table proxy, just to get a value, would cause
programmers to drop down to Java to avoid this pointless restriction.
Why bother?

I wonder if there's a use for a lazy 'bean' call, then.  Lots of
things use bean properties to do things that can be quite expensive.

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: leiningen - a Clojure build tool

2009-11-18 Thread Shantanu Kumar

On Nov 18, 1:45 pm, ngocdaothanh ngocdaoth...@gmail.com wrote:
 Which IDE and Ant plugin do you use?

 I think you can use lein pom to have an pom.xml file for use with
 Maven. Hope that your fantastic IDE supports Maven.

Earlier I used NetBeans but now I generally use Eclipse -- both of
them support Ant natively and Maven plugins are available.

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.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: A typo on the website about vars

2009-11-18 Thread Michael Wood
2009/11/17 Chouser chou...@gmail.com:
 On Tue, Nov 17, 2009 at 8:40 AM, Jacek Laskowski ja...@laskowski.net.pl 
 wrote:

 I'm wondering what part is missing in which provides a means for
 nested contexts to communicate with code before it the call stack. at
 http://clojure.org/vars? I think the wording is broken at the end.

 Fixed, thanks.

See also:

http://groups.google.com/group/clojure/browse_thread/thread/f90f2f68f078ec02/232b3f60e8caa2ad?q=#232b3f60e8caa2ad

It could be a little clearer as follows:

Bindings created with _the binding macro_ can be assigned to, which[...]

-- 
Michael Wood esiot...@gmail.com

-- 
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: A Clojure Highlife

2009-11-18 Thread Joseph Smith
The m-surrounding-neighbors-seq function only memoizes sequences  
containing Refs surrounding a particular ref at (x,y). I do this to  
avoid the recalculation of the coordinates of the cells surrounding  
each cell. As I understand it, memoization caches return values for  
input values.

For example, the the Ref for cell (3,4) has Refs at [(2,3) (3,3) (4,3)  
(2,4) (4,4) (2,5) (3,5) (4,5)] surrounding it. It is only memoizing a  
sequence of these Refs, once for each point in the grid, not for every  
grid. If it was indeed doing that it wouldn't take long before the JVM  
ran out of memory- the simulation is very unlikely to hit a cycle :)


Use the clojure libs I include in the bundle on my website: 
http://www.solussd.com/wp-content/uploads/2009/11/highlife.zip


---
Joseph Smith
j...@uwcreations.com
(402)601-5443





On Nov 16, 2009, at 8:24 PM, Jeff Heon wrote:

 Hi there,

 Unfortunately, I was unable to get it working.
 From what I gather, I'm using the wrong clojure.jar and or clojure-
 contrib.jar.

 Could you tell me which version of theses files you are using?

 Anyway, I was wondering about the memoizing of the function
 surrounding-neighbors-seq.

 It's memoizing for every grid, which I guess is good if the
 application hits a cycle, but if it doesn't, it will unnecessarily
 keep function results for passed grids.

 I'm not sure about the memoizing cache behavior, but if we bet for  
 non-
 repeating grids, I think it might be better to dynamically memoize for
 each grid only.
 This way, memoizing information for passed grids will be GCed.

 I'm thinking about something like this.
 Remove the global def:
 (def m-surrounding-neighbors-seq (memoize surrounding-neighbors-seq))

 Modify the two following count-living-neighbors and get-living-
 neighbors-seq functions to let a memoized version once for each grid:
 See http://paste.lisp.org/display/90541

 Using a let and passing the local memoized function to count-living-
 neighbors felt weird, but it felt better than doing a binding.

 I wonder which would be the idiomatic way to go.

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

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


Stack overflow while processing XML

2009-11-18 Thread mkrajnak
I am processing a very large xml file, 13MB, using clojure.xml.parse
and clojure.contrib.zip-filter.xml with clojure 1.0.0.

The xml file contains information on 13000 japanese characters and I'm
extracting about 200 or so.

At its core it extracts a very small subset of elements using:

(xml- kdic :character [:literal #(contains? kcset (text %))] node)

Where kcset is a set of desired characters.

My understanding of this is that it returns a lazy-seq which if I
count-ed the length of the sequence it would return 200 (not
13000).  But in practice it actually generates a stack overflow.

At the end of this post I have a relatively short version of the
program which throws the stack overflow.  In this case it has a
(count ...) call which causes the stack overflow.  In the full program
I tried a few variations like so:

(dorun (for [knode knodes] (print-kinfo knode

To try to get the information to print, but before it also reaches the
end of list it also throws a stack overflow.

I also have the stack trace at the end as well.

Thanks!


Here's the short version of the program:

(ns kanji.prkanji
(:use clojure.xml )
(:use [clojure.zip :only (xml-zip node)])
(:use clojure.contrib.zip-filter.xml)
(:import java.lang.Character$UnicodeBlock)
(:import java.io.File))

(def CJK Character$UnicodeBlock/CJK_UNIFIED_IDEOGRAPHS)

(defn filter-for-kanji
[chars]
(filter #(= CJK (Character$UnicodeBlock/of %)) chars))

(defn get-unique-kanji
[chars]
(let [kchars (filter-for-kanji chars)]
 (set kchars)))

(defn print-kinfos
[knodes]
(count knodes))
;; this is what I would normally do: (dorun (for [knode knodes] (print-
kinfo knode

(defn get-kdic-info
[kdic kchars]
(let [kcset (set (map str kchars))]
(xml- kdic :character [:literal #(contains? kcset (text %))]
node)))

(defn load-kdic
[fname]
(xml-zip (parse (File. fname

(defn process-file
[file]
(let [kchars (get-unique-kanji (slurp file))]
(print-kinfos
(get-kdic-info
(load-kdic kanji/kdic-data.xml) kchars

(process-file (second *command-line-args*))

And here's the top of the stack trace:

Exception in thread main java.lang.StackOverflowError (prkanji.clj:
0)
at clojure.lang.Compiler.eval(Compiler.java:4543)
at clojure.lang.Compiler.load(Compiler.java:4857)
at clojure.lang.Compiler.loadFile(Compiler.java:4824)
at clojure.main$load_script__5833.invoke(main.clj:206)
at clojure.main$init_opt__5836.invoke(main.clj:211)
at clojure.main$initialize__5846.invoke(main.clj:239)
at clojure.main$null_opt__5868.invoke(main.clj:264)
at clojure.main$legacy_script__5883.invoke(main.clj:295)
at clojure.lang.Var.invoke(Var.java:346)
at clojure.main.legacy_script(main.java:34)
at clojure.lang.Script.main(Script.java:20)
Caused by: java.lang.StackOverflowError
at clojure.lang.Cons.next(Cons.java:37)
at clojure.lang.RT.boundedLength(RT.java:1117)
at clojure.lang.AFn.applyToHelper(AFn.java:168)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply__3243.doInvoke(core.clj:390)
at clojure.lang.RestFn.invoke(RestFn.java:443)
at clojure.core$mapcat__3842.doInvoke(core.clj:1528)
at clojure.lang.RestFn.invoke(RestFn.java:428)
at clojure.contrib.zip_filter$descendants__48$fn__50.invoke
(zip_filter.clj:63)
at clojure.lang.LazySeq.seq(LazySeq.java:41)
at clojure.lang.RT.seq(RT.java:436)
at clojure.lang.LazySeq.seq(LazySeq.java:41)
at clojure.lang.RT.seq(RT.java:436)
at clojure.core$seq__3133.invoke(core.clj:103)
at clojure.core$map__3815$fn__3817.invoke(core.clj:1502)
at clojure.lang.LazySeq.seq(LazySeq.java:41)
at clojure.lang.Cons.next(Cons.java:37)
at clojure.lang.RT.boundedLength(RT.java:1117)
at clojure.lang.RestFn.applyTo(RestFn.java:135)
at clojure.core$apply__3243.doInvoke(core.clj:390)
at clojure.lang.RestFn.invoke(RestFn.java:428)
at clojure.core$mapcat__3842.doInvoke(core.clj:1528)
at clojure.lang.RestFn.invoke(RestFn.java:428)
at clojure.contrib.zip_filter$mapcat_chain__65$fn__67.invoke
(zip_filter.clj:88)
at clojure.lang.ArraySeq.reduce(ArraySeq.java:116)
at clojure.core$reduce__3319.invoke(core.clj:536)
at clojure.contrib.zip_filter$mapcat_chain__65.invoke(zip_filter.clj:
89)
at clojure.contrib.zip_filter.xml$xml__GT___119.doInvoke(xml.clj:75)
at clojure.lang.RestFn.invoke(RestFn.java:460)
at clojure.contrib.zip_filter.xml$text__102.invoke(xml.clj:43)
at kanji.prkanji$get_kdic_info__147$fn__149.invoke(prkanji.clj:36)
at clojure.contrib.zip_filter$fixup_apply__60.invoke(zip_filter.clj:
76)
at clojure.contrib.zip_filter$mapcat_chain__65$fn__67$fn__69.invoke
(zip_filter.clj:88)

Re: Stack overflow while processing XML

2009-11-18 Thread Alex Osborne
mkrajnak wrote:
 I am processing a very large xml file, 13MB, using clojure.xml.parse
 and clojure.contrib.zip-filter.xml with clojure 1.0.0.

clojure.xml.parse loads the whole document into memory at once so it's 
only really suitable for small (at most a megabyte or two) XML 
documents.  Have a look at something like Xom instead:

http://www.xom.nu/

If you're looking for an example of usage from Clojure, Mark Triggs has 
a nifty wrapper for Xom that efficiently turns an XML document into a 
lazy-seq (using a queue) which he routinely uses on multi-gigabyte XML 
files:

http://github.com/marktriggs/xml-picker-seq

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


Transforming a SeqMap to a Map

2009-11-18 Thread Robert Campbell
Hey guys,

I'm having some trouble finding a nice way to perform a map
transformation I need. I need to transform this:

[ {:a 1 :b 2 :c 3} {:a 4 :b 5 :c 6} {:a 7 :b 8 :c 9} ]

into this:

{ {:a 1 :b 2} 3 {:a 4 :b 5} 6 {:a 7 :b 8} 9 }

I wanted to use map, but each f in map only returns one value, so I
couldn't figure it out. Here is what I have now:

(def result (ref {}))
(for [item coll]
(dosync (alter result assoc (dissoc item :c) (item :c
; result should now have correct value

I also wrote a recursive version to build the map without using a ref,
but I feel like I'm missing a simpler 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


Re: Transforming a SeqMap to a Map

2009-11-18 Thread Christophe Grand
Hi

(defn f [coll]
  (into {} (for [{c :c :as m} coll] [(dissoc m :c) c])))

or

(defn f [coll]
  (reduce (fn [r {c :c :as m}] (assoc r (dissoc m :c) c)) {} coll))

hth,

Christophe


On Wed, Nov 18, 2009 at 2:19 PM, Robert Campbell rrc...@gmail.com wrote:
 Hey guys,

 I'm having some trouble finding a nice way to perform a map
 transformation I need. I need to transform this:

 [ {:a 1 :b 2 :c 3} {:a 4 :b 5 :c 6} {:a 7 :b 8 :c 9} ]

 into this:

 { {:a 1 :b 2} 3 {:a 4 :b 5} 6 {:a 7 :b 8} 9 }

 I wanted to use map, but each f in map only returns one value, so I
 couldn't figure it out. Here is what I have now:

 (def result (ref {}))
 (for [item coll]
    (dosync (alter result assoc (dissoc item :c) (item :c
 ; result should now have correct value

 I also wrote a recursive version to build the map without using a ref,
 but I feel like I'm missing a simpler 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




-- 
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.cgrand.net/ (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: A Clojure Highlife

2009-11-18 Thread Jeff Heon
Thanks. I got it working with the bundle.

Arghh, I realized about half an hour after posting that I had
misunderstood m-surrounding-neighbors-seq.
I withdrew my post from the Google group, but like they say, nothing
vanishes without a trace ;)

I had not realized that since the grid is made out of refs, and since
the refs themselves do not change, that the grid will always be equal
to itself and thus not generate new memoization values even if the
values inside the refs do change.

These days it seems that not matter how long I think about a reply,
and no matter how many times I reread it before posting, I'll find an
error in it just after posting it 8p

-- 
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: Transforming a SeqMap to a Map

2009-11-18 Thread Rich Hickey
On Wed, Nov 18, 2009 at 8:19 AM, Robert Campbell rrc...@gmail.com wrote:
 Hey guys,

 I'm having some trouble finding a nice way to perform a map
 transformation I need. I need to transform this:

 [ {:a 1 :b 2 :c 3} {:a 4 :b 5 :c 6} {:a 7 :b 8 :c 9} ]

 into this:

 { {:a 1 :b 2} 3 {:a 4 :b 5} 6 {:a 7 :b 8} 9 }

 I wanted to use map, but each f in map only returns one value, so I
 couldn't figure it out. Here is what I have now:

 (def result (ref {}))
 (for [item coll]
    (dosync (alter result assoc (dissoc item :c) (item :c
 ; result should now have correct value

 I also wrote a recursive version to build the map without using a ref,
 but I feel like I'm missing a simpler way..


(into {}
 (map (fn [m] [(dissoc m :c) (:c m)])
  [{:a 1 :b 2 :c 3} {:a 4 :b 5 :c 6} {:a 7 :b 8 :c 9}]))

- {{:a 1, :b 2} 3, {:a 4, :b 5} 6, {:a 7, :b 8} 9}

Rich

-- 
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: Transforming a SeqMap to a Map

2009-11-18 Thread Meikel Brandmeyer
Hi,

On Nov 18, 2:35 pm, Christophe Grand christo...@cgrand.net wrote:

 (defn f [coll]
   (into {} (for [{c :c :as m} coll] [(dissoc m :c) c])))

(defn f
  [coll]
  (into {} (for [{c :c :as (- (dissoc :c) m)} coll] [m c])))

Untested.

Sincerely
Meikel

-- 
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: leiningen - a Clojure build tool

2009-11-18 Thread Sean Devlin
 I'm pleased to announce the initial release of Leiningen.

 Leiningen is a build tool for Clojure designed to not set your hair on fire.


Phil -
Will there be a backwards compatibility mode for those of us that like
setting our hair on fire?  Perhaps a *set-hair-on-fire* binding that
defaults to false?

(binding [*set-hair-on-fire* true]
  ;do-stuff)

Sean :)

-- 
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: Transforming a SeqMap to a Map

2009-11-18 Thread Sean Devlin
user=(def your-data [{:a 1 :b 2 :c 3} {:a 4 :b 5 :c 6} {:a 7 :b 8 :c
9}])

user=(into {} (map (juxt #(dissoc % :c) :c) your-data))

{{:a 1, :b 2} 3, {:a 4, :b 5} 6, {:a 7, :b 8} 9}

On Nov 18, 8:36 am, Rich Hickey richhic...@gmail.com wrote:
 On Wed, Nov 18, 2009 at 8:19 AM, Robert Campbell rrc...@gmail.com wrote:
  Hey guys,

  I'm having some trouble finding a nice way to perform a map
  transformation I need. I need to transform this:

  [ {:a 1 :b 2 :c 3} {:a 4 :b 5 :c 6} {:a 7 :b 8 :c 9} ]

  into this:

  { {:a 1 :b 2} 3 {:a 4 :b 5} 6 {:a 7 :b 8} 9 }

  I wanted to use map, but each f in map only returns one value, so I
  couldn't figure it out. Here is what I have now:

  (def result (ref {}))
  (for [item coll]
     (dosync (alter result assoc (dissoc item :c) (item :c
  ; result should now have correct value

  I also wrote a recursive version to build the map without using a ref,
  but I feel like I'm missing a simpler way..

 (into {}
  (map (fn [m] [(dissoc m :c) (:c m)])
       [{:a 1 :b 2 :c 3} {:a 4 :b 5 :c 6} {:a 7 :b 8 :c 9}]))

 - {{:a 1, :b 2} 3, {:a 4, :b 5} 6, {:a 7, :b 8} 9}

 Rich

-- 
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: Proposal: Extend behavior of hash-map

2009-11-18 Thread Sean Devlin
Do you mean the bean fn?

http://clojure.org/api#toc120

On Nov 18, 4:23 am, David Brown cloj...@davidb.org wrote:
 On Tue, Nov 17, 2009 at 03:24:46PM -0800, Richard Newman wrote:
 Baby, bathwater. Making a persistent map out of a Java map is
 expensive. Not everything that implements Map is concrete; e.g.,
 spending several seconds making a local persistent Clojure map out of
 a distributed hash table proxy, just to get a value, would cause
 programmers to drop down to Java to avoid this pointless restriction.
 Why bother?

 I wonder if there's a use for a lazy 'bean' call, then.  Lots of
 things use bean properties to do things that can be quite expensive.

 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: leiningen - a Clojure build tool

2009-11-18 Thread Teemu Antti-Poika
On Nov 18, 4:00 pm, Sean Devlin francoisdev...@gmail.com wrote:
 Will there be a backwards compatibility mode for those of us that like
 setting our hair on fire?  Perhaps a *set-hair-on-fire* binding that
 defaults to false?

You could always write a maven plugin for leiningen. That ought to do
it.

-- 
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: leiningen - a Clojure build tool

2009-11-18 Thread Stuart Sierra
On Nov 18, 9:00 am, Sean Devlin francoisdev...@gmail.com wrote:
 (binding [*set-hair-on-fire* true]
   ;do-stuff)

I like this just for the Var name.
-SS

-- 
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: A Clojure Highlife

2009-11-18 Thread Joseph Smith
Heh. I had wondered if you had withdrawn the post since I only saw it  
in my email box. No worries- I went back and examined my code to make  
sure it was doing what I thought it was.

---
Joseph Smith
j...@uwcreations.com
(402)601-5443


On Nov 18, 2009, at 7:35 AM, Jeff Heon jfh...@gmail.com wrote:

 Thanks. I got it working with the bundle.

 Arghh, I realized about half an hour after posting that I had
 misunderstood m-surrounding-neighbors-seq.
 I withdrew my post from the Google group, but like they say, nothing
 vanishes without a trace ;)

 I had not realized that since the grid is made out of refs, and since
 the refs themselves do not change, that the grid will always be equal
 to itself and thus not generate new memoization values even if the
 values inside the refs do change.

 These days it seems that not matter how long I think about a reply,
 and no matter how many times I reread it before posting, I'll find an
 error in it just after posting it 8p

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

-- 
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: swap two elements in an arbitrary collection

2009-11-18 Thread Jacek Laskowski
On Sat, Nov 14, 2009 at 11:59 PM, Meikel Brandmeyer m...@kotka.de wrote:

 And there is always macroexpand(-1)...

 user= (macroexpand-1 '(- foo (bar baz)))
 (bar foo baz)

I'm glad you've pointed it out as I've recently been asking myself how
to expand a macro entirely (including subforms)? I'd prefer knowing
what the final expansion would be for swap.

user= (macroexpand '(- v (assoc i (v j)) (assoc j (v i
(assoc (clojure.core/- v (assoc i (v j))) j (v i))

How to expand the macro in the subform above?

Jacek

-- 
Jacek Laskowski
Notatnik Projektanta Java EE - http://www.JacekLaskowski.pl

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

2009-11-18 Thread Paul Stadig
Thanks for your feedback.

I was able to get it to work again and pushed some minor changes to
the git repo. I downloaded Terracotta 3.1.1, and followed the
instructions in the tim-clojure-1.0-SNAPSHOT/example/README. I ended
up uncommenting all of the code in ClojureTerracottaConfigurator.java.
I believe I had commented it out, because some of the replacement
classes were not necessary anymore, and I was going to trim it down to
the essential replacements, but I never finished the work.

The error you are experiencing might be because of one of the
outstanding issues. A non-portable class cannot be used as a root
binding for any Var. As I mentioned before, I have an idea for a
workaround, but have not pursued it as yet. If you'd like to help,
then let me know.


Paul

On Nov 17, 12:43 pm, Sergey Didenko sergey.dide...@gmail.com wrote:
 Hi Paul,

 the code from [1] does not work under the latest Terracotta (3.1.1)
 with clojure-slim.jar's in the following combinations:

 1) branch 1.0.x from [3]
 2) branch 1.0.x from [3] + modified
 ClojureTerracottaConfigurator.java (uncommented lines)
 3) [2] svn revision 1335 + modified ClojureTerracottaConfigurator.java
 (uncommented lines)
 4) [2] svn revision 1310 + modified ClojureTerracottaConfigurator.java
 (uncommented lines)

 Terracotta writes messages like

 Non-portable field name   : clojure.lang.Var.root
 Unshareable class         : clojure.lang.XMLHandler
 

 [1]http://github.com/pjstadig/tim-clojure-1.0-snapshot
 [2]http://clojure.googlecode.com/svn
 [3]http://github.com/richhickey/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


Missing unsigned-bit-shift-right?

2009-11-18 Thread MarkSwanson
I'm porting some Java code that uses .
Is there a way to do this in Clojure?

FYI: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/opsummary.html

-- 
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: Contrib (1.0 compatible) succeeds (but fails :-)

2009-11-18 Thread .Bill Smith
I have the same problem.  I run ant clean and then ant -
Dclojure.jar=/path/to/clojure-1.0.0.jar.  The errors I get (long
stack traces omitted but available if requested):

 [java] java.io.FileNotFoundException: Could not locate clojure/
stacktrace__init.class or clojure/stacktrace.clj on classpath:
(jmx.clj:10)
[...]
 [java] Caused by: java.io.FileNotFoundException: Could not locate
clojure/stacktrace__init.class or clojure/stacktrace.clj on
classpath:  (jmx.clj:10)
[...]
 [java] Caused by: java.io.FileNotFoundException: Could not locate
clojure/stacktrace__init.class or clojure/stacktrace.clj on
classpath:
[...]
 [java] --- Nested Exception ---
 [java] java.io.FileNotFoundException: Could not locate clojure/
stacktrace__init.class or clojure/stacktrace.clj on classpath:
(jmx.clj:10)
[...]
 [java] Caused by: java.io.FileNotFoundException: Could not locate
clojure/stacktrace__init.class or clojure/stacktrace.clj on
classpath:
[...]
compile_clojure:
 [echo] Locating namespaces to compile ...
 [echo] Compiling Clojure namespaces ...
 [java] java.io.FileNotFoundException: Could not locate clojure/
walk__init.class or clojure/walk.clj on classpath:  (dataflow.clj:17)
 [...]
 [java] Caused by: java.io.FileNotFoundException: Could not locate
clojure/walk__init.class or clojure/walk.clj on classpath:
(dataflow.clj:17)
[...]
 [java] Caused by: java.io.FileNotFoundException: Could not locate
clojure/walk__init.class or clojure/walk.clj on classpath:
[...]
 [java] java.io.FileNotFoundException: Could not locate clojure/
walk__init.class or clojure/walk.clj on classpath:  (dataflow.clj:17)
[...]
 [java] Caused by: java.io.FileNotFoundException: Could not locate
clojure/walk__init.class or clojure/walk.clj on classpath:
[...]

$ java -version
java version 1.6.0_10
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Server VM (build 11.0-b15, mixed mode)

Bill Smith

-- 
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: Datatypes and Protocols - early experience program

2009-11-18 Thread samppi
This is wonderful, wonderful, wonderful. It makes my work with FnParse
so much easier.

Question: are the general mechanisms for accessing and setting fields
their keywords and assoc respectively:
  (deftype Bar [a b c d e])
  (def b (Bar 1 2 3 4 5))
  (:c b)
  (def c (assoc b :e 2))
Does (:c b) and (assoc b :e 2) take advantage of Bar's field
information? Is it any faster than using an array map? Are there any
equivalents to struct maps' accessor functions?

On Nov 12, 5:10 am, Rich Hickey richhic...@gmail.com wrote:
 An early version of the code for a few important new language
 features, datatypes[1] and protocols[2] is now available in the 'new'
 branch[3]. Note also that the build system[4] has builds of the new
 branch, and that the new branch works with current contrib.

 If you have the time and inclination, please try them out. Feedback is
 particularly welcome as they are being refined.

 Thanks,

 Rich

 [1]http://www.assembla.com/wiki/show/clojure/Datatypes
 [2]http://www.assembla.com/wiki/show/clojure/Protocols
 [3]http://github.com/richhickey/clojure/tree/new
 [4]http://build.clojure.org/

-- 
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: Contrib (1.0 compatible) succeeds (but fails :-)

2009-11-18 Thread Stuart Halloway
The file jmx.clj should not exist on the 1.0-compatible branch. Is it  
there on yours?

Stu

 I have the same problem.  I run ant clean and then ant -
 Dclojure.jar=/path/to/clojure-1.0.0.jar.  The errors I get (long
 stack traces omitted but available if requested):

 [java] java.io.FileNotFoundException: Could not locate clojure/
 stacktrace__init.class or clojure/stacktrace.clj on classpath:
 (jmx.clj:10)
 [...]
 [java] Caused by: java.io.FileNotFoundException: Could not locate
 clojure/stacktrace__init.class or clojure/stacktrace.clj on
 classpath:  (jmx.clj:10)
 [...]
 [java] Caused by: java.io.FileNotFoundException: Could not locate
 clojure/stacktrace__init.class or clojure/stacktrace.clj on
 classpath:
 [...]
 [java] --- Nested Exception ---
 [java] java.io.FileNotFoundException: Could not locate clojure/
 stacktrace__init.class or clojure/stacktrace.clj on classpath:
 (jmx.clj:10)
 [...]
 [java] Caused by: java.io.FileNotFoundException: Could not locate
 clojure/stacktrace__init.class or clojure/stacktrace.clj on
 classpath:
 [...]
 compile_clojure:
 [echo] Locating namespaces to compile ...
 [echo] Compiling Clojure namespaces ...
 [java] java.io.FileNotFoundException: Could not locate clojure/
 walk__init.class or clojure/walk.clj on classpath:  (dataflow.clj:17)
 [...]
 [java] Caused by: java.io.FileNotFoundException: Could not locate
 clojure/walk__init.class or clojure/walk.clj on classpath:
 (dataflow.clj:17)
 [...]
 [java] Caused by: java.io.FileNotFoundException: Could not locate
 clojure/walk__init.class or clojure/walk.clj on classpath:
 [...]
 [java] java.io.FileNotFoundException: Could not locate clojure/
 walk__init.class or clojure/walk.clj on classpath:  (dataflow.clj:17)
 [...]
 [java] Caused by: java.io.FileNotFoundException: Could not locate
 clojure/walk__init.class or clojure/walk.clj on classpath:
 [...]

 $ java -version
 java version 1.6.0_10
 Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
 Java HotSpot(TM) Server VM (build 11.0-b15, mixed mode)

 Bill Smith

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

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


take repeatedly alternative?

2009-11-18 Thread Raoul Duke
when people use (take n (repeatedly fn)) are there other ways they
might have written that in clojure? it just seems like more ascii than
should be required :-)

e.g. not exactly the same but bigloo has list-tabulate
http://www-sop.inria.fr/mimosa/fp/Bigloo/doc/bigloo-7.html#list-tabulate

gracias.

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

2009-11-18 Thread patrickdlogan
There are other lisps (including schemes) but the three I have some
experience with are JScheme, SISC, and Clojure. Based on that I would
answer it this way...

* Use SISC if you want a full implementation of Scheme on the JVM.
(It's been reliable in the past but I have not used it for a couple of
years - it may no longer be actively supported.) Speedier but more
compliant and more complex than JScheme.

* Use JScheme if you want a Lisp or Scheme-ish language, mostly for
writing Java-esque applications in Lisp. (Again it has been a while,
worked well for me in the past, and I don't know it's current support
level.)

* Use Clojure if you want a Lisp or other mostly functional and/or
highly concurrent language for the JVM, under active development,
etc. So far I have found its Java interop to be at least as expressive
as JScheme's. But I would say use JScheme if you just want a
traditional Lisp language that can use Java - the shift to
Clojure's mostly functional style is more dramatic than that of
JScheme's.



On Nov 17, 3:33 pm, Michael Jaaka michael.ja...@googlemail.com
wrote:
 Can anyone defend Clojure in comparision to JScheme?
 I want to see all pros why to learn Clojure instead of JScheme.
 I've found out that the java methods invocation and rest of syntax is
 very similar, which satisfies me since it is easier to work with lisp
 family languages.

-- 
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: Contrib (1.0 compatible) succeeds (but fails :-)

2009-11-18 Thread .Bill Smith
I downloaded the 1.0-compatible branch of clojure-contrib this
afternoon, and jmx.clj was included.

Unfortunately, there are other build problems as well.   dataflow.clj
is unable to find walk.clj, which is in the test_contrib directory.
In addition, error_kit.clj references stacktrace.clj, which was not
included.  Once you take those out, still other things don't build.

Does anyone know how to make clojure-contrib buildable?

On Nov 18, 5:16 pm, Stuart Halloway stuart.hallo...@gmail.com wrote:
 The file jmx.clj should not exist on the 1.0-compatible branch. Is it  
 there on yours?

 Stu

  I have the same problem.  I run ant clean and then ant -
  Dclojure.jar=/path/to/clojure-1.0.0.jar.  The errors I get (long
  stack traces omitted but available if requested):

      [java] java.io.FileNotFoundException: Could not locate clojure/
  stacktrace__init.class or clojure/stacktrace.clj on classpath:
  (jmx.clj:10)
  [...]
      [java] Caused by: java.io.FileNotFoundException: Could not locate
  clojure/stacktrace__init.class or clojure/stacktrace.clj on
  classpath:  (jmx.clj:10)
  [...]
      [java] Caused by: java.io.FileNotFoundException: Could not locate
  clojure/stacktrace__init.class or clojure/stacktrace.clj on
  classpath:
  [...]
      [java] --- Nested Exception ---
      [java] java.io.FileNotFoundException: Could not locate clojure/
  stacktrace__init.class or clojure/stacktrace.clj on classpath:
  (jmx.clj:10)
  [...]
      [java] Caused by: java.io.FileNotFoundException: Could not locate
  clojure/stacktrace__init.class or clojure/stacktrace.clj on
  classpath:
  [...]
  compile_clojure:
      [echo] Locating namespaces to compile ...
      [echo] Compiling Clojure namespaces ...
      [java] java.io.FileNotFoundException: Could not locate clojure/
  walk__init.class or clojure/walk.clj on classpath:  (dataflow.clj:17)
  [...]
      [java] Caused by: java.io.FileNotFoundException: Could not locate
  clojure/walk__init.class or clojure/walk.clj on classpath:
  (dataflow.clj:17)
  [...]
      [java] Caused by: java.io.FileNotFoundException: Could not locate
  clojure/walk__init.class or clojure/walk.clj on classpath:
  [...]
      [java] java.io.FileNotFoundException: Could not locate clojure/
  walk__init.class or clojure/walk.clj on classpath:  (dataflow.clj:17)
  [...]
      [java] Caused by: java.io.FileNotFoundException: Could not locate
  clojure/walk__init.class or clojure/walk.clj on classpath:
  [...]

  $ java -version
  java version 1.6.0_10
  Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
  Java HotSpot(TM) Server VM (build 11.0-b15, mixed mode)

  Bill Smith

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

-- 
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: Contrib (1.0 compatible) succeeds (but fails :-)

2009-11-18 Thread .Bill Smith
I went to http://github.com/richhickey/clojure-contrib/ and clicked
the Download button.  Was that the wrong thing to do?

Bill

-- 
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: A macro for flexible keyword argument handling

2009-11-18 Thread Constantine Vetoshev
On Nov 17, 11:33 pm, nchubrich nicholas.chubr...@gmail.com wrote:
 can it be any more
 general or minimal than this?

Seems to me that your suggestion effectively makes every positional
argument optional. You did note that the scheme calls for supplied-
predicates, but this pushes responsibility for checking required
arguments from the compiler to the programmer. That seems a little too
minimal to me, and barely an improvement from extracting everything
from an arguments array.

-- 
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: Contrib (1.0 compatible) succeeds (but fails :-)

2009-11-18 Thread .Bill Smith
Correction: I went to 
http://github.com/richhickey/clojure-contrib/tree/clojure-1.0-compatible
and clicked the download button.

On Nov 18, 8:14 pm, .Bill Smith william.m.sm...@gmail.com wrote:
 I went tohttp://github.com/richhickey/clojure-contrib/and clicked
 the Download button.  Was that the wrong thing to do?

 Bill

-- 
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: Contrib (1.0 compatible) succeeds (but fails :-)

2009-11-18 Thread Mike Hinchey
The github link for download is confusing. It points to the most recent
download irrespective of branch.

This should be correct:
http://github.com/richhickey/clojure-contrib/archives/clojure-1.0-compatible

-Mike

On Wed, Nov 18, 2009 at 6:27 PM, .Bill Smith william.m.sm...@gmail.comwrote:

 Correction: I went to
 http://github.com/richhickey/clojure-contrib/tree/clojure-1.0-compatible
 and clicked the download button.

 On Nov 18, 8:14 pm, .Bill Smith william.m.sm...@gmail.com wrote:
  I went tohttp://github.com/richhickey/clojure-contrib/and clicked
  the Download button.  Was that the wrong thing to do?
 
  Bill

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

Code improvement: incrementing a meta val

2009-11-18 Thread samppi
Is there a more elegant way to phrase this?

(defn- inc-index
  Increments the :index val in the givens state's metadata.
  [state]
  (vary-meta state assoc :index (inc (:index ^state

-- 
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: Contrib (1.0 compatible) succeeds (but fails :-)

2009-11-18 Thread Mike Hinchey
github has a ticket, so they should fix the link soon.

On Wed, Nov 18, 2009 at 6:58 PM, Mike Hinchey hinche...@gmail.com wrote:

 The github link for download is confusing. It points to the most recent
 download irrespective of branch.



-- 
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: Contrib (1.0 compatible) succeeds (but fails :-)

2009-11-18 Thread .Bill Smith
Thank you, Mike.  I will give that a try.

-- 
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: Code improvement: incrementing a meta val

2009-11-18 Thread jan
samppi rbysam...@gmail.com writes:

 Is there a more elegant way to phrase this?

 (defn- inc-index
   Increments the :index val in the givens state's metadata.
   [state]
   (vary-meta state assoc :index (inc (:index ^state

This is slightly cleaner

(defn- inc-index
  Increments the :index val in the givens state's metadata.
  [state]
  (vary-meta state update-in [:index] inc))

--
jan

-- 
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: leiningen - a Clojure build tool

2009-11-18 Thread Phil Hagelberg
ngocdaothanh ngocdaoth...@gmail.com writes:

 Lein is super easy to install and use!

 To demonstrate the ease of installation, the Installation part in
 README should say:
 1. Download only one file: wget 
 http://github.com/technomancy/leiningen/raw/master/bin/lein
 2. chmod +x lein
 3. ./lein self-install

 Thanks for the work.

Good idea; I'll update it.

-Phil

-- 
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: leiningen - a Clojure build tool

2009-11-18 Thread Phil Hagelberg
Shantanu Kumar kumar.shant...@gmail.com writes:

 Is any IDE support planned for this? As it turns out, many people
 (including me) stick with Ant just because the IDE support is
 fantastic.

I have no plans myself, but if writing the pom is not sufficient a
plugin could be written. I've never used an IDE, so I don't know what
kind of features people expect. Tests and compilation should be easy to
do without a build tool (at least it is Emacs), so are you just looking
for a button on a toolbar for each of lein's tasks?

I must confess I don't understand the avoid the command-line mindset
at all, so I need a little extra explanation.

-Phil

-- 
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: SLIME REPL broken

2009-11-18 Thread Kei Suzuki
You can still use slime-fancy and the arglist display feature by just
disabling autodoc mode like this:

(setq slime-use-autodoc-mode nil)
(slime-setup '(slime-fancy))

On Nov 18, 11:26 am, Constantine Vetoshev gepar...@gmail.com wrote:
 On Nov 17, 2:52 pm, David Nolen dnolen.li...@gmail.com wrote:

  Thanks for pursuing this so adamantly :) For a long time (more than a year)
  it was possible to use SLIME tip. It would be great for that to continue.

 You can still use SLIME; just avoid the slime-autodoc contrib. Use

 (slime-setup '(slime-repl))

 to initialize SLIME. At least, this works for me. Make sure you don't
 use (slime-setup '(slime-fancy)), because slime-fancy includes slime-
 autodoc. You lose the nicer minibuffer function argument display, but
 at least the basic environment works.

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


LDAP lib

2009-11-18 Thread Sean Devlin
Hello everyone.

I need to query an LDAP directory.  Is there an existing Clojure
library already?  Simply trying to avoid reinventing the wheel.

Sean

-- 
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: leiningen - a Clojure build tool

2009-11-18 Thread Shantanu Kumar


On Nov 19, 10:22 am, Phil Hagelberg p...@hagelb.org wrote:
 Shantanu Kumar kumar.shant...@gmail.com writes:
  Is any IDE support planned for this? As it turns out, many people
  (including me) stick with Ant just because the IDE support is
  fantastic.

 I have no plans myself, but if writing the pom is not sufficient a
 plugin could be written. I've never used an IDE, so I don't know what
 kind of features people expect. Tests and compilation should be easy to
 do without a build tool (at least it is Emacs), so are you just looking
 for a button on a toolbar for each of lein's tasks?

 I must confess I don't understand the avoid the command-line mindset
 at all, so I need a little extra explanation.

I don't use Maven, so can't tell about that. This is how an Ant view
looks like in Eclipse (list of build targets): 
http://www.easyscreens.info/?v=5109

You can right-click on a build target and run / debug it from the
context menu. Double-clicking a target instantly runs it. Debugging
(stepping through breakpoints etc) is something that may be hard to do
from command line, especially for a large code base.

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.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Missing unsigned-bit-shift-right?

2009-11-18 Thread Michael Wood
2009/11/19 MarkSwanson mark.swanson...@gmail.com:
 I'm porting some Java code that uses .
 Is there a way to do this in Clojure?

 FYI: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/opsummary.html

I'm sure someone else will have a proper answer, but you could just
create a class with a static unsignedRightShift method in Java and
then:

user= (defn  [#^Integer val #^Integer shift]
(Shift/unsignedRightShift val shift))
#'user/
user= ( 99 2)
24

Although you might want to call it unsigned-bit-shift-right instead
for consistency with bit-shift-right.

-- 
Michael Wood esiot...@gmail.com

-- 
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: leiningen - a Clojure build tool

2009-11-18 Thread Martin DeMello
On Thu, Nov 19, 2009 at 10:52 AM, Phil Hagelberg p...@hagelb.org wrote:

 I must confess I don't understand the avoid the command-line mindset
 at all, so I need a little extra explanation.

It's a matter of context switching. If I'm working in an IDE, I want
to compile the code without having to open a new window just to type
'ant' or whatever in.

martin

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