Some bugs?

58 views
Skip to first unread message

Jacob Howe

unread,
Aug 7, 2013, 1:02:04 PM8/7/13
to lispy...@googlegroups.com
Dear God Of Lispyscript,

    First of all, I would like to thank you for creating this
project. I am a lisp hack in training, and your project ticks all of
my boxes for a great language. I too read "Beating the Averages"; I
think it's a good sign this project was inspired by that essay. I'll
be using this language for creating an online game (if it all works
out ;) ), so I'm reading the documentation now and I've found a few
unclear things/errors. Correct me if I'm wrong on any of the below. If
you need help fixing them let me know (I'm just learning javascript
now so I don't know much, but wherever I can help I will)

First: a bug in the website. There's a discrepancy between "Try it!" and command line compiler.
On the web site, in the "Try it!" tab, when I try compiling
    (function (-> ($ "#xyz") (.required) (.alphanum) (.min 3) (.max 30) (.with "email")))
It gives 
function(->,$,"#xyz",.required,.alphanum,.min,3,.max,30,.with,"email") { };
which just seems wrong.
However, compiling with the command line tool lispy gives:
    // Generated by LispyScript v0.3.6
    ((((($("#xyz")).required()).alphanum()).min(3)).max(30)).with("email");

You must not be..... expanding macros? Check out the _compile function you exported in lib/ls.js I think.
And besides, what's with all of those extra parens? Shouldn't it just be:
    $("#xyz").required().alphanum().min(3).max(30).with("email");
 or so? (not knowing jquery)


Also, on the documentation page, you say the usage for the `->` macro is as follows:
    (-> (function expression) (.key1 args1 ...) (.key2 args2 ...) ...)

Looking at the source code for the macro `->`, I still don't
understand. It doesn't seem as though the arguments match up, in other
words it seems like the useage should be something like:
    (-> expression (.key1 args1 ...) (.key2 args2 ...) ...)
assuming scheme documentation style ellipses (where the preceding sexp is repeated 0 or more times) 

But I still cannot understand the macro. looking at lib/ls.js, it seems
`rest...` is syntactically significant, but this isn't documented any
which where. Same with #args-shift and it's kin.

Also, I was wondering if you used the closure compiler.

Let me know if I can help, 
   Jacob Howe

Santosh Rajan

unread,
Aug 7, 2013, 1:18:31 PM8/7/13
to lispy...@googlegroups.com
My comments inline.


On Wednesday, 7 August 2013 22:32:04 UTC+5:30, Jacob Howe wrote:

    First of all, I would like to thank you for creating this
project. I am a lisp hack in training, and your project ticks all of
my boxes for a great language. I too read "Beating the Averages"; I
think it's a good sign this project was inspired by that essay. I'll
be using this language for creating an online game (if it all works
out ;) ), so I'm reading the documentation now and I've found a few
unclear things/errors. Correct me if I'm wrong on any of the below. If
you need help fixing them let me know (I'm just learning javascript
now so I don't know much, but wherever I can help I will)

Thanks for the encouraging words.

 

First: a bug in the website. There's a discrepancy between "Try it!" and command line compiler.
On the web site, in the "Try it!" tab, when I try compiling
    (function (-> ($ "#xyz") (.required) (.alphanum) (.min 3) (.max 30) (.with "email")))
It gives 
function(->,$,"#xyz",.required,.alphanum,.min,3,.max,30,.with,"email") { };
which just seems wrong.
However, compiling with the command line tool lispy gives:
    // Generated by LispyScript v0.3.6
    ((((($("#xyz")).required()).alphanum()).min(3)).max(30)).with("email");

You must not be..... expanding macros? Check out the _compile function you exported in lib/ls.js I think.

This is because the tryit page uses an old version of LispyScript. The tryit is only for trying out simple things. I need to mention this somewhere (or update it to 3.6)
 
And besides, what's with all of those extra parens? Shouldn't it just be:
    $("#xyz").required().alphanum().min(3).max(30).with("email");
 or so? (not knowing jquery)

The extra parens are there because we need whatever is in the parens to be evaluated. Unfortunately in the case of nesting it becomes to many nested parens. This is not a problem for the JavaScript compilers which are will optimize this. However I agree it does not look good.
 


Also, on the documentation page, you say the usage for the `->` macro is as follows:
    (-> (function expression) (.key1 args1 ...) (.key2 args2 ...) ...)

Looking at the source code for the macro `->`, I still don't
understand. It doesn't seem as though the arguments match up, in other
words it seems like the useage should be something like:
    (-> expression (.key1 args1 ...) (.key2 args2 ...) ...)
assuming scheme documentation style ellipses (where the preceding sexp is repeated 0 or more times) 

You are right I need to make this clear. It should read <function expression>. I will fix that in the docs.
 

But I still cannot understand the macro. looking at lib/ls.js, it seems
`rest...` is syntactically significant, but this isn't documented any
which where. Same with #args-shift and it's kin.

rest... is documented here http://lispyscript.com/docs/#macros

However the homoiconic expressions #args-shift etc are not yet documented. I need to do that.
 

Also, I was wondering if you used the closure compiler.

No I did not use the closure compiler.
 

Let me know if I can help, 

Thanks for the offer. Any help is welcome.
Thanks again.
 
   Jacob Howe

Jacob Howe

unread,
Aug 7, 2013, 1:55:10 PM8/7/13
to lispy...@googlegroups.com
Alright, I'll keep on running through the documentation and I'll let you know of anything else I find. 
Jacob Howe

Jacob Howe

unread,
Aug 7, 2013, 2:02:04 PM8/7/13
to lispy...@googlegroups.com
Same error with str: Should read

(str <string expression 1> <string expression 2> ...)

again assuming scheme style ellipses. 

Jacob Howe

unread,
Aug 7, 2013, 2:19:57 PM8/7/13
to lispy...@googlegroups.com
(array element1 element2 ...)
should read (array element1 ...)
if you're doing scheme ellipses

Also 
(object key1 val1 key2 val2 ....)
should be something like
(object key1 val1 ...)

but that would imply that val is being repeated, so some notation
should be made up to compensate for this?

(object {key1 val1} ...)

of course people will get the idea, but consistency is good.

(new Classname arg1 arg2 ....)
should be 
(new Classname arg1 ...)

Really, a lot of things need to be updated if you're going to maintain
consistent notation for your function calls. If you send me the source
for the webpage (assuming you didn't use a static page) I'll update it
so you don't have to, then you can compare the diffs and fix my
mistakes, if you want me too.

Santosh Rajan

unread,
Aug 8, 2013, 12:56:45 AM8/8/13
to lispy...@googlegroups.com

Jacob Howe

unread,
Aug 8, 2013, 10:53:42 AM8/8/13
to lispy...@googlegroups.com
    Can't find your email anywhere and I don't think that I can attach
a file here. I don't know how to work github (yet!). Let me know how
to send you `index.html`. So, I updated `index.html`, fixing typos and
an inconsistent function notation. I have some other outstanding
problems I think I uncovered:

    First, with the emacs mode: The highlighting is off. For instance,
If I type in `doSomething` as a function, it highlights the `do` but
not the `Something`. Also, `doMonad` doesn't get highlighted. I know
this is Kris's deal, so should I let him know?

    Also, `each2d` takes a third argument, but it doesn't do anything
with it.

    The function `javascript` isn't documented.

    I've already let you know about the old interpreter on the
website, and the family of `#args-shift` functions. putting this here
for easy reference

    Also, I found out that macros must take at least one expression;
This is inconsistent with common lisp's implementation. Did you mean
to make it this way?

    Plus, this paragraph isn't finished: 

    "The bindings for a and b are made for every element of the
corresponding arrays. In the second example we applied a when
condition to the result expression to keep out results greater than
six. This when condition can only be used with the array monad and
maybe monad. Or to be more specific, monads that define mZero"

    And the withMonad function isn't documented.

    aaand there's a gotcha with html5 templates: you can't use the
object and eventsource tags.

    -> still works with normal functions; The arguments don't have to
be .key functions, they can be normal functions and -> still
compiles. Did you mean to do this?

    Not trying to load you with work, but I think it would be worth a
run through of your code to see which functions are being exposed and
document those.  Of course, not knowing javascript, I don't know if
there's an export function or whatever, so I cannot immediately tell
if a function is exported, and besides if it was I would not know what
it did, so I feel as though you're the better candidate to do that.

Santosh Rajan

unread,
Aug 9, 2013, 3:15:26 AM8/9/13
to lispy...@googlegroups.com

Thanks. You can attach file here. I can see the option above the reply box. I will go through the file and make the necessary changes.


On Thursday, 8 August 2013 20:23:42 UTC+5:30, Jacob Howe wrote:

    First, with the emacs mode: The highlighting is off. For instance,
If I type in `doSomething` as a function, it highlights the `do` but
not the `Something`. Also, `doMonad` doesn't get highlighted. I know
this is Kris's deal, so should I let him know?

I am not using emacs so I wouldnt know. Maybe you should let the emacs mode author know.

 

    Also, `each2d` takes a third argument, but it doesn't do anything
with it.

 

    The function `javascript` isn't documented.

Yes it is not documented, because it is meant for internal use only.
 

    I've already let you know about the old interpreter on the
website, and the family of `#args-shift` functions. putting this here
for easy reference

    Also, I found out that macros must take at least one expression;
This is inconsistent with common lisp's implementation. Did you mean
to make it this way?

Yes it is meant to be this way. There are reasons for it.
 

    Plus, this paragraph isn't finished: 

    "The bindings for a and b are made for every element of the
corresponding arrays. In the second example we applied a when
condition to the result expression to keep out results greater than
six. This when condition can only be used with the array monad and
maybe monad. Or to be more specific, monads that define mZero"

    And the withMonad function isn't documented.

Will do this.
 

    aaand there's a gotcha with html5 templates: you can't use the
object and eventsource tags.

Yes `object` does not work because it clashes with lispyscript `object`. Need to fix that. Need to add support for eventsource.
 

    -> still works with normal functions; The arguments don't have to
be .key functions, they can be normal functions and -> still
compiles. Did you mean to do this?

Yes
 

    Not trying to load you with work, but I think it would be worth a
run through of your code to see which functions are being exposed and
document those.  Of course, not knowing javascript, I don't know if
there's an export function or whatever, so I cannot immediately tell
if a function is exported, and besides if it was I would not know what
it did, so I feel as though you're the better candidate to do that.

Yes I agree. Thanks. 

Jacob Howe

unread,
Aug 9, 2013, 7:49:18 AM8/9/13
to lispy...@googlegroups.com
I think that you have permission to post files but other users don't. So, here's the file:
https://docs.google.com/file/d/0B-iXq8LOsCkydTBjM3F2cHRqa3c/edit?usp=sharing
Reply all
Reply to author
Forward
0 new messages