Re: for behavior difference between clojure and clojurescript?

2012-03-02 Thread David Nolen
On Thu, Mar 1, 2012 at 3:21 AM, Benjamin Peter wrote:

> Hi all,
>
> thanks for responding.
>
> On Mar 1, 1:21 am, David Nolen  wrote:
> > Yes it's a known issue. Right now, = only works for two args. For the
> time
> > being this is for performance reasons, a decent = is critical.
>
> I see. Is there a know issues list or is the problem something that
> should be noted on the "differences to clojure" page?
>

JIRA is the issues list.


> Or would you say clojurescript is in an early stage where you should
> expect those issues and such a list would be high maintenance.
>

ClojureScript is still in an early stage. But ... many things are now
implemented and performance enhancements are becoming a higher priority.


> I just found the cljs jira instance. Another thing that comes to mind
> would be to create an open and confirmed issues filter that could be
> linked in the wiki.
>

Linking to a CLJS issues filter is a good idea.


> Regards,
>
> Ben.

-- 
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: for behavior difference between clojure and clojurescript?

2012-03-02 Thread Benjamin Peter
Hi all,

thanks for responding.

On Mar 1, 1:21 am, David Nolen  wrote:
> Yes it's a known issue. Right now, = only works for two args. For the time
> being this is for performance reasons, a decent = is critical.

I see. Is there a know issues list or is the problem something that
should be noted on the "differences to clojure" page?

Or would you say clojurescript is in an early stage where you should
expect those issues and such a list would be high maintenance.

I just found the cljs jira instance. Another thing that comes to mind
would be to create an open and confirmed issues filter that could be
linked in the wiki.


Regards,

Ben.

-- 
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: for behavior difference between clojure and clojurescript?

2012-02-29 Thread David Nolen
Yes it's a known issue. Right now, = only works for two args. For the time
being this is for performance reasons, a decent = is critical.

The way ClojureScript currently handles multiple arity fns is quite
unfortunate from a performance perspective - it uses the JavaScript
arguments object. This results in an order of magnitude slow down for
function calls on V8 as well as JavaScriptCore.

I think we need to resolve this first before fixing =. There's already an
open ticket in JIRA for both issues.

David

On Wed, Feb 29, 2012 at 6:26 PM, Alan Malloy  wrote:

> On Feb 29, 2:36 pm, Benjamin Peter  wrote:
> > Hello,
> >
> > when I was trying to port a little clojure app to clojurescript I
> > think I noticed a difference in behavior of the "for" macro.
> >
> > I am quite new to clojure and maybe you can tell me where my problem
> > is or if my assumptions that there might be a problem could be
> > correct.
> >
> > As far as I see it, the "for" macro works for clojurescript quite well
> > but I am not sure if it is "supported".
> >
> > I am using a two dimensional "for" with a ":when" condition. I already
> > tried to narrow the problem down but this was the closest I could get
> > so far. It seems like some elements are missing in the output.
> >
> > (for [a [0 1] b [0 1]
> >  :when (not (= 0 a b))]
> >  [a b])
> >
> > In clojurescript seems to result in:
> >
> > [[1 0] [1 1]]
> >
> > Wrapping to doall doesn't change a thing, but could lazyness be a
> > problem?
> >
> > I put together a little project you could check out, please have a
> > look:
> >
> > https://github.com/dedeibel/cljs-fortest
>
> Isn't this a special case of cljs not having the right equality
> semantics for multiple args? I don't have a clojurescript repl handy,
> but I remember reading it only looks at the first two args, so (= 0 0
> 1) returns true, keeping that one out of your results.
>
> --
> 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: for behavior difference between clojure and clojurescript?

2012-02-29 Thread Neale Swinnerton
i had a cljs repl up and running...here's the comparison and the emitted JS

ClojureScript:cljs.user> (= 0 0 0)
true
; js => cljs.core._EQ_.call(null,0,0,0);

ClojureScript:cljs.user> (= 0 0 1)
true
; js =>  cljs.core._EQ_.call(null,0,0,1);

ClojureScript:cljs.user> (== 0 0 1)
false
; js => (function (){var and__3546__auto4873 = (0 === 0);

if(cljs.core.truth_(and__3546__auto4873))
{return (0 === 1);
} else
{return and__3546__auto4873;
}
})();

ClojureScript:cljs.user> (== 0 0 0)
true
; js => (function (){var and__3546__auto4879 = (0 === 0);

if(cljs.core.truth_(and__3546__auto4879))
{return (0 === 0);
} else
{return and__3546__auto4879;
}
})();


So...looks like it's just = vs == (or even ===)

Neale
{t: @sw1nn, w: sw1nn.com}



On Wed, Feb 29, 2012 at 11:26 PM, Alan Malloy  wrote:
>
> On Feb 29, 2:36 pm, Benjamin Peter  wrote:
> > Hello,
> >
> > when I was trying to port a little clojure app to clojurescript I
> > think I noticed a difference in behavior of the "for" macro.
> >
> > I am quite new to clojure and maybe you can tell me where my problem
> > is or if my assumptions that there might be a problem could be
> > correct.
> >
> > As far as I see it, the "for" macro works for clojurescript quite well
> > but I am not sure if it is "supported".
> >
> > I am using a two dimensional "for" with a ":when" condition. I already
> > tried to narrow the problem down but this was the closest I could get
> > so far. It seems like some elements are missing in the output.
> >
> > (for [a [0 1] b [0 1]
> >          :when (not (= 0 a b))]
> >          [a b])
> >
> > In clojurescript seems to result in:
> >
> > [[1 0] [1 1]]
> >
> > Wrapping to doall doesn't change a thing, but could lazyness be a
> > problem?
> >
> > I put together a little project you could check out, please have a
> > look:
> >
> > https://github.com/dedeibel/cljs-fortest
>
> Isn't this a special case of cljs not having the right equality
> semantics for multiple args? I don't have a clojurescript repl handy,
> but I remember reading it only looks at the first two args, so (= 0 0
> 1) returns true, keeping that one out of your results.
>
> --
> 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: for behavior difference between clojure and clojurescript?

2012-02-29 Thread Alan Malloy
On Feb 29, 2:36 pm, Benjamin Peter  wrote:
> Hello,
>
> when I was trying to port a little clojure app to clojurescript I
> think I noticed a difference in behavior of the "for" macro.
>
> I am quite new to clojure and maybe you can tell me where my problem
> is or if my assumptions that there might be a problem could be
> correct.
>
> As far as I see it, the "for" macro works for clojurescript quite well
> but I am not sure if it is "supported".
>
> I am using a two dimensional "for" with a ":when" condition. I already
> tried to narrow the problem down but this was the closest I could get
> so far. It seems like some elements are missing in the output.
>
> (for [a [0 1] b [0 1]
>          :when (not (= 0 a b))]
>          [a b])
>
> In clojurescript seems to result in:
>
> [[1 0] [1 1]]
>
> Wrapping to doall doesn't change a thing, but could lazyness be a
> problem?
>
> I put together a little project you could check out, please have a
> look:
>
> https://github.com/dedeibel/cljs-fortest

Isn't this a special case of cljs not having the right equality
semantics for multiple args? I don't have a clojurescript repl handy,
but I remember reading it only looks at the first two args, so (= 0 0
1) returns true, keeping that one out of your results.

-- 
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: for behavior difference between clojure and clojurescript?

2012-02-29 Thread Jordan Berg
Hi,

You should be using == for comparison between numbers.

(for [a [0 1] b [0 1]
:when (not (== 0 a b))]
[a b])

has the same results between clojure and clojurescript.

Cheers,

Jordan

On Wed, Feb 29, 2012 at 5:36 PM, Benjamin Peter wrote:

> Hello,
>
> when I was trying to port a little clojure app to clojurescript I
> think I noticed a difference in behavior of the "for" macro.
>
> I am quite new to clojure and maybe you can tell me where my problem
> is or if my assumptions that there might be a problem could be
> correct.
>
> As far as I see it, the "for" macro works for clojurescript quite well
> but I am not sure if it is "supported".
>
> I am using a two dimensional "for" with a ":when" condition. I already
> tried to narrow the problem down but this was the closest I could get
> so far. It seems like some elements are missing in the output.
>
> (for [a [0 1] b [0 1]
> :when (not (= 0 a b))]
> [a b])
>
> In clojurescript seems to result in:
>
> [[1 0] [1 1]]
>
> Wrapping to doall doesn't change a thing, but could lazyness be a
> problem?
>
> I put together a little project you could check out, please have a
> look:
>
> https://github.com/dedeibel/cljs-fortest
>
>
> Thank you,
>
> --
>
> Benjamin Peter
> https://myminutes.wordpress.com/
> http://twitter.com/BenjaminPtr
>
> --
> 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