Re: Javascript generator
jim jim.d...@gmail.com writes: Due to popular demand*, I resuscitated my code to generate javascript from s-expressions. This was what I coded to learn about logic programming in Clojure. Github: http://github.com/jduey/js-gen Clojars: http://clojars.org/net.intensivesystems/js-gen *actually it was just one person, but I'm easily swayed. Neat! You've seen Scriptjure, I expect, so it'd be interesting to hear how your library differs: http://github.com/arohner/scriptjure -Steve -- 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: Javascript generator
I've heard of scriptjure but never used it or looked at it. My interests took me in another direction and I've never circled back. I would be interested to know how the differ. Thanks, Jim On Oct 11, 3:21 am, Steve Purcell st...@sanityinc.com wrote: jim jim.d...@gmail.com writes: Due to popular demand*, I resuscitated my code to generate javascript from s-expressions. This was what I coded to learn about logic programming in Clojure. Github:http://github.com/jduey/js-gen Clojars:http://clojars.org/net.intensivesystems/js-gen *actually it was just one person, but I'm easily swayed. Neat! You've seen Scriptjure, I expect, so it'd be interesting to hear how your library differs: http://github.com/arohner/scriptjure -Steve -- 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: Javascript generator
Well, taking a brief look over your code, it seems like the main difference is that scriptjure is macro-based, so all the code generation gets done at compile-time. That makes scriptjure faster, but at the expense of needing an unquote form - (clj ...) - to splice clojure expressions into the javascript source sexps. -Steve jim jim.d...@gmail.com writes: I've heard of scriptjure but never used it or looked at it. My interests took me in another direction and I've never circled back. I would be interested to know how the differ. Thanks, Jim On Oct 11, 3:21 am, Steve Purcell st...@sanityinc.com wrote: jim jim.d...@gmail.com writes: Due to popular demand*, I resuscitated my code to generate javascript from s-expressions. This was what I coded to learn about logic programming in Clojure. Github:http://github.com/jduey/js-gen Clojars:http://clojars.org/net.intensivesystems/js-gen *actually it was just one person, but I'm easily swayed. Neat! You've seen Scriptjure, I expect, so it'd be interesting to hear how your library differs: http://github.com/arohner/scriptjure -Steve -- 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: Javascript generator
On Mon, Oct 11, 2010 at 10:02 AM, Steve Purcell st...@sanityinc.com wrote: Well, taking a brief look over your code, it seems like the main difference is that scriptjure is macro-based, so all the code generation gets done at compile-time. js-gen generates js at compile time. That makes scriptjure faster, but at the expense of needing an unquote form - (clj ...) - to splice clojure expressions into the javascript source sexps. -Steve I haven't found this to be true at all. Scriptjure in my tests is quite a bit slower because it doesn't emit the final generated code at compile time, but an intermediate form that permits splicing. I look forward to the cross-pollinations of ideas between these two endeavors :) David -- 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: Javascript generator
David Nolen dnolen.li...@gmail.com writes: On Mon, Oct 11, 2010 at 10:02 AM, Steve Purcell st...@sanityinc.com wrote: Well, taking a brief look over your code, it seems like the main difference is that scriptjure is macro-based, so all the code generation gets done at compile-time. js-gen generates js at compile time. Indeed - my embarrassing mistake, for which I apologise! A more thorough reading of the code would have shown up the one key macro that ties it all together. That makes scriptjure faster, but at the expense of needing an unquote form - (clj ...) - to splice clojure expressions into the javascript source sexps. I haven't found this to be true at all. Scriptjure in my tests is quite a bit slower because it doesn't emit the final generated code at compile time, but an intermediate form that permits splicing. I look forward to the cross-pollinations of ideas between these two endeavors :) Indeed. Thanks for taking the time to correct me! Now time for me to actually play with js-gen in earnest... -Steve -- 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: Javascript generator
I'll be glad to support it if people choose to use it and report issues. My plans to use are still on my todo list, things just keep getting put on top of them. One of which is to get my own server set up to host this and some other projects. I'll check out those asserts and make them so they're not dependent on order. Have you seen anything else that needs to be fixed? Thanks 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 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: Javascript generator
Cool! Rather then waiting, you could host it in the interim on GitHub or Google Code so people like myself can submit patches (which I'm more than willing to do) ;) Just a thought... A couple of things: (println (javascript (var x))) I would expect this to convert to: var x; It does not. (println (javascript (new Object {prop1 a prop2 b}))) var MyClass = new(ClassGenerator, {prop1:a,prop2:b}); Instead of , var MyClass = new ClassGenerator({prop1:a, prop2:b}); This idiom is essential to MooTools, a JS library I use quite a bit. The other thought that I had was how to use macros with js-gen? The javascript macro pretty much captures everything and doesn't allow macros to be embedded. Seems like this would be quite handy. I've been contemplating writing a system which generates tagged javascript so that it can be sanely debugged if generated server side via Clojure. On Tue, Apr 14, 2009 at 9:07 AM, jim jim.d...@gmail.com wrote: I'll be glad to support it if people choose to use it and report issues. My plans to use are still on my todo list, things just keep getting put on top of them. One of which is to get my own server set up to host this and some other projects. I'll check out those asserts and make them so they're not dependent on order. Have you seen anything else that needs to be fixed? Thanks 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 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: Javascript generator
Cool! Rather then waiting, you could host it in the interim on GitHub or Google Code so people like myself can submit patches (which I'm more than willing to do) ;) Just a thought... A couple of things: (println (javascript (var x))) I would expect this to convert to: var x; It does not. (println (javascript (new Object {prop1 a prop2 b}))) var MyClass = new(ClassGenerator, {prop1:a,prop2:b}); Instead of , var MyClass = new ClassGenerator({prop1:a, prop2:b}); This idiom is essential to MooTools, a JS library I use quite a bit. The other thought that I had was how to use macros with js-gen? The javascript macro pretty much captures everything and doesn't allow macros to be embedded. Seems like this would be quite handy. I've been contemplating writing a system which generates tagged javascript so that it can be sanely debugged if generated server side via Clojure. On Tue, Apr 14, 2009 at 9:07 AM, jim jim.d...@gmail.com wrote: I'll be glad to support it if people choose to use it and report issues. My plans to use are still on my todo list, things just keep getting put on top of them. One of which is to get my own server set up to host this and some other projects. I'll check out those asserts and make them so they're not dependent on order. Have you seen anything else that needs to be fixed? Thanks 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 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: Javascript generator
I got my static IP today. I'm setting up the web server now. I'll setup the Git server ASAP. --~--~-~--~~~---~--~~ 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 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: Javascript generator
Cool! Thanks. Also sorry for the accidental double post and I had a typo, I meant the weird result was: (println (javascript (new ClassGenerator {prop1 a prop2 b}))) var MyClass = new(ClassGenerator, {prop1:a,prop2:b}); Instead of- var MyClass = new ClassGenerator({prop1:a, prop2:b}); On Tue, Apr 14, 2009 at 4:01 PM, jim jim.d...@gmail.com wrote: I got my static IP today. I'm setting up the web server now. I'll setup the Git server ASAP. --~--~-~--~~~---~--~~ 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 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: Javascript generator
Do you have any plans for continuing to support this? If so are you against putting this on GitHub or Google Code so that people can follow it's development? Thanks for contributing it to the community. On Wed, Feb 25, 2009 at 7:49 PM, jim jim.d...@gmail.com wrote: I've just uploaded a javascript generator ala Parenscript. It's pretty half-baked, so be cautious using it until we get the bugs ironed out. http://clojure.googlegroups.com/web/js_gen.clj The code for the generator is about 250 lines. It depends on the mini- kanren implementation I just uploaded. The file also includes a bunch of unit tests of the various functions. At the bottom, there are some examples of javascript functions being generated. Bug reports very much appreciated. 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 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: Javascript generator
One thing, there are several assertions in js-gen like the following: (assert (= '(obj = {prop2:\str-val\,prop1:3}) (run out-str (js-assignment '(= obj {prop1 3, prop2 str-val}) out-str This assertion statement might fail (and did for me) since maps are not ordered. On Tue, Apr 14, 2009 at 1:19 AM, David Nolen dnolen.li...@gmail.com wrote: Do you have any plans for continuing to support this? If so are you against putting this on GitHub or Google Code so that people can follow it's development? Thanks for contributing it to the community. On Wed, Feb 25, 2009 at 7:49 PM, jim jim.d...@gmail.com wrote: I've just uploaded a javascript generator ala Parenscript. It's pretty half-baked, so be cautious using it until we get the bugs ironed out. http://clojure.googlegroups.com/web/js_gen.clj The code for the generator is about 250 lines. It depends on the mini- kanren implementation I just uploaded. The file also includes a bunch of unit tests of the various functions. At the bottom, there are some examples of javascript functions being generated. Bug reports very much appreciated. 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 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 -~--~~~~--~~--~--~---