Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 25 19:58
    CI run 1505007061 passed
  • Nov 25 19:13

    feeley on master

    Add sequence-number to generate… Merge branch 'master' of github… (compare)

  • Nov 24 06:03
    CI run 1497963613 passed
  • Nov 24 05:22

    gambiteer on master

    Fix typo in ##gcd2. I can't th… (compare)

  • Nov 24 04:24
    CI run 1497724360 passed
  • Nov 24 03:35

    feeley on master

    Fix "make modules" and "make te… (compare)

  • Nov 24 03:05
    Windows-msvc build of CI run failed
  • Nov 24 03:04
    Windows-mingw build of CI run 1497576506 failed
  • Nov 24 02:32

    gambiteer on master

    Correct gcd test; simplify sqrt… (compare)

  • Nov 24 01:18
    Windows-msvc build of CI run failed
  • Nov 24 01:11
    Windows-mingw build of CI run 1497296009 failed
  • Nov 24 00:44
    Windows-msvc build of CI run failed
  • Nov 24 00:41

    gambiteer on master

    Add numerical tests. (compare)

  • Nov 24 00:34
    Windows-mingw build of CI run 1497203660 failed
  • Nov 24 00:16
    Windows-msvc build of CI run failed
  • Nov 24 00:14
    Windows-mingw build of CI run 1497135839 failed
  • Nov 24 00:10

    gambiteer on master

    Add fast path for sqrt of simpl… (compare)

  • Nov 24 00:09
    Windows-mingw build of CI run 1497114743 failed
  • Nov 24 00:07
    MacOS build of CI run 1497135839 failed
  • Nov 24 00:05
    Windows-msvc build of CI run failed
Drew Crampsie
@drewc
I generally use functional components for the most part.
But can do them both, of course ... let me see if I have github code to show
https://github.com/drewc/gloui/blob/main/src/assets/widgets.ss#L166 <--- that is a Vue component written in Gerbil which is transpiled to Gambit which is transpiled to JS using gxjs-loader
Drew Crampsie
@drewc
if you look here you can see the code that it expands to, though it's so minimized that I cannot even tell you where that code goes: https://github.com/drewc/gloui/tree/gh-pages
@feeley That's brilliant, I like that!
Oh, and for an -exe or -link it can see what needs to be in the RTS file by foreign code, not domestic ... that's brilliant as well.
drewc @drewc does a wee happy dance.
amirouche
@amirouche
I will do myself a favor, and read gambit.pdf!
Guillaume Cartier
@gcartier

I’m trying to figure out how to use ##wr. I have the following wr.scm file

(include "~~lib/_gambit#.scm")

(##wr-set!
  (lambda (we obj)
    (if (##symbol? obj)
        (##write-string "123" (macro-writeenv-port we))
      (##default-wr we obj))))

(write 'hello)

and the result I get when I run it is that 123 gets display twice and I cannot figure out why

$ gsi wr
123123

any idea what I’m doing wrong?

Guillaume Cartier
@gcartier
Just figured it, that I need to call (##default-wr we obj) if (macro-writeenv-style we) is ‘mark
amirouche
@amirouche

The following code:

\alert(`42)

Does not work with js backend, it does nothing.

Marc Feeley
@feeley
@amirouche On https://gambitscheme.org/try/ it works fine. What do you mean with “js backend”? The SIX syntax is not enabled by default and you need to import the library (_six js) to activate the handling of \….
amirouche
@amirouche
There is another error:
✦ ❯ cat webui.scm
(import (_six js))

\alert(42)

✦ ❯ ./scm2js.sh webui.scm
+ pwd
+ docker run -v /home/amirouche/src/scheme/arew:/mnt --rm -it schemers/gambit:head gsc -:r7rs -target js -exe /mnt/src/ /mnt/webui.scm
*** ERROR IN "mnt/webui.scm"@3.1 -- Ill-formed expression
amirouche
@amirouche
I am using the latest gambit master (I triggered a build dockerhub side)
Marc Feeley
@feeley
@amirouche I’m looking into it
Marc Feeley
@feeley
there’s something strange happening with the handling of the \… notation by the parser… a literal (six.infix (six.call (six.identifier alert) (six.literal 42))) does not have the problem
Marc Feeley
@feeley
@amirouche Indeed there was a problem with the parser that added an extra level of wrapping of six.infix. This has been fixed and the commit pushed. The program can be compiled and run like this:
% cp `gsc -e '(display(path-expand"~~lib"))'`_six/js*.scm .
% cat webui.scm
(import (_six js))
(define n 2)
\alert(Math.sqrt(`n))
% gsc -target js -exe -o webui.html js.scm webui.scm
js.scm:
/Users/feeley/test/js.js:
webui.scm:
/Users/feeley/test/webui.js:
/Users/feeley/test/webui_.js:
% open webui.html
Drew Crampsie
@drewc
@feeley The latest minimization is brilliant. From 35mb down to 4.5mb with just a couple more added @'s is so nice.
Marc Feeley
@feeley
when you minimize and gzip it gets down to 640KB… I still can’t understand this
Drew Crampsie
@drewc
That makes .... no sense to me either .... my head is going through compression ... a pointer or address is at least char sized ... we have almost no chars ...
Marc Feeley
@feeley
who would have thought that JS code was a path to program compression
Bradley Lucier
@gambiteer
@feeley what can't you understand?
Drew Crampsie
@drewc
It does almost entirely change both my approach and my tactics... 640KB is worth very byte for an entire Gambit ecosystem. Tabarnouche!
Marc Feeley
@feeley
gzip compressing the JS code of the interpreter (including the Gambit runtime library) gives 640KB… gzip compressing the x86 code of the interpreter gives 1.5MB (down from 6.1MB)… I would have thought that machine code is rather compressed to start with
Bradley Lucier
@gambiteer
Aha. The C back end includes a number of tables of floating-point numbers, which are likely somewhat difficult to compress, plus a bit more code for bignum algorithms.
Marc Feeley
@feeley
sure… but 640KB! that means the “information content” of Gambit’s interpreter is <= 640KB… doesn’t sound like much
Drew Crampsie
@drewc
I'm still in shock over that small number.
Bradley Lucier
@gambiteer
Well, that's a good thing, right? Does that include the module code?
Drew Crampsie
@drewc
It also means an increase in performance due to _i being a tiny lookup...
Marc Feeley
@feeley
yes a super good thing… and yes the runtime system includes dynamic module loading (but all the usual modules are preloaded)
Drew Crampsie
@drewc
and changes my entire strategy when it comes to minimal js downloads ... it's so tiny, for almost everything, that it's well worth the little tiny bits of bytes.
Marc Feeley
@feeley
I saved quite a bit by compressing the Unicode tables… they went from 600KB of JS to 5.2KB… more than 100x more compact (and I’m not including the gzip compression factor)
François-René Rideau
@fare
So that's what they meant when they said that nobody needs more than 640KB...
Drew Crampsie
@drewc
I'm still somewhat in shock lol... it's so much in such a small package.
5 and a quarter, it's a small package as it's still floppy!!
Drew Crampsie
@drewc
@feeley I also have to give you some major big-ups on the @async_call@ and the ##callback-loop. That is exactly what I was needing to attempt this week as, I'm sure you well know, that bloody stack and FFI and async do/did not get along.
Marc Feeley
@feeley
yes I’m quite pleased with the solution which interfaces JS async functions and Scheme threads
Drew Crampsie
@drewc
Having most of the interaction be in a promise saves so much headscratching and will totally get rid of my "fake" js#function where I copy the stack and sp. I never thought I'd enjoy the JS universe so much, but 4 odd months of Universal Runtime and interactions with it, I'm now quite a fan.
Uniting threads and async was what I needed to have IndexedDB interactions without having to pass callbacks.
That was my plan this week, with mutexes and a loop, so 10% of what you did in 1000% of a timesink due to my lack of clue... so I'm very happy :) What a fun Monday.
Marc Feeley
@feeley
too bad you don’t also like SIX… but I’ll give you some time
Drew Crampsie
@drewc
I've thought about that as well and already figured a number of reasons to get along with it, so likely next week you'll hear my praise \infix('of)
Marc Feeley
@feeley
I don’t want praise… I want the happy dance
Drew Crampsie
@drewc
lol, it could happen!
Drew Crampsie
@drewc
Question: why does my gsc and _gambit.js seem to have glo as _i or RTS.i while it most certainly seems to be _g? Is there an easy way to find/see that mapping?
Marc Feeley
@feeley
You’ll find the mapping in gsc/_t-univ-1.scm :
(define (univ-rts-field-low-level-name ctx name)
  (if (univ-compactness>=? ctx 5)
      (case name
        ((r0)        'r)
        ((r1)        'a)
        ((r2)        'b)
        ((r3)        'c)
        ((r4)        'd)
        ((glo)       'g)
        ((stack)     's)
        ((sp)        't)
        ((nargs)     'n)
        ((peps)      'e)
        ((pollcount) 'q)
        ((inttemp1)  'o)
        ((inttemp2)  'h)
        (else        name))
      name))

(define (univ-rts-method-low-level-name ctx name)
  (if (univ-compactness>=? ctx 5)
      (case name
        ((poll)                 'p)
        ((wrong_nargs)          'w)
        ((make_interned_symbol) 'i)
        ((check_procedure_glo)  'u)
        ((ctrlpt_init)          'j)
        ((returnpt_init)        'k)
        ((entrypt_init)         'l)
        ((parententrypt_init)   'm)
        ((flonumbox)            'F)
        ((flonump)              'f)
        ((vectorbox)            'V)
        ((vectorp)              'v)
        ((stringbox)            'Z)
;;        ((stringp)              'z)
        ((cons)                 'X)
        ((pairp)                'x)
        ((jsnumberp)            'y)
        ((base92_decode)        'z)
        (else                   name))
      name))
Drew Crampsie
@drewc
Brilliant, thanks!
Jaime Fournier
@ober
Jaime Fournier
@ober
without --enable-multiple-threaded-vms I can't reproduce.
Marc Feeley
@feeley
@ober should be fixed now