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

emulisp

v1.206.0

Published

Description

Downloads

17

Readme

EmuLisp

Javascript partial implementation of PicoLisp

Build Status

Instructions

npm install emulisp -g

will make a command available:

  • pil-njs-w on Windows,
  • pil-njs on the other plaforms.

This command should work as the beloved pil.

Maintainer's note

Please note:

  • I'm not the original author.
  • The original author is OK with this package.

This package is a quick and dirty way to make EmuLisp available to the NodeJS platform. There is still some issues like:

  • it's not the most recent version of EmuLisp,
  • the architecture of the package is not optimal/classical regarding good practices for npm packages,
  • the version number is not the EmuLisp one since I'm republishing a lot while learning how to package for npm.

Author's note

EmuLisp is a PicoLisp emulator, written in JavaScript. However, in this early version it only covers a tiny subset of PicoLisp. My main motivation for writing this emulator, was that I wanted to learn the PicoLisp basics better.

Version 2

My first version of EmuLisp paid no attention to namespace pollution; there was a very big number of globally declared functions and variables. To make EmuLisp easier to use with JavaScript code from other projects, it has now been re-organized into modules.

The modules

EmuLisp currently consists of three modules:

  • emulisp_core.js - the basics
  • emulisp_js.js - operations on JavaScript functions and objects
  • emulisp_cv.js - Canvas functions

For a simple example on how to use these modules, take a look at the emulisp_console.html.
The functions exported by emulisp_core.js are the ones needed in emulisp_js.js and emulisp_cv.js and a few more...

Switching between EmuLisp contexts

Here is an example of how you can work with different contexts, or states, if you should ever have the need to do so. For simplicity, just use the emulisp-console.html which already has the EMULISP_CORE variable ready (from emulisp_core.js), and do the following in your browser's console:

EMULISP_CORE.eval("(setq L (range 1 5))");
// -> "(1 2 3 4 5)"
s1 = EMULISP_CORE.currentState();
// -> Object
EMULISP_CORE.init();
// -> undefined
EMULISP_CORE.eval("(setq L (range 6 9))");
// -> "(6 7 8 9)"
s2 = EMULISP_CORE.currentState();
// -> Object
EMULISP_CORE.init(s1);
// -> undefined
EMULISP_CORE.eval("L");
// -> "(1 2 3 4 5)"

Some implementation details

Numbers

The Number data type is simply the JavaScript Number, which includes floating point numbers. The / function thus does floating point division. However, a /t function is provided in case you need the division(s) to be truncated. The constants π and e are available as js:PI and js:E.

Function definitions

When you define your own functions, you may currently only use these patterns:

  • (de foo (X Y ...) <prog>), i.e. all arguments evaluated
  • (de foo @ <prog>), i.e. a variable number of evaluated arguments
  • (de foo X <prog>), i.e. a variable number of unevaluated arguments

Circular lists

Circular lists may be entered using the (a b c .) notation, and they may also be printed that way. It is, however, not difficult to include such circular lists into other structures so that the simple "circular detector" fails to detect. You may know the result. As long as you stick to "safe circular lists", they shall cause no problem as argument in the length function.

Have fun!