Re: {:new "ClojureScript One TodoMVC" }

2012-10-05 Thread Wei Hsu
Thanks for sharing! I found it quite helpful.

On Tuesday, October 2, 2012 1:34:56 AM UTC-7, Pierre-Henry Perret wrote:
>
> The best way to learn is to practice !
>
> So I have choosed to make the *TodoMVC* template  (see [0]) application 
> with *ClojureScript One* and *Enfocus*. ( see [1] for running app )
>
> What I could say now, is that CjOne is a little hard to embrace, but when 
> it's done , this is a real pleasure to work with.
>
> (I havent used the api functionalities in the sample, *todos* are saved 
> on local repo)
>
> The hard part was to integrate *Enfocus*. 
> The whole view is done with Enfocus which rocks !
>
> For those interested in code, see [2].
> ___
> [0] http://todomvc.com
> [1] http://todomvc.herokuapp.com
> [2] https://github.com/phperret/cjone-todomvc.git
>

-- 
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: mapv-in or map-in?

2012-10-05 Thread Gijs S.
 

Look at clojure.walk for mapping functions over nested structures:

(defn mapv-in [f coll]

  (clojure.walk/prewalk #(if (coll? %) % (f %)) coll))

Clojure walk api: http://clojure.github.com/clojure/clojure.walk-api.html

On Friday, October 5, 2012 7:58:30 AM UTC+2, nchurch wrote:
>
> I ended up needing the following utility, modified from the Clojure 
> source: 
>
> (defn mapv-in 
>   "maps f over a nested vector structure" 
>   ([f coll] 
> (let [f #(if (coll? %)(mapv-in f %)(f %))] 
>  (-> (reduce (fn [v o] (conj! v (f o))) (transient []) coll) 
>  persistent! 
>
> I wrote just as much as I needed.  Has anyone else needed to map some 
> function over nested structures?  Is there some standard 
> implementation out there? 
>

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

nth performance (was: performance in versions >= 1.4.0)

2012-10-05 Thread Karsten Schmidt
I understand the O(n) aspect, however this was also true for 1.3.0. And
since nth is used to obtain arguments in every single destructuring call,
it seems to me that its performance should not just suddenly be allowed to
drop and especially this drastically. New versions of a software should be
equal or faster than a predecessor, not the way round, no?

I've also seen the checks for RandomAccess and Sequential and by simply
moving them to the top (after the null check) of the long if-then cascade
in RT.nthFrom(), the old performance is restored. I will open a ticket and
submit a patch, but have to send in the CA first.

Thoughts? Does no one else find this is an issue that our beloved Clojure
has become slower because of this?

K.

On 4 Oct 2012 12:24, "Ben Smith-Mannschott"  wrote:

> nth only promises O(n) performance for all things sequential. However,
> the implementation on master in RT.java appears to special case
> indexed and random-access collections for faster access, so I'm not
> sure why you're seeing such a difference. You could try using get in
> place of nth, though from reading the source I'm not sure why it would
> produce results that are any different from what you're already
> seeing.
>
> The code that looks like it runs when you call nth on a vector has
> been in Clojure since:
>
> # commit ff27522840fb3c1681c331ad1fb44a313bd44e0a
> # Author: Rich Hickey 
> # Date:   2009-05-28 13:42:16 +
> #
> # first cut of chunked seqs
> # Chunked seqs, initial Java-side support
>
> So, I'm not finding any easy explanation for the performance
> difference you're seeing.
>
> Color me confused.
>
> // Ben
>
>
> On Thu, Oct 4, 2012 at 12:33 PM, Karsten Schmidt  wrote:
> > Okay, after several hours of more testing & profiling it seems the
> culprit
> > is the implementation of (nth) - and IMHO this is quite a biggie:
> >
> > (use 'macrochrono.core) ; only used for bench macro below
> >
> > (def t [[0 0] [100 0] [100 100] [[0 0] 1 100]])
> >
> > (defn foo [[a b c [[dx dy] r x2]] [px py]]
> >   (let [xx (- dx px) yy (- dy py)]
> > (< (+ (* xx xx) (* yy yy)) r)))
> >
> > 1.3.0
> >
> > user=> (bench 100 (dotimes [i 10] (foo t [i i])))
> > {:median 12.647, :max 31.255, :min 11.365, :avg 12.731339}
> >
> > 1.4.0:
> >
> > (bench 100 (dotimes [i 10] (foo t [i i])))
> > {:median 21.574, :max 32.243, :min 18.031, :avg 22.326779}
> >
> > 1.5.0-master-SNAPSHOT:
> >
> > (bench 100 (dotimes [i 10] (foo t [i i])))
> > {:median 21.429, :max 106.704, :min 17.7769997, :avg 22.94385}
> >
> > VisualVM shows most of the time is spent in calls to nth, which makes
> sense
> > since the function makes heavy use of destructuring.
> >
> > However, could someone please explain why its implementation is now
> almost
> > half the speed as compared to 1.3.0? nth is such a fundamental function
> that
> > it should not show such degradation in performance. I'm about to dig
> through
> > the commit logs to find out more, but that's gonna take a while and I
> hope
> > someone from Clojure/Core can shed some light instead.
> >
> > Proposals for workarounds are appreciated too (apart from avoiding
> > destructuring)... Moving & reducing destructuring in the inner (let)
> > improves it somewhat, but not much and makes the code less legible:
> >
> > (defn foo2 [t p]
> >   (let [[d r x2] (t 3)
> > xx (- (d 0) (p 0)) yy (- (d 0) (p 0))]
> > (< (+ (* xx xx) (* yy yy)) r)))
> >
> > 1.4.0
> >
> > user=> (bench 100 (dotimes [i 10] (foo2 t [i i])))
> > {:median 17.122, :max 108.78, :min 14.293, :avg 19.7231707}
> >
> > 1.5.0-master-SNAPSHOT
> >
> > user=> (bench 100 (dotimes [i 10] (foo2 t [i i])))
> > {:median 17.146, :max 93.476999, :min 13.777, :avg
> > 18.9884803}
> >
> > Many thanks!
> >
> > K.
> >
> > --
> > 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 f

Re: == is not transitive?

2012-10-05 Thread Jean Niklas L'orange


On Friday, October 5, 2012 2:39:05 AM UTC+2, Ben wrote:
>
> user> [(== 0 0.0) (== 0.0 0.0M) (== 0.0M 0)] 
> [true true false] 
>

When passing two arguments to ==, == will be transitive.
 

> user> [(== 0 0.0 0.0M) (== 0 0.0M 0.0) (== 0.0 0 0.0M) (== 0.0 0.0M 0) 
> (== 0.0M 0.0 0) (== 0.0M 0 0.0)] 
> [true false false false true false] 
>

This is more of a problem with number equality, not the transitivity of ==. 
(== x1 x2 x3 ... xn) can be rewritten as (and (== x1 x2) (== x2 x3) ... (== 
xn-1 xn)). 

So if you compare (== x y z), then if x = y, then the result of (== x z) 
and (== y z) should be equivalent, considering the numbers are, well, 
numbers.

I believe the issue lies within the bigdec-parsing, which seems to have two 
zeroes: (== 0M 0.0M) returns false, and their hashcode (0 and 1, 
respectively) are different.
 

-- 
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: nth performance (was: performance in versions >= 1.4.0)

2012-10-05 Thread Meikel Brandmeyer (kotarak)
Hi,

Am Freitag, 5. Oktober 2012 10:58:05 UTC+2 schrieb Karsten Schmidt:
>
> I've also seen the checks for RandomAccess and Sequential and by simply 
> moving them to the top (after the null check) of the long if-then cascade 
> in RT.nthFrom(), the old performance is restored. I will open a ticket and 
> submit a patch, but have to send in the CA first.
>
I'm a bit surprised about this, because vectors are Indexed. So they should 
not hit nthFrom() at all, since this case is handled in nth(). So changing 
nthFrom() should not have any impact on the speed of vector destructuring.

Kind regards
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: == is not transitive?

2012-10-05 Thread Ben Smith-Mannschott
On Fri, Oct 5, 2012 at 11:08 AM, Jean Niklas L'orange
 wrote:
>
>
> On Friday, October 5, 2012 2:39:05 AM UTC+2, Ben wrote:
>>
>> user> [(== 0 0.0) (== 0.0 0.0M) (== 0.0M 0)]
>> [true true false]
>
>
> When passing two arguments to ==, == will be transitive.
>
>>
>> user> [(== 0 0.0 0.0M) (== 0 0.0M 0.0) (== 0.0 0 0.0M) (== 0.0 0.0M 0)
>> (== 0.0M 0.0 0) (== 0.0M 0 0.0)]
>> [true false false false true false]
>
>
> This is more of a problem with number equality, not the transitivity of ==.
> (== x1 x2 x3 ... xn) can be rewritten as (and (== x1 x2) (== x2 x3) ... (==
> xn-1 xn)).
>
> So if you compare (== x y z), then if x = y, then the result of (== x z) and
> (== y z) should be equivalent, considering the numbers are, well, numbers.
>
> I believe the issue lies within the bigdec-parsing, which seems to have two
> zeroes: (== 0M 0.0M) returns false, and their hashcode (0 and 1,
> respectively) are different.

Yea, I think this is the peculiar definition of BigDecimal.equals()
biting us here.

http://docs.oracle.com/javase/1.4.2/docs/api/java/math/BigDecimal.html

# Note: care should be exercised if BigDecimals are to be used as keys in a
# SortedMap or elements in a SortedSet, as BigDecimal's natural ordering is
# inconsistent with equals. See Comparable, SortedMap or SortedSet for more
# information.

equals():
# Compares this BigDecimal with the specified Object for equality. Unlike
# compareTo, this method considers two BigDecimals equal only if they are
# equal in *value* and *scale* (thus 2.0 is not equal to 2.00 when compared by
# this method)

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


Re: ANN: core.logic Go solver

2012-10-05 Thread David Nolen
On Fri, Oct 5, 2012 at 1:53 AM, nchurch  wrote:

> Here's a Go solver
>
> code:
> https://github.com/nchurch/go/blob/master/src/go/core.clj
>
> README:
> https://github.com/nchurch/go


Neat!


> There are some issues that I'd like to get input on.  For one thing,
> I've used mutual recursion (as the Wiki article on mutual recursion
> says, Prolog depends on mutual recursion); I don't see any
> straightforward and clean way to eliminate it (you can't just
> trampoline).  Probably because of this, you can't generate boards
> bigger than 15X15.
>

I don't think mutual recursion itself should cause a problem. core.logic
has a fancy trampoline built inside of it derived from miniKanren.

Can't say much more about the later issue w/o examining the code more
closely.

Thanks for sharing this!

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: optimized clojurescript->js file throws exception but debug version does not?

2012-10-05 Thread Andrew
Oh. I'm pretty sure it's because in the broken case I use two blobs of js 
which were minified at *separate* times thus allowing for name conflicts. 

-- 
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: optimized clojurescript->js file throws exception but debug version does not?

2012-10-05 Thread David Nolen
On Fri, Oct 5, 2012 at 8:16 AM, Andrew  wrote:

> Oh. I'm pretty sure it's because in the broken case I use two blobs of js
> which were minified at *separate* times thus allowing for name conflicts.


Yes Closure assumes whole program optimization. You can't use two
separately advanced compiled pieces of JS code together.

So is this the actual issue?

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: optimized clojurescript->js file throws exception but debug version does not?

2012-10-05 Thread Andrew
How do I tell Closure to include Codemirror.js and other js files when it 
optimizes?

My project.clj file has this:


  :cljsbuild {

  :builds {
   :prod
   {:source-path "src-cljs"
:compiler {:output-to 
"resources/public/js/subpar.core.js"
   :optimizations :advanced
   :pretty-print false}}}

On Friday, October 5, 2012 8:21:09 AM UTC-4, David Nolen wrote:
>
> On Fri, Oct 5, 2012 at 8:16 AM, Andrew >wrote:
>
>> Oh. I'm pretty sure it's because in the broken case I use two blobs of js 
>> which were minified at *separate* times thus allowing for name 
>> conflicts. 
>
>
> Yes Closure assumes whole program optimization. You can't use two 
> separately advanced compiled pieces of JS code together.
>
> So is this the actual issue?
>
> 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: ANN: core.logic Go solver

2012-10-05 Thread nchurch
I realized what the latter issue is: I forgot to relationalize
"opposite".  It turns out not to matter when you're checking for
alive, but it does matter checking for dead for some reason.  See the
new push.

The board size limitation issue has a \very odd error message that
doesn't seem to come from core.logic:

CompilerException java.lang.ClassFormatError: Too many arguments in
method signature in class file go/core
$eval2878$fn__2881$fn__2882$_inc__2883$fn__2884$_inc__2885$fn__2890,
compiling:(NO_SOURCE_PATH:1)

On Oct 5, 5:15 am, David Nolen  wrote:
> On Fri, Oct 5, 2012 at 1:53 AM, nchurch  wrote:
> > Here's a Go solver
>
> > code:
> >https://github.com/nchurch/go/blob/master/src/go/core.clj
>
> > README:
> >https://github.com/nchurch/go
>
> Neat!
>
> > There are some issues that I'd like to get input on.  For one thing,
> > I've used mutual recursion (as the Wiki article on mutual recursion
> > says, Prolog depends on mutual recursion); I don't see any
> > straightforward and clean way to eliminate it (you can't just
> > trampoline).  Probably because of this, you can't generate boards
> > bigger than 15X15.
>
> I don't think mutual recursion itself should cause a problem. core.logic
> has a fancy trampoline built inside of it derived from miniKanren.
>
> Can't say much more about the later issue w/o examining the code more
> closely.
>
> Thanks for sharing this!
>
> 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: ANN: core.logic Go solver

2012-10-05 Thread David Nolen
On Fri, Oct 5, 2012 at 8:42 AM, nchurch  wrote:

> CompilerException java.lang.ClassFormatError: Too many arguments in
> method signature in class file go/core
> $eval2878$fn__2881$fn__2882$_inc__2883$fn__2884$_inc__2885$fn__2890,
> compiling:(NO_SOURCE_PATH:1)
>

 Yeah that's not core.logic related. You're creating an anonymous fn via
the macro make-boards and generating too many fn arguments.

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: ANN: core.logic Go solver

2012-10-05 Thread nchurch
Hmm!  Then I must have hit the limit for how many arguments I can put
in an arglist, there in fresh: (i.e. (fresh [~@positions]).  I had no
idea there \was a limit.  Can't see any way around that at the
moment.  I never dreamed I'd try to put > 256 arguments in a
function

On Oct 5, 5:46 am, David Nolen  wrote:
> On Fri, Oct 5, 2012 at 8:42 AM, nchurch  wrote:
> > CompilerException java.lang.ClassFormatError: Too many arguments in
> > method signature in class file go/core
> > $eval2878$fn__2881$fn__2882$_inc__2883$fn__2884$_inc__2885$fn__2890,
> > compiling:(NO_SOURCE_PATH:1)
>
>  Yeah that's not core.logic related. You're creating an anonymous fn via
> the macro make-boards and generating too many fn arguments.
>
> 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: optimized clojurescript->js file throws exception but debug version does not?

2012-10-05 Thread David Nolen
On Fri, Oct 5, 2012 at 8:38 AM, Andrew  wrote:

> How do I tell Closure to include Codemirror.js and other js files when it
> optimizes?
>
> My project.clj file has this:
>
>
>   :cljsbuild {
>
>   :builds {
>:prod
>{:source-path "src-cljs"
> :compiler {:output-to
> "resources/public/js/subpar.core.js"
>:optimizations :advanced
>:pretty-print false}}}
>

You might find this helpful:
http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html

I believe you can use the same options you give to ClojureScript compiler
so you should be good.

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: ANN: core.logic Go solver

2012-10-05 Thread David Nolen
On Fri, Oct 5, 2012 at 8:51 AM, nchurch  wrote:

> Hmm!  Then I must have hit the limit for how many arguments I can put
> in an arglist, there in fresh: (i.e. (fresh [~@positions]).  I had no
> idea there \was a limit.  Can't see any way around that at the
> moment.  I never dreamed I'd try to put > 256 arguments in a
> function
>

It's pretty easy to surmount. Remember fresh is just sugar over let:

(fresh [x y]
  ...)

=>

(let [x (lvar 'x)
  y (lvar 'y)]
  ...)

You can construct lvars yourself and put them into a sequence and then pull
them apart.

(let [board (take 255 (make-seq-of-lvars))]
  (all
... goals ...))

I don't have time to go into all the details but this blog post should give
you some more guidance: http://dosync.posterous.com/friendlier-shorter

Note that it's quite easy to mix the functional and logical style ;)

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: ANN: core.logic Go solver

2012-10-05 Thread nchurch
Thanks David!  I'll try to fix that in the next few days.

On Oct 5, 5:57 am, David Nolen  wrote:
> On Fri, Oct 5, 2012 at 8:51 AM, nchurch  wrote:
> > Hmm!  Then I must have hit the limit for how many arguments I can put
> > in an arglist, there in fresh: (i.e. (fresh [~@positions]).  I had no
> > idea there \was a limit.  Can't see any way around that at the
> > moment.  I never dreamed I'd try to put > 256 arguments in a
> > function
>
> It's pretty easy to surmount. Remember fresh is just sugar over let:
>
> (fresh [x y]
>   ...)
>
> =>
>
> (let [x (lvar 'x)
>       y (lvar 'y)]
>   ...)
>
> You can construct lvars yourself and put them into a sequence and then pull
> them apart.
>
> (let [board (take 255 (make-seq-of-lvars))]
>   (all
>     ... goals ...))
>
> I don't have time to go into all the details but this blog post should give
> you some more guidance:http://dosync.posterous.com/friendlier-shorter
>
> Note that it's quite easy to mix the functional and logical style ;)
>
> 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: ANN Ritz 0.5.0

2012-10-05 Thread bruce li
Hello, Hugo.

I'm trying ritz and having some issues with SLDB that really confused 
me. When I switch on the slime-break-on-exception, it seems it sometimes 
doesn't work. The SLDB buffer won't pop up and I sometimes can see the 
exceptions in the terminal (but sometimes not :(  ).

The easiest way to reproduce it is to repeatedly type some junk into Slime 
REPL and the first 2 or 3 tries will bring up the SLDB buffer  and I select 
"Abort" or "Continue" to return to REPL, but then the exceptions are just 
printed out to the terminal. Also when I compile some form hitting C-c C-c, 
or the file with C-c C-k, those exceptions thrown from the form will also 
be ignored.

By the way, it seems ritz 0.5.0 does not work with Lein 1. I'm wondering if 
Ritz is planned to support Lein 2 only from then on?

Best regards,
Bruce


在 2012年9月20日星期四UTC+8上午3时49分51秒,Hugo Duncan写道:
>
>
> Ritz provides a clojure debugger for nREPL.el and SLIME, other nREPL 
> middleware, and a general repl-utils library. 
>
> 0.5.0 adds several new features. 
>
>  * load-project will load the project for buffer you are currently 
>visiting. This allows you to switch projects in an existing repl. 
>
>  * reload-project will reload the current project. If you have added 
>dependencies to the project, these will be added to the classpath. If 
>you have removed dependencies, the classpath will be updated 
>appropriately and all user namespaces cleared. 
>
>  * lein will allow you to use the REPL vm to run lein command for you 
>current project. 
>
> The commands above should be prefixed with slime-ritz-, or nrepl-ritz- 
> as appropriate. 
>
> ritz-nrepl works with the recent nrepl.el 0.1.4 release. 
>
> Change log: https://github.com/pallet/ritz/blob/develop/ReleaseNotes.md 
>
> Project: https://github.com/pallet 
>
> Hugo 
>

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

Re: ANN: a Clojure docs site, and github organization

2012-10-05 Thread Mayank Jain
On Fri, Oct 5, 2012 at 6:54 PM, Michael Klishin  wrote:

>
>
> 2012/10/5 Michael Fogus 
>
>> You say that as if it's a bad thing.  I'm of the opinion that these
>> kinds of efforts should have a low barrier to contribution and be fun.
>>
>
> My apologies, I did not imply that it is a bad thing, only that it is not
> entirely clear what direction the project
> will take. While for CDS it is pretty clear (at least to people who have
> started it).
>
> While we are at this fun stuff, can we also make the CA submission process
> fun?
>
+1

>
> --
> MK
>
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin
>
>  --
> 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
>



-- 
Regards,
Mayank.

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

Smarter code reloading with tools.namespace 0.2.0

2012-10-05 Thread Stuart Sierra
Announcing... tools.namespace 0.2.0. Just released, it will reach
Maven Central in a few hours.

Short summary: reload code in the REPL with greater accuracy and
awareness of dependencies.

Full documentation in the README:
https://github.com/clojure/tools.namespace

This is my latest attempt at making REPL development more convenient,
building on work that reaches back to Lazytest and some of my earliest
contribs.

It is hopefully a step towards "Never Close a REPL":
http://dev.clojure.org/display/design/Never+Close+a+REPL

Have fun, let me know how it goes!
-S

-- 
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: == is not transitive?

2012-10-05 Thread Patrick Houk
I was bitten by this a year ago and posted here:
http://groups.google.com/group/clojure/browse_frm/thread/9091ad790fc96b24

My workaround is to call BigDecimal#stripTrailingZeros before passing
it to code that might compare it to some other number.

user> (== 1 (.stripTrailingZeros 1.0M))
true

However, there is an edge case:

user> (== 0 (.stripTrailingZeros 0.0M))
false

Which is due to this Java bug:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6480539

So I use a function like the following instead of bigdec to parse
BigDecimals.

(defn parse-stripped-bigdec [^String value-str]
  ;; Note that bigdec uses reflection (at least in Clojure 1.2.1)
  (let [n (java.math.BigDecimal. value-str)]
(if (zero? n) 0M (.stripTrailingZeros n

Be aware that stripping the zeros changes how the BigDecimal is
formatted by #toString.

user> (str (parse-stripped-bigdec "10"))
"1E+1"

So, I have a special case for BigDecimal that calls #toPlainString in
the places where I do not want exponential format.

user> (.toPlainString (parse-stripped-bigdec "10"))
"10"

I hope that helps.
- Pat

On Oct 4, 8:39 pm, Ben Wolfson  wrote:
> user> [(== 0 0.0) (== 0.0 0.0M) (== 0.0M 0)]
> [true true false]
> user> [(== 0 0.0 0.0M) (== 0 0.0M 0.0) (== 0.0 0 0.0M) (== 0.0 0.0M 0)
> (== 0.0M 0.0 0) (== 0.0M 0 0.0)]
> [true false false false true false]
>
> --
> Ben Wolfson
> "Human kind has used its intelligence to vary the flavour of drinks,
> which may be sweet, aromatic, fermented or spirit-based. ... Family
> and social life also offer numerous other occasions to consume drinks
> for pleasure." [Larousse, "Drink" entry]

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


clojure.java.jdbc create-table

2012-10-05 Thread Matt
Hi,

I'm relatively new to Clojure. This must be easy.
I am trying to write a function that creates a table with a name passed as 
argument, and this naturally requires passing *
clojure.java.jdbc/create-table *a value for the table name, rather than 
specifying the name as a constant. However I'm not insofar able to pull it 
off. 

When I use the form *create-table passed-argument [fields] *as opposed to a 
constant as in *create-table **:hard-coded-entity-name** [fields]*, then 
the table gets successfully created in the database, however my code also 
gets an exception - java.lang.ClassCastException: 
clojure.lang.ArraySeq$ArraySeq_int cannot be cast to clojure.lang.IFn. The 
exception is received even though the table had been seemingly perfectly 
created. I'm probably missing something basic. What do you think can it be?

Thanks,
Matt



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

Fast REPL restarts Re: Smarter code reloading with tools.namespace 0.2.0

2012-10-05 Thread Grant Rettke
REPL restarts are slow and costly, but the freshness they provide is
obviously so valuable, too.

Has anyone experimented with something like JRebel or some alternative to
provide super-fast like fraction of a section REPL restarts?

On Fri, Oct 5, 2012 at 8:56 AM, Stuart Sierra
wrote:

> Announcing... tools.namespace 0.2.0. Just released, it will reach
> Maven Central in a few hours.
>
> Short summary: reload code in the REPL with greater accuracy and
> awareness of dependencies.
>
> Full documentation in the README:
> https://github.com/clojure/tools.namespace
>
> This is my latest attempt at making REPL development more convenient,
> building on work that reaches back to Lazytest and some of my earliest
> contribs.
>
> It is hopefully a step towards "Never Close a REPL":
> http://dev.clojure.org/display/design/Never+Close+a+REPL
>
> Have fun, let me know how it goes!
> -S
>
> --
> 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
>



-- 
((λ (x) (x x)) (λ (x) (x x)))
http://www.wisdomandwonder.com/
ACM, AMA, COG, IEEE

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

Re: ANN Ritz 0.5.0

2012-10-05 Thread Hugo Duncan
bruce li  writes:

> I'm trying ritz and having some issues with SLDB that really confused 
> me. When I switch on the slime-break-on-exception, it seems it sometimes 
> doesn't work. The SLDB buffer won't pop up and I sometimes can see the 
> exceptions in the terminal (but sometimes not :(  ).

Probably https://github.com/pallet/ritz/issues/51

> By the way, it seems ritz 0.5.0 does not work with Lein 1. I'm wondering if 
> Ritz is planned to support Lein 2 only from then on?

I broke it unintentionally - I wonder how many are still using lein1.
Continuing to support lein 1 is obviously more complicated, but should
be feasible.

Hugo

-- 
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: Core.logic performance of looping over a list with tabling

2012-10-05 Thread David Nolen
I believe I understand one problem in the original tabling implementation.
I will try to get a patch in this weekend. There may be another trickier
issue but let's see how much the fix I have in mind will help first.

On Monday, October 1, 2012, Reinout Stevens wrote:

>
>
> On Saturday, September 29, 2012 11:10:38 PM UTC+2, David Nolen wrote:
>>
>> On Wed, Sep 26, 2012 at 9:20 AM, Reinout Stevens wrote:
>>
>>> Hi,
>>>
>>>
>>> I'm the author of a DSL that allows reasoning over paths throughout
>>> graphs using core.logic ( 
>>> https://github.com/**ReinoutStevens/damp.qwal).
>>>  We noticed that for larger graphs performance became horribly slow, even
>>> though there is no apparent reason why it should be. First investigations
>>> lead me to believe tabling was the issue. We use tabling to prevent
>>> infinite loops due to cycles in the graph. After writing a small testcase
>>> that exhibits the described problems I've noticed that it is a combination
>>> of tabling and looping over a list.
>>>
>>> In the test case we construct a linear graph (so: a graph where each
>>> node has a single successor). We want to asser that there exists a path
>>> from the start to the end node. This is done by using the logical rule trans
>>> [graph current next], which given a graph and the current node binds
>>> next to the possible successors. We write this query in three different
>>> ways. First, we try to succeed the goal trans as many times as needed,
>>> until we end up in the end state. Next, we do the same but tabling our
>>> loop. This prevents looping in case our graph would contain a cycle (in
>>> this case, there is no such cycle). Finally, instead of directly proving
>>> trans, we prove a list of goals. This list contains a single goal (trans).
>>> This last scenario runs much slower than the previous two, even though I
>>> don't see a large difference with the first two scenarios.
>>>
>>> In attachment the code of our test case. There are 3 functions at the
>>> end, each implementing one of the described scenarios. Note the difference
>>> between solve-goal and solve-goals.
>>>
>>> Any pointers how to solve the issue, or work around it are appreciated
>>>
>>
>> I took some time to look into this. The issue is that your terms are
>> quite complex - the entire graph is the first arg to the tabled goal! In
>> order for tabling to work this argument needs to be reified (completely
>> walked and all logic vars replaced with copies) and this is used as the
>> table cache key. As you can imagine this means given the way you've written
>> your program the entries in the table can get quite large and the
>> comparisons to determine whether a reusable cached answer term exists is
>> quite expensive!
>>
>> It's important to table at the right "level". Does this make sense and
>> can you formulate a solution so that you're not passing in the entire graph
>> as the first argument to the tabled goal?
>>
>> David
>>
>>
> Hi,
>
>
> I quickly changed the code so that the graph structure no longer contains
> the list of nodes, and the same behaviour still persists. For the actual
> implementation I have changed it to a function that returns a list of
> nodes, which can be compared in O(1) instead of looping over the data
> structure, and also here we get the same behaviour.
>
> Personally, I don't see the difference between calling solve-goal or
> solve-goals, as both should have an equally large table. The recursive step
> of solve-goals shouldn't do anything, as we are only passing a list
> containing a single item. In attachment the updated code (aka: just removed
> the :node key from the graph).
>
>
> Thanks for taking your time and looking into this,
>
>
> Reinout
>
> --
> 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 '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  'clojure%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

Handling exceptions (subject renamed)

2012-10-05 Thread Matt
Hi,

Sorry to anyone who read the original post.
Apparently I had malformed the try block encompassing the create-table in a 
very non-clojure-ish way. 
So my problem wasn't with clojure.java.jdbc's create-table. Being 
'dynamic', clojure could not warn me about it until it crashes in 
runtime. I guess I should also learn more about making exception printouts 
contain more details (such as line number as one, if that's at all 
possible?)
I'd appreciate knowing how to get more details when an exception is caught 
by my code e.g. at least a line number if possible -

I was using - 
*(catch Exception e (println (str "Exception is: " e)))*

Which only yielded a general description (java.lang.ClassCastException: 
clojure.lang.ArraySeq$ArraySeq_int cannot be cast to clojure.lang.IFn) without 
indicating where my code broke.

Is it possible to get the source line that made the code break?

Thanks!

On Friday, October 5, 2012 5:15:18 PM UTC+2, Matt wrote:
>
> Hi,
>
> I'm relatively new to Clojure. This must be easy.
> I am trying to write a function that creates a table with a name passed as 
> argument, and this naturally requires passing *
> clojure.java.jdbc/create-table *a value for the table name, rather than 
> specifying the name as a constant. However I'm not insofar able to pull it 
> off. 
>
> When I use the form *create-table passed-argument [fields] *as opposed 
> to a constant as in *create-table **:hard-coded-entity-name** [fields]*, 
> then the table gets successfully created in the database, however my code 
> also gets an exception - java.lang.ClassCastException: 
> clojure.lang.ArraySeq$ArraySeq_int cannot be cast to clojure.lang.IFn. 
> The exception is received even though the table had been seemingly 
> perfectly created. I'm probably missing something basic. What do you think 
> can it be?
>
> Thanks,
> Matt
>
>
>
>

-- 
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: == is not transitive?

2012-10-05 Thread Ben Wolfson
On Fri, Oct 5, 2012 at 2:08 AM, Jean Niklas L'orange
 wrote:
>
> On Friday, October 5, 2012 2:39:05 AM UTC+2, Ben wrote:
>>
>> user> [(== 0 0.0) (== 0.0 0.0M) (== 0.0M 0)]
>> [true true false]
>
> When passing two arguments to ==, == will be transitive.

I'm not sure what you mean by this. Transitivity means that for all x,
y, and z, (Fxy & Fyz) => Fxz. But there are values of x, y, and z for
which that does not hold.

-- 
Ben Wolfson
"Human kind has used its intelligence to vary the flavour of drinks,
which may be sweet, aromatic, fermented or spirit-based. ... Family
and social life also offer numerous other occasions to consume drinks
for pleasure." [Larousse, "Drink" entry]

-- 
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: optimized clojurescript->js file throws exception but debug version does not?

2012-10-05 Thread Andrew
After I read the link you provided and another 
page,
 
I discovered that wrapping my compiled stuff in an anonymous function keeps 
Google Closure's output symbols from colliding with other existing stuff 
such as CodeMirror's minified variables.

That link points out that it's best to have the compiler do the wrapping 
for you with  --output_wrapper. Is there a way to specify this for 
cljsbuild? lein-cljsbuild issue 
#117says cljsbuild is 
just a wrapper for the ClojureScript compiler and if we 
want it we should open a ticket for ClojureScript. I looked and did not 
immediately see a ticket or the wrapper option. So maybe I'll open that 
ticket?

By the way, I'm not sure compiling CodeMirror and my stuff in one go is the 
right approach, because I don't know whether CodeMirror is compatible with 
Google Closure's advanced compilation. (I see that CodeMirror 1's 
compression page had Google Closure advanced optimization as an option but 
it disappeared for CodeMirror 2.) I think doing so would require me to 
hand-edit CodeMirror to add a goog.provide call.

On Friday, October 5, 2012 8:52:09 AM UTC-4, David Nolen wrote:
>
>
> You might find this helpful: 
> http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html
>
> I believe you can use the same options you give to ClojureScript compiler 
> so you should be good.
>
> 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: optimized clojurescript->js file throws exception but debug version does not?

2012-10-05 Thread David Nolen
On Fri, Oct 5, 2012 at 2:37 PM, Andrew  wrote:

> After I read the link you provided and another 
> page,
> I discovered that wrapping my compiled stuff in an anonymous function keeps
> Google Closure's output symbols from colliding with other existing stuff
> such as CodeMirror's minified variables.
>
> That link points out that it's best to have the compiler do the wrapping
> for you with  --output_wrapper. Is there a way to specify this for
> cljsbuild? lein-cljsbuild issue 
> #117says cljsbuild is 
> just a wrapper for the ClojureScript compiler and if we
> want it we should open a ticket for ClojureScript. I looked and did not
> immediately see a ticket or the wrapper option. So maybe I'll open that
> ticket?
>
> By the way, I'm not sure compiling CodeMirror and my stuff in one go is
> the right approach, because I don't know whether CodeMirror is compatible
> with Google Closure's advanced compilation. (I see that CodeMirror 1's
> compression page had Google Closure advanced optimization as an option but
> it disappeared for CodeMirror 2.) I think doing so would require me to
> hand-edit CodeMirror to add a goog.provide call.
>

You don't need to do that. That's what the :foreign-libs option is for
which is described at the end of blog post.

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: Handling exceptions (subject renamed)

2012-10-05 Thread gaz jones
http://clojure.github.com/clojure/clojure.stacktrace-api.html

On Fri, Oct 5, 2012 at 12:06 PM, Matt  wrote:
> Hi,
>
> Sorry to anyone who read the original post.
> Apparently I had malformed the try block encompassing the create-table in a
> very non-clojure-ish way.
> So my problem wasn't with clojure.java.jdbc's create-table. Being 'dynamic',
> clojure could not warn me about it until it crashes in runtime. I guess I
> should also learn more about making exception printouts contain more details
> (such as line number as one, if that's at all possible?)
> I'd appreciate knowing how to get more details when an exception is caught
> by my code e.g. at least a line number if possible -
>
> I was using -
> (catch Exception e (println (str "Exception is: " e)))
>
> Which only yielded a general description (java.lang.ClassCastException:
> clojure.lang.ArraySeq$ArraySeq_int cannot be cast to clojure.lang.IFn)
> without indicating where my code broke.
>
> Is it possible to get the source line that made the code break?
>
> Thanks!
>
> On Friday, October 5, 2012 5:15:18 PM UTC+2, Matt wrote:
>>
>> Hi,
>>
>> I'm relatively new to Clojure. This must be easy.
>> I am trying to write a function that creates a table with a name passed as
>> argument, and this naturally requires passing clojure.java.jdbc/create-table
>> a value for the table name, rather than specifying the name as a constant.
>> However I'm not insofar able to pull it off.
>>
>> When I use the form create-table passed-argument [fields] as opposed to a
>> constant as in create-table :hard-coded-entity-name [fields], then the table
>> gets successfully created in the database, however my code also gets an
>> exception - java.lang.ClassCastException: clojure.lang.ArraySeq$ArraySeq_int
>> cannot be cast to clojure.lang.IFn. The exception is received even though
>> the table had been seemingly perfectly created. I'm probably missing
>> something basic. What do you think can it be?
>>
>> Thanks,
>> Matt
>>
>>
>>
> --
> 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: Handling exceptions (subject renamed)

2012-10-05 Thread Matan Safriel
Awesome.


On Fri, Oct 5, 2012 at 8:40 PM, gaz jones  wrote:

> http://clojure.github.com/clojure/clojure.stacktrace-api.html
>
> On Fri, Oct 5, 2012 at 12:06 PM, Matt  wrote:
> > Hi,
> >
> > Sorry to anyone who read the original post.
> > Apparently I had malformed the try block encompassing the create-table
> in a
> > very non-clojure-ish way.
> > So my problem wasn't with clojure.java.jdbc's create-table. Being
> 'dynamic',
> > clojure could not warn me about it until it crashes in runtime. I guess I
> > should also learn more about making exception printouts contain more
> details
> > (such as line number as one, if that's at all possible?)
> > I'd appreciate knowing how to get more details when an exception is
> caught
> > by my code e.g. at least a line number if possible -
> >
> > I was using -
> > (catch Exception e (println (str "Exception is: " e)))
> >
> > Which only yielded a general description (java.lang.ClassCastException:
> > clojure.lang.ArraySeq$ArraySeq_int cannot be cast to clojure.lang.IFn)
> > without indicating where my code broke.
> >
> > Is it possible to get the source line that made the code break?
> >
> > Thanks!
> >
> > On Friday, October 5, 2012 5:15:18 PM UTC+2, Matt wrote:
> >>
> >> Hi,
> >>
> >> I'm relatively new to Clojure. This must be easy.
> >> I am trying to write a function that creates a table with a name passed
> as
> >> argument, and this naturally requires passing
> clojure.java.jdbc/create-table
> >> a value for the table name, rather than specifying the name as a
> constant.
> >> However I'm not insofar able to pull it off.
> >>
> >> When I use the form create-table passed-argument [fields] as opposed to
> a
> >> constant as in create-table :hard-coded-entity-name [fields], then the
> table
> >> gets successfully created in the database, however my code also gets an
> >> exception - java.lang.ClassCastException:
> clojure.lang.ArraySeq$ArraySeq_int
> >> cannot be cast to clojure.lang.IFn. The exception is received even
> though
> >> the table had been seemingly perfectly created. I'm probably missing
> >> something basic. What do you think can it be?
> >>
> >> Thanks,
> >> Matt
> >>
> >>
> >>
> > --
> > 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: ANN: a Clojure docs site, and github organization

2012-10-05 Thread Andy Fingerhut

On Oct 4, 2012, at 1:34 PM, Michael Klishin wrote:

> There are pretty specific plans about the guides and moving clojuredocs.org 
> forward
> to 1.4 and (hopefully, at some point) multi-version support.

Michael, are these specific plans described anywhere that we could read?  Or 
would you be able to describe them briefly?

Curious to know what is planned there.

Thanks,
Andy


-- 
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: Meaning of "="

2012-10-05 Thread Stuart Sierra
On Wednesday, October 3, 2012 1:56:19 PM UTC-4, Warren Lynn wrote:
>
> Out of curiosity, if we want to check if two collections has the same 
> structure/type and elements, namely if I want 
> (my-equal  [1 2 3 4 '(5)]  [1 2 3 4 [5]]) => false
> (my-equal  [1 2 3 4 [5]]  [1 2 3 4 [5]]) => true
>
> Is there any convenient way to do that?
>

Not really. You would have to define your own equality function. Then you 
have to make all the decisions about what should be considered "equal." For 
example, lists versus sequences, hash-maps versus array-maps.

-S

-- 
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: Smarter code reloading with tools.namespace 0.2.0

2012-10-05 Thread Mayank Jain
This will be very helpful to me. Writing selenium tests on repl then
restarting is a pain. Will share my views on it.

Thank you for your time :)

Sent from phone. Please excuse brevity.
On Oct 5, 2012 7:26 PM, "Stuart Sierra"  wrote:

> Announcing... tools.namespace 0.2.0. Just released, it will reach
> Maven Central in a few hours.
>
> Short summary: reload code in the REPL with greater accuracy and
> awareness of dependencies.
>
> Full documentation in the README:
> https://github.com/clojure/tools.namespace
>
> This is my latest attempt at making REPL development more convenient,
> building on work that reaches back to Lazytest and some of my earliest
> contribs.
>
> It is hopefully a step towards "Never Close a REPL":
> http://dev.clojure.org/display/design/Never+Close+a+REPL
>
> Have fun, let me know how it goes!
> -S
>
> --
> 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

ANN: a Clojure docs site, and github organization

2012-10-05 Thread Michael Jaaka
why don't you use advantage of html and split the site into two panes
on left the table of content in hiperlink form and on the right the content 
reloaded on clickin in link in toc
also use numbers for chapters and subchapters
dont use bullets for lists, its harder to make references
also add disqus.com to allow for comments (like on mysql docs)
and your site will be at least useful for someone and treated as reference doc 
site

-- 
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: Core.logic performance of looping over a list with tabling

2012-10-05 Thread David Nolen
On Mon, Oct 1, 2012 at 9:13 AM, Reinout Stevens  wrote:

> Hi,
>
>
> I quickly changed the code so that the graph structure no longer contains
> the list of nodes, and the same behaviour still persists. For the actual
> implementation I have changed it to a function that returns a list of
> nodes, which can be compared in O(1) instead of looping over the data
> structure, and also here we get the same behaviour.
>
> Personally, I don't see the difference between calling solve-goal or
> solve-goals, as both should have an equally large table. The recursive step
> of solve-goals shouldn't do anything, as we are only passing a list
> containing a single item. In attachment the updated code (aka: just removed
> the :node key from the graph).
>
>
> Thanks for taking your time and looking into this,
>
>
> Reinout
>

Hi I've been able to significantly improve the performance of core.logic's
tabling for your use case with this commit:
http://github.com/clojure/core.logic/commit/03ad0a425c5b3b91a00142ff91e5fcd378daa682

Can you please try this out? Is the performance at least acceptable now? I
think we could still do a lot better but it would require some more
consideration.

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: clojurescript: how to use clojure.reflect/doc in the cljs-repl?

2012-10-05 Thread Frank Siebenlist
…bumb…

Is this maybe related to the use of lein-cljsbuild and having a separate server 
from which the js is downloaded?

In other words, the reflect handler seems to be listening on the repl server on 
port 9000,
while the web server from which the js is initially downloaded is listening on 
port 3000.

The cljs-reflect code seems to get a conn from (net/xhr-connection), but I can 
not see any port number specified…

I've reached the end of my javascript and goog knowledge… please.

Did anyone get this to work with the lein-cljsbuild setup?

-FrankS.



On Sep 23, 2012, at 2:10 PM, Frank Siebenlist  
wrote:

> Trying to use the clojure.reflect/doc function in the cljs-repl, 
> but I only errors" 
> 
> ---
> 
> ClojureScript:cljs.user> (clojure.reflect/doc "clojure.reflect/doc")
> nil
> Reflection query failed.
> ClojureScript:cljs.user> (clojure.reflect/doc clojure.reflect.doc)
> nil
> Reflection query failed.
> ClojureScript:cljs.user> (clojure.reflect/doc 'clojure.reflect.doc)
> nil
> Reflection query failed.
> ClojureScript:cljs.user> (clojure.reflect/doc 'doc)
> nil
> Reflection query failed.
> 
> ---
> 
> Do I have to configure something on the server side maybe?
> Any suggestions?
> 
> Thanks, FrankS.
> 

-- 
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: how to use clojure.reflect/doc in the cljs-repl?

2012-10-05 Thread Frank Siebenlist
Forgot to mention that the issue is most probably on the browser side,
because pointing a webbrowser at 
"http://localhost:9000/reflect?var=example.hello/say-hello"; by hand,
yields in the browser window:

cljs.core.ObjMap.fromObject(["\uFDD0'method-params","\uFDD0'name","\uFDD0'doc","\uFDD0'line","\uFDD0'file"],{"\uFDD0'method-params":"[[]]","\uFDD0'name":"example.hello/say-hello","\uFDD0'doc":"say-hello
 
doc","\uFDD0'line":10,"\uFDD0'file":"/Users/franks/Development/ClojureScript/swimtimer/src-cljs/example/hello.cljs"});

which is what one expects.

-FS.


On Oct 5, 2012, at 9:13 PM, Frank Siebenlist  wrote:

> …bumb…
> 
> Is this maybe related to the use of lein-cljsbuild and having a separate 
> server from which the js is downloaded?
> 
> In other words, the reflect handler seems to be listening on the repl server 
> on port 9000,
> while the web server from which the js is initially downloaded is listening 
> on port 3000.
> 
> The cljs-reflect code seems to get a conn from (net/xhr-connection), but I 
> can not see any port number specified…
> 
> I've reached the end of my javascript and goog knowledge… please.
> 
> Did anyone get this to work with the lein-cljsbuild setup?
> 
> -FrankS.
> 
> 
> 
> On Sep 23, 2012, at 2:10 PM, Frank Siebenlist  
> wrote:
> 
>> Trying to use the clojure.reflect/doc function in the cljs-repl, 
>> but I only errors" 
>> 
>> ---
>> 
>> ClojureScript:cljs.user> (clojure.reflect/doc "clojure.reflect/doc")
>> nil
>> Reflection query failed.
>> ClojureScript:cljs.user> (clojure.reflect/doc clojure.reflect.doc)
>> nil
>> Reflection query failed.
>> ClojureScript:cljs.user> (clojure.reflect/doc 'clojure.reflect.doc)
>> nil
>> Reflection query failed.
>> ClojureScript:cljs.user> (clojure.reflect/doc 'doc)
>> nil
>> Reflection query failed.
>> 
>> ---
>> 
>> Do I have to configure something on the server side maybe?
>> Any suggestions?
>> 
>> Thanks, FrankS.
>> 
> 

-- 
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: how to use clojure.reflect/doc in the cljs-repl?

2012-10-05 Thread Frank Siebenlist
Ok - I managed to get clojure.reflect/doc to work if the browser loads the 
javascript from the repl-server instead of the separate webserver…

When the reason for this issue is that the repl- & web-servers are listening on 
different ports, where the js is downloaded from the webserver while the 
reflect-handler is associaed with the repl-server… 
then you will not be able to use the clojure.reflect/doc with the standard 
lein-cljsbuild setup.

Unless you can somehow specify the port number for the clojure.reflect/doc GET 
request (?).

Ough.

-FS.


On Oct 5, 2012, at 9:28 PM, Frank Siebenlist  wrote:

> Forgot to mention that the issue is most probably on the browser side,
> because pointing a webbrowser at 
> "http://localhost:9000/reflect?var=example.hello/say-hello"; by hand,
> yields in the browser window:
> 
> cljs.core.ObjMap.fromObject(["\uFDD0'method-params","\uFDD0'name","\uFDD0'doc","\uFDD0'line","\uFDD0'file"],{"\uFDD0'method-params":"[[]]","\uFDD0'name":"example.hello/say-hello","\uFDD0'doc":"say-hello
>  
> doc","\uFDD0'line":10,"\uFDD0'file":"/Users/franks/Development/ClojureScript/swimtimer/src-cljs/example/hello.cljs"});
> 
> which is what one expects.
> 
> -FS.
> 
> 
> On Oct 5, 2012, at 9:13 PM, Frank Siebenlist  
> wrote:
> 
>> …bumb…
>> 
>> Is this maybe related to the use of lein-cljsbuild and having a separate 
>> server from which the js is downloaded?
>> 
>> In other words, the reflect handler seems to be listening on the repl server 
>> on port 9000,
>> while the web server from which the js is initially downloaded is listening 
>> on port 3000.
>> 
>> The cljs-reflect code seems to get a conn from (net/xhr-connection), but I 
>> can not see any port number specified…
>> 
>> I've reached the end of my javascript and goog knowledge… please.
>> 
>> Did anyone get this to work with the lein-cljsbuild setup?
>> 
>> -FrankS.
>> 
>> 
>> 
>> On Sep 23, 2012, at 2:10 PM, Frank Siebenlist  
>> wrote:
>> 
>>> Trying to use the clojure.reflect/doc function in the cljs-repl, 
>>> but I only errors" 
>>> 
>>> ---
>>> 
>>> ClojureScript:cljs.user> (clojure.reflect/doc "clojure.reflect/doc")
>>> nil
>>> Reflection query failed.
>>> ClojureScript:cljs.user> (clojure.reflect/doc clojure.reflect.doc)
>>> nil
>>> Reflection query failed.
>>> ClojureScript:cljs.user> (clojure.reflect/doc 'clojure.reflect.doc)
>>> nil
>>> Reflection query failed.
>>> ClojureScript:cljs.user> (clojure.reflect/doc 'doc)
>>> nil
>>> Reflection query failed.
>>> 
>>> ---
>>> 
>>> Do I have to configure something on the server side maybe?
>>> Any suggestions?
>>> 
>>> Thanks, FrankS.
>>> 
>> 
> 

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