Re: When arithmetic on a computer bite back

2012-06-02 Thread Tassilo Horn
kawas  writes:

> I've checked with a python repl, the correct value seems to be the one
> using BigDecs
>
 from decimal import *
 Decimal('1.4411518807585587E17') / Decimal(2)
> Decimal('72057594037927935')
>
> I've submitted a bug and commented on it about BigDecimal constructors
> but I may have made a mistake about which value is the correct one...

Yes, you did.  How can a power of two divided by two be *odd* (well,
except for 2/2 = 1, of course)? ;-)

But strangely, clojure is wrong, python is wrong, and ruby is wrong,
too.

--8<---cut here---start->8---
irb(main):012:0> x = BigDecimal.new("1.4411518807585587E17")
=> #
irb(main):013:0> x
=> #
irb(main):014:0> x / 2
=> #
--8<---cut here---end--->8---

So maybe that's a general bigdecimal representation issue?

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: When arithmetic on a computer bite back

2012-06-02 Thread Mark Engelberg
1.4411518807585587E17 ends in 0, and therefore when you divide by 2, it
should end in 5.
It's not a power of 2, it is a merely an inexact approximation of one.

On Sat, Jun 2, 2012 at 2:31 AM, Tassilo Horn  wrote:

> Yes, you did.  How can a power of two divided by two be *odd* (well,
> except for 2/2 = 1, of course)? ;-)
>
>

-- 
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] Leiningen 2.0.0-preview5 released

2012-06-02 Thread nick rothwell
I seem to not be getting an upgrade. :-( (I then followed the re-download 
instructions, and got preview4 again.)

bash-3.2$ ~/lein2 upgrade
The script at /Users/nick/lein2 will be upgraded to the latest preview 
version.
Do you want to continue [Y/n]? Y

Upgrading...
  % Total% Received % Xferd  Average Speed   TimeTime Time  
Current
 Dload  Upload   Total   SpentLeft  
Speed
100  7230  100  72300 0   1511  0  0:00:04  0:00:04 --:--:--  
271k

The self-install jar already exists at 
/Users/nick/.lein/self-installs/leiningen-2.0.0-preview4-standalone.jar.
If you wish to re-download, delete it and rerun "/Users/nick/lein2 
self-install".
bash-3.2$ ~/lein2 version
Leiningen 2.0.0-preview4 on Java 1.6.0_31 Java HotSpot(TM) 64-Bit Server VM

-- 
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] 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'll stick to that for the moment!


Jim

On 02/06/12 19:03, nick rothwell wrote:
I seem to not be getting an upgrade. :-( (I then followed the 
re-download instructions, and got preview4 again.)


bash-3.2$ ~/lein2 upgrade
The script at /Users/nick/lein2 will be upgraded to the latest preview 
version.

Do you want to continue [Y/n]? Y

Upgrading...
  % Total% Received % Xferd  Average Speed   TimeTime 
Time  Current
 Dload  Upload   Total   Spent
Left  Speed
100  7230  100  72300 0   1511  0  0:00:04  0:00:04 
--:--:--  271k


The self-install jar already exists at 
/Users/nick/.lein/self-installs/leiningen-2.0.0-preview4-standalone.jar.
If you wish to re-download, delete it and rerun "/Users/nick/lein2 
self-install".

bash-3.2$ ~/lein2 version
Leiningen 2.0.0-preview4 on Java 1.6.0_31 Java HotSpot(TM) 64-Bit 
Server VM


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

Hooking up Postal to Amazon SES

2012-06-02 Thread rossputin
Hi Guys.

Has anyone hooked Postal up to SES ?

If so how ?

Thanks!

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

Clojure code explanation tool?

2012-06-02 Thread Rich Morin
The received wisdom in most programming circles is that comments should
explain intent, rather then simply transliterating the code into a human
language (eg, English).  For example, comments like this are discouraged:

  (def a 42);; Define a to be 42.

However, as a Clojure noob, I would _love_ to have a tool that explains
even the syntactic level of an arbitrary piece of Clojure code.  If it
could use metadata from (say) function definitions to go deeper, so much
the better.

I Googled around but didn't find anything very close.  Might anyone know
of any efforts in this direction?

-r

 -- 
http://www.cfcl.com/rdmRich Morin
http://www.cfcl.com/rdm/resume r...@cfcl.com
http://www.cfcl.com/rdm/weblog +1 650-873-7841

Software system design, development, and documentation


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


clojure.java.jdbc byte[] result type question

2012-06-02 Thread rossputin
Hi.

I've got a clojure.java.jdbc result coming back as a byte[].  Its from
a GROUP_CONCAT on an int(10) field.

In the mysql client the result is: '1,2,4,6,7,19,24,32,54,152'.

I am unsure how to extract this result properly in clojure… (println
(seq (somevar))) gives me an unexpected result: (49 44 50 44 52 44 54
44 55 44 49 57 44 50 52 44 51 50 44 53 52 44 49 53 50).

Any ideas what I should be doing ?

Thanks!

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


lazy-cat infinite realization on empty seq

2012-06-02 Thread michaelr524
Hi,

This has probably been asked a million times but I couldn't find
anything.

Why the following triggers infinite realization of the infinite lazy
seq and how I can work around it and make it stop when f1 returns an
empty seq,

(defn f1 [] (println "hello") [])
(defn f2 [] (lazy-cat (f1) (f2)))

(doseq [a (f2)]
 (pprint a))

Thanks,
Michael

-- 
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: Clojurians in Austria

2012-06-02 Thread gas
hi,

i'm located in Vienna too and very much interested in meeting austrian 
clojurians as well.

regards,
gerhard

Am Dienstag, 29. Mai 2012 19:20:02 UTC+2 schrieb bsmith.occs:
>
> I too am in Vienna. I use Clojure at work for a few small internal 
> tools, but not in production. I'd be glad to meet some other 
> Clojurists. 
>
> // Ben 
>
> On Tue, May 29, 2012 at 5:05 PM, Nuno Marques 
>  wrote: 
> > I'm in Vienna and I know a couple of more Clojure people here. 
> > I would be happy to help start a clojure group here. 
> > 
> > On May 29, 2012, at 4:40 PM, Florian Over wrote: 
> > 
> >> Hi 
> >> i met a nice guy (David from intermaps.com) from Vienna on 
> EuroClojure. 
> >> He mentioned that there are other Clojure-User in Vienna as well. 
> >> But no UserGroup right now. 
> >> 
> >> Maybe you can start irc clojure-at ? 
> >> 
> >> Florian 
> >> 
> >> 2012/5/29 Jozef Wagner : 
> >>> Hi, 
> >>> 
> >>> Are there some Clojurians from Austria or is there an Austria Clojure 
> >>> group? 
> >>> 
> >>> I'm looking for a Clojure related job in Austria, and so far I haven't 
> found 
> >>> any Austrian group on meetup.com nor on the google groups :( 
> >>> 
> >>> Best, 
> >>> Jozef 
> >>> 
> >>> -- 
> >>> 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 
>

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

Using Clojure internal libraries in another project

2012-06-02 Thread Edward Yang
Hello all,

We're interested in using some of Clojure's internal libraries (in particular, 
it's STM implementation), in the runtime for another programming language. We 
were wondering if anyone had attempted this before, and if there are any things 
to keep in mind along the way.

Cheers,
Edward

-- 
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: Suggestions for using MPI in Clojure

2012-06-02 Thread Guillermo López





On Thursday, February 9, 2012 4:52:15 AM UTC+1, Brent Millare wrote:
>
> From what I've seen, MPI in java is not good performance wise. You take a 
> huge hit due to all the copying. To get good cluster performance in java, 
> you need to use something like Java Fast Sockets.  
> http://developers.sun.com/solaris/articles/fastSockets.html
>
> http://www.des.udc.es/~juan/papers/comcom.pdf 
>
> MPJ looks promising, but I honestly have never tried it. I'd be interested 
> in seeing how far that takes you.
>
> Best,
> Brent
>


Dear Adam and Brent,
Dear clojure users,

We have been working quite actively in Java Fast Sockets and FastMPJ for 
the last 10 years and recently we have launched their webpages:
http://www.fastmpj.com
http://www.javafastsockets.com

We are receiving a lot of attention since we made these webpages 
available, as well as from the our recent work, G.L Taboada, S. Ramos, 
R.R. Exposito, J. Tourino, R. Doallo, Java in the High Performance 
Computing arena: Research, practice and experience. In Science of 
Computer Programming  
(pre-print version 
), 
where we report about their exceptionally efficient support of Java 
communications on shared memory and low-latency Remote Direct Memory 
Access (RDMA) networks (e.g., InfiniBand). As you can see, MPJ can 
compete with MPI, considering the 20 years of code optimization of the 
MPI benchmarks compared to our internal MPJ benchmarks... MPJ results 
are great!

Thus, FastMPJ achieve quite similar performance than MPI, sometimes even 
outperforms MPI (for shared memory transfers FastMPJ achieves 70 Gbps 
and Java Fast Sockets 50 Gbps, whereas MPI is below 40 Gbps).

We have FastMPJ available in the downloads section and also we have 
gathered a quite nice documentation at http://fastmpj.com/documentation/

Regards,

Guillermo
-- 
Guillermo Lopez Taboada
Dept. Electronics and Systems
University of A Corunna, Spain
http://gac.udc.es/~gltaboada

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

Using Clojure internal libraries in another project

2012-06-02 Thread ezy...@streambase.com
Hello all,

We're interested in using some of Clojure's internal libraries (in 
particular, it's STM implementation), in the runtime for another 
programming language. We were wondering if anyone had attempted this 
before, and if there are any things to keep in mind along the way.

Cheers,
Edward

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

Re: Clojure code explanation tool?

2012-06-02 Thread Alex Baranosky
It's not what you are asking for, but it is a nice resource, with examples
and such:
clojuredocs.org

On Sat, Jun 2, 2012 at 12:12 AM, Rich Morin  wrote:

> The received wisdom in most programming circles is that comments should
> explain intent, rather then simply transliterating the code into a human
> language (eg, English).  For example, comments like this are discouraged:
>
>  (def a 42);; Define a to be 42.
>
> However, as a Clojure noob, I would _love_ to have a tool that explains
> even the syntactic level of an arbitrary piece of Clojure code.  If it
> could use metadata from (say) function definitions to go deeper, so much
> the better.
>
> I Googled around but didn't find anything very close.  Might anyone know
> of any efforts in this direction?
>
> -r
>
>  --
> http://www.cfcl.com/rdmRich Morin
> http://www.cfcl.com/rdm/resume r...@cfcl.com
> http://www.cfcl.com/rdm/weblog +1 650-873-7841
>
> Software system design, development, and documentation
>
>
> --
> 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: Can we use Clojure like a general library in Java?

2012-06-02 Thread Sean Corfield
On Fri, Jun 1, 2012 at 5:53 PM, Qihui Sun  wrote:
> So I am interested,if Clojure can be used like a general library in Java,it
> will beat above libraries and be awesome !

Yes, you can instantiate clojure.lang.RT inside your Java code and
load, compile and invoke Clojure code, directly from Java. You can
also write code in Clojure, compile it to .class files, package it as
a JAR and use it like a regular Java library.
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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: Can we use Clojure like a general library in Java?

2012-06-02 Thread Philip Potter
Yes it can! It's just a jar file after all, so you can use the classes in
your java program if you like.

However, clojure data structures typically do not use static typing as java
uses it. For example, PersistentVector is a collection of Objects and not
genericized. Getting things out of such a vector will no doubt require
typecasting, just like the old 1.4 days.

Phil
On Jun 2, 2012 9:25 PM, "Qihui Sun"  wrote:

> Hi,the Thoughtworks technology radar mentioned below:
>
> http://www.thoughtworks.com/articles/technology-radar-march-2012
>
> Functional programming continues its slow but steady ascent into developer
> mind share and, increasingly, code bases. New languages like Clojure,
> Scala, and F# offer great new features. Now libraries such as*Functional
> Java*,* TotallyLazy and LambdaJ* are back porting some functional
> language capabilities, particularly around higher-order functions and
> collections, into Java. We like this trend because it previews common
> capabilities of future languages yet allows developers to stay in their
> comfort zone.
>
> So I am interested,if Clojure can be used like a general library in
> Java,it will beat above libraries and be awesome !
>
> --
> Solomon
> HUAWEI 
> Google+: Qihui Sun 
>
>
>
>  --
> 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

Future milestones of ClojurescriptOne ?

2012-06-02 Thread Murtaza Husain
Hi,

Are there any plans to release further milestones of ClojureScriptOne, its 
an awesome project, and a great learning tool. I see the current milestone 
of M003 has also not been released.

Thanks,
Murtaza

-- 
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: Learning clojure: debugging?

2012-06-02 Thread Sean Corfield
On Fri, Jun 1, 2012 at 11:18 AM, Abraham Egnor  wrote:
> I'm early in the process of learning clojure, and am hoping that the
> community has suggestions for a frustration I've run into.
...
> I eventually tracked it down by evaluating each subexpression of line - the
> root bug is that mul should be returning a {:dx :dy :dz} map, not a {:x :y
> :z} one, so add gets nil for the subvalues, so in turn + raises the NPE.
...
> Is there some technique I'm not seeing to make this kind of simple
> typo-based error less of a hassle to track down?  Or is this simply a matter
> of getting better at deciphering the stack traces?

I'm curious about your process for creating the solution...

Did you evolve it piece by piece in the REPL? Did you write tests for
each operation and then evolve the code until they passed? Did you
start at the top of the file and just write code until you got to the
bottom and then test the whole thing?

(obviously loaded questions - my follow-up would be that if you
started in the REPL or via a TDD-style approach, you'd have probably
caught the error earlier - but, yes, Clojure stack traces can be
pretty daunting at first)

Looking at the stack trace, the NPE comes from hex/core.clj line 8,
invoked from hex/core.clj line 42 inside the line function
(hex.core$line), during evaluation of an anonymous function (the
$fn__1022 part). That would narrow it down quite a bit and you could,
in the REPL, try (mul (delta :xy) 1) and see what you get, then (add
origin *1) ;; *1 is bound to the last result, (mul (delta :xy) 1) in
this case -- and you'd see your NPE and it should be easy to see
why... Which is why a REPL-first or test-first process would have hit
it as soon as you composed mul and add, or possibly even when you just
saw mul evaluated?

HTH... Welcome to Clojure, BTW!
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

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


Re: clojure.java.jdbc byte[] result type question

2012-06-02 Thread Sean Corfield
On Fri, Jun 1, 2012 at 5:26 AM, rossputin  wrote:
> I've got a clojure.java.jdbc result coming back as a byte[].  Its from
> a GROUP_CONCAT on an int(10) field.
>
> In the mysql client the result is: '1,2,4,6,7,19,24,32,54,152'.

Looks like a string? (coming back as a byte array)

> I am unsure how to extract this result properly in clojure… (println
> (seq (somevar))) gives me an unexpected result: (49 44 50 44 52 44 54
> 44 55 44 49 57 44 50 52 44 51 50 44 53 52 44 49 53 50).

I guess you'd need to convert the byte array to a String and then
split it at "," and then parse each item to an int. Perhaps something
like:

(map #(Integer/parseInt %) (.split (String. somevar) ","))
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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: Learning clojure: debugging?

2012-06-02 Thread Moritz Ulrich
On Fri, Jun 1, 2012 at 8:18 PM, Abraham Egnor  wrote:
> Is there some technique I'm not seeing to make this kind of simple
> typo-based error less of a hassle to track down?  Or is this simply a matter
> of getting better at deciphering the stack traces?

I think one important point here is that you use two different data
structures to hold the same kind of data. Why use a map of #{:dx :dy
:dz} and a map of #{:x :y :z} for the same use? Why not represent
deltas using :x :y and :z too?
And if we're on this track, why a map? Will the points contain other
important data? If not, I'd just use a vector of n items, representing
n dimensions. This would simplify the code and make it much easier to
maintain. All functions could operate on generic vectors describing
any point in n-dimensional space :-)

Regarding the debugging statement:

If you're using emacs and Slime, there's a full-blown debugger
integrated in swank-clojure. It features breakpoints, watches, etc.
though I rarely use it.
When I encounter such problems, I usually just throw in one or two
println statements printing the parameters. This way it's easy to
check if wrong values are passed.
Adding some asserts is helpful too: In your case it would be wise to
check at the start of the `add' function if `delta' really has the
keys #{:dx :dy :dz}.

-- 
Moritz Ulrich

-- 
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: Learning clojure: debugging?

2012-06-02 Thread Sean Corfield
On Sat, Jun 2, 2012 at 2:34 PM, Moritz Ulrich
 wrote:
> I think one important point here is that you use two different data
> structures to hold the same kind of data.

Points and deltas are not the "same kind of data". Yes, they both have
x/y/z values but their meaning is different. Perhaps {:point [x y z]}
and {:delta [x y z]} might be a better choice (combining the vector
approach you suggest while still distinguishing the 'types' that the
OP wants)?

> If you're using emacs and Slime, there's a full-blown debugger
> integrated in swank-clojure. It features breakpoints, watches, etc.

True, and it's very powerful.

> When I encounter such problems, I usually just throw in one or two
> println statements printing the parameters. This way it's easy to
> check if wrong values are passed.

Perhaps clojure.tools.trace would be easier?

https://github.com/clojure/tools.trace

(I keep meaning to switch to using this instead of just adding println
statements!)

> Adding some asserts is helpful too: In your case it would be wise to
> check at the start of the `add' function if `delta' really has the
> keys #{:dx :dy :dz}.

Yes, :pre / :post would be another useful technique here! Good suggestion!
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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: Learning clojure: debugging?

2012-06-02 Thread Softaddicts
clojure.tools.trace beats println by far (biased advice, I maintain it:)))
It's also easier to segregate between debug and normal output in the code.

You can enable/disable fn tracing dynamically from the REPL for all fns in a 
given
namespace.

I seldom use a debugger. When I do it's to dive in the clojure runtime.

The REPL and trace tool meet my needs most of the time.

The trick is to avoid having huge chunks of code stuffed
in a single fn. It makes life harder. No dumb rule of thumb here (have no more
than xx lines per fn, blabla, ...).

Just make sure you have testable fns of reasonnable scope.

With the trace output, you can then isolate the culprit and test it standalone 
with
its input arguments captured from the trace (cut & paste).

Luc P

> On Sat, Jun 2, 2012 at 2:34 PM, Moritz Ulrich
>  wrote:
> > I think one important point here is that you use two different data
> > structures to hold the same kind of data.
> 
> Points and deltas are not the "same kind of data". Yes, they both have
> x/y/z values but their meaning is different. Perhaps {:point [x y z]}
> and {:delta [x y z]} might be a better choice (combining the vector
> approach you suggest while still distinguishing the 'types' that the
> OP wants)?
> 
> > If you're using emacs and Slime, there's a full-blown debugger
> > integrated in swank-clojure. It features breakpoints, watches, etc.
> 
> True, and it's very powerful.
> 
> > When I encounter such problems, I usually just throw in one or two
> > println statements printing the parameters. This way it's easy to
> > check if wrong values are passed.
> 
> Perhaps clojure.tools.trace would be easier?
> 
> https://github.com/clojure/tools.trace
> 
> (I keep meaning to switch to using this instead of just adding println
> statements!)
> 
> > Adding some asserts is helpful too: In your case it would be wise to
> > check at the start of the `add' function if `delta' really has the
> > keys #{:dx :dy :dz}.
> 
> Yes, :pre / :post would be another useful technique here! Good suggestion!
> -- 
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
> World Singles, LLC. -- http://worldsingles.com/
> 
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)
> 
> -- 
> 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
> 
--
Softaddicts sent by ibisMail from my ipad!

-- 
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: Learning clojure: debugging?

2012-06-02 Thread Vinzent
BTW, you may want to use clojure-contracts (
https://github.com/dnaumov/clojure-contracts) instead of asserts or 
:pre\:post in order to get much nicer and informative error reporting.
>
>

-- 
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: Learning clojure: debugging?

2012-06-02 Thread Sean Corfield
On Sat, Jun 2, 2012 at 5:22 PM, Vinzent  wrote:
> BTW, you may want to use clojure-contracts
> (https://github.com/dnaumov/clojure-contracts) instead of asserts or
> :pre\:post in order to get much nicer and informative error reporting.

Or keep an eye on https://github.com/clojure/core.contracts currently
available as [org.clojure/core.contracts "0.0.1-SNAPSHOT"]
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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: Can we use Clojure like a general library in Java?

2012-06-02 Thread Qihui Sun
Thanks above two reply.
As Sean Corfield said,it is a bit complex.If there is a command option,ONE
TIME do this,it will more convenient.
For example:
java -jar clojure-1.5.0.jar -genclasses,will produce
clojure-lib-1.5.0.jar,and it is  genericized as Philip Potter mentioned!

Maybe Clojure as a general/regular Java lib will get more widely to
adopt,be more successful than a language :).


2012/6/3 Philip Potter 

> Yes it can! It's just a jar file after all, so you can use the classes in
> your java program if you like.
>
> However, clojure data structures typically do not use static typing as
> java uses it. For example, PersistentVector is a collection of Objects and
> not genericized. Getting things out of such a vector will no doubt require
> typecasting, just like the old 1.4 days.
>
> Phil
> On Jun 2, 2012 9:25 PM, "Qihui Sun"  wrote:
>
>> Hi,the Thoughtworks technology radar mentioned below:
>>
>> http://www.thoughtworks.com/articles/technology-radar-march-2012
>>
>> Functional programming continues its slow but steady ascent into
>> developer mind share and, increasingly, code bases. New languages like
>> Clojure, Scala, and F# offer great new features. Now libraries such 
>> as*Functional
>> Java*,* TotallyLazy and LambdaJ* are back porting some functional
>> language capabilities, particularly around higher-order functions and
>> collections, into Java. We like this trend because it previews common
>> capabilities of future languages yet allows developers to stay in their
>> comfort zone.
>>
>> So I am interested,if Clojure can be used like a general library in
>> Java,it will beat above libraries and be awesome !
>>
>> --
>> Solomon
>> HUAWEI 
>> Google+: Qihui Sun 
>>
>>
>>
>>  --
>> 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
>



-- 
Solomon
HUAWEI 
Google+: Qihui Sun 

-- 
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: Can we use Clojure like a general library in Java?

2012-06-02 Thread Sean Corfield
On Sat, Jun 2, 2012 at 7:31 PM, Qihui Sun  wrote:
> For example:
> java -jar clojure-1.5.0.jar -genclasses,will produce
> clojure-lib-1.5.0.jar,and it is  genericized as Philip Potter mentioned!

Sounds like what you want is Leiningen, to generate an uberjar,
optionally with compiled classes.
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

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


[ANN] Leiningen 2.0.0-preview6 released

2012-06-02 Thread Phil Hagelberg
On Thu, May 31, 2012 at 10:11 PM, Phil Hagelberg  wrote:
> I'm happy to announce the release of Leiningen 2.0.0-preview5.

I've just pushed out 2.0.0-preview6; sorry for the inconvenience.

## 2.0.0-preview6 / 2012-06-01

* Allow lookup of :repositories credentials from environment variables.
* Perform more SSL certificate validity checks.
* Fix a bug where repl dependency was conflicting.
* Add certificate for Clojars to default project settings.
* Allow custom SSL :certificates to be specified for repositories.

The changes are almost all around the handling of certificates for
repositories. Not only is the certificate for Clojars distributed with
Leiningen now, but users are able to specify their own certificates to
use with repositories using self-signed certificates, so this is a big
improvement for anyone running their own private repository. The new
SSL settings should also help prevent MITM attacks since the Aether
defaults were sloppy.

I hope this addresses the issues people were seeing with preview5.

thanks,
Phil

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