Re: Addition of new a priori distinct element to a vector

2011-09-23 Thread F Lengyel

On Sep 23, 1:39 am, Nathan Sorenson n...@sfu.ca wrote:
 Just to clarify, you want to conj a vector to itself? i.e. [1 2 3 4] -- [1
 2 3 4 [1 2 3 4]] I'm curious what the application of this is.

 Regarding the overhead of conj-ing to a vector: Clojure's data structures
 make use of structural sharing so conjoining an element to the end of a
 vector won't require any copying of entire vectors. It's a cheap,
 constant(ish) time operation.


Good: (conj v v) is O(1) in time and space, and appends an element
distinct from the preceding elements (if any). I meant to add that
querying
the vector is not allowed. The reason is to use reduce in situations
where
some data structure is created based on a previous and current
element. If the last element is guaranteed to be different from those
preceding it, then an edge case is eliminated (or rather, encoded into
the sequence at minimal cost).

-- 
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: Addition of new a priori distinct element to a vector

2011-09-23 Thread Andy Fingerhut
To be very precise, (conj v new-elem) is O(log n) in time and space, but it
is constant-ish because the base of the logarithm is something like 32,
rather than something like 2, so the constant factor multiplying the log n
is typically pretty small.

Also, there is no difference in Clojure's behavior in this case whether the
new element is different than all elements previously conj'd onto the
vector.  They could all be the same, and the time and space requirements
would be exactly the same as if they were all distinct.  If you happen to
know that they are all distinct, that's your business :-)

Andy


On Thu, Sep 22, 2011 at 11:09 PM, F Lengyel florian.leng...@gmail.comwrote:


 On Sep 23, 1:39 am, Nathan Sorenson n...@sfu.ca wrote:
  Just to clarify, you want to conj a vector to itself? i.e. [1 2 3 4] --
 [1
  2 3 4 [1 2 3 4]] I'm curious what the application of this is.
 
  Regarding the overhead of conj-ing to a vector: Clojure's data structures
  make use of structural sharing so conjoining an element to the end of a
  vector won't require any copying of entire vectors. It's a cheap,
  constant(ish) time operation.


 Good: (conj v v) is O(1) in time and space, and appends an element
 distinct from the preceding elements (if any). I meant to add that
 querying
 the vector is not allowed. The reason is to use reduce in situations
 where
 some data structure is created based on a previous and current
 element. If the last element is guaranteed to be different from those
 preceding it, then an edge case is eliminated (or rather, encoded into
 the sequence at minimal cost).

 --
 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: Addition of new a priori distinct element to a vector

2011-09-23 Thread Kevin Livingston
what's the actual use case where you want this?
it seems pretty weird just on it's own.  it may in practice be more
clever than other solutions, but that's not clear yet.  if you just
want a unique symbol there's (gensym)


regarding vectors, I found this a helpful read a while back, it's a
few years old, but I think it's still accurate, and may help you get a
picture of what's under the hood.
http://blog.higher-order.net/2009/02/01/understanding-clojures-persistentvector-implementation/

Kevin


On Sep 23, 12:09 am, F Lengyel florian.leng...@gmail.com wrote:
 On Sep 23, 1:39 am, Nathan Sorenson n...@sfu.ca wrote:

  Just to clarify, you want to conj a vector to itself? i.e. [1 2 3 4] -- [1
  2 3 4 [1 2 3 4]] I'm curious what the application of this is.

  Regarding the overhead of conj-ing to a vector: Clojure's data structures
  make use of structural sharing so conjoining an element to the end of a
  vector won't require any copying of entire vectors. It's a cheap,
  constant(ish) time operation.

 Good: (conj v v) is O(1) in time and space, and appends an element
 distinct from the preceding elements (if any). I meant to add that
 querying
 the vector is not allowed. The reason is to use reduce in situations
 where
 some data structure is created based on a previous and current
 element. If the last element is guaranteed to be different from those
 preceding it, then an edge case is eliminated (or rather, encoded into
 the sequence at minimal cost).

-- 
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: Addition of new a priori distinct element to a vector

2011-09-23 Thread F Lengyel


On Sep 23, 2:18 am, Andy Fingerhut andy.finger...@gmail.com wrote:
 To be very precise, (conj v new-elem) is O(log n) in time and space, but it
 is constant-ish because the base of the logarithm is something like 32,
 rather than something like 2, so the constant factor multiplying the log n
 is typically pretty small.

OK, thanks.

 Also, there is no difference in Clojure's behavior in this case whether the
 new element is different than all elements previously conj'd onto the
 vector.

Nor did I imply or suggest that it would be different.

FL


-- 
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: Addition of new a priori distinct element to a vector

2011-09-23 Thread Stefan Kamphausen
Hi,

is there any particular reason not to use a Set instead of a vector?  It 
solves the issue of distinct values.  Or am I missing something?

Regards,
Stefan

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

Partitioning problem

2011-09-23 Thread Michael Jaaka
Hi!

I have a sequence of natural numbers and I have to partition them into
more or less equals N groups.
Partitioning function is just a sum of numbers in a given group.

My naive solution is to sort numbers descending then take each number
and put into one of N groups in which sum of its elements with given
number is the lowest. Here is the code: http://pastebin.com/Nw28FaRK

So for input [ 1 2 34  54 12 23 5  2 3  1 2 12 11 12 32 67 ] and N = 5
I get
([32 12 5 1 1] [34 12 2 2] [23 12 11 3 2] [54] [67])

Do you know any better solution?

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


Re: How to attach debugger on clojure's repl ?

2011-09-23 Thread Sam Aaron

On 23 Sep 2011, at 06:14, Glen Stampoultzis wrote:
 
 
 Ritz looks really nice the setup seems complicated.  I haven't had much luck 
 setting it up unfortunately. 

Me neither. Here's the steps I took so far:

* Cloned https://github.com/pallet/ritz to a tmp dir
* Copied the slime dir inside ritz into my .emacs.d dir
* Modified my global cake project.clj file to look as follows:

(defproject global 0.0.0
  :description Don't rename this project, but you can change the version if 
you want.
  :dependencies [[clojure 1.3.0-RC0]]
  :dev-dependencies [[ritz 0.1.8-SNAPSHOT]])

* Ran `cake deps --global`
* My .cake dir now looks as follows:

/Users/sam/.cake 
├── build
├── classes  
├── lib  
│   ├── clojure-1.3.0-RC0.jar
│   ├── deps.clj 
│   └── dev  
│   ├── ritz-0.1.8-20110809.143608-3.jar 
│   └── useful-0.4.0.jar 
├── pom.xml  
├── project.clj  
├── run  
└── templates
└── default  
├── LICENSE  
├── project.clj  
├── src  
│   └── +project+
│   └── core.clj 
└── test 
 
10 directories, 9 files  

* The ritz README talks about making sure tools.clj is in the classpath. 
However, it appears on OS X there is no tools.jar:

tools.jar does not exist. Classes usually located here are instead included in 
classes.jar. Scripts that rely on the existence of tools.jar need to be 
rewritten accordingly. (see 
http://developer.apple.com/library/mac/#documentation/Java/Conceptual/Java14Development/02-JavaDevTools/JavaDevTools.html)

* I created a blank project with `cake new foo`
* cd into foo
* Ran `cake ritz` to get the error unknown task: ritz.

I'm unsure where to go from here. How do I teach cake about the ritz task? Am I 
missing any specific steps? Is not having tools.jar available on OS X an issue? 

I'd be very happy to write up a Getting Started tutorial on the ritz wiki if 
I can get things working.

Sam

---
http://sam.aaron.name


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


Re: How to attach debugger on clojure's repl ?

2011-09-23 Thread Scott Jaderholm
I don't think it looks for tools.jar specifically, it probably just uses the
classes in there so as long as they're on the classpath you should be fine.
I wouldn't worry about it unless you see an error saying it can't find some
classes that googling reveals are in tools.jar.

The README doesn't mention any cake plugins, that's why cake ritz isn't
working. If cake supports lein plugins then maybe you didn't do lein plugin
install ritz 0.1.7.

Perhaps use lein or the maven plugin instead.

Scott

On Fri, Sep 23, 2011 at 8:00 AM, Sam Aaron samaa...@gmail.com wrote:


 On 23 Sep 2011, at 06:14, Glen Stampoultzis wrote:
 
 
  Ritz looks really nice the setup seems complicated.  I haven't had much
 luck setting it up unfortunately.

 Me neither. Here's the steps I took so far:

 * Cloned https://github.com/pallet/ritz to a tmp dir
 * Copied the slime dir inside ritz into my .emacs.d dir
 * Modified my global cake project.clj file to look as follows:

 (defproject global 0.0.0
  :description Don't rename this project, but you can change the version if
 you want.
  :dependencies [[clojure 1.3.0-RC0]]
  :dev-dependencies [[ritz 0.1.8-SNAPSHOT]])

 * Ran `cake deps --global`
 * My .cake dir now looks as follows:

 /Users/sam/.cake
 ├── build
 ├── classes
 ├── lib
 │   ├── clojure-1.3.0-RC0.jar
 │   ├── deps.clj
 │   └── dev
 │   ├── ritz-0.1.8-20110809.143608-3.jar
 │   └── useful-0.4.0.jar
 ├── pom.xml
 ├── project.clj
 ├── run
 └── templates
└── default
├── LICENSE
├── project.clj
├── src
│   └── +project+
│   └── core.clj
└── test

 10 directories, 9 files

 * The ritz README talks about making sure tools.clj is in the classpath.
 However, it appears on OS X there is no tools.jar:

 tools.jar does not exist. Classes usually located here are instead
 included in classes.jar. Scripts that rely on the existence of tools.jar
 need to be rewritten accordingly. (see
 http://developer.apple.com/library/mac/#documentation/Java/Conceptual/Java14Development/02-JavaDevTools/JavaDevTools.html
 )

 * I created a blank project with `cake new foo`
 * cd into foo
 * Ran `cake ritz` to get the error unknown task: ritz.

 I'm unsure where to go from here. How do I teach cake about the ritz task?
 Am I missing any specific steps? Is not having tools.jar available on OS X
 an issue?

 I'd be very happy to write up a Getting Started tutorial on the ritz wiki
 if I can get things working.

 Sam

 ---
 http://sam.aaron.name


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

How to replace c.c.mock when migrating to Clojure 1.3?

2011-09-23 Thread r0man
Hello,

I'm in the process of porting my code to Clojure 1.3. Those two
pages were really helpful on the way:

- http://dev.clojure.org/display/doc/Clojure+Contrib
- http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

The only dependency I still couldn't get rid of is
clojure.contrib.mock. What's the recommended replacement for this
library? How is mocking done in Clojure 1.3 at all? In pre 1.3 I
could have used binding. But in Clojure 1.3 this doesn't work
anymore, because my fn under test is not defined to be dynamic?

What's the solution to this problem? Adding ^:dynamic to those
fns?

Thanks for your help, Roman.

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

Re: How to attach debugger on clojure's repl ?

2011-09-23 Thread Hugo Duncan

On Fri, 23 Sep 2011 08:00:36 -0400, Sam Aaron samaa...@gmail.com wrote:



On 23 Sep 2011, at 06:14, Glen Stampoultzis wrote:



Ritz looks really nice the setup seems complicated.  I haven't had much  
luck setting it up unfortunately.


Hopefully we can simplify the process. The setup hasn't been the main  
priority yet.



* Modified my global cake project.clj file to look as follows:


I've not actually tried running ritz from cake recently. Which version of  
cake?



(defproject global 0.0.0
  :description Don't rename this project, but you can change the  
version if you want.

  :dependencies [[clojure 1.3.0-RC0]]
  :dev-dependencies [[ritz 0.1.8-SNAPSHOT]])


I've also not tried running with 1.3.0-RC0.

* The ritz README talks about making sure tools.clj is in the classpath.  
However, it appears on OS X there is no tools.jar:


tools.jar doesn't exist for the mac jdk. I'll add an explicit comment to  
the readme.



* I created a blank project with `cake new foo`
* cd into foo
* Ran `cake ritz` to get the error unknown task: ritz.

I'm unsure where to go from here. How do I teach cake about the ritz  
task? Am I missing any specific steps? Is not having tools.jar available  
on OS X an issue?


I imagine this is some issue preventing the cake task from loading.  I  
believe cake logs its output somewhere - maybe you could check the cake  
logs for ritz related messages?


I'll try taking a look later today.

I'd be very happy to write up a Getting Started tutorial on the ritz  
wiki if I can get things working.


I'll gladly take you up on that :)

Hugo

--
Hugo Duncan

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


Re: How to attach debugger on clojure's repl ?

2011-09-23 Thread Hugo Duncan
On Fri, 23 Sep 2011 08:14:43 -0400, Scott Jaderholm jaderh...@gmail.com  
wrote:


I don't think it looks for tools.jar specifically, it probably just uses  
the
classes in there so as long as they're on the classpath you should be  
fine.
I wouldn't worry about it unless you see an error saying it can't find  
some

classes that googling reveals are in tools.jar.


Correct.


The README doesn't mention any cake plugins, that's why cake ritz isn't
working.


There is a cake task. It hasn't seen a lot of use as far as I know, but  
was working at one point. Cake has however seen a lot of instability  
recently (from my occasional usage at least). In this case I suspect 1.3  
RC0 is causing the task not to load.


If cake supports lein plugins then maybe you didn't do lein plugin  
install ritz 0.1.7.


I would recommend 0.1.8-SNAPSHOT. The main difference is in how exceptions  
are selected for breaking into the debugger, which remains the main  
sticking point for ritz development at the moment. I'm itching for a  
clojure.match release so I can use it for this. [1]



Perhaps use lein or the maven plugin instead.


The maven plugin is zi [2]

Hugo

[1] https://github.com/pallet/ritz/issues/14
[2] https://github.com/pallet/zi

--
Hugo Duncan

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


Re: How to replace c.c.mock when migrating to Clojure 1.3?

2011-09-23 Thread Stuart Sierra
Hi, Roman,

In 1.3, you can use `with-redefs` to temporarily replace definitions.

-Stuart Sierra
clojure.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: issues to build clojure-1.3.0-RC0 with JDK-1.7

2011-09-23 Thread Stuart Sierra
Hi Jochen, thanks for this report.

It looks like the annotations tests are failing due to changes from JDK 1.6 
to 1.7. They were brittle tests to begin with and should probably be removed 
or replaced.

This also revealed to me that our JDK test builds on Hudson were not 
actually building properly. That is now fixed, so we can confirm this issue 
on Hudson: http://build.clojure.org/view/Clojure/job/clojure-test-matrix/

-Stuart Sierra
clojure.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

how to get the correct library????

2011-09-23 Thread jayvandal
I downloaded the contrib file that was indicated as the file
containing
 (:use clojure.contrib.duck-streams)) but I get an error when trying
to run code.

I get errors but don't know what clojure is seeking??
Any advice will be appreciated

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


Re: how to get the correct library????

2011-09-23 Thread Stuart Sierra
Hi Jayvandal,

clojure.contrib.duck-streams is quite old. Since Clojure 1.2.0, most of the 
functionality of duck-streams has been packaged with Clojure itself in the 
clojure.java.io namespace.

Please refer to http://dev.clojure.org/display/design/Clojure+Contrib for 
more information on what Clojure contrib means for different versions of 
Clojure.

Thanks,
-Stuart Sierra
clojure.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: How to replace c.c.mock when migrating to Clojure 1.3?

2011-09-23 Thread r0man
Thx Stuart, that worked fine ...

-- 
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: issues to build clojure-1.3.0-RC0 with JDK-1.7

2011-09-23 Thread Stuart Halloway
 Hi Jochen, thanks for this report.
 
 It looks like the annotations tests are failing due to changes from JDK 1.6 
 to 1.7. They were brittle tests to begin with and should probably be removed 
 or replaced.
 
 This also revealed to me that our JDK test builds on Hudson were not actually 
 building properly. That is now fixed, so we can confirm this issue on Hudson: 
 http://build.clojure.org/view/Clojure/job/clojure-test-matrix/
 
 -Stuart Sierra
 clojure.com
 

Now fixed on master. Thanks for the report!

Stu

Stuart Halloway
Clojure/core
http://clojure.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

lein repl newbie question

2011-09-23 Thread labwork07
I like the lein repl. However, when I try to exit I get this error below.  
Any ideas?

user= (System/exit 0)
Exception in thread Thread-3 java.lang.RuntimeException:  
java.lang.IndexOutOfBoundsException

at parsepcap.scrapeindex= (System/exit 0)
Exception in thread Thread-3 java.lang.RuntimeException:  
java.lang.IndexOutOfBoundsException

at clojure.lang.AFn.run(AFn.java:28)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.IndexOutOfBoundsException
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:102)
at java.io.OutputStreamWriter.write(OutputStreamWriter.java:190)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at  
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:90)
at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
at leiningen.repl$copy_out_loop.invoke(repl.clj:87)
at leiningen.repl$repl_client$fn__2971.invoke(repl.clj:93)
at clojure.lang.AFn.run(AFn.java:24)
... 1 more

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

Re: How to attach debugger on clojure's repl ?

2011-09-23 Thread Sam Aaron

On 23 Sep 2011, at 14:24, Hugo Duncan wrote:
 
 I've not actually tried running ritz from cake recently. Which version of 
 cake?

0.6.3

 
 I've also not tried running with 1.3.0-RC0.

I get the same issue (unknown task: ritz) with Clojure 1.2.0

 
 I imagine this is some issue preventing the cake task from loading.  I 
 believe cake logs its output somewhere - maybe you could check the cake logs 
 for ritz related messages?
 

Both the local .cake/cake.log and the global ~/.cake/.cake/cake.log logs don't 
report anything from ritz when attempting to run `cake ritz`.

 I'd be very happy to write up a Getting Started tutorial on the ritz wiki 
 if I can get things working.
 
 I'll gladly take you up on that :)

It would be a pleasure :-)

Sam

---
http://sam.aaron.name

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


Something missing from the clojure compiler's java annotation support for gen-class and defrecord? Am I driving while bouncing off the guard rails?

2011-09-23 Thread Warren Wood
Ideally when generating a java class from Clojure for interop
purposes, we should be able to generate any annotations that the
equivalent java code could generate.  Thus if a java class can
annotate a constructor parameter, then gen-class and defrecord should
be able to do that too.  (I'm trying to interoperate with some Spring
Framework stuff that expects to inject stuff into my class via an
annotated constructor parameter.  I'm trying to gradually introduce
clojure code into the project starting with this one class that has
that requirement. Maybe that's not a good idea to begin with, but I
always find it very tempting. It's probably a case of driving while
bouncing off the guard rails. :))

Did I put my constructor annotation in the wrong place in my example
below?  I also tried putting directly on the parameter of the -init
function.  If this is truly missing functionality, I may try to level
up enough to patch the clojure compiler, send in a CA, submit a pull
request...  But I think I have a ways to go to level up my clojure to
that level.

Many thanks in advance for any insights/feedback from the wonderful
clojure community.

(ns com.warrenthomaswood.MyGenClass
  (:gen-class :methods [[foo [^{Deprecated true} String] void]]
  :init init
  :constructors {[^{Deprecated true} String] []}))

(defn -init [word] (println word))

(defn -foo [this word] (println word))

;;; given the above clojure-generated class MyGenClass, and a plain
java class MyClass with a
;;; constructor parameter annotation as follows:

package com.warrenthomaswood;
public class MyClass { public MyClass(@Deprecated String s) { } }

;;; when I try to retrieve the annotations in a JUnit test, I can
retrieve the method parameter
;;; annotation from the clojure generated class using
MyGenClass.class.getMethods() and then calling
;;; getAnnotations() on the method.

;;; I can retrieve the constructor parameter annotation from the java
generated class using
;;; MyClass.class.getConstructors() and then calling getAnnotations on
the constructor

;;; but the clojure compiler does not seem to have a way of getting
the constructor parameter
;;; annotation into the byte code.  I can get annotations on the whole
constructor I think, but
;;; not on the individual parameters of the construct.

-- 
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: lein repl newbie question

2011-09-23 Thread Islon Scherer
Have you tried control+d?

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

:use :only support in ClojureScript now available

2011-09-23 Thread David Nolen
A lot people have been clamoring for this. This has been merged into master.

(:use [foo.bar :only [...]])

(:use-macros [foo.bar :only [...]])

Are now both supported! Thanks to all that helped out!

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

aquamacs, slime and clojure on OS X

2011-09-23 Thread Jake Penton
Sorry to raise something that has probably been asked and answered umpteen 
times. 

I have been looking forward to trying clojure for quite some time. I 
appreciate that clojure and its ecosystem is undergoing rapid 
development. However, I have spent the last day and a half trying to get 
either aquamacs or gnu emacs working with slime and clojure, with no 
success.

BTW, I have used aquamacs with slime and Common Lisp (ccl, sbcl) for a long 
time now. I know those are older, more stable languages, but good golly - I 
had aquamacs+slime+ccl set up in about an hour.

Is their a reliable set of instructions to set up slime with clojure 
somewhere?

I have followed instructions from a half dozen different web pages. They are 
rich in magic incantations which fail (possibly because I'm dense). I *think 
*I followed the instructions on the Getting Started with Emacs page linked 
to from the clojure site, but - it did not work. Perhaps my attitude is 
wrong, but the user comments on the Getting Started page basically 
demolished my confidence in the information there.

I won't post error messages yet, although it may come to that shortly.

I would prefer to use aquamacs, but would settle for GNU Emacs. What I want 
to start with is the simplest set of things that will give me a clojure REPL 
in aquamacs/emacs.

In the absence of reliable installation instructions (or perhaps even 
preferable to them), is there a description somewhere of the final target 
state that my system should be in? That is, I actually do NOT *really* want 
to use any of the following, unless absolutely required:

   - an Emacs Starter Kit
   - a development version of GNU Emacs, i.e. v.24
   - any kind of package manager for Emacs
   - any kind of project build system for clojure, i.e. leiningen

All of the above appear to me to be well-intended help, any or all of 
which have broken on me as I tried this. Instead I would prefer to know what 
files I need in what locations. But then, who am I to boss y'all around on 
how to help me ;-)

My setup:

   - Snow Leopard 10.6.8
   - aquamacs 2.3a
   - GNU Emacs 24
   - clojure and clojure-contrib from macports, whatever their latest is
   - Slime-related jar files and elisp files littered all over the place 
   that didn't do me any good


TIA.

- Jake -


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

Why visible in-transaction changes?

2011-09-23 Thread Denis Washington
Hi,

I really like the idea of grouping mutation in my programs into
transactions in order to reduce the number of possible states make
make reasoning about them easier (in the spirit of the mutable state
discussion of [1]) and thought that Clojure's dosync + refs might be
the ideal way to do this. However, I was disappointed to find out the
following:

  (def r (ref 1))

  (dosync
(alter r #(+ 1 %))
(println @r))

  (println @r)

   Output:
   2
   2

I would have hoped that changes to refs during an transaction wouldn't
affect the in-transaction value of the ref (that is, I would have
liked the code to print 1, then 2). This way, the view of the
program's state would always be guaranteed to be consistent, even
during a transaction, and there would be no fear of non-consistent in-
transaction states breaking anything. The way it is currently work in
Clojure, though, still requires one to take all such inconsistent
states into account, rendering them effectively useless for the kind
of state management I imagined.

(Note that I am not talking about multi-threading here; my objective
is to reduce the number of possible states in the single-threaded
case, and make sure that every computation is based upon a consistent
state.)

Why was this behavior chosen, instead of only making changes to refs
invisible until commited (even to the transaction commiting them)? I
believe that the latter approach would actually fit better to Clojure
in general. Maybe there could at least be an alternative dosync form
that acts like this?

Regards,
Denis

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


Re: Why visible in-transaction changes?

2011-09-23 Thread Stuart Halloway
 I would have hoped that changes to refs during an transaction wouldn't
 affect the in-transaction value of the ref (that is, I would have
 liked the code to print 1, then 2). This way, the view of the
 program's state would always be guaranteed to be consistent, even
 during a transaction, and there would be no fear of non-consistent in-
 transaction states breaking anything. The way it is currently work in
 Clojure, though, still requires one to take all such inconsistent
 states into account, rendering them effectively useless for the kind
 of state management I imagined.
 
 (Note that I am not talking about multi-threading here; my objective
 is to reduce the number of possible states in the single-threaded
 case, and make sure that every computation is based upon a consistent
 state.)
 
 Why was this behavior chosen, instead of only making changes to refs
 invisible until commited (even to the transaction commiting them)? I
 believe that the latter approach would actually fit better to Clojure
 in general. Maybe there could at least be an alternative dosync form
 that acts like this?
 
 Regards,
 Denis

There are a lot of scenarios that would become difficult or impossible with the 
semantics you propose.

On the other hand, what you want is quite simple to achieve: If you want 
consistent view of the the values of refs, deref them all at the start of the 
transaction.

Stu

Stuart Halloway
Clojure/core
http://clojure.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: aquamacs, slime and clojure on OS X

2011-09-23 Thread Mark Rathwell
Intentionally avoiding leiningen on ideological grounds will make
things more difficult and frustrating for yourself.  If you do want to
try it out, there are links below to get you started below.  You can
realistically be up and running with emacs and slime in less than an
hour.

lein:  https://github.com/technomancy/leiningen

lein tutorial:
https://github.com/technomancy/leiningen/blob/1.x/doc/TUTORIAL.md

swank-clojure:  https://github.com/technomancy/swank-clojure


On Thu, Sep 22, 2011 at 8:46 PM, Jake Penton jakepen...@gmail.com wrote:
 Sorry to raise something that has probably been asked and answered umpteen
 times.
 I have been looking forward to trying clojure for quite some time. I
 appreciate that clojure and its ecosystem is undergoing rapid
 development. However, I have spent the last day and a half trying to get
 either aquamacs or gnu emacs working with slime and clojure, with no
 success.
 BTW, I have used aquamacs with slime and Common Lisp (ccl, sbcl) for a long
 time now. I know those are older, more stable languages, but good golly - I
 had aquamacs+slime+ccl set up in about an hour.

 Is their a reliable set of instructions to set up slime with clojure
 somewhere?

 I have followed instructions from a half dozen different web pages. They are
 rich in magic incantations which fail (possibly because I'm dense). I think
 I followed the instructions on the Getting Started with Emacs page linked to
 from the clojure site, but - it did not work. Perhaps my attitude is wrong,
 but the user comments on the Getting Started page basically demolished my
 confidence in the information there.
 I won't post error messages yet, although it may come to that shortly.
 I would prefer to use aquamacs, but would settle for GNU Emacs. What I want
 to start with is the simplest set of things that will give me a clojure REPL
 in aquamacs/emacs.
 In the absence of reliable installation instructions (or perhaps even
 preferable to them), is there a description somewhere of the final target
 state that my system should be in? That is, I actually do NOT really want to
 use any of the following, unless absolutely required:

 an Emacs Starter Kit
 a development version of GNU Emacs, i.e. v.24
 any kind of package manager for Emacs
 any kind of project build system for clojure, i.e. leiningen

 All of the above appear to me to be well-intended help, any or all of
 which have broken on me as I tried this. Instead I would prefer to know what
 files I need in what locations. But then, who am I to boss y'all around on
 how to help me ;-)
 My setup:

 Snow Leopard 10.6.8
 aquamacs 2.3a
 GNU Emacs 24
 clojure and clojure-contrib from macports, whatever their latest is
 Slime-related jar files and elisp files littered all over the place that
 didn't do me any good

 TIA.

 - Jake -

 --
 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: Partitioning problem

2011-09-23 Thread Chouser
On Fri, Sep 23, 2011 at 7:51 AM, Michael Jaaka
michael.ja...@googlemail.com wrote:
 Hi!

 I have a sequence of natural numbers and I have to partition them into
 more or less equals N groups.
 Partitioning function is just a sum of numbers in a given group.

 My naive solution is to sort numbers descending then take each number
 and put into one of N groups in which sum of its elements with given
 number is the lowest. Here is the code: http://pastebin.com/Nw28FaRK

 So for input [ 1 2 34  54 12 23 5  2 3  1 2 12 11 12 32 67 ] and N = 5
 I get
 ([32 12 5 1 1] [34 12 2 2] [23 12 11 3 2] [54] [67])

 Do you know any better solution?

Seems like a good algorithm.  Here's another implementation:

(defn partition-into [f n coll]
  (map peek
   (reduce
 (fn [buckets x]
   (let [b (first buckets), b2 (conj (b 2) x)]
 (conj (disj buckets b) [(apply f b2) (b 1) b2])))
 (apply sorted-set (for [i (range n)] [0 i []]))
 (reverse (sort coll)

This only computes the sum once each time a partition is added to
(instead of multiple times during the sort), and because it's using a
sorted set only has to compare the sum to log(n) other buckets each
time instead of doing an n*log(n) sort-by.

--Chouser

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


Revelytix hiring Clojure developers

2011-09-23 Thread David McNeil
Revelytix [1] is hiring Clojure developers for full-time, direct
employment in St. Louis, Missouri and Baltimore, Maryland USA. We are
a relatively small team of developers building semantic technology
based, data integration products. We understand that applicants may
not have deep Clojure or semantic technology experience, but this is a
great place to get it!

If you are interested, email a note and your resume to careers _at_
revelytix.com.

[1] http://revelytix.com/

Thanks.
-David McNeil

-- 
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: Partitioning problem

2011-09-23 Thread Michael Jaaka
Good stuff! Thanks! Especially the trick with indexing so the set accepts 
first state of buckets.

Beside this you are ignoring the current candidate computation along rest 
and
just put him into nearest bucket. In mine I'm first looking for the 
potentially the best and finally put him over there.
But in general yours looks better is also correct and of course is less 
computing expensive and as output gives already sorted buckets.

First sort can be (sort-by f coll) instead (sort coll)

-- 
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: aquamacs, slime and clojure on OS X

2011-09-23 Thread Phil Hagelberg
On Thu, Sep 22, 2011 at 5:46 PM, Jake Penton jakepen...@gmail.com wrote:
 In the absence of reliable installation instructions (or perhaps even
 preferable to them), is there a description somewhere of the final target
 state that my system should be in? That is, I actually do NOT really want to
 use any of the following, unless absolutely required:

 an Emacs Starter Kit
 a development version of GNU Emacs, i.e. v.24
 any kind of package manager for Emacs
 any kind of project build system for clojure, i.e. leiningen

It's not really feasible to have a slime setup that's compatible with
both CL and Clojure without using Leiningen. The path of least
resistance is shown in the swank-clojure readme. The tl;dr version
follows:

  * install Leiningen
  * install the swank-clojure plugin: lein plugin install swank-clojure 1.3.2
  * install clojure-mode (you can do this from git)
  * navigate to a project and do M-x clojure-jack-in

That's all it takes. It might work with Aquamacs, but since that fork
is not portable it's impossible for me to test on it. So GNU Emacs is
recommended.

If you absolutely cannot use Leiningen then you will have to manually
juggle between the CL-compatible versions of slime packages and the
Clojure-compatible ones, which from what I've heard from CL users
sounds like a nightmare. (This is due to the fact that the Slime
developers only target CL and refuse to make stable releases.) If you
only need Clojure support then it's a little easier to get along
without Leiningen, but it's still a pain in the neck. But the
swank-clojure readme does explain embedding swank in your own
application. You just need to manually load the slime elisp files from
the swank-clojure git repository.

-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: Recursion/Algorithm Question

2011-09-23 Thread ax2groin
Thanks,

That (along with returning the completed path via (list)) nailed it. I
thought I'd tried concat at some point, but that might have been with
another problem I've been tackling.

-- 
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: Partitioning problem

2011-09-23 Thread Alan Malloy
In the general case this is an NP-complete problem (ie, no algorithm
you can write will be good enough), but many simpler cases can be
solved quickly by some heuristic or other. See
http://en.wikipedia.org/wiki/Partition_problem#Methods for some
examples.

On Sep 23, 4:51 am, Michael Jaaka michael.ja...@googlemail.com
wrote:
 Hi!

 I have a sequence of natural numbers and I have to partition them into
 more or less equals N groups.
 Partitioning function is just a sum of numbers in a given group.

 My naive solution is to sort numbers descending then take each number
 and put into one of N groups in which sum of its elements with given
 number is the lowest. Here is the code:http://pastebin.com/Nw28FaRK

 So for input [ 1 2 34  54 12 23 5  2 3  1 2 12 11 12 32 67 ] and N = 5
 I get
 ([32 12 5 1 1] [34 12 2 2] [23 12 11 3 2] [54] [67])

 Do you know any better solution?

-- 
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: aquamacs, slime and clojure on OS X

2011-09-23 Thread Justin Kramer


   * install Leiningen
   * install the swank-clojure plugin: lein plugin install swank-clojure 
 1.3.2
   * install clojure-mode (you can do this from git)
   * navigate to a project and do M-x clojure-jack-in

 That's all it takes. It might work with Aquamacs, but since that fork
 is not portable it's impossible for me to test on it. So GNU Emacs is
 recommended.

For what it's worth, I use this setup with Aquamacs and everything works 
perfectly.

Justin

-- 
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: Something missing from the clojure compiler's java annotation support for gen-class and defrecord? Am I driving while bouncing off the guard rails?

2011-09-23 Thread Stuart Sierra
Hi Warren,

Clojure doesn't try to be support every possible feature of Java when 
generating Java classes, it just provides enough for interop purposes. 
Annotations have always been a weak area. I don't know if annotations on 
constructor arguments in `gen-class` are supported, but my suspicion is they 
are not.

A patch would be possible - the `gen-class` code is written mostly in 
Clojure. But the easier solution for now would be to write a small class in 
Java and `:extend` it in your gen-class.

-Stuart Sierra
clojure.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: Something missing from the clojure compiler's java annotation support for gen-class and defrecord? Am I driving while bouncing off the guard rails?

2011-09-23 Thread Warren Wood
Excellent, thanks!   And thanks for sharing the taxi from Strange Loop
to STL tuesday night! :)

On Sep 23, 2:07 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote:
 Hi Warren,

 Clojure doesn't try to be support every possible feature of Java when
 generating Java classes, it just provides enough for interop purposes.
 Annotations have always been a weak area. I don't know if annotations on
 constructor arguments in `gen-class` are supported, but my suspicion is they
 are not.

 A patch would be possible - the `gen-class` code is written mostly in
 Clojure. But the easier solution for now would be to write a small class in
 Java and `:extend` it in your gen-class.

 -Stuart Sierra
 clojure.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: Why visible in-transaction changes?

2011-09-23 Thread Denis Washington

Am 23.09.2011 17:25, schrieb Stuart Halloway:

I would have hoped that changes to refs during an transaction wouldn't
affect the in-transaction value of the ref (that is, I would have
liked the code to print 1, then 2). This way, the view of the
program's state would always be guaranteed to be consistent, even
during a transaction, and there would be no fear of non-consistent in-
transaction states breaking anything. The way it is currently work in
Clojure, though, still requires one to take all such inconsistent
states into account, rendering them effectively useless for the kind
of state management I imagined.

(Note that I am not talking about multi-threading here; my objective
is to reduce the number of possible states in the single-threaded
case, and make sure that every computation is based upon a consistent
state.)

Why was this behavior chosen, instead of only making changes to refs
invisible until commited (even to the transaction commiting them)? I
believe that the latter approach would actually fit better to Clojure
in general. Maybe there could at least be an alternative dosync form
that acts like this?

Regards,
Denis


There are a lot of scenarios that would become difficult or impossible
with the semantics you propose.


Do you have an example?


On the other hand, what you want is quite simple to achieve: If you want
consistent view of the the values of refs, deref them all at the start
of the transaction.


Fair enough, but if a transaction is split among several functions, this 
becomes difficult.


Regards,
Denis

--
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: ClojureScript: Problem getting Browser Repl Env to Work

2011-09-23 Thread Volker Schlecht
No unfortunately not, with neither FF nor Chrome, and using the
Javascript Debuggers of both ...

On Sep 21, 10:27 pm, David Nolen dnolen.li...@gmail.com wrote:
 Do you get any JS errors from the browser at the JS console?

 David

 On Wed, Sep 21, 2011 at 4:23 PM, Volker Schlecht
 volker.schle...@gmail.comwrote:







  Hi,

  no, I've tried it against - essentially - a manual replication of the
  built-in sample. But thanks for the hint, because the sample does
  work, but so far I haven't figured out the deciding difference ... at
  least I have a reference now to compare against.

  Thanks!
  Volker

  On Sep 21, 7:26 pm, David Nolen dnolen.li...@gmail.com wrote:
   Hmm in my experience

   1. Start the Browser REPL
   2. Open your project's main html file (index.html)

   And you're good to go. Sometimes you need to refresh the browser but
  that's
   about it as far as I can tell.

   Are you trying this against the built in sample?

   David

   On Tue, Sep 20, 2011 at 4:32 PM, Volker Schlecht
   volker.schle...@gmail.comwrote:

Hi everybody,

I'm trying out the new browser repl-environment using both the
tutorial (https://github.com/clojure/clojurescript/wiki/The-REPL-and-
Evaluation-Environments) but so far am unable to get it to work.

Using current (as of the writing of this mail) master from github, and
following the Steps in the tutorial:

1. Starting up the repl works, leads me straight to the repl (i.e.
allows me to enter an expression). I remember trying a previous
version of the in-browser repl which worked for me, but in which i
couldn't enter anything before the browser initiated a connection. The
docs mention a wait for a browser connection being neccesary here ...

2. Setting up the XPC communication works, i.e. I see the initial GET
request receiving sensible-looking javascript, and I see a POST of
ready being answered by a goog.provide('user').

3. That's it however - connection closed. Non-surprisingly, entering
any expression only hangs the REPL.

Using curl as per browser.clj:

1. Startting REPL works, as above
2. curl -v -d readyhttp://localhost:9000/respondswith

 HTTP/1.1 200 OK
 Server: ClojureScript REPL
 Content-Type: text/javascript; charset=utf-8
 Content-Length: 26

* Connection #0 to host localhost left intact
* Closing connection #0
goog.provide('cljs.user');

3. Looking not too bad except for the closed connection, so entering
(+ 1 1) hangs the REPL

4. curl -v -d 2http://127.0.0.1:9000thenresponds with the
compiled javascript as far as I can tell:

 HTTP/1.1 200 OK
 Server: ClojureScript REPL
 Content-Type: text/javascript; charset=utf-8
 Content-Length: 61

cljs.core.pr_str.call(null,cljs.core._PLUS_.call(null,1,1));
* Connection #0 to host localhost left intact
* Closing connection #0

To me it seems that something is awry with keeping that connection
really open on my system.

I'm on Debian SID and tried with firefox 6 and 7-beta as well as with
google-chrome. JDK is Oracle Java 1,6.0_26-b03, ClojureScript is as
stated above a vanilla copy of current master, freshly bootstrapped.

Reverting to select previous states of ClojureScript (i.e. right after
clojure.browser was merged into master, and right before) yielded no
better results, except that those didn't get me to a REPL prompt at
all and were stuck at Server started The last and only time I
had that working was with the clojure.browser branch from some time
around August 26th.

What am I doing wrong? Any hints?

regards,
Volker

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

-- 
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: ClojureScript: Problem getting Browser Repl Env to Work

2011-09-23 Thread David Nolen
Are you getting any missing resources errors?

On Fri, Sep 23, 2011 at 4:03 PM, Volker Schlecht
volker.schle...@gmail.comwrote:

 No unfortunately not, with neither FF nor Chrome, and using the
 Javascript Debuggers of both ...

 On Sep 21, 10:27 pm, David Nolen dnolen.li...@gmail.com wrote:
  Do you get any JS errors from the browser at the JS console?
 
  David
 
  On Wed, Sep 21, 2011 at 4:23 PM, Volker Schlecht
  volker.schle...@gmail.comwrote:
 
 
 
 
 
 
 
   Hi,
 
   no, I've tried it against - essentially - a manual replication of the
   built-in sample. But thanks for the hint, because the sample does
   work, but so far I haven't figured out the deciding difference ... at
   least I have a reference now to compare against.
 
   Thanks!
   Volker
 
   On Sep 21, 7:26 pm, David Nolen dnolen.li...@gmail.com wrote:
Hmm in my experience
 
1. Start the Browser REPL
2. Open your project's main html file (index.html)
 
And you're good to go. Sometimes you need to refresh the browser but
   that's
about it as far as I can tell.
 
Are you trying this against the built in sample?
 
David
 
On Tue, Sep 20, 2011 at 4:32 PM, Volker Schlecht
volker.schle...@gmail.comwrote:
 
 Hi everybody,
 
 I'm trying out the new browser repl-environment using both the
 tutorial (
 https://github.com/clojure/clojurescript/wiki/The-REPL-and-
 Evaluation-Environments) but so far am unable to get it to work.
 
 Using current (as of the writing of this mail) master from github,
 and
 following the Steps in the tutorial:
 
 1. Starting up the repl works, leads me straight to the repl (i.e.
 allows me to enter an expression). I remember trying a previous
 version of the in-browser repl which worked for me, but in which i
 couldn't enter anything before the browser initiated a connection.
 The
 docs mention a wait for a browser connection being neccesary here
 ...
 
 2. Setting up the XPC communication works, i.e. I see the initial
 GET
 request receiving sensible-looking javascript, and I see a POST of
 ready being answered by a goog.provide('user').
 
 3. That's it however - connection closed. Non-surprisingly,
 entering
 any expression only hangs the REPL.
 
 Using curl as per browser.clj:
 
 1. Startting REPL works, as above
 2. curl -v -d readyhttp://localhost:9000/respondswith
 
  HTTP/1.1 200 OK
  Server: ClojureScript REPL
  Content-Type: text/javascript; charset=utf-8
  Content-Length: 26
 
 * Connection #0 to host localhost left intact
 * Closing connection #0
 goog.provide('cljs.user');
 
 3. Looking not too bad except for the closed connection, so
 entering
 (+ 1 1) hangs the REPL
 
 4. curl -v -d 2http://127.0.0.1:9000thenresponds with the
 compiled javascript as far as I can tell:
 
  HTTP/1.1 200 OK
  Server: ClojureScript REPL
  Content-Type: text/javascript; charset=utf-8
  Content-Length: 61
 
 cljs.core.pr_str.call(null,cljs.core._PLUS_.call(null,1,1));
 * Connection #0 to host localhost left intact
 * Closing connection #0
 
 To me it seems that something is awry with keeping that connection
 really open on my system.
 
 I'm on Debian SID and tried with firefox 6 and 7-beta as well as
 with
 google-chrome. JDK is Oracle Java 1,6.0_26-b03, ClojureScript is as
 stated above a vanilla copy of current master, freshly
 bootstrapped.
 
 Reverting to select previous states of ClojureScript (i.e. right
 after
 clojure.browser was merged into master, and right before) yielded
 no
 better results, except that those didn't get me to a REPL prompt at
 all and were stuck at Server started The last and only time I
 had that working was with the clojure.browser branch from some time
 around August 26th.
 
 What am I doing wrong? Any hints?
 
 regards,
 Volker
 
 --
 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

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to 

Re: Re: lein repl newbie question

2011-09-23 Thread labwork07

well, I was doing control+c which works too. How is control+d different?

On , Islon Scherer islonsche...@gmail.com wrote:

Have you tried control+d?






--



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: Re: lein repl newbie question

2011-09-23 Thread Islon Scherer
control+d exits clojure repl

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

Re: Re: lein repl newbie question

2011-09-23 Thread Bronsa
labwor...@gmail.com wrote:

 well, I was doing control+c which works too. How is control+d different?


 On , Islon Scherer islonsche...@gmail.com wrote:
  Have you tried control+d?
 
 
 
 
  --
 
  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

ctrl-c sends a SIGINT while ctrl-d sends an EOF

-- 
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: Something missing from the clojure compiler's java annotation support for gen-class and defrecord? Am I driving while bouncing off the guard rails?

2011-09-23 Thread Tarantoga
Deftype handles annotations and all the other features of java
classes. Have a look here for an example:
http://translate.google.com/translate?sl=autotl=enjs=nprev=_thl=enie=UTF-8layout=2eotf=1u=http%3A%2F%2Fmy-clojure.blogspot.com%2F2011%2F06%2Fweb-clojure.html

On Sep 23, 10:11 pm, Warren Wood warrenthomasw...@yahoo.com wrote:
 Excellent, thanks!   And thanks for sharing the taxi from Strange Loop
 to STL tuesday night! :)

 On Sep 23, 2:07 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote:







  Hi Warren,

  Clojure doesn't try to be support every possible feature of Java when
  generating Java classes, it just provides enough for interop purposes.
  Annotations have always been a weak area. I don't know if annotations on
  constructor arguments in `gen-class` are supported, but my suspicion is they
  are not.

  A patch would be possible - the `gen-class` code is written mostly in
  Clojure. But the easier solution for now would be to write a small class in
  Java and `:extend` it in your gen-class.

  -Stuart Sierra
  clojure.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: issues to build clojure-1.3.0-RC0 with JDK-1.7

2011-09-23 Thread Jochen Schmitt

Am 23.09.11 16:41, schrieb Stuart Halloway:

Hi Jochen, thanks for this report.

It looks like the annotations tests are failing due to changes from 
JDK 1.6 to 1.7. They were brittle tests to begin with and should 
probably be removed or replaced.


This also revealed to me that our JDK test builds on Hudson were not 
actually building properly. That is now fixed, so we can confirm this 
issue on Hudson: 
http://build.clojure.org/view/Clojure/job/clojure-test-matrix/


-Stuart Sierra
clojure.com http://clojure.com



Now fixed on master. Thanks for the report!

Can you tell me the exact commit number, so I can apply the patch to the 
Fedora package.


Best Regards:

Jochen Schmitt

--
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: issues to build clojure-1.3.0-RC0 with JDK-1.7

2011-09-23 Thread Stuart Halloway
 Hi Jochen, thanks for this report.
 
 It looks like the annotations tests are failing due to changes from JDK 1.6 
 to 1.7. They were brittle tests to begin with and should probably be 
 removed or replaced.
 
 This also revealed to me that our JDK test builds on Hudson were not 
 actually building properly. That is now fixed, so we can confirm this issue 
 on Hudson: http://build.clojure.org/view/Clojure/job/clojure-test-matrix/
 
 -Stuart Sierra
 clojure.com
 
 
 Now fixed on master. Thanks for the report!
 
 Can you tell me the exact commit number, so I can apply the patch to the 
 Fedora package.
 
 Best Regards:
 
 Jochen Schmitt

The SHA for that commit is fcc3d799cc33c920720fa512b18901e2f2a81dda .

But you might want to leapfrog that and just grab the clojure-1.3.0 tag. :-)

Stu


Stuart Halloway
Clojure/core
http://clojure.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

[ANN] Clojure 1.3 Released

2011-09-23 Thread Christopher Redinger


We are pleased to announce today the release of Clojure 1.3:

  http://clojure.org/downloads

For maven/leiningen users, your settings are now:

  :dependencies [[org.clojure/clojure 1.3.0]]

This release includes many significant features and performance
enhancements, documented here:

  https://github.com/clojure/clojure/blob/1.3.x/changes.txt 

The number of Clojure contributors continues to grow. Thanks to all
the people whose code is included in this release:

  Aaron Bedra
  Alan Dipert
  Alex Miller
  Alex Ott
  Alex Redington
  Alexander Taggart
  Allen Rohner
  Ben Smith-Mannschott
  Benjamin Teuber
  Brian Hurt
  Chas Emerick
  Chouser
  Christophe Grand
  Christopher Redinger
  Colin Jones
  Cosmin Stejerean
  Daniel Solano Gómez
  David Miller
  David Powell
  David Rupp
  Fogus
  George Jahad
  Jason Wolfe
  Juha Arpiainen
  Justin Balthrop
  Kevin Downey
  Luke VanderHart
  Meikel Brandmeyer
  Michał Marczyk
  Mike Hinchey
  Nicolas Buduroi
  Paul Michael Bauer
  Paul Stadig
  Phil Hagelberg
  Rasmus Svensson
  Rich Hickey
  Robert Lachlan
  Stephen C. Gilardi
  Stuart Halloway
  Stuart Sierra
  Timothy Pratley
  Tom Faulhaber
  
Thanks to all involved!


Chris
Clojure/core

-- 
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: Addition of new a priori distinct element to a vector

2011-09-23 Thread F Lengyel


On Sep 23, 2:20 am, Kevin Livingston
kevinlivingston.pub...@gmail.com wrote:
 what's the actual use case where you want this?
 it seems pretty weird just on it's own.  it may in practice be more
 clever than other solutions, but that's not clear yet.  if you just
 want a unique symbol there's (gensym)

For the sake of illustration, this function will chunk a vector into
vectors of identical elements, in order (no assurance that it won't
be weird in context):

 (defn grp [s]
(- (reduce
 (fn [[v chunk] elt]
 (if (or (empty? chunk) (= elt (first chunk)))
 [v (conj chunk elt)]
 [(conj v chunk) [elt]]))
 [[][]] (conj s s))
(first)))

user (grp [])
[]
user (grp [1 2 3 2 2 3])
[[1] [2] [3] [2 2] [3]]
user (grp [1 1 4 4 4])
[[1 1] [4 4 4]]
user

 regarding vectors, I found this a helpful read a while back, it's a
 few years old, but I think it's still accurate, and may help you get a
 picture of what's under the 
 hood.http://blog.higher-order.net/2009/02/01/understanding-clojures-persis...

 Kevin


That's helpful, thank you.

-- 
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: Addition of new a priori distinct element to a vector

2011-09-23 Thread Alan Malloy
On Sep 23, 3:02 pm, F Lengyel florian.leng...@gmail.com wrote:
 On Sep 23, 2:20 am, Kevin Livingston

 kevinlivingston.pub...@gmail.com wrote:
  what's the actual use case where you want this?
  it seems pretty weird just on it's own.  it may in practice be more
  clever than other solutions, but that's not clear yet.  if you just
  want a unique symbol there's (gensym)

 For the sake of illustration, this function will chunk a vector into
 vectors of identical elements, in order (no assurance that it won't
 be weird in context):

  (defn grp [s]
         (- (reduce
              (fn [[v chunk] elt]
                  (if (or (empty? chunk) (= elt (first chunk)))
                      [v (conj chunk elt)]
                      [(conj v chunk) [elt]]))
              [[][]] (conj s s))
             (first)))

(partition-by identity s) is simpler unless you have some very
compelling reason to need vectors?


 user (grp [])
 []
 user (grp [1 2 3 2 2 3])
 [[1] [2] [3] [2 2] [3]]
 user (grp [1 1 4 4 4])
 [[1 1] [4 4 4]]
 user

  regarding vectors, I found this a helpful read a while back, it's a
  few years old, but I think it's still accurate, and may help you get a
  picture of what's under the 
  hood.http://blog.higher-order.net/2009/02/01/understanding-clojures-persis...

  Kevin

 That's helpful, thank you.

-- 
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: aquamacs, slime and clojure on OS X

2011-09-23 Thread MarisO
use this script to download everything you need for clojure
development on emacs (aquamacs)

git clone https://github.com/technomancy/clojure-mode.git
wget -P framemove  http://www.emacswiki.org/emacs/download/framemove.el
wget -P paredit http://mumble.net/~campbell/emacs/paredit.el
wget --no-check-certificate 
https://github.com/downloads/magit/magit/magit-1.0.0.tar.gz
mkdir magit
tar --strip-components=1 --directory=magit -xzf magit-1.0.0.tar.gz
wget 
http://download.savannah.gnu.org/releases/color-theme/color-theme-6.6.0.tar.gz
mkdir color-theme
tar --strip-components=1 --directory=color-theme -xzf color-
theme-6.6.0.tar.gz

my init.el:

;; clojure-mode
(add-to-list 'load-path ~/.emacs.d/clojure-mode)
(require 'clojure-mode)

;; paredit
(add-to-list 'load-path ~/.emacs.d/paredit)
(require 'paredit)

;; color theme
(add-to-list 'load-path ~/.emacs.d/color-theme)
(require 'color-theme)
(eval-after-load color-theme
  '(progn
 (color-theme-initialize)))

; windmove and framemove
(add-to-list 'load-path ~/.emacs.d/framemove)
(require 'framemove)
(windmove-default-keybindings)
(setq framemove-hook-into-windmove t)

;; customizations
(menu-bar-mode -1)
(show-paren-mode t)
(if
(boundp 'tool-bar-mode)
(tool-bar-mode -1))
(if
(boundp 'scroll-bar-mode)
(scroll-bar-mode -1))

;; color profiles
(defun color-dark () (interactive)
  (global-hl-line-mode 1)
  (color-theme-deep-blue)
  (set-face-foreground 'minibuffer-prompt #9df0f6)
  (set-face-background 'hl-line #203e5e))

;; shell fix
(autoload 'ansi-color-for-comint-mode-on ansi-color nil t)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)

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


Re: Why visible in-transaction changes?

2011-09-23 Thread Stefan Kamphausen
Hi,

On Friday, September 23, 2011 5:25:34 PM UTC+2, stuart@gmail.com wrote:

 I would have hoped that changes to refs during an transaction wouldn't
 affect the in-transaction value of the ref


you usually don't want that.  When you start working on more than one value 
in a transaction (and that's the point -- otherwise you'd use an atom) you 
will most probably want to use the in-transaction value like a common 
state-changing variable.  It just feels more natural.

Imagine a genetic algorithm which creates new individuals and calculates 
their fitness in parallel.  After one thread created a new indiv and 
computed the fitness it will want to save that indiv to The Population.  
However, there may be a monitor in place that also updates the list of the 
best 10 indivs in the population just within the same transaction.  This 
might want to sort the new Population, including the new indiv, and return 
the best 10.  

Ah, words fail me...  I think, my main point is: start using more than one 
Ref in a coordinated manner, because that's what they are for.  Maybe you'll 
see.  (And, of course, maybe you'll stick with your view ;-).

 

 (that is, I would have
 liked the code to print 1, then 2). This way, the view of the
 program's state would always be guaranteed to be consistent, 


But you are creating a new consistent state in minor steps that you, in your 
code, know how to control, and that you want to be atomic *from the 
outside*.  STM ensures that the changing of as many Refs as you need will 
appear atomic from outside the transaction.
 

 even
 during a transaction, and there would be no fear of non-consistent in-
 transaction states breaking anything. The way it is currently work in
 Clojure, though, still requires one to take all such inconsistent
 states into account, rendering them effectively useless for the kind
 of state management I imagined.


I'd be interested in reading, what you want to achieve.
 

 (Note that I am not talking about multi-threading here; my objective
 is to reduce the number of possible states in the single-threaded
 case, and make sure that every computation is based upon a consistent
 state.)


Huh?  It is probably too late in my time-zone to fully understand, what 
you'd like to do.  But why would you want to use a technology that was made 
to deal with state changes from different threads for guarding a 
single-threaded application?
 



Kind regards,
Stefan

-- 
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: aquamacs, slime and clojure on OS X

2011-09-23 Thread Durgesh Mankekar
+1 here. These instructions have worked for me with Aquamacs.

On Sep 23, 2011, at 2:46 PM, Justin Kramer wrote:

  * install Leiningen
  * install the swank-clojure plugin: lein plugin install swank-clojure 1.3.2
  * install clojure-mode (you can do this from git)
  * navigate to a project and do M-x clojure-jack-in

That's all it takes. It might work with Aquamacs, but since that fork
is not portable it's impossible for me to test on it. So GNU Emacs is
recommended.

For what it's worth, I use this setup with Aquamacs and everything works 
perfectly.

Justin

-- 
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: trace-forms macro

2011-09-23 Thread Luc Prefontaine
Hi Jonathan,

I am moving the trace contrib stuff to 1.3. I would like to include your 
trace-forms
macro in it. Feeling ok with this ? Comments ? 

The issues you underlined are not runtime errors, they are compilation errors.
There's not much you can do to trap these.
The macro is still valuable for runtime tracing.

Luc P.

On Mon, 12 Sep 2011 11:31:39 +0200
Jonathan Fischer Friberg odysso...@gmail.com wrote:

 Hello,
 
 I made a small macro, if anyone is interested.
 https://gist.github.com/1209498
 
 It wraps one or more forms and if an exception is thrown,
 prints the form that caused it, and throws the exception itself.
 
 Examples:
 
 user= (trace-forms 3)
 3
 
 user= (trace-forms (+ 6 (/ 9 0)))
 java.lang.ArithmeticException: Divide by zero (NO_SOURCE_FILE:9)
 Form failed: (/ 9 0)
 Form failed: (+ 6 (/ 9 0))
 
 user= (trace-forms (let [a 0 b (/ 9 a)] b))
 java.lang.ArithmeticException: Divide by zero (NO_SOURCE_FILE:75)
 Form failed: (/ 9 a)
 Form failed: (let* [a 0 b (/ 9 a)] b)
 Form failed: (let [a 0 b (/ 9 a)] b)
 
 Issues:
 
 user= (trace-forms (let [b (/ 9 a)] b))
 java.lang.Exception: Unable to resolve symbol: a in this context
 (NO_SOURCE_FILE:94)
 
 user= (trace-forms (let [a (java.lang.DoesNotExist.)] a))
 java.lang.ClassNotFoundException: java.lang.DoesNotExist
 (NO_SOURCE_FILE:93)
 
 
 
 Thoughts?
 
 Jonathan
 



-- 
Luc P.


The rabid Muppet

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