Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shellyln/liyad-lisp-pkg-example


https://github.com/shellyln/liyad-lisp-pkg-example

javascript lisp liyad-cli node nodejs

Last synced: 21 days ago
JSON representation

Awesome Lists containing this project

README

        

# liyad-lisp-pkg-example

NPM package example for [Liyad](https://www.npmjs.com/package/liyad) Lisp interpreter [CLI](https://www.npmjs.com/package/liyad-cli).

## Install

```bash
$ npm install -g liyad-cli

$ mkdir myapp
$ cd myapp
$ npm install liyad-lisp-pkg-example
```

## Write the code

```bash
$ vi app.lisp
```

app.lisp
```lisp
($let ex ($require "liyad-lisp-pkg-example"))

;; Benchmarks
($console-log (::ex:tarai 12 6 0))
($console-log (::ex:fib 10))
($console-log (::ex:fac 10))

;; Run the web server on port 3000.
($let url ($node-require "url"))

(::ex:#get "/" (-> (req res)
($let u (::url:parse ::req:url))
(::res@writeHead 200 (# (Content-Type "text/html")))
(::res@end ($concat "hit / ," ::req:method "," ::u:path)) ) )

(::ex:serve 3000) ($last "start server")
```

## Run

```bash
$ liyad app.lisp

12
55
3628800
start server
```