• Preact, SXML and Scheme in JavaScript

    From Jakub T. Jankiewicz@21:1/5 to All on Sat Oct 31 01:37:16 2020
    I want to share my project LIPS it's scheme based lisp with few extensions similar as Racked add new things.

    Here is example of devel version, you can also use 1.0 Beta version.

    In this pen there is example of SXML macro in use (that still in devel and not released as beta yet).

    https://codepen.io/jcubic/pen/JjKbqWd

    What's different about this lisp is that it new type of extension, do you think it would be good idea as SRFI?

    it works like this, there are four functions:

    set-special!
    unset-special!
    set-repr!
    unset-repr!

    it allow to add new syntax similar how to ` and ' is the same as quasiquote and quote. It probably will be changed how it works soon, because right now it just works like macro that's expanded by the parser.

    Example is JavaScript objects (that is like Scheme AList or hash table).

    &(:foo 10 :bar 20)

    this is mapped into

    (object :foo 10 :bar 20)

    but if you evaluate the expression in REPL you will get same value

    &(:foo 10 :bar 20)

    so it can be evaluated again.

    The way it works need to be changed fixed so it works the same as with this expression in Scheme:

    '(foo bar #(1 2 3))

    in LIPS it evaluate to:

    (foo bar (vector 1 2 3))

    so this type of extensions need to be changed and be evaluated by the parser and be always quoted like vectors.

    What cool about this if this would be SRFI is that Schemes would be adding new syntax.

    The project url is at https://jcubic.github.io/lips/ you can check the the 1.0 draft on the wiki that showcase the language https://jcubic.github.io/lips/

    And to be complete I need to say one limitation (I need to add this to Readme) LIPS not as fast as BiwaScheme but it's good while learning and creating prototypes or when you don't do lot of computation. Example is that if you create very long loops like
    10 000 iterations it's very slow in comparison with BiwaScheme that is way faster because it's compiled. This is may be because of macros.

    This project is still in development. To be full scheme compatible it still lack TCO and continuations (I have branch where I've stared working on this but it turns out harder to implement).

    LIPS have hygienic macros (define-syntax/syntax-rules) with lot of unit tests and different cases but it also need to be rewritten (with lips macros) and be like other lisp expanded before evaluation because right now they are evaluated like functions
    and it give problems in edge cases.

    REPL of beta version can be found at https://jcubic.github.io/lips/beta.html

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jakub T. Jankiewicz@21:1/5 to All on Sun Nov 1 23:48:42 2020
    sobota, 31 października 2020 o 09:37:19 UTC+1 Jakub T. Jankiewicz napisał(a):
    I want to share my project LIPS it's scheme based lisp with few extensions similar as Racked add new things.

    Here is example of devel version, you can also use 1.0 Beta version.

    In this pen there is example of SXML macro in use (that still in devel and not released as beta yet).

    https://codepen.io/jcubic/pen/JjKbqWd

    What's different about this lisp is that it new type of extension, do you think it would be good idea as SRFI?

    it works like this, there are four functions:

    set-special!
    unset-special!
    set-repr!
    unset-repr!

    it allow to add new syntax similar how to ` and ' is the same as quasiquote and quote. It probably will be changed how it works soon, because right now it just works like macro that's expanded by the parser.

    Example is JavaScript objects (that is like Scheme AList or hash table).

    &(:foo 10 :bar 20)

    this is mapped into

    (object :foo 10 :bar 20)

    but if you evaluate the expression in REPL you will get same value

    &(:foo 10 :bar 20)

    so it can be evaluated again.

    The way it works need to be changed fixed so it works the same as with this expression in Scheme:

    '(foo bar #(1 2 3))

    in LIPS it evaluate to:

    (foo bar (vector 1 2 3))

    so this type of extensions need to be changed and be evaluated by the parser and be always quoted like vectors.

    What cool about this if this would be SRFI is that Schemes would be adding new syntax.

    The project url is at https://jcubic.github.io/lips/ you can check the the 1.0 draft on the wiki that showcase the language https://jcubic.github.io/lips/

    And to be complete I need to say one limitation (I need to add this to Readme) LIPS not as fast as BiwaScheme but it's good while learning and creating prototypes or when you don't do lot of computation. Example is that if you create very long loops
    like 10 000 iterations it's very slow in comparison with BiwaScheme that is way faster because it's compiled. This is may be because of macros.

    This project is still in development. To be full scheme compatible it still lack TCO and continuations (I have branch where I've stared working on this but it turns out harder to implement).

    LIPS have hygienic macros (define-syntax/syntax-rules) with lot of unit tests and different cases but it also need to be rewritten (with lips macros) and be like other lisp expanded before evaluation because right now they are evaluated like functions
    and it give problems in edge cases.

    REPL of beta version can be found at https://jcubic.github.io/lips/beta.html

    I've just released version beta.7 with fixed syntax extensions, now '(foo bar #(1 2 (1 2 3)) works as it should.
    I've needed to rewrite the parser because it was too complex to modify.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)