Re: If a protocol creates a Java interface under the covers...

2012-06-13 Thread Jim - FooBar();
On 13/06/12 10:58, nicolas.o...@gmail.com wrote: And from what I understand of your design, I disagree on a point: I think it is not true a move is a command apply to a piece. A lot of moves involve multiple pieces. So I would try to represent a move as something like: (defprotocol Move

Re: If a protocol creates a Java interface under the covers...

2012-06-13 Thread Jim - FooBar();
First of all, thanks all of you for your helpful and often enlightening comments On 13/06/12 08:13, Tassilo Horn wrote: But probably that's not a good approach. When mutating the positions in a move, there's no way back. If everything was immutable, i.e., updatePosition would return a ne

Re: core.logic for encoding the rules of chess or checkers? is it plausible/desirable ?

2012-06-12 Thread Jim - FooBar();
Nevermind...I found the namespace with these non-relational operators and the code works like a charm!!! I am so happy... :-) Jim On 12/06/12 22:18, Jim - FooBar(); wrote: Hi Marek, I did what you said and I translated the prolog code to core.logic. Your 2 examples helped a lot and thanks

Re: core.logic for encoding the rules of chess or checkers? is it plausible/desirable ?

2012-06-12 Thread Jim - FooBar();
Hi Marek, I did what you said and I translated the prolog code to core.logic. Your 2 examples helped a lot and thanks again for that. The versionI've got now is this: --- (defn knight-moves [x y] (let [

Re: If a protocol creates a Java interface under the covers...

2012-06-12 Thread Jim - FooBar();
On 12/06/12 19:41, Alan Malloy wrote: It's not just less convenient, but genuinely incorrect to use dot- notation for protocol functions. Not every class that satisfies the protocol will be implementing the interface directly, and so dot- notation will fail on them. The interface generated by def

Re: If a protocol creates a Java interface under the covers...

2012-06-12 Thread Jim - FooBar();
On 12/06/12 14:43, Tassilo Horn wrote: "Jim - FooBar();" writes: If update-position is a protocol function just call it without the dot. Just like a normal function. Then any reflection will go away and no type hint is needed. WHAT??? Seriously??? I'll try it... OMG! You we

Re: If a protocol creates a Java interface under the covers...

2012-06-12 Thread Jim - FooBar();
On 12/06/12 13:53, Jim - FooBar(); wrote: On 12/06/12 13:47, Meikel Brandmeyer (kotarak) wrote: If update-position is a protocol function just call it without the dot. Just like a normal function. Then any reflection will go away and no type hint is needed. WHAT??? Seriously??? I'll t

Re: If a protocol creates a Java interface under the covers...

2012-06-12 Thread Jim - FooBar();
On 12/06/12 13:47, Meikel Brandmeyer (kotarak) wrote: If update-position is a protocol function just call it without the dot. Just like a normal function. Then any reflection will go away and no type hint is needed. WHAT??? Seriously??? I'll try it... Jim -- You received this message because

Re: If a protocol creates a Java interface under the covers...

2012-06-12 Thread Jim - FooBar();
Jim On 12/06/12 13:28, Jim - FooBar(); wrote: Of course, I Just noticed that type-hinting 'p' renders the precondition useless...an extra performance bonus! Jim On 12/06/12 13:26, Jim - FooBar(); wrote: On 12/06/12 13:16, Tassilo Horn wrote: I don't get you. If IPieces

Re: If a protocol creates a Java interface under the covers...

2012-06-12 Thread Jim - FooBar();
Of course, I Just noticed that type-hinting 'p' renders the precondition useless...an extra performance bonus! Jim On 12/06/12 13:26, Jim - FooBar(); wrote: On 12/06/12 13:16, Tassilo Horn wrote: I don't get you. If IPieces can be moved, then move should be a protocol met

Re: If a protocol creates a Java interface under the covers...

2012-06-12 Thread Jim - FooBar();
On 12/06/12 13:16, Tassilo Horn wrote: I don't get you. If IPieces can be moved, then move should be a protocol method declared in IPiece. No what i have in IPiece is 'updatePosition' so each piece knows how to update its position. THere is more to a move though. 'move' is a regular function

Re: If a protocol creates a Java interface under the covers...

2012-06-12 Thread Jim - FooBar();
Thanks Tassilo, your suggestion of fully qualifying the protocol worked like a charm! I managed to eliminate my last 2 reflective calls on the whole namespace... this is good stuff! Jim On 12/06/12 12:57, Jim - FooBar(); wrote: aaa ok I see... however I only want to do this to avoid a

Re: If a protocol creates a Java interface under the covers...

2012-06-12 Thread Jim - FooBar();
iled answer :-) On 12/06/12 12:50, Tassilo Horn wrote: "Jim - FooBar();" writes: why can't I use the interface as function argument instead of the concrete class (record)? example: (defprotocol IPiece blah blah blah) (defrecord ChessPiece IPiece blah b

If a protocol creates a Java interface under the covers...

2012-06-12 Thread Jim - FooBar();
why can't I use the interface as function argument instead of the concrete class (record)? example: (defprotocol IPiece blah blah blah) (defrecord ChessPiece IPiece blah blah blah) (defrecord CheckersPiece IPiece blah blah blah) (defn move [^IPiece p] ;will complain th

Re: Clojure Sticker

2012-06-11 Thread Jim - FooBar();
Obviously, I meant "t-shirt"... :-[ Jim On 12/06/12 00:29, Jim.foobar wrote: i got a t-shit from zazzle ... Sent from my mobile... Sven Johansson wrote: I've been trawling the internet for Clojure stickers before and come up empty. If there's really and truly nowhere to get these online,

Re: core.logic for encoding the rules of chess or checkers? is it plausible/desirable ?

2012-06-11 Thread Jim - FooBar();
B is Y - 2. move([X, Y, Xmax, Ymax], [A, B, Xmax, Ymax]) :- X - 2 >= 0, Y - 1 >= 0, A is X - 2, B is Y - 1. move([X, Y, Xmax, Ymax], [A, B, Xmax, Ymax]) :- X - 2 >= 0, Y + 1 < Ymax, A is X - 2, B is Y + 1. move([X, Y, Xmax, Ymax], [A, B, Xmax,

Re: core.logic for encoding the rules of chess or checkers? is it plausible/desirable ?

2012-06-11 Thread Jim - FooBar();
sorry I confused knights with bishops! I meant to say that checkers move similarly with bishops...nevertheless, If I can translate the knight's move (perhaps the most difficult one), I think I can come up with the moves for the rest of the pieces... Jim On 11/06/12 11:25, Jim - F

Re: core.logic for encoding the rules of chess or checkers? is it plausible/desirable ?

2012-06-11 Thread Jim - FooBar();
ax, Ymax], [A, B, Xmax, Ymax]) :- X - 2 >= 0, Y + 1 < Ymax, A is X - 2, B is Y + 1. move([X, Y, Xmax, Ymax], [A, B, Xmax, Ymax]) :- X - 1 >= 0, Y + 2 < Ymax, A is X - 1, B is Y + 2. Jim On 11/06/12 01:09, Jim - FooBar(); wrote: Hello everyone, I'm trying to decide if its worth

core.logic for encoding the rules of chess or checkers? is it plausible/desirable ?

2012-06-10 Thread Jim - FooBar();
Hello everyone, I'm trying to decide if its worth writing the rules of chess/checkers using core.logic or go down the conventional road but unfortunately I'm inexperienced as far as core.logic goes. I mean I've played around for a bit but nothing serious. What I want is NOT AI or anything li

Re: fully type-hinted record still uses reflection!

2012-06-10 Thread Jim - FooBar();
On 10/06/12 18:43, Ben Smith-Mannschott wrote: "can accept ints or doubles" How is the Clojure compiler to know wether to compile a call to Point.setLocation(double,double) or Point.setLocation(int,int)? I think you need to tell the compiler the types of (first np) and (second np), which means

Re: fully type-hinted record still uses reflection!

2012-06-10 Thread Jim - FooBar();
m the start - that is why I've put the little comment there) thanks a lot Ben...I do know i n advance which one of the 2 to call (the one accepting doubles) so I'll type-hint accordingly :-) Jim On 10/06/12 18:43, Ben Smith-Mannschott wrote: On Sun, Jun 10, 2012 at 7:04 PM, Jim - F

Re: fully type-hinted record still uses reflection!

2012-06-10 Thread Jim - FooBar();
the same thing as far as updating the position goes and setLocation is the culprit again! Jim On 10/06/12 18:09, Lars Nilsson wrote: On Sun, Jun 10, 2012 at 1:08 PM, Lars Nilsson wrote: On Sun, Jun 10, 2012 at 1:04 PM, Jim - FooBar(); wrote: Hi again (busy day eh?), well this doesn't make a

fully type-hinted record still uses reflection!

2012-06-10 Thread Jim - FooBar();
Hi again (busy day eh?), well this doesn't make any sense either! Why is a record with type-hinted arguments still using reflection? I've got the following example record: -- (defrecord CheckersPiec

Re: clashing methods between 2 different protocols???

2012-06-10 Thread Jim - FooBar();
"Chess-move originating from" (.getStartPos this) "to" (.getEndPos this Jim On 10/06/12 14:58, Jim - FooBar(); wrote: Hello everyone, I am completely and utterly confused about this error that I just got: Warning: protocol #'Clondie24.core/MoveCommand is overwriti

clashing methods between 2 different protocols???

2012-06-10 Thread Jim - FooBar();
Hello everyone, I am completely and utterly confused about this error that I just got: Warning: protocol #'Clondie24.core/MoveCommand is overwriting method toString of protocol Piece (defprotocol MoveCommand "The Command design pattern in action." (execute [this]) (undo[this]) (getM

Re: Doseq, map-style

2012-06-09 Thread Jim - FooBar();
I just saw this has been already answered! I apologise for the noise! Jim On 09/06/12 16:45, Jim - FooBar(); wrote: Why not make it yourself? Something like this perhaps? (defmacro doeach [f coll] `(doseq [x# ~coll] (~f x#))) Itis good if you name it "doeach" instead of each to i

Re: Doseq, map-style

2012-06-09 Thread Jim - FooBar();
Why not make it yourself? Something like this perhaps? (defmacro doeach [f coll] `(doseq [x# ~coll] (~f x#))) Itis good if you name it "doeach" instead of each to imply side-effects (just like doseq)... Hope that helps... Jim On 08/06/12 04:32, David Jacobs wrote: I would love to have a ve

Re: help with chess-checkers engine (constructing the board after each move)

2012-06-08 Thread Jim - FooBar();
(assoc nb (.getListPosition p) p) (rest p) Jim ps: thanks anyway for those who looked at the question in the first place! :-) On 08/06/12 15:47, Jim - FooBar(); wrote: Hello fellow Clojurians, I've started building an extendible board-game engine (chess/checkers at the moment) and I'm f

help with chess-checkers engine (constructing the board after each move)

2012-06-08 Thread Jim - FooBar();
Hello fellow Clojurians, I've started building an extendible board-game engine (chess/checkers at the moment) and I'm facing a few problems...Let me explain... For checkers I'd like to represent the board as a list of 31 positions. Of course there has to be a mapping from the 1d list to a 2d

Re: Last element of sequence returned by 'take' not showing side effects

2012-06-06 Thread Jim - FooBar();
It's obvious that you're looking for: (def lazy1 (interleave (repeat '+) (range 3))) but I still haven't figured out why you get: (+0 +1 2) when using iterate! Jim On 06/06/12 11:13, Jim - FooBar(); wrote: From the docs: clojure.core/iterate ([f x]) Returns a la

Re: Last element of sequence returned by 'take' not showing side effects

2012-06-06 Thread Jim - FooBar();
From the docs: clojure.core/iterate ([f x]) Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects Your f is NOT free of side-effects...Nonetheless, I would expect (0 +1 +2) instead of (+0 +1 2)! Can anyone shine some light on this? Jim On 06/06/12 10:24, Z

Re: user.clj not working with lein 2.0

2012-06-05 Thread Jim - FooBar();
On 05/06/12 18:17, Phil Hagelberg wrote: On Tue, Jun 5, 2012 at 10:00 AM, Jim - FooBar(); wrote: Ok I see... then why can I not use my debug-repl, which is located in init.clj ? It only works when I'm in the 'user' namespace...I think this worked perfectly ok in lein1...at a

Re: user.clj not working with lein 2.0

2012-06-05 Thread Jim - FooBar();
On 05/06/12 18:00, Jim - FooBar(); wrote: On 05/06/12 17:10, Phil Hagelberg wrote: On Tue, Jun 5, 2012 at 5:20 AM, Jim - FooBar(); wrote: Does the :injections key replace the init.clj found in /.lein/? If I understood correctly, I had roughly the same problem...my code in init.clj (some

Re: user.clj not working with lein 2.0

2012-06-05 Thread Jim - FooBar();
On 05/06/12 17:10, Phil Hagelberg wrote: On Tue, Jun 5, 2012 at 5:20 AM, Jim - FooBar(); wrote: Does the :injections key replace the init.clj found in /.lein/? If I understood correctly, I had roughly the same problem...my code in init.clj (some debugging functions I always need available) is

Re: user.clj not working with lein 2.0

2012-06-05 Thread Jim - FooBar();
Does the :injections key replace the init.clj found in /.lein/? If I understood correctly, I had roughly the same problem...my code in init.clj (some debugging functions I always need available) is no more being loaded with lein2...should I use the :injections key instead? Thanks in advance...

Re: [ANN] Leiningen 2.0.0-preview5 released

2012-06-02 Thread Jim - FooBar();
Exactly the same thing happened to me! so I went in and changed manually the preview number in the lein script to get 5 again...However preview5 still ahs the JLine class issue at which point I gave up...I've got a local build of preview5 (from borkerdude on github) which works just fine so I'l

Re: [ANN] Leiningen 2.0.0-preview5 released

2012-06-01 Thread Jim - FooBar();
How come building preview5 from source works just fine? Jim On 01/06/12 18:27, Phil Hagelberg wrote: It turns out the problem with SSL is an issue with Oracle's JDK rather than being specific to Windows; Oracle revoked the certificate authority used by Clojars. So if you are not using OpenJDK

Re: [ANN] Leiningen 2.0.0-preview5 released

2012-06-01 Thread Jim - FooBar();
https://www.refheap.com/paste/2956 I am using Java6 on Mac OS X. Regards, BG On Fri, Jun 1, 2012 at 1:59 PM, Jim - FooBar(); wrote: After upgrading from preview4 to preview5 I get this when trying to do "lein2 repl" inside any project folder... Is this a known issue? I&

Re: [ANN] Leiningen 2.0.0-preview5 released

2012-06-01 Thread Jim - FooBar();
After upgrading from preview4 to preview5 I get this when trying to do "lein2 repl" inside any project folder... Is this a known issue? I'm using Jdk 1.7... Could not find artifact reply:reply:pom:0.1.0-beta8 in central (http://rep

Re: reify vs proxy

2012-05-28 Thread Jim - FooBar();
On 28/05/12 11:48, Jim - FooBar(); wrote: Hello everyone, I know this is trivial but i just noticed that, unlike proxy, reify demands that at least the return types are consistent. I had a piece of code like this: (defmacro implement-CalculateScore "Consumer convenience for implementin

reify vs proxy

2012-05-28 Thread Jim - FooBar();
Hello everyone, I know this is trivial but i just noticed that, unlike proxy, reify demands that at least the return types are consistent. I had a piece of code like this: (defmacro implement-CalculateScore "Consumer convenience for implementing the CalculateScore interface which is needed f

repl hanging sometimes in lein2?

2012-05-18 Thread Jim - FooBar();
It seems that the known issue of lein1 (repl hanging sometimes after printing), is still present on lein2... The only way to avoid this is to aot compile at least one namespace and then do "lein2 run", which is exactly what I used to do before upgrading... Any insights? Is this what everyone

Re: Different behavior at REPL vs compiled code

2012-05-18 Thread Jim - FooBar();
Try wrapping your if statement in a let with a binding : [k (Integer/parseInt n) ] and then use k from then onas Ankit said, arguments passed from cmd are always strings... Jim On 18/05/12 07:39, Ankit Goel wrote: Hi, I have recently started learning clojure and have been setting up lei

Re: what is the deal with ArraySeq?

2012-05-16 Thread Jim - FooBar();
n 16 May 2012 20:41, Jim - FooBar(); wrote: Really OMG...why so? what if I sometimes need more than one array - for example in the data-set case? Jim On 16/05/12 19:38, Michał Marczyk wrote: You need to remove the&from the params vector of make-data. Cheers, M. On 16

Re: what is the deal with ArraySeq?

2012-05-16 Thread Jim - FooBar();
Really OMG...why so? what if I sometimes need more than one array - for example in the data-set case? Jim On 16/05/12 19:38, Michał Marczyk wrote: You need to remove the& from the params vector of make-data. Cheers, M. On 16 May 2012 20:35, Jim - FooBar(); wrote: This is '

Re: what is the deal with ArraySeq?

2012-05-16 Thread Jim - FooBar();
On 16/05/12 19:38, David Nolen wrote: What's actually on line 37? (do (. twa analyze (doubles data)) the error originates here... 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 No

Re: what is the deal with ArraySeq?

2012-05-16 Thread Jim - FooBar();
32, David Nolen wrote: On Wed, May 16, 2012 at 1:59 PM, Jim - FooBar(); <mailto:jimpil1...@gmail.com>> wrote: ClassCastException [D cannot be cast to java.lang.Number clojure.lang.Numbers.double_array (Numbers.java:1068) clojure-encog.training/make-data/fn--9

Re: what is the deal with ArraySeq?

2012-05-16 Thread Jim - FooBar();
ked inside data. I'm sorry guys... Jim On 16/05/12 19:27, Jim - FooBar(); wrote: On 16/05/12 19:09, Michał Marczyk wrote: (doto (doubles data) ((comp prn class))) this causes an IllegalArgumentException argument type mismatch java.lang.reflect.Array.set (Array.java:-2) clojure.lan

Re: what is the deal with ArraySeq?

2012-05-16 Thread Jim - FooBar();
On 16/05/12 19:11, Michał Marczyk wrote: , is the output of normalize transformed in any way before being passed on to the method which blow up? no it is not...give me 2 min to try the other suggestions... Jim -- You received this message because you are subscribed to the Google Groups "Cloju

Re: Idiomatic usage of partial

2012-05-16 Thread Jim - FooBar();
One of the best examples of partial that I've seen is in the debug-repl...look it up on github and see how it is being used there in the main function that starts the debug repl...basically every time you invoke the debug-repl within the same repl session you're going to have different local bi

Re: what is the deal with ArraySeq?

2012-05-16 Thread Jim - FooBar();
37 (interruptible_eval.clj:51) clojure.core/apply (core.clj:601) clojure.core/with-bindings* (core.clj:1771) Jim On 16/05/12 18:15, Aaron Cohen wrote: On Wed, May 16, 2012 at 1:04 PM, Jim - FooBar(); <mailto:jimpil1...@gmail.com>> wrote: This is the only error I&#x

Re: what is the deal with ArraySeq?

2012-05-16 Thread Jim - FooBar();
On 16/05/12 18:37, Michał Marczyk wrote: Anyway -- does the function displayed in function.png work if you just type it in at the REPL (wrapped in a (let [data some-array-of-doubles] ...), I guess)? Hey Michal... Yes you're right, the fucntions on their own work just fine...I've attached a sc

Re: what is the deal with ArraySeq?

2012-05-16 Thread Jim - FooBar();
leiningen2 to test this? With swank & Emacs? On Wed, May 16, 2012 at 1:35 PM, Jim - FooBar(); <mailto:jimpil1...@gmail.com>> wrote: Well, suspect or not that is what is happening under leiningen2...in all fairness this rarely happens - ususally the errors originate from my

Re: what is the deal with ArraySeq?

2012-05-16 Thread Jim - FooBar();
rmer creates an array, the latter is a cast. Cheers, Michał On 16 May 2012 19:04, Jim - FooBar();mailto:jimpil1...@gmail.com>> wrote: This is the only error I'm getting - there is no stack trace or at least i can not s

Re: what is the deal with ArraySeq?

2012-05-16 Thread Jim - FooBar();
) I don't even know where that comes from!!! any ideas? Jim On 16/05/12 18:10, Michał Marczyk wrote: You probably want to use double-array rather than doubles. The former creates an array, the latter is a cast. Cheers, Michał On 16 May 2012 19:04, Jim - FooBar(); wrote: This is the only

Re: what is the deal with ArraySeq?

2012-05-16 Thread Jim - FooBar();
I guess what I'm asking is at which point does the array become an ArraySeq and why casting it back to a double array with 'doubles' doesn't work? Jim On 16/05/12 17:40, Walter Tetzner wrote: On Wednesday, May 16, 2012 12:34:08 PM UTC-4, Jim foo.bar wrote: -

Re: what is the deal with ArraySeq?

2012-05-16 Thread Jim - FooBar();
On 16/05/12 17:40, Walter Tetzner wrote: On Wednesday, May 16, 2012 12:34:08 PM UTC-4, Jim foo.bar wrote: --- (defn normalize [data high-end low-end] (let [norm (NormalizeArray.)]

what is the deal with ArraySeq?

2012-05-16 Thread Jim - FooBar();
Hello all... I've been stuck for a good 2 hours trying to figure out why I'm getting this exception on a very simple example: ClassCastException clojure.lang.ArraySeq cannot be cast to [D clojure.lang.Numbers.doubles (Numbers.java:1280) I have 2 very simple functions: -

[ANN] clojure-encog 0.3.0 released on clojars

2012-05-15 Thread Jim - FooBar();
Hello folks, I'm happy to announce the release of clojure-encog, a thin wrapper around Encog AI framework 3.1. Basically i did this so i could use it for a project of mine but I guess someone else might find it useful as well...especially if someone does not want to get down and dirty with Jav

Re: ...regarding Clojure's STM performance and scalability

2012-05-09 Thread Jim - FooBar();
Thanks all of you for your input... i was suspecting that i would get replies like these...they all basically come down to the same conclusion, that the functional style favours the STM abstraction and avoids some of its inherent bottlenecks... just one more thing though... what i omitted to

Re: ...regarding Clojure's STM performance and scalability

2012-05-09 Thread Jim - FooBar();
The exact paper is this (called "STM In the small"): http://www.google.co.uk/url?sa=t&rct=j&q=stm%20spectm&source=web&cd=3&sqi=2&ved=0CGEQFjAC&url=http%3A%2F%2Finfoscience.epfl.ch%2Frecord%2F174888%2Ffiles%2Feuro170-dragojevic.pdf&ei=BcGqT8vSJsHf8AOfwYjjBA&usg=AFQjCNEITMgowGA_QZHUrJTAqSnphild0w

...regarding Clojure's STM performance and scalability

2012-05-09 Thread Jim - FooBar();
Hello all, I'm going to keep this as short as possible...basically this guy came today in Machester uni to talk to all postgrads about work he's done on STM implementations for Microsoft research. In a nutshell, and very general he highlighted the following: 1. general purpose STM systems th

Re: Odd termination behaviour of a program that uses pmap

2012-05-09 Thread Jim - FooBar();
Does this mean we need to call (shutdown-agents) whenever we use futures (internally or explicitly)? I've never had any problems with clojure.java.shell/sh or pmap, albeit i've not used them extensively... Jim On 09/05/12 12:16, Muharem Hrnjadovic wrote: Thank you very much indeed! On 05/08

Re: why can i not shut-down my pc from Java?

2012-05-07 Thread Jim - FooBar();
On 07/05/12 23:34, Softaddicts wrote: I am guessing here, Multics ? DOS/360 ? MVS ? NOS/BE ? TOPS-10/20 ? RSX-11 ? RT-11 ? VMS ? U*x ? Did I left any ? Oh, I forgot MS-DOS... :) ...for the love of god!!! :-X Jim -- You received this message because you are subscribed to the Google Groups "

Re: why can i not shut-down my pc from Java?

2012-05-07 Thread Jim - FooBar();
Ok, a couple of things... I think we can all agree that if there is one thing that OO is doing right is polymorphism (well...almost!)...the whole notion of multiple-dispatch allows us to make decisions on a higher level - one closer to our mental perspective...personally, whenever i see some p

Re: why can i not shut-down my pc from Java?

2012-05-07 Thread Jim - FooBar();
On 07/05/12 21:59, Aaron Cohen wrote: You invoke your multimethod with 2 arguments. You need to change your dispatch function to take 2 arguments (it can ignore them if you don't need them). Thanks Aaron - it did the trick! I did not realize that multi-methods cannot be overloaded... Also..

Re: why can i not shut-down my pc from Java?

2012-05-07 Thread Jim - FooBar();
- when calling (halt "some-password" 1) i'm getting this: java.lang.IllegalArgumentException: Wrong number of args (2) passed to: user$eval664$fn (NO_

Re: why can i not shut-down my pc from Java?

2012-05-07 Thread Jim - FooBar();
Good stuff... :-) Jim On 07/05/12 19:51, Armando Blancas wrote: Can someone please verify that it works on windows as well??? It works on XP. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googleg

Re: why can i not shut-down my pc from Java?

2012-05-07 Thread Jim - FooBar();
-- Notice the "\n" after the password string - it is needed otherwise it won't accept it as correct! Can someone please verify that it works on windows as well??? IT is really hard for me to find a windows machine! Thanks again... Jim On 07/05/12 16:32, Craig Brozefsky wr

Re: why can i not shut-down my pc from Java?

2012-05-07 Thread Jim - FooBar();
On 07/05/12 16:32, Craig Brozefsky wrote: "Jim - FooBar();" writes: In preference to using Runtime/exec, you can use clojure.java.shell/sh and write your password to the stdin of the process using its :in argument. Now that sounds more sensible but it means that the consumer h

Re: why can i not shut-down my pc from Java?

2012-05-07 Thread Jim - FooBar();
er program. This is a shell feature, and I think .exec doesn't start a shell so you just run 'echo' with some arguments. Try running a shell withing exec, passing the commands as an argument to the shell. On Mon, May 7, 2012 at 5:08 PM, Jim - FooBar(); wrote: Hello everyone, I was

Re: why can i not shut-down my pc from Java?

2012-05-07 Thread Jim - FooBar();
On 07/05/12 16:16, Craig Brozefsky wrote: You should checkout proces output to make sure, but I'm betting that sudo is opening a tty to read the password and not getting it from stdout. The properly solution here, here, may be to define shutdown as a sudo action for your user ID which does not r

why can i not shut-down my pc from Java?

2012-05-07 Thread Jim - FooBar();
Hello everyone, I was just messing about with the following function and cannot figure out why it won't work... I know that the command I'm passing to the runtime object is a valid unix command...i can execute it on my terminal no problem! Java however refuses send the "halt" signal to my ubun

Re: Best Clojure Learning Resource for Lisper

2012-05-07 Thread Jim - FooBar();
Well, if you already know CL and can understand bit of Java (for interop), you're good to go!!! Make sure you know about Clojure's immutable data-structures before anything else...this is the BIG difference between Clojure vs CL (Clojure wins here!) other than that, prepare yourself for a wond

Re: new with clojure, need help!

2012-05-05 Thread Jim - FooBar();
On 06/05/12 00:51, Rostislav Svoboda wrote: i need a more basic guidence on how to install the nessecery plugins to eclipse, and what to do with them... eclipse IDE may look like a good idea but in the beginning it just increases the amount of work you need to do and troubles you need to overcom

Re: infix-to-prefix macro dead-end!!!

2012-05-02 Thread Jim - FooBar();
s that form, passing it into the compiler. Here's an example expansion: user> (infix->prefix (1 * 2 + 3 - 6)) (1 * 2 + 3 - 6) ((* 1 2) + 3 - 6) ((+ (* 1 2) 3) - 6) ((- (+ (* 1 2) 3) 6)) -1 On Wed, May 2, 2012 at 1:24 PM, Jim - FooBar(); <mailto:jimpil1...@gmail.com>> wrote: H

Re: infix-to-prefix macro dead-end!!!

2012-05-02 Thread Jim - FooBar();
On 02/05/12 21:33, Aaron Cohen wrote: (if-not (empty? (filter #(list? %)) '~expr)) This looks suspicious. filter is being called with 1st parameter anon function, and no second parameter. How does that compile? I apologise for the typo...it was originally (filter (fn [k] (list? k)) '~

infix-to-prefix macro dead-end!!!

2012-05-02 Thread Jim - FooBar();
Hey everyone, I've been trying all morning (more than 3 hours) to improve my macro but with little success...basically what I had before i started fiddling with it was a macro which would take an expression of the form (1 + 4 * 5 - 1 / 2) and would return the expression in prefix form: (/ (-

Re: [ANN] Leiningen 2.0.0-preview3

2012-05-02 Thread Jim - FooBar();
On 02/05/12 20:56, Stuart Sierra wrote: Just want to say thanks to Phil and everyone else who has contributed to Leiningen. It's been pleasing to see the evolution from a limited script to a solid development tool. -S -- You received this message because you are subscribed to the Google Groups

Re: Arithmethic Evaluation

2012-05-02 Thread Jim - FooBar();
On 02/05/12 04:19, Asranz wrote: so i need some others functions to parse it and then just doing the infix i guess? basically you need to find a way to convert your string into a data-structure (a list) and then you can use a macro to rearrange things in any way you like...as long as it is a st

Re: Arithmethic Evaluation

2012-05-01 Thread Jim - FooBar();
On 02/05/12 01:04, Asranz wrote: Hello so i got this problem agian i have been trying to resolve it with macros but i dont get the idea. i just need to evaluate in infix a string "(1 +2 (4 * 5)" but dont get it to do it with macros the part of changing the string type. Thanks, I can help yo

Re: simple script using Autodoc to generate a static docs site

2012-04-28 Thread Jim - FooBar();
On 28/04/12 23:41, John Gabriele wrote: On Apr 28, 5:37 pm, "Jim.foobar" wrote: github says 404 this is not the page you are looking for Weird. I double-checked the link, and it works. Is it still 404'ing for you? No its just fine from my desktop...for some reason my phone does not

Re: Socket Library in Clojure

2012-04-27 Thread Jim - FooBar();
Yes go with Java interop...sockets are pretty straight forward. Jim On 27/04/12 11:15, Baishampayan Ghose wrote: I was looking for socket libraries in clojure. The requirement is to connect via telnet to a mainframe based system and run commands on it. Can't you use JVM interop directly? The

Re: Having Problems with excercise noob.

2012-04-26 Thread Jim - FooBar();
On 26/04/12 19:15, Asranz wrote: Hi tahnks! i just need to do that operation. to conbert that string. for example for sums i did (defn sum [s] (apply + (map #(- (int (first %)) (int \0)) (re-seq #"[0-9]" s and it just sums the the numbers but if a have also multiplications, substracyi

Re: Having Problems with excercise noob.

2012-04-26 Thread Jim - FooBar();
On 26/04/12 19:06, Asranz wrote: Oh sorry i mean i didt wit sums and multiplications but i dont get how it can do it conbined in the same line On 25 abr, 22:18, Asranz wrote: Hi. im having a little problem i need to do a parser like to do operations but i dont get how to do it very well ex.

Re: Having Problems with excercise noob.

2012-04-26 Thread Jim - FooBar();
On 26/04/12 04:18, Asranz wrote: Hi. im having a little problem i need to do a parser like to do operations but i dont get how to do it very well ex. "1+2*3+4-5*6+7*8-9" = 431 i have to do it with sums but i dont get it how i can take all the operations. any advices? if you need a macro th

Re: ANN: A more fully-featured lein-vimclojure

2012-04-14 Thread Jim - FooBar();
good stuff...can i ask something completely irrelevant? is there any chance the clojure repl for android will ever get support for loading external libraries? also i run a tiny genetic algorithm on it only showed all the output at the end of the simulation rather than going one step at a time.

Re: Boolean

2012-04-13 Thread Jim - FooBar();
wow!!! i wasn't expecting that one... Jim On 13/04/12 21:17, Armando Blancas wrote: It's the other way around: false is boxed into Boolean/FALSE. Here's the if stmt: public Object eval() { Object t = testExpr.eval(); if(t != null && t != Boolean.FALSE) return thenExpr.eval(); return elseExpr.

Re: Light Table - a new IDE concept

2012-04-13 Thread Jim - FooBar();
I am left speecheless...! Jim On 13/04/12 19:49, sean neilan wrote: I wish there was a link to download it. On Fri, Apr 13, 2012 at 1:34 PM, looselytyped > wrote: This is an awesome implementation of Brett Victors "Inventing On Principle" [http://vimeo.c

Re: Supporting platform specific code

2012-04-12 Thread Jim - FooBar();
+1 for meta-data...it fits the glove perfectly ;-) On 12/04/12 18:52, Vinzent wrote: First thing which comes to mind is to use metadata for this purpose. Something like (defn ^{:platform :jvm} to-string [x] ...) This doesn't force the user to create a separate file for each platform (althou

Re: How come (`+ 1 2) => 2 ???

2012-04-09 Thread Jim - FooBar();
Aaaa ok, it makes sense now... Thanks a lot! Jim On 09/04/12 13:00, Aaron Cohen wrote: When symbols and keywords are in function position, (as you say) they look themselves up "in" the second argument. The third argument specifies a not-found value. Since "1" isn't a collection, it will alwa

How come (`+ 1 2) => 2 ???

2012-04-09 Thread Jim - FooBar();
Hello everyone... Can somebody please provide some insight as to why (`+ 1 2) => 2 and ('+ 1 2) => 2 ??? Thanks in advance... Jim ps. I understand that symbols are functions that look themselves up in sequences but here i'm not passing a seq - instead i'm passing 2 args! Shouldn't there be

Re: Boolean

2012-04-09 Thread Jim - FooBar();
On 08/04/12 21:05, Stefan Kamphausen wrote: Hi, (= (Boolean. false) false) ;=> true now, that is really weird. By all means (at least those, I can come up with ;-) it looks like false and (Boolean. false) are the same: I think when you use the = operator in Clojure it calls to the .equ

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Jim - FooBar();
Wow that is indeed very clear and informative...Thanks a lot! I could not agree more! I was struggling to understand the 'meaning' of the algorithm and what it was trying to demonstrate...as Stefan said, one would expect the most expensive bit in any evolutionary computation to be the fitness/

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Jim - FooBar();
The intersting on send is, that the agent queues the send actions if you use send. If you use send-off the agent does not stores the action into a queue. Yet the code uses "send" predominantly... On 03/04/12 18:39, Marcus Lindner wrote: Could be, that in the case of pmap a similiar effect ta

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Jim - FooBar();
Hmmminteresting thoughts... I was under the impression that that agents are asynchronous and thus do not depend on the STM , which is only for co-ordinated change! There is a dedicated Thread pool where agents are assigned separate threads for their work.You seem to suggest otherwise...I

Re: Need help to find a bug in a genetic algorithm

2012-04-02 Thread Jim - FooBar();
have not find out how much. Am 02.04.2012 20:34, schrieb Jim - FooBar();: Shouldn't the line (inside start-evolution) : *(map #(send % a-day-in-the-life-agent-fn) domiciles) * be: *(pmap #(send % a-day-in-the-life-agent-fn) domiciles)* ??? why does it need to happen serially? Jim On 02/04/

Re: Need help to find a bug in a genetic algorithm

2012-04-02 Thread Jim - FooBar();
Next" by exploring many possible variations and to get as near as possible to the solution "Thursday Next". The main purpose of this algorithm, I think, is to show how you can use agents and atoms to implement a genetic algorithm. On Apr 2, 7:59 pm, "Jim - FooBar();" wrote:

Re: Need help to find a bug in a genetic algorithm

2012-04-02 Thread Jim - FooBar();
f this algorithm, I think, is to show how you can use agents and atoms to implement a genetic algorithm. On Apr 2, 7:59 pm, "Jim - FooBar();" wrote: Is it possible to explain briefly what this genetic algorithm tries to accomplish? I mean what problem is it producing solution for? It ne

Re: Need help to find a bug in a genetic algorithm

2012-04-02 Thread Jim - FooBar();
Next" by exploring many possible variations and to get as near as possible to the solution "Thursday Next". The main purpose of this algorithm, I think, is to show how you can use agents and atoms to implement a genetic algorithm. On Apr 2, 7:59 pm, "Jim - FooBar();" wr

<    2   3   4   5   6   7   8   >