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

@lain9293/simple-lisp

v1.0.2

Published

A simple lisp machine for educational purposes.

Downloads

5

Readme

simple-lisp

A simple lisp machine for educational purposes.

Define a procedure that takes three numbers as arguments and returns the sum squares of two large ones.

(defun sqSum(x y) (+ (* x x) (* y y)))
(defun max(x y) (cond ((< x y) y) (t x)))
(defun main(x y z) (sqSum (max x y) (max y z)))
(main 1 2 3)
; sqrt
(defun average(x y) (/ (+ x y) 2))

(defun square(x)  (* x x))

(defun improve(guess x) (average guess (/ x guess)))

(defun abs(x) (cond ((< x 0) (- x)) ((= x 0) 0) ((> x 0) x)))

(defun good-enough?(guess x) (< (abs (- (square guess) x)) 0.001))

(defun sqrt-iter(guess x) (cond
                            ((good-enough? guess x) guess)
                            (t (sqrt-iter (improve guess x) x))
                          )
)

(defun sqrt(x) (sqrt-iter 1 x))
(sqrt 9)
;if
(defun if(predicate then else)  (cond
                                    (predicate then)
                                    (t else)
                                )
 )
 (if (= 2 3) 0 5)
 (if (= 1 1) 0 5)
(defun factorial(n) (cond
                        ((= n 1) 1)
                        (t (* n (factorial (- n 1))))
                    )
)
(factorial 5)

(defun factorial(n) (fact-iter 1 1 n))
(defun fact-iter(product counter max-count) (cond
                                                ((> counter max-count) product)
                                                (t (fact-iter (* counter product) (+ counter 1) max-count)))
)
(factorial 6)

how many ways can I exchange an amount of 1 dollar if there are coins of 50, 25, 10, 5 and 1 cent?

(defun first-denomination(kinds-of-coins) (cond
                                                ((= kinds-of-coins 1) 1)
                                                ((= kinds-of-coins 2) 5)
                                                ((= kinds-of-coins 3) 10)
                                                ((= kinds-of-coins 4) 25)
                                                ((= kinds-of-coins 5) 50))
)

(defun cc(amount kinds-of-coins) (cond ((= amount 0) 1)
                                       ((or (< amount 0) (= kinds-of-coins 0)) 0)
                                       (t (+
                                            (cc amount (- kinds-of-coins 1))
                                            (cc (- amount
                                                   (first-denomination kinds-of-coins)) kinds-of-coins)))
                                 )
)

(defun count-change(amount) (cc amount 5))
(count-change 100)
(defun expt(b n) (cond
                        ((= n 0) 1)
                        (t(* b (expt b (- n 1))))
                 )
)
(expt 2 3)

(defun expt-iter(b counter product) (cond
                                        ((= counter 0) product)
                                        (t (expt-iter b (- counter 1) (* b product)))
                                     )
)

(defun expt(b n) (expt-iter b n 1))

(expt 2 3)
(defun sum(term a next b) (cond
                            ((> a b) 0)
                            (t (+ (term a)
                                  (sum term (next a) next b)))
                          )
)

(defun inc(n) (+ n 1))
(defun cube(x) (* x x x))

(defun sum-cubes(a b) (sum cube a inc b))
(sum-cubes 1 10)