Giter Club home page Giter Club logo

silly-joy's Introduction

silly-joy

Build Status

silly-joy is an interpreter for the concatenative programming language Joy, implemented in Haskell using extensible-effects.

What's Joy?

Here are some resources:

Try it out!

Simplest way to try it out is by using Docker:

docker run -it rootmos/silly-joy --tui

You'll be greeted by a terminal UI with the REPL as well as a window showing the current stack. Very convenient when learning stack-based languages!

demo

Example session

> 1 2 +
> :stack
3
> 12 *
> print
36
> fact := [[pop 0 =] [pop pop 1] [ [dup 1 -] dip dup i *] ifte] dup i
> 10 fact
> :st
3628800
> ["foo" "bar" strcat] [strlen] b
> dup print
6
> 1 swap - print
-5
> even := 2 % 0 =
> odd := even not
> 3 odd 2 even and print
true
> prime := [dup even [3 <] dip or] [2 =] [prime_trial_division] ifte
> prime_trial_division := 3 [[pop % null] [pop =] [[2 +] dip x] ifte] x
> [2 3 4 5 6 7 8 9 10 11 12 13] [prime] map print
[true true false true false true false false false true false true]
> sum := 0 [+] fold
> div-3-5 := [dup [3 % null] dip 5 % null or] filter
> up-to := pred [[]] [cons] primrec
> 10 up-to div-3-5 sum print
23
> next-fib := dup [+] dip swap
> add-if-even := [even] [dup [rotate] dip + rotate] [] ifte
> 0 1 1 [100 >] [pop pop] [next-fib add-if-even] [i] genrec print
188

silly-joy's People

Contributors

rootmos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.