https://github.com/johnynek/bosatsu
A python-ish pure and total functional programming language
https://github.com/johnynek/bosatsu
functional-programming language
Last synced: 15 days ago
JSON representation
A python-ish pure and total functional programming language
- Host: GitHub
- URL: https://github.com/johnynek/bosatsu
- Owner: johnynek
- License: apache-2.0
- Created: 2017-10-19T02:48:28.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2025-04-08T23:59:14.000Z (11 months ago)
- Last Synced: 2025-04-13T00:42:47.120Z (11 months ago)
- Topics: functional-programming, language
- Language: Scala
- Homepage:
- Size: 180 MB
- Stars: 228
- Watchers: 13
- Forks: 11
- Open Issues: 118
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-java - Bosatsu
- programming-languages - Bosatsu - Python-ish pure and total functional programming language. (Functional)
README
# The Bosatsu Programming Language

Bosatsu (菩薩) is the transliteration in Japanese of the sanskrit bodhisattva.
A bodhisattva is someone who can reach enlightenment but decides not to, to
help others achieve that goal. -- Wikipedia
Bosatsu is a simple, non-turing complete language designed for configuration, queries and scripting. It
borrows from [Python](https://www.python.org/), [Haskell](https://www.haskell.org/),
[Dhall](https://hackage.haskell.org/package/dhall) and [Rust](https://www.rust-lang.org/en-US/).
Please see the [documentation site](https://johnynek.github.io/bosatsu/)
and the [Getting started guide](docs/src/main/paradox/getting_started.md)
or try basic expressions using this [in-browser Bosatsu compiler](https://johnynek.github.io/bosatsu/compiler/).
## An example of Bosatsu
Here is a working Bosatsu program to solve the first [Project Euler](https://projecteuler.net/) problem:
```
package Euler/One
# see:
# https://projecteuler.net/problem=1
# Find the sum of all the multiples of 3 or 5 below 1000.
operator == = eq_Int
operator % = mod_Int
def operator ||(x, y):
True if x else y
def keep(i):
(i % 3 == 0) || (i % 5 == 0)
def sum(as): as.foldl_List(0, add)
# here is the python version:
# >>> sum(i for i in xrange(1000) if keep_fn(i))
# 233168
#
# bosatsu version here
computed = sum([i for i in range(1000) if keep(i)])
test = Assertion(computed == 233168, "expected 233168")
```
## Contributing
Please feel free to file an issue to discuss making a change to Bosatsu or
to ask a question about how Bosatsu might be useful for a use-case that is
interesting to you.
## Release
See [release.md](release.md) for the release workflow and tagging steps.