Re: [ANN] nrepl.el 0.1.3 released

2012-08-22 Thread Tassilo Horn
Phil Hagelberg p...@hagelb.org writes:

Hi Phil,

   - The completion only completes if there's exactly one match.  If
 there are multiple candidates, it simply echos them in the echo
 area.  Why not doing the usual emacs completion stuff with a
 *Completions* buffer and completing the common prefix?

 I looked into some of the other options for completion, but none of
 them seemed appropriate.

The standard way of doing completion in modern emacsen is to add your
own completion function to `completion-at-point-functions' and bind
M-TAB to `complete-symbol'.  That does all the magic of showing a
*Completions* buffer with multiple possibilities and completing common
prefixes for you.

I've already started working on that, and I'm mostly finished.  I'll
send a pull request anytime soon.

I have one minor problem, though.  Is there a way to block until a
handler has done its job?

Concretely, in

(nrepl-send-string form nrepl-buffer-ns (nrepl-complete-handler
 (current-buffer)
 (save-excursion
   (backward-sexp)
   (point
(do-magick)

I'd like to (do-magick) not before nrepl-complete-handler was run.  Is
that possible?

Bye,
Tassilo

-- 
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] nrepl.el 0.1.3 released

2012-08-22 Thread Tassilo Horn
Tassilo Horn t...@gnu.org writes:

 The standard way of doing completion in modern emacsen is to add your
 own completion function to `completion-at-point-functions' and bind
 M-TAB to `complete-symbol'.  That does all the magic of showing a
 *Completions* buffer with multiple possibilities and completing common
 prefixes for you.

 I've already started working on that, and I'm mostly finished.  I'll
 send a pull request anytime soon.

Pull request is sent!

 I have one minor problem, though.  Is there a way to block until a
 handler has done its job?

I did it in a poor-man's fashion, but it works anyway.

Bye,
Tassilo

-- 
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: real-world usage of reducers?

2012-08-22 Thread Ulises
Apologies in advance if this is a silly question but have you tried
profiling your code to see where the hotspots are?

U

-- 
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: real-world usage of reducers?

2012-08-22 Thread nicolas.o...@gmail.com
Hi,

3 questions:

1. Are you sure your moves list at the op level is in a vector?
  Looking at the code for reducers, it seems that it is the only
implementation actually doing concurrency.
2. The default block size for spawning a new thread is 512. Meaning
that if you have
  less than 512 first move in your game (quite likely, or else your
tree is too highly branching to do anything
 by min-max anyway), then it is only working on one thread.
This is tuned for large data set with moderate amount of work per datum.
Exactly the opposite of your workload. (Only 20 datums, but a lot of
work per datum).
 You will want to change the size of the block to something like 1, 2 or 3.
 So your last line should look like that:

(defn best-move Start folding here. [dir b d]
  (r/fold 1 best best
   (r/map #(Move-Value. (:move %) (search score-by-count (:tree %) d))
   (:children (game-tree dir b
next-level)
3. I have doubte about your best function. The first branch should
return something that the second branch can read.
I suggest:
(defn best
([] nil)
([best1 best2]
  (cond
(nil? best1) best2
(nil? best2) best1)
t (if (= (:value best1) (:value best2))
 best1 best2


With these modifications, it should run in // and be quite fast.

-- 
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: real-world usage of reducers?

2012-08-22 Thread nicolas.o...@gmail.com
Sorry, I forgot to convert to a vector:

(defn best-move Start folding here. [dir b d]
  (r/fold 1 best best
(r/map #(Move-Value. (:move %) (search score-by-count (:tree %) d))
   (into [] (:children (game-tree
dir b next-level))

-- 
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: Folding a reducer inside of a fold

2012-08-22 Thread nicolas.o...@gmail.com
 In particular, if I attempt to replace the `r/reduce` call on line #23,
 with a call to `r/fold`, I get the following crash:

This calss sems strange.
remaining? should represent a monoid for it to work.

Meaning two functions:
1 - A and (A - A - A)

In your code, the case with no arg returns a boolean, and the function
in the other branch wait
for a boolean and a number.

-- 
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: real-world usage of reducers?

2012-08-22 Thread Jim - FooBar();

Hi again Nicolas,

1) My moves at the top are a result of r/map...I did try to pou it all 
in a vector with 'nto []'

 but nothing changes.

2)well, no there is no way to have 512 moves at any point in  in the 
game!!! The game actually starts with 20 branches (2 moves for each pawn 
and 2 for each knight) but quickly goes up to 30, 40, 50 etc. I will try 
your suggestion...



3)I'm not sure I understand what you mean...You're returning nil - I'm 
returning a very small number, they can both be read by the next branch 
don't they?


Jim


On 22/08/12 10:04, nicolas.o...@gmail.com wrote:

Hi,

3 questions:

1. Are you sure your moves list at the op level is in a vector?
   Looking at the code for reducers, it seems that it is the only
implementation actually doing concurrency.
2. The default block size for spawning a new thread is 512. Meaning
that if you have
   less than 512 first move in your game (quite likely, or else your
tree is too highly branching to do anything
  by min-max anyway), then it is only working on one thread.
This is tuned for large data set with moderate amount of work per datum.
Exactly the opposite of your workload. (Only 20 datums, but a lot of
work per datum).
  You will want to change the size of the block to something like 1, 2 or 3.
  So your last line should look like that:

(defn best-move Start folding here. [dir b d]
   (r/fold 1 best best
(r/map #(Move-Value. (:move %) (search score-by-count (:tree %) d))
(:children (game-tree dir b
next-level)
3. I have doubte about your best function. The first branch should
return something that the second branch can read.
I suggest:
(defn best
([] nil)
([best1 best2]
   (cond
 (nil? best1) best2
 (nil? best2) best1)
 t (if (= (:value best1) (:value best2))
  best1 best2


With these modifications, it should run in // and be quite fast.



--
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: real-world usage of reducers?

2012-08-22 Thread Jim - FooBar();
Ok, so I followed your suggestions and the block size did the trick with 
regards to using all 4 cores of mine...However, even so, I get no 
performance improvements!!! It still needs close to 4 min to go to level 
4 and it still needs 5-6 sec to go to level 2 (a tiny bit faster than 
the sequential equivalent)...


Jim


On 22/08/12 13:33, Jim - FooBar(); wrote:

Hi again Nicolas,

1) My moves at the top are a result of r/map...I did try to pou it all 
in a vector with 'nto []'

 but nothing changes.

2)well, no there is no way to have 512 moves at any point in  in the 
game!!! The game actually starts with 20 branches (2 moves for each 
pawn and 2 for each knight) but quickly goes up to 30, 40, 50 etc. I 
will try your suggestion...



3)I'm not sure I understand what you mean...You're returning nil - I'm 
returning a very small number, they can both be read by the next 
branch don't they?


Jim


On 22/08/12 10:04, nicolas.o...@gmail.com wrote:

Hi,

3 questions:

1. Are you sure your moves list at the op level is in a vector?
   Looking at the code for reducers, it seems that it is the only
implementation actually doing concurrency.
2. The default block size for spawning a new thread is 512. Meaning
that if you have
   less than 512 first move in your game (quite likely, or else your
tree is too highly branching to do anything
  by min-max anyway), then it is only working on one thread.
This is tuned for large data set with moderate amount of work per datum.
Exactly the opposite of your workload. (Only 20 datums, but a lot of
work per datum).
  You will want to change the size of the block to something like 1, 
2 or 3.

  So your last line should look like that:

(defn best-move Start folding here. [dir b d]
   (r/fold 1 best best
(r/map #(Move-Value. (:move %) (search score-by-count (:tree %) d))
(:children (game-tree dir b
next-level)
3. I have doubte about your best function. The first branch should
return something that the second branch can read.
I suggest:
(defn best
([] nil)
([best1 best2]
   (cond
 (nil? best1) best2
 (nil? best2) best1)
 t (if (= (:value best1) (:value best2))
  best1 best2


With these modifications, it should run in // and be quite fast.





--
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: real-world usage of reducers?

2012-08-22 Thread nicolas.o...@gmail.com
On Wed, Aug 22, 2012 at 1:53 PM, Jim - FooBar(); jimpil1...@gmail.com wrote:
 Ok, so I followed your suggestions and the block size did the trick with
 regards to using all 4 cores of mine...However, even so, I get no
 performance improvements!!! It still needs close to 4 min to go to level 4
 and it still needs 5-6 sec to go to level 2 (a tiny bit faster than the
 sequential equivalent)...
You should see a close to *4 speed up, at least in the level 4.
One thing that could happen is if some of your functions are using
an atom or a reference and the threads keeps bumping into each other
and retrying.
Are you sure that both next-level and core-by-count are pure functions?
(And any other that are used in the search)


 3)I'm not sure I understand what you mean...You're returning nil - I'm 
 returning a very small number,
 they can both be read by the next branch don't they?

The problem is that (:value Integer/MIN_VALUE) is nil, which looks
like a bug and make your code hard to understand.

-- 
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: real-world usage of reducers?

2012-08-22 Thread Jim - FooBar();

On 22/08/12 14:08, nicolas.o...@gmail.com wrote:

You should see a close to *4 speed up, at least in the level 4.
One thing that could happen is if some of your functions are using
an atom or a reference and the threads keeps bumping into each other
and retrying.
Are you sure that both next-level and core-by-count are pure functions?
(And any other that are used in the search)


Well, the next-level fn derefs a promise (which holds a map with the 
current game's details) to produce the next boards but never changes it 
so has no side-effects...score-by-count is also pure - it just returns a 
number!



The problem is that (:value Integer/MIN_VALUE) is nil, which looks
like a bug and make your code hard to understand.


I'm really sorry but I don't follow...I'm only doing (:value best) or 
(:value next). best or next return a Move-Value (it has :move and :value 
keys) where the :value key could be Integer/MIN_VALUE - I'm not doing  
(:value Integer/MIN_VALUE) anywhere...


Jim




--
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: real-world usage of reducers?

2012-08-22 Thread Jim - FooBar();
So I tried with and without r/fold and I do get an almost 3x speedup for 
level 2 (a depth i can easily test)...


I get 60,598 ms without r/fold VS  23,901 ms with r/fold...so this is 
good - at least it's showing improvement (more than 2x)!


However, level 4 (which is the crucial level i want to train at) is ages 
away! I'm really not that patient to test it, but it seems it's well 
over 5 min away...How is that possible? An imperative for-loop in Java 
needed less than 2min to reach level 4, 3 years ago! Now I'm using all 4 
cores at 99% and nothing is happening...it is just heating up (my ubuntu 
becomes less responsive as well)!


Jim

ps: Could it be that the sequential version really is a lot worse than 
what I'm approximating?



On 22/08/12 14:20, Jim - FooBar(); wrote:

On 22/08/12 14:08, nicolas.o...@gmail.com wrote:

You should see a close to *4 speed up, at least in the level 4.
One thing that could happen is if some of your functions are using
an atom or a reference and the threads keeps bumping into each other
and retrying.
Are you sure that both next-level and core-by-count are pure functions?
(And any other that are used in the search)


Well, the next-level fn derefs a promise (which holds a map with the 
current game's details) to produce the next boards but never changes 
it so has no side-effects...score-by-count is also pure - it just 
returns a number!



The problem is that (:value Integer/MIN_VALUE) is nil, which looks
like a bug and make your code hard to understand.


I'm really sorry but I don't follow...I'm only doing (:value best) or 
(:value next). best or next return a Move-Value (it has :move and 
:value keys) where the :value key could be Integer/MIN_VALUE - I'm not 
doing  (:value Integer/MIN_VALUE) anywhere...


Jim






--
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: real-world usage of reducers?

2012-08-22 Thread nicolas.o...@gmail.com
 I'm really sorry but I don't follow...I'm only doing (:value best) or
 (:value next). best or next return a Move-Value (it has :move and :value
 keys) where the :value key could be Integer/MIN_VALUE - I'm not doing
 (:value Integer/MIN_VALUE) anywhere...

Then you want to write:
(defn best
([]   {:value Integer/MIN_VALUE})

because the second branch will be called with the result of the first
branch as a first argument.

-- 
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: real-world usage of reducers?

2012-08-22 Thread nicolas.o...@gmail.com
You should replace your functions that computes the board by function
that does return 30 times the same board.
And evaluation function by something that returns a constant value.
And check : speed and speed-up for folding.

Then you will know for sure whether the slowness comes from the
explore and search or from
the evaluation and computation of moves.

Alternatively, use visualvm (comes with jdk) or any other profiler to
check where are the 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: Deprecation of Swank Clojure, long live nrepl.el

2012-08-22 Thread Warren Lynn

I just gave a quick try on nrepl. It works right out of the box (at least 
the basics I tried) with jack-in. Thank you.

Now I have two questions:

1. I did not not ritz before this post. Its debugging capabilities is 
attractive to me (I have not tried it yet). Is there any plan to have those 
capabilities in nREPL too?
2. Right now I use slime-completions function with auto-complete.el so I 
have automatic completion working. I am very attached to auto-complete as 
that is a big helper on my coding efficiency. I know there is 
nrepl-complete command, but is there a function that will return all the 
completions for a prefix so I can use that with auto-complete? I could not 
find it.

Great to see the tool chain is moving forward. 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: What is the meaning of :while in a for ?

2012-08-22 Thread Arie van Wingerden
Extra restrictions on (range of values of) variables used in the for.
See here:
http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/for

2012/8/21 nicolas.o...@gmail.com nicolas.o...@gmail.com

 Dear all,

 What is the meaning of :while in a for?
 I understand :when, and also that :while jumps more element when the
 condition is not met,
 but where does it jump to exactly?

 Best regards,

 Nicolas.

 --
 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: What is the meaning of :while in a for ?

2012-08-22 Thread nicolas.o...@gmail.com
=
On Tue, Aug 21, 2012 at 11:50 AM, Arie van Wingerden xapw...@gmail.com wrote:
 Extra restrictions on (range of values of) variables used in the for.
 See here:
 http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/for

The link says nothing about the meaning of the modifiers.
(I agree it should, though.)

-- 
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: Deprecation of Swank Clojure, long live nrepl.el

2012-08-22 Thread Tim King
On Wed, Aug 22, 2012 at 7:56 AM, Warren Lynn wrn.l...@gmail.com wrote:

2. Right now I use slime-completions function with auto-complete.el so I
 have automatic completion working. I am very attached to auto-complete as
 that is a big helper on my coding efficiency. I know there is
 nrepl-complete command, but is there a function that will return all the
 completions for a prefix so I can use that with auto-complete? I could not
 find it.


Hi Warren,

You may want to check out  https://github.com/purcell/ac-nrepl.

Cheers,
Tim

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

Re: [ANN] nrepl.el 0.1.3 released

2012-08-22 Thread Tim King

 Tassilo Horn t...@gnu.org writes:

 Pull request is sent!


Thank you for your feedback and the pull request.
I'll check that out when I have a spare moment.

Cheers,
Tim

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

Re: Deprecation of Swank Clojure, long live nrepl.el

2012-08-22 Thread Baishampayan Ghose
 Thanks for being loyal users, and please do give nrepl.el a try.

I gave nrepl.el a shot today and I was quite impressed to say the least.

There were a couple of minor annoyances though -

* M-. on a JVM inter-op call throws an exception. This should be
handled gracefully.
* When using M-x nrepl, I can't specify a host, so it always picks localhost
* M-x repl should show me the default host/port automatically (does
nREPL have a default port at all?)
* There is no way to disconnect (or at least I couldn't find one)
* Backspace with paredit is broken

I am quite liking the way nREPL  nrepl.el are progressing, I think I
will be able to switch quite soon.

Kudos to Tim, Phil, Chas and everyone involved!

Regards,
BG

-- 
Baishampayan Ghose
b.ghose at gmail.com

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


Re: Lazily extract lines from large file

2012-08-22 Thread Stephen Compall
On Aug 17, 2012 4:53 PM, David Jacobs da...@wit.io wrote:
 Okay that's great. Thanks, you guys. Was read-lines only holding onto
 the head of the line seq because I bound it in the let statement?

No; (partial nth values) holds on to values, and map holds on to the
function you give it.

Omitting needless lets is a matter of style in this case.

--
Stephen Compall
If anyone in the MSA is online, you should watch this flythrough.

-- 
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] nrepl.el 0.1.3 released

2012-08-22 Thread Tassilo Horn
Tim King king...@gmail.com writes:

Hi Tim,

 Tassilo Horn t...@gnu.org writes:

 Pull request is sent!

 Thank you for your feedback and the pull request.

You're welcome.

 I'll check that out when I have a spare moment.

Great.

Bye,
Tassilo

-- 
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: Folding a reducer inside of a fold

2012-08-22 Thread Joshua Ballanco
On Wed, Aug 22, 2012 at 10:48:03AM +0100, nicolas.o...@gmail.com wrote:
  In particular, if I attempt to replace the `r/reduce` call on line #23,
  with a call to `r/fold`, I get the following crash:
 
 This calss sems strange.
 remaining? should represent a monoid for it to work.
 
 Meaning two functions:
 1 - A and (A - A - A)
 
 In your code, the case with no arg returns a boolean, and the function
 in the other branch wait
 for a boolean and a number.

You're likely right, but currently my code doesn't even get to
remaining? (i.e. if I put a log line in the method, it never gets
logged).

Actually, this is a different issue, but my reading of the reducers
library is that I could use remaining? as is for the reducef and a
separate function for the combinef, and only combinef needs to be a
proper monoid. Is that right? Also, on a related note, it's very
annoying that and in Clojure is implemented as a macro and therefore
cannot be used directly as combinef...

- Josh


-- 
Joshua Ballanco

ELC Technologies™
1771 NW Pettygrove Street, Suite 140
Portland, OR, 97209
jballa...@elctech.com

P +1 866.863.7365
F +1 877.658.6313
M +1 646.463.2673
T +90 533.085.5773

http://www.elctech.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


nREPL 0.2.0-beta9 released

2012-08-22 Thread Chas Emerick
I have recently released [org.clojure/tools.nrepl 0.2.0-beta9].  No 
incompatibilities are known between this release and prior betas.

Much of this release was focused on simplifying:

(a) The use of third-party middlewares; constructing an nREPL handler had 
become far too difficult from a user perspective, insofar as middlewares often 
must be stacked in a particular position relative to other middlewares

(b) nREPL client responsiveness; there was previously no way for clients to 
know what operations were supported by an nREPL endpoint, thus forcing a least 
common denominator approach (i.e. do everything via `eval`)

These factors should make life much easier for both users and developers of 
nREPL middlewares.

Unrelated to this release, I'd like to point out that nREPL has previously 
grown the flexibility to work around the thread stack size limitations frequent 
on Android devices, so such usage should be reasonably straightforward at this 
point (see http://dev.clojure.org/jira/browse/NREPL-8).  Feedback on any 
further Android issues are most welcome.

Looking forward, very little stands between us and a final 0.2.0 release.  
Please file your issues with the appropriate haste. ;-)

Finally, here's a summary of the changes in 0.2.0-beta9:

* New standard `describe` op, returns a machine- and human-readable directory 
of all ops supported by an nREPL endpoint's middleware stack (a.k.a. nREPL 
feature detection)

* New standard `load-file` op for loading the contents of a source file with 
debugging information (source path, etc) (Particularly important for 
Clojure/ClojureScript REPL uniformity)

* Added support for automagically arranging middlewares into a properly-ordered 
stack based on their runtime dependencies 
(http://dev.clojure.org/jira/browse/NREPL-26)

* The response message to requests that contain an unknown op now include a 
done status in addition to the prior error and unknown-op statuses

* Encoding and decoding of bencode bytestrings to Strings via UTF-8 has been 
pushed up into the default bencode Transport implementation to support sending 
binary values in messages efficiently (watch 
http://dev.clojure.org/jira/browse/NREPL-28 for further developments there).

* `eval` messages specifying a nonexistent namespace via :ns will provoke a 
response with statuses of #{error namespace-not-found done} instead of 
silently failing (http://dev.clojure.org/jira/browse/NREPL-23)

Cheers,

- Chas

--
http://cemerick.com
[Clojure Programming from O'Reilly](http://www.clojurebook.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: Deprecation of Swank Clojure, long live nrepl.el

2012-08-22 Thread Chas Emerick
On Aug 22, 2012, at 12:56 PM, Baishampayan Ghose wrote:

 * M-x repl should show me the default host/port automatically (does
 nREPL have a default port at all?)

No, nREPL does not yet have a default port, but it's a known TODO item:

http://dev.clojure.org/jira/browse/NREPL-3

I suppose I should put the application into IANA sooner rather than later...

- Chas

-- 
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: Deprecation of Swank Clojure, long live nrepl.el

2012-08-22 Thread Baishampayan Ghose
On Wed, Aug 22, 2012 at 11:56 PM, Chas Emerick c...@cemerick.com wrote:
 * M-x repl should show me the default host/port automatically (does
 nREPL have a default port at all?)

 No, nREPL does not yet have a default port, but it's a known TODO item:

 http://dev.clojure.org/jira/browse/NREPL-3

 I suppose I should put the application into IANA sooner rather than later...

Pick 7888 right-away and standardize later...

Regards,
BG

-- 
Baishampayan Ghose
b.ghose at gmail.com

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


Re: Deprecation of Swank Clojure, long live nrepl.el

2012-08-22 Thread Chas Emerick
On Aug 22, 2012, at 2:30 PM, Baishampayan Ghose wrote:

 * M-x repl should show me the default host/port automatically (does
 nREPL have a default port at all?)
 
 No, nREPL does not yet have a default port, but it's a known TODO item:
 
 http://dev.clojure.org/jira/browse/NREPL-3
 
 I suppose I should put the application into IANA sooner rather than later...
 
 Pick 7888 right-away and standardize later...

Maybe this is a case where I should ask for forgiveness later, but I was trying 
to stay on the good side of the last bullet here:

http://www.iana.org/form/ports-services

Anyone with experience with IANA, standardization of ports, etc., please feel 
free to contact me off list with any pointers on smoothing the way in this area.

- Chas

-- 
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: Deprecation of Swank Clojure, long live nrepl.el

2012-08-22 Thread Tassilo Horn
Baishampayan Ghose b.gh...@gmail.com writes:

 * Backspace with paredit is broken

That's fixed in a pull request of mine which also implements a major
overhaul of the completion mechanism.

Bye,
Tassilo

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


[viewing clojure datastructures] Is there something better than clojure.inspector?

2012-08-22 Thread Denis Labaye
Hi everyone,

The clojure.inspector functions are ... mmm ... a bit rough on the edge =)

Is there any lib that provide better support for exploring 
Clojure data-structures?

I am surprised I didn't found anything on Google, GitHub, ... 
Data-structures are at the core of Clojure, so being able to view / explore 
them seems a basic need to me.

For example: 

;; this works fine
(clojure.inspector/inspect-tree (range 10))

;; this breaks
(clojure.inspector/inspect-tree (range))

It seems to me that it would be *trivial*™ to implement a viewer that would 
be able to display (possibly infinite) lazy nested data structures. 

Any ideas? 

Cheers,

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: [viewing clojure datastructures] Is there something better than clojure.inspector?

2012-08-22 Thread Nahuel Greco
Another nice and simple addition to clojure.inspector would be add
auto-refreshing, so you can pass a reference and it and will display always
his latest version (maybe by using a watcher). It will be nice for live
debugging.

Saludos,
Nahuel Greco.


On Wed, Aug 22, 2012 at 5:58 PM, Denis Labaye denis.lab...@gmail.comwrote:

 Hi everyone,

 The clojure.inspector functions are ... mmm ... a bit rough on the edge
 =)

 Is there any lib that provide better support for exploring
 Clojure data-structures?

 I am surprised I didn't found anything on Google, GitHub, ...
 Data-structures are at the core of Clojure, so being able to view /
 explore them seems a basic need to me.

 For example:

 ;; this works fine
 (clojure.inspector/inspect-tree (range 10))

 ;; this breaks
 (clojure.inspector/inspect-tree (range))

 It seems to me that it would be *trivial*™ to implement a viewer that
 would be able to display (possibly infinite) lazy nested data structures.

 Any ideas?

 Cheers,

 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

-- 
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: [viewing clojure datastructures] Is there something better than clojure.inspector?

2012-08-22 Thread Frank Siebenlist
Check out clj-ns-browser (https://github.com/franks42/clj-ns-browser;).

When a var is defined, you can look at it's value, which is presented with 
pprint, which means that most data structures are nicely displayed.

When the value is a list/tree-like data structure, you can bring up Rich's 
original tree browser with the click of a button to look at the values. (that 
widget should really be rewritten as it's look and feel good be improved… but 
it works!)

Furthermore, there is a menu button that turns on an auto-refresh for the var's 
displayed value such that you can follow the var's value near real-time.

This may help with your requirements...

Enjoy, Frank.


On Aug 22, 2012, at 1:58 PM, Denis Labaye denis.lab...@gmail.com wrote:

 Hi everyone,
 
 The clojure.inspector functions are ... mmm ... a bit rough on the edge =)
 
 Is there any lib that provide better support for exploring Clojure 
 data-structures?
 
 I am surprised I didn't found anything on Google, GitHub, ... 
 Data-structures are at the core of Clojure, so being able to view / explore 
 them seems a basic need to me.
 
 For example: 
 
 ;; this works fine
 (clojure.inspector/inspect-tree (range 10))
 
 ;; this breaks
 (clojure.inspector/inspect-tree (range))
 
 It seems to me that it would be trivial™ to implement a viewer that would be 
 able to display (possibly infinite) lazy nested data structures. 
 
 Any ideas? 
 
 Cheers,
 
 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

-- 
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: [viewing clojure datastructures] Is there something better than clojure.inspector?

2012-08-22 Thread Nahuel Greco
You can set the clj-ns-browser browser to auto-refresh but you need to
utilize a full browser window just to watch a Var, and also the value not
as nicely displayed as using clojure.inspector. A nice addition to
clj-ns-browser will be to make possible create many auto-refreshing
clojure.inspector like windows out of browser selections, so many Vars can
be watched live in the least screen state possible.


Saludos,
Nahuel Greco.


On Wed, Aug 22, 2012 at 6:33 PM, Frank Siebenlist 
frank.siebenl...@gmail.com wrote:

 Check out clj-ns-browser (https://github.com/franks42/clj-ns-browser;).

 When a var is defined, you can look at it's value, which is presented with
 pprint, which means that most data structures are nicely displayed.

 When the value is a list/tree-like data structure, you can bring up Rich's
 original tree browser with the click of a button to look at the values.
 (that widget should really be rewritten as it's look and feel good be
 improved… but it works!)

 Furthermore, there is a menu button that turns on an auto-refresh for the
 var's displayed value such that you can follow the var's value near
 real-time.

 This may help with your requirements...

 Enjoy, Frank.


 On Aug 22, 2012, at 1:58 PM, Denis Labaye denis.lab...@gmail.com wrote:

  Hi everyone,
 
  The clojure.inspector functions are ... mmm ... a bit rough on the
 edge =)
 
  Is there any lib that provide better support for exploring Clojure
 data-structures?
 
  I am surprised I didn't found anything on Google, GitHub, ...
  Data-structures are at the core of Clojure, so being able to view /
 explore them seems a basic need to me.
 
  For example:
 
  ;; this works fine
  (clojure.inspector/inspect-tree (range 10))
 
  ;; this breaks
  (clojure.inspector/inspect-tree (range))
 
  It seems to me that it would be trivial™ to implement a viewer that
 would be able to display (possibly infinite) lazy nested data structures.
 
  Any ideas?
 
  Cheers,
 
  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

 --
 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: Deprecation of Swank Clojure, long live nrepl.el

2012-08-22 Thread Warren Lynn


Hi Warren,

 You may want to check out  https://github.com/purcell/ac-nrepl.

 Cheers,
 Tim


Thank you. I tried it out. It basically works but has glitches: 

1. If I type (clojure.repl/, right after the forward slash, I got a 
exception java.lang.ClassNotFoundException: clojure.repl (followed by a 
long stack trace). This is close to a deal breaker for me.

2. The pop-up documentation does not work right. Lines are missing (but 
those lines will show up again if I resize my Emacs window to force a 
redraw). I am on Windows so that could be a factor, but my auto-complete 
pop-up documentation for my Elisp code has no problem.



-- 
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: [viewing clojure datastructures] Is there something better than clojure.inspector?

2012-08-22 Thread Nahuel Greco
You can set the clj-ns-browser browser to auto-refresh but you need to
utilize a full browser window just to watch a Var, and also the value not
as nicely displayed as using clojure.inspector. A nice addition to
clj-ns-browser will be to make possible create many auto-refreshing
clojure.inspector like windows out of browser selections, so many Vars can
be watched live without using too much screen space.


Saludos,
Nahuel Greco.


On Wed, Aug 22, 2012 at 6:33 PM, Frank Siebenlist 
frank.siebenl...@gmail.com wrote:

 Check out clj-ns-browser (https://github.com/franks42/clj-ns-browser;).

 When a var is defined, you can look at it's value, which is presented with
 pprint, which means that most data structures are nicely displayed.

 When the value is a list/tree-like data structure, you can bring up Rich's
 original tree browser with the click of a button to look at the values.
 (that widget should really be rewritten as it's look and feel good be
 improved… but it works!)

 Furthermore, there is a menu button that turns on an auto-refresh for the
 var's displayed value such that you can follow the var's value near
 real-time.

 This may help with your requirements...

 Enjoy, Frank.


 On Aug 22, 2012, at 1:58 PM, Denis Labaye denis.lab...@gmail.com wrote:

  Hi everyone,
 
  The clojure.inspector functions are ... mmm ... a bit rough on the
 edge =)
 
  Is there any lib that provide better support for exploring Clojure
 data-structures?
 
  I am surprised I didn't found anything on Google, GitHub, ...
  Data-structures are at the core of Clojure, so being able to view /
 explore them seems a basic need to me.
 
  For example:
 
  ;; this works fine
  (clojure.inspector/inspect-tree (range 10))
 
  ;; this breaks
  (clojure.inspector/inspect-tree (range))
 
  It seems to me that it would be trivial™ to implement a viewer that
 would be able to display (possibly infinite) lazy nested data structures.
 
  Any ideas?
 
  Cheers,
 
  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

 --
 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: real-world usage of reducers?

2012-08-22 Thread Jim - FooBar();

On 22/08/12 15:16, nicolas.o...@gmail.com wrote:

You should replace your functions that computes the board by function
that does return 30 times the same board.
And evaluation function by something that returns a constant value.
And check : speed and speed-up for folding.

Then you will know for sure whether the slowness comes from the
explore and search or from
the evaluation and computation of moves.

Alternatively, use visualvm (comes with jdk) or any other profiler to
check where are the cost.



Ok, so I followed your advice and replaced the scoring-fn with (rand-int 
10) and the next-level-fn with (repeat 30 (Move-Board blah blah...)) and 
I have some interesting results


First of all, experimentation showed that the best partitioning size is 
1 unless it's only going to level 2 in which case it seems partitioning 
with 2 is slightly better...anyway I'm not interested in only going to 
level 2 so it doesn't matter.


As you reported 4-5 emails back, after  some optimizations (mainly 
'definline' and using reducers in my core ns as well) I managed to go to 
level 4 in roughly 8sec, with the dummy fns of course! Now that I got my 
baseline, starts the real experimentation...


Just looking at the 2 fns that are obviously the culprit, it is pretty 
obvious that the one producing the next-boards is the most expensive of 
the 2. so let's leave it last. for the moment let's bother with the one 
that calculates the leaves (the scoring-fn).


--with the dummy scoring-fn (rand-int 10) : 8-9sec

--with the scoring-fn that counts the pieces and subtracts  : 63-64sec
--with the scoring fn that counts their relative-value and subtracts : 
83-84


the good thing about the dummy scoring-fn is that at the end i can 
verify that it brought back the move with :value 9 so that is good news. 
However, no matter how much i tried to tune this, it seems that just 
counting the pieces is 7 times more expensive than generating random 
ints!!! In addition, accessing the :value key of the pieces (they are 
records) and subtracting their sums is an extra 20% more expensive! 
These are the best times i can report - mind you, I started with 127 and 
168 sec respectively...


Now, that we've established how much cheaper it is to generate random 
ints let's move on to the serious bit. for the next experiment the 
scoring-fn is locked (rand-ints) but I'm using the real next-level fn, 
again after making some optimisations...



--with the dummy board generation (repeat blah blah), as we saw above it 
takes 8-9 sec.
--with the real board generation it takes forever!!! I can't even 
measure how much cos I can't wait that long.


trying with the 2 real fns does not make any sense at this point...it is 
pretty clear that 'next level' is the culprit with regards to 
performance. So here it is:

--
(defn next-level [b dir]
  (r/map #(Move-Board. % (core/try-move %))
 (core/team-moves @curr-game b dir))) ;;curr-game is a promise

(definline team-moves
[game b dir]
`(let [team# (gather-team ~b ~dir)
   tmvs# (r/mapcat (fn [p#] (r/map #(dest-Move ~game p# %) 
(getMoves p#))) team#)]

 (into [] tmvs#)) )

(definline gather-team Returns all the pieces with same direction dir 
on this board b.

[b dir]
`(into [] (r/filter #(= ~dir (:direction %)) ~b))) ;all the team-mates 
(with same direction)


(definline dest-Move Helper fn for creating moves.
[dm p dest]  `(Move. ~p (partial move ~dm) ~dest))

(defn move
The function responsible for moving Pieces. Each piece knows how to 
move itself. Returns the resulting board without making any state 
changes. 

[game-map p coords]
;;{:pre [(satisfies? Piece p)]}  ;safety comes first
;;(if  (some #{coords} (:mappings game-map)) ;check that the position 
exists on the grid
(let [newPiece (update-position p coords) ;the new piece as a result of 
moving

  old-pos  (getListPosition p)
  new-pos  (getListPosition newPiece)]   ;;piece is a record
(- @(:board-atom game-map) ;deref the appropriate board atom
 (transient)
 (assoc! old-pos nil)
 (assoc! new-pos newPiece)
 (persistent!)
 #_(populate-board))) ;replace dead-pieces with nils
#_(throw (IllegalStateException. (str coords  is NOT a valid position 
according to the mappings provided!


(defn collides? Returns true if the move from [sx sy] to [ex ey] 
collides with any friendly pieces.

The move will be walked step by step by the walker fn.
[[sx sy] [ex ey] walker b m dir]
(loop [[imm-x imm-y] (if (nil? walker) [ex ey] (walker [sx sy]))] ;if 
walker is nil make one big step to the end (for the knight)

(cond
  (= [ex ey] [imm-x imm-y]) ;if reached destination
   (if (not= dir (:direction (b (translate-position ex ey m 
false true)

  (not (nil? (get b (translate-position imm-x imm-y m true
:else (recur (walker [imm-x imm-y])


Re: [viewing clojure datastructures] Is there something better than clojure.inspector?

2012-08-22 Thread Denis Labaye
On Wed, Aug 22, 2012 at 11:33 PM, Frank Siebenlist 
frank.siebenl...@gmail.com wrote:

 Check out clj-ns-browser (https://github.com/franks42/clj-ns-browser;).


This is really cool!

I love the tree like view of the global environmental. Great for exploring
clojure.core and libs.

It doesn't quite do what I want, especially it breaks when displaying large
(or infinite) seqs.

But it's definitely something I'll add to my Clojure tool belt!





 When a var is defined, you can look at it's value, which is presented with
 pprint, which means that most data structures are nicely displayed.

 When the value is a list/tree-like data structure, you can bring up Rich's
 original tree browser with the click of a button to look at the values.
 (that widget should really be rewritten as it's look and feel good be
 improved… but it works!)

 Furthermore, there is a menu button that turns on an auto-refresh for the
 var's displayed value such that you can follow the var's value near
 real-time.

 This may help with your requirements...

 Enjoy, Frank.


 On Aug 22, 2012, at 1:58 PM, Denis Labaye denis.lab...@gmail.com wrote:

  Hi everyone,
 
  The clojure.inspector functions are ... mmm ... a bit rough on the
 edge =)
 
  Is there any lib that provide better support for exploring Clojure
 data-structures?
 
  I am surprised I didn't found anything on Google, GitHub, ...
  Data-structures are at the core of Clojure, so being able to view /
 explore them seems a basic need to me.
 
  For example:
 
  ;; this works fine
  (clojure.inspector/inspect-tree (range 10))
 
  ;; this breaks
  (clojure.inspector/inspect-tree (range))
 
  It seems to me that it would be trivial™ to implement a viewer that
 would be able to display (possibly infinite) lazy nested data structures.
 
  Any ideas?
 
  Cheers,
 
  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

 --
 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: nREPL 0.2.0-beta9 released

2012-08-22 Thread Brent Millare
First, great work on nrepl! It's a great tool.

Second, I noticed you recently updated leiningen repl to include beta9. I 
was having problems trying to get piggieback to work with the older 
leiningen which depended on beta6. I was trying to customize profiles so 
that I could depend on beta9 but I couldn't find the config to work.

I tried:
~/.lein/profile.clj
{:repl {:dependencies [[blahblah beta9]]}}

and foo/project.clj
{:repl {:dependencies [[blahblah beta9]]}} 

Neither worked. What's the right way to do that?

(Note I got it to work with the updated master branch of leiningen, but I'm 
just trying to know this in the future in case I encounter a similar 
problem).

On Wednesday, August 22, 2012 1:51:33 PM UTC-4, Chas Emerick wrote:

 I have recently released [org.clojure/tools.nrepl 0.2.0-beta9].  No 
 incompatibilities are known between this release and prior betas. 

 Much of this release was focused on simplifying: 

 (a) The use of third-party middlewares; constructing an nREPL handler had 
 become far too difficult from a user perspective, insofar as middlewares 
 often must be stacked in a particular position relative to other 
 middlewares 

 (b) nREPL client responsiveness; there was previously no way for clients 
 to know what operations were supported by an nREPL endpoint, thus forcing a 
 least common denominator approach (i.e. do everything via `eval`) 

 These factors should make life much easier for both users and developers 
 of nREPL middlewares. 

 Unrelated to this release, I'd like to point out that nREPL has previously 
 grown the flexibility to work around the thread stack size limitations 
 frequent on Android devices, so such usage should be reasonably 
 straightforward at this point (see 
 http://dev.clojure.org/jira/browse/NREPL-8).  Feedback on any further 
 Android issues are most welcome. 

 Looking forward, very little stands between us and a final 0.2.0 release. 
  Please file your issues with the appropriate haste. ;-) 

 Finally, here's a summary of the changes in 0.2.0-beta9: 

 * New standard `describe` op, returns a machine- and human-readable 
 directory of all ops supported by an nREPL endpoint's middleware stack 
 (a.k.a. nREPL feature detection) 

 * New standard `load-file` op for loading the contents of a source file 
 with debugging information (source path, etc) (Particularly important for 
 Clojure/ClojureScript REPL uniformity) 

 * Added support for automagically arranging middlewares into a 
 properly-ordered stack based on their runtime dependencies (
 http://dev.clojure.org/jira/browse/NREPL-26) 

 * The response message to requests that contain an unknown op now include 
 a done status in addition to the prior error and unknown-op statuses 

 * Encoding and decoding of bencode bytestrings to Strings via UTF-8 has 
 been pushed up into the default bencode Transport implementation to support 
 sending binary values in messages efficiently (watch 
 http://dev.clojure.org/jira/browse/NREPL-28 for further developments 
 there). 

 * `eval` messages specifying a nonexistent namespace via :ns will provoke 
 a response with statuses of #{error namespace-not-found done} instead 
 of silently failing (http://dev.clojure.org/jira/browse/NREPL-23) 

 Cheers, 

 - Chas 

 -- 
 http://cemerick.com 
 [Clojure Programming from O'Reilly](http://www.clojurebook.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

Parser combinators in parsatron

2012-08-22 Thread Alexsandro Soares
Hi all,

   I'm using the Parsatron library to build parser combinators. I have the
following definition:

(defparser anbn []
  (let- [as  (many (char \a))
  bs  (times (count as) (char \b))]
(always (concat as bs

(defparser xdny []
  (let- [ds (between (char \x) (char \y)
   (many (char \d)))]
(always (concat '(\x) ds '(\y)

(defparser pL []
  (either
(anbn)
(xdny)))

When I use this definition in REPL with some examples, I have:

user= (run (pL) xddy)
()

user= (run (pL) aabb)
(\a \a \b \b)

user= (run (xdny) xddy)
(\x \d \d \y)

I didn't understand why the first answer is not (\x \d \d \y). The second
and third answers are correct for me.

Can anyone help me?

Regards,
Alex

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

dumping maps out to XML

2012-08-22 Thread larry google groups
Forgive me if this has been asked before. I am a beginner. I have a data 
structure that is composed of maps nested inside of a map. What is the 
easiest way to dump this out as XML? 

-- 
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: Deprecation of Swank Clojure, long live nrepl.el

2012-08-22 Thread Leonardo Borges
I must be missing something here. I followed the steps on the
leiningen upgrade wiki page and everything seemed fine.

However, even thought my project has an explicit dependency on Clojure
1.4.0, lein repl is starting a session with Clojure 1.2.1

Can't really see where I've gone wrong. Does this ring a bell to anyone?

Cheers,
Leonardo Borges
www.leonardoborges.com


On Thu, Aug 23, 2012 at 7:52 AM, Warren Lynn wrn.l...@gmail.com wrote:


 Hi Warren,

 You may want to check out  https://github.com/purcell/ac-nrepl.

 Cheers,
 Tim


 Thank you. I tried it out. It basically works but has glitches:

 1. If I type (clojure.repl/, right after the forward slash, I got a
 exception java.lang.ClassNotFoundException: clojure.repl (followed by a
 long stack trace). This is close to a deal breaker for me.

 2. The pop-up documentation does not work right. Lines are missing (but
 those lines will show up again if I resize my Emacs window to force a
 redraw). I am on Windows so that could be a factor, but my auto-complete
 pop-up documentation for my Elisp code has no problem.



 --
 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: [viewing clojure datastructures] Is there something better than clojure.inspector?

2012-08-22 Thread blackblock
I get this with Lein2 with lein repl:

IllegalStateException escape-html already refers to: 
#'hiccup.core/escape-html in namespace: hiccup.page  
clojure.lang.Namespace.warnOrFailOnReplace (Namespace.java:88)

On Thursday, August 23, 2012 7:33:44 AM UTC+10, FrankS wrote:

 Check out clj-ns-browser (https://github.com/franks42/clj-ns-browser;). 

 When a var is defined, you can look at it's value, which is presented with 
 pprint, which means that most data structures are nicely displayed. 

 When the value is a list/tree-like data structure, you can bring up Rich's 
 original tree browser with the click of a button to look at the values. 
 (that widget should really be rewritten as it's look and feel good be 
 improved… but it works!) 

 Furthermore, there is a menu button that turns on an auto-refresh for the 
 var's displayed value such that you can follow the var's value near 
 real-time. 

 This may help with your requirements... 

 Enjoy, Frank. 


 On Aug 22, 2012, at 1:58 PM, Denis Labaye denis@gmail.comjavascript: 
 wrote: 

  Hi everyone, 
  
  The clojure.inspector functions are ... mmm ... a bit rough on the 
 edge =) 
  
  Is there any lib that provide better support for exploring Clojure 
 data-structures? 
  
  I am surprised I didn't found anything on Google, GitHub, ... 
  Data-structures are at the core of Clojure, so being able to view / 
 explore them seems a basic need to me. 
  
  For example: 
  
  ;; this works fine 
  (clojure.inspector/inspect-tree (range 10)) 
  
  ;; this breaks 
  (clojure.inspector/inspect-tree (range)) 
  
  It seems to me that it would be trivial™ to implement a viewer that 
 would be able to display (possibly infinite) lazy nested data structures. 
  
  Any ideas? 
  
  Cheers, 
  
  Denis 
  
  
  -- 
  You received this message because you are subscribed to the Google 
  Groups Clojure group. 
  To post to this group, send email to clo...@googlegroups.comjavascript: 
  Note that posts from new members are moderated - please be patient with 
 your first post. 
  To unsubscribe from this group, send email to 
  clojure+u...@googlegroups.com javascript: 
  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: Parser combinators in parsatron

2012-08-22 Thread Armando Blancas
pL first tries anbn: many parses zero \a's; then times has to parse zero 
\b's; and the parser returns the concatenation of two empty lists. An empty 
list isn't a failure as far as the parser either is concerned, so it won't 
try xdny in that case.

On Wednesday, August 22, 2012 5:38:56 PM UTC-7, Alexsandro Soares wrote:

 Hi all,

I'm using the Parsatron library to build parser combinators. I have the 
 following definition:

 (defparser anbn [] 
   (let- [as  (many (char \a))
   bs  (times (count as) (char \b))]
 (always (concat as bs

 (defparser xdny []
   (let- [ds (between (char \x) (char \y) 
(many (char \d)))]
 (always (concat '(\x) ds '(\y)

 (defparser pL []
   (either 
 (anbn)
 (xdny)))

 When I use this definition in REPL with some examples, I have:

 user= (run (pL) xddy)
 ()

 user= (run (pL) aabb)
 (\a \a \b \b)

 user= (run (xdny) xddy)
 (\x \d \d \y)

 I didn't understand why the first answer is not (\x \d \d \y). The second 
 and third answers are correct for me.

 Can anyone help me?

 Regards,
 Alex


-- 
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: Deprecation of Swank Clojure, long live nrepl.el

2012-08-22 Thread Leonardo Borges
Moreover, not only it starts an old version of Clojure, but it
randomly picks a clojure version each time I start the repl (?!) from
within the same project directory

$ lein repl
nREPL server started on port 7888
REPL-y 0.1.0-beta10
Clojure 1.3.0


$ lein repl
nREPL server started on port 7888
REPL-y 0.1.0-beta10
Clojure 1.2.1

$ lein repl
nREPL server started on port 7888
REPL-y 0.1.0-beta10
Clojure 1.3.0

Absolutely no clue. I even removed all Clojure versions from ~/.m2
just in case that was messing up something but no help.

And I do have Clojure 1.4.0 listed in my project.clj:

(defproject blah/blah 1.0.0-SNAPSHOT
 :dependencies [[org.clojure/clojure 1.4.0]
...

Cheers,
Leonardo Borges
www.leonardoborges.com


On Thu, Aug 23, 2012 at 12:03 PM, Leonardo Borges
leonardoborges...@gmail.com wrote:
 I must be missing something here. I followed the steps on the
 leiningen upgrade wiki page and everything seemed fine.

 However, even thought my project has an explicit dependency on Clojure
 1.4.0, lein repl is starting a session with Clojure 1.2.1

 Can't really see where I've gone wrong. Does this ring a bell to anyone?

 Cheers,
 Leonardo Borges
 www.leonardoborges.com


 On Thu, Aug 23, 2012 at 7:52 AM, Warren Lynn wrn.l...@gmail.com wrote:


 Hi Warren,

 You may want to check out  https://github.com/purcell/ac-nrepl.

 Cheers,
 Tim


 Thank you. I tried it out. It basically works but has glitches:

 1. If I type (clojure.repl/, right after the forward slash, I got a
 exception java.lang.ClassNotFoundException: clojure.repl (followed by a
 long stack trace). This is close to a deal breaker for me.

 2. The pop-up documentation does not work right. Lines are missing (but
 those lines will show up again if I resize my Emacs window to force a
 redraw). I am on Windows so that could be a factor, but my auto-complete
 pop-up documentation for my Elisp code has no problem.



 --
 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: nREPL 0.2.0-beta9 released

2012-08-22 Thread Chas Emerick
The requirement noted in Piggieback's README on what's currently in Leiningen 
master isn't related to nREPL (Piggieback itself doesn't depend on -beta9 and 
should work just fine with -beta6); it's due to the Leiningen's new support for 
customizing the handler or middleware used by nREPL endpoints started by `lein 
repl`:

https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L133

Without that, you'll have to configure and start an nREPL server as otherwise 
described in the Piggieback README to include its middleware — which you can 
then connect to through Leiningen (or any other nREPL client) if you like.

In short, you can use Piggieback with any sane rev of nREPL or Leiningen, but 
you'll need what's in the latter's master in order to include Piggieback in the 
REPL started via `lein repl`.

- Chas

On Aug 22, 2012, at 7:37 PM, Brent Millare wrote:

 First, great work on nrepl! It's a great tool.
 
 Second, I noticed you recently updated leiningen repl to include beta9. I was 
 having problems trying to get piggieback to work with the older leiningen 
 which depended on beta6. I was trying to customize profiles so that I could 
 depend on beta9 but I couldn't find the config to work.
 
 I tried:
 ~/.lein/profile.clj
 {:repl {:dependencies [[blahblah beta9]]}}
 
 and foo/project.clj
 {:repl {:dependencies [[blahblah beta9]]}} 
 
 Neither worked. What's the right way to do that?
 
 (Note I got it to work with the updated master branch of leiningen, but I'm 
 just trying to know this in the future in case I encounter a similar problem).
 
 On Wednesday, August 22, 2012 1:51:33 PM UTC-4, Chas Emerick wrote:
 I have recently released [org.clojure/tools.nrepl 0.2.0-beta9].  No 
 incompatibilities are known between this release and prior betas. 
 
 Much of this release was focused on simplifying: 
 
 (a) The use of third-party middlewares; constructing an nREPL handler had 
 become far too difficult from a user perspective, insofar as middlewares 
 often must be stacked in a particular position relative to other 
 middlewares 
 
 (b) nREPL client responsiveness; there was previously no way for clients to 
 know what operations were supported by an nREPL endpoint, thus forcing a 
 least common denominator approach (i.e. do everything via `eval`) 
 
 These factors should make life much easier for both users and developers of 
 nREPL middlewares. 
 
 Unrelated to this release, I'd like to point out that nREPL has previously 
 grown the flexibility to work around the thread stack size limitations 
 frequent on Android devices, so such usage should be reasonably 
 straightforward at this point (see 
 http://dev.clojure.org/jira/browse/NREPL-8).  Feedback on any further Android 
 issues are most welcome. 
 
 Looking forward, very little stands between us and a final 0.2.0 release.  
 Please file your issues with the appropriate haste. ;-) 
 
 Finally, here's a summary of the changes in 0.2.0-beta9: 
 
 * New standard `describe` op, returns a machine- and human-readable 
 directory of all ops supported by an nREPL endpoint's middleware stack 
 (a.k.a. nREPL feature detection) 
 
 * New standard `load-file` op for loading the contents of a source file with 
 debugging information (source path, etc) (Particularly important for 
 Clojure/ClojureScript REPL uniformity) 
 
 * Added support for automagically arranging middlewares into a 
 properly-ordered stack based on their runtime dependencies 
 (http://dev.clojure.org/jira/browse/NREPL-26) 
 
 * The response message to requests that contain an unknown op now include a 
 done status in addition to the prior error and unknown-op statuses 
 
 * Encoding and decoding of bencode bytestrings to Strings via UTF-8 has been 
 pushed up into the default bencode Transport implementation to support 
 sending binary values in messages efficiently (watch 
 http://dev.clojure.org/jira/browse/NREPL-28 for further developments there). 
 
 * `eval` messages specifying a nonexistent namespace via :ns will provoke a 
 response with statuses of #{error namespace-not-found done} instead of 
 silently failing (http://dev.clojure.org/jira/browse/NREPL-23) 
 
 Cheers, 
 
 - Chas 
 
 -- 
 http://cemerick.com 
 [Clojure Programming from O'Reilly](http://www.clojurebook.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

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

Re: nREPL 0.2.0-beta9 released

2012-08-22 Thread Brent Millare
Good to know I wasn't going crazy trying to find the right profile setup.

On another note (and slightly OT), taking the return value of 
cljs.closure/build of the cljs file with the call to repl/connect and 
inserting the outputed js into the index.html appears to be sufficient from 
the clojurescript side to make a browser repl.

I'm happy that it is now both simple and easy to create a nrepl session 
tied to a cljs 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: Deprecation of Swank Clojure, long live nrepl.el

2012-08-22 Thread Leonardo Borges
Nevermind. I used lein deps :tree to analyze my current dependency
tree an realized korma depended on Clojure 1.3.0 - why lein was
loading 1.2.1 sometimes is still beyond me.

I upgraded Korma and lein repl now respects my preference for clojure 1.4.0

All is well in the world. Sorry for the noise.

Cheers,
Leonardo Borges
www.leonardoborges.com


On Thu, Aug 23, 2012 at 1:06 PM, Leonardo Borges
leonardoborges...@gmail.com wrote:
 Moreover, not only it starts an old version of Clojure, but it
 randomly picks a clojure version each time I start the repl (?!) from
 within the same project directory

 $ lein repl
 nREPL server started on port 7888
 REPL-y 0.1.0-beta10
 Clojure 1.3.0


 $ lein repl
 nREPL server started on port 7888
 REPL-y 0.1.0-beta10
 Clojure 1.2.1

 $ lein repl
 nREPL server started on port 7888
 REPL-y 0.1.0-beta10
 Clojure 1.3.0

 Absolutely no clue. I even removed all Clojure versions from ~/.m2
 just in case that was messing up something but no help.

 And I do have Clojure 1.4.0 listed in my project.clj:

 (defproject blah/blah 1.0.0-SNAPSHOT
  :dependencies [[org.clojure/clojure 1.4.0]
 ...

 Cheers,
 Leonardo Borges
 www.leonardoborges.com


 On Thu, Aug 23, 2012 at 12:03 PM, Leonardo Borges
 leonardoborges...@gmail.com wrote:
 I must be missing something here. I followed the steps on the
 leiningen upgrade wiki page and everything seemed fine.

 However, even thought my project has an explicit dependency on Clojure
 1.4.0, lein repl is starting a session with Clojure 1.2.1

 Can't really see where I've gone wrong. Does this ring a bell to anyone?

 Cheers,
 Leonardo Borges
 www.leonardoborges.com


 On Thu, Aug 23, 2012 at 7:52 AM, Warren Lynn wrn.l...@gmail.com wrote:


 Hi Warren,

 You may want to check out  https://github.com/purcell/ac-nrepl.

 Cheers,
 Tim


 Thank you. I tried it out. It basically works but has glitches:

 1. If I type (clojure.repl/, right after the forward slash, I got a
 exception java.lang.ClassNotFoundException: clojure.repl (followed by a
 long stack trace). This is close to a deal breaker for me.

 2. The pop-up documentation does not work right. Lines are missing (but
 those lines will show up again if I resize my Emacs window to force a
 redraw). I am on Windows so that could be a factor, but my auto-complete
 pop-up documentation for my Elisp code has no problem.



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