npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gambit-loader

v0.1.1

Published

Gambit Scheme to JavaScript loader

Downloads

2

Readme

Gambit Loader : Use gsc for Scheme -> JavaScript

The Gambit programming system is a full implementation of the Scheme language which conforms to the R4RS, R5RS and IEEE Scheme standards.

The gambit-loader package allows the loading of a scheme file in a javascript environment.

The gambit-scheme UMD library is one way to have a runtime that works alongside it.

Installation

Easy! I choose yarn, but npm also works.

yarn add gambit-loader --dev
yarn add gambit-scheme

Documentation

For details see the repo, man! https://github.com/drewc/gxjs

Usage

The package gambit-scheme contains a minimal runtime generated by the Gambit Scheme environment. It attempts to be small yet contain enough to develop and application with the option to add and load Gambit modules.

To load a .scm file, gambit-loader is the easy way. The options are the same as gxjs-loader.

Here is gambit-scheme-usage.scm.

(declare (extended-bindings))

(##inline-host-declaration "console.log('Started Gambit loaded file!')")


(define gambit-vector
  (##vector
   42 'this "is how we hake the moonshine"))


(define (this-is-gambit! #!optional (val 42))
  (let ((three (##inline-host-expression "{ answer: 42 };")))
    (##inline-host-statement "console.log('This is Gambit!', (@1@), (@2@), (@3@))"
                           val gambit-vector three)))

(##inline-host-statement "console.log('finished Gambit-loaded file');
 module.exports = RTS.scm2host(@1@);" this-is-gambit!)

Now for a JavaScript file, gambit-scheme-usage.js. We’ll make this a CommonJS module.

We do not actually need to require('gambit-scheme') here at all but the RTS is exported pretty much so we can see just that.

const RTS = require('gambit-scheme');

const thisIsGambit = require('gambit-loader!./gambit-scheme-usage.scm');

thisIsGambit(0.42);

module.exports = RTS;

Running that outputs this.

Started Gambit loaded file!
finished Gambit-loaded file
This is Gambit! { val: 0.42 } [
  42,
  { name: 'this', hash: 439079553, interned: true },
  {
    codes: [
      105, 115,  32, 104, 111, 119,  32,
      119, 101,  32, 104,  97, 107, 101,
       32, 116, 104, 101,  32, 109, 111,
      111, 110, 115, 104, 105, 110, 101
    ]
  }
] { answer: 42 }

By default gambit-loader automagically requires gambit-scheme by prepending const RTS = require('gambit-scheme'); to the top of the “file”.

(declare (extended-bindings))
(##inline-host-statement #<<EOF
console.log('Ok, auto RTS!', Object.keys(RTS.glo).length)

module.exports = RTS;

EOF
)

const RTS = require('./gambit-scheme-usage.js');
const sameRTS = require('gambit-loader!./gambit-scheme-auto.scm');

console.log('Same Runtime?', RTS === sameRTS);

That outputs this:

Started Gambit loaded file!
finished Gambit-loaded file
This is Gambit! { val: 0.42 } [
  42,
  { name: 'this', hash: 439079553, interned: true },
  {
    codes: [
      105, 115,  32, 104, 111, 119,  32,
      119, 101,  32, 104,  97, 107, 101,
       32, 116, 104, 101,  32, 109, 111,
      111, 110, 115, 104, 105, 110, 101
    ]
  }
] { answer: 42 }
Ok, auto RTS! 127
Same Runtime? true

Support

Go to https://github.com/drewc/gxjs/issues or contact the author.