True functional programming in Python
Project description
Functon λ [EXPERIMENTAL]
Installation
python3 -m pip install functon
Usage
Hello world:
>>> from functon import fn
>>> fn(print, "Hello world!")
'Hello world!'
Triple the value of a number:
>>> from functon import defun, fn
>>> def triple(x: int) -> defun(("*", 3, "x")):
... """Compute three times X."""
>>> fn(triple, 3)
9
Compute factorials using recursion:
>>> from functon import defun, fn, IF
>>> def factorial(N: int) -> defun((IF, ("=", "N", 1), 1, ("*", "N", ("factorial", ("-", "N", 1))))):
... """Compute the factorial of N."""
>>> fn(factorial, 5)
120
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
functon-0.0.2.dev0.tar.gz
(2.9 kB
view details)
Built Distribution
File details
Details for the file functon-0.0.2.dev0.tar.gz
.
File metadata
- Download URL: functon-0.0.2.dev0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.2 Darwin/21.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bef050e4cffd199b41d3622f447fbda6e6d1fcb1e7ab3261c6e2922dc54272c2 |
|
MD5 | f1ab4ac053737a553b2dfb258a1ad5af |
|
BLAKE2b-256 | 48873b699bbb67dd312aa6af9169f76874cf33a737b1a55fd485666525b0548f |
File details
Details for the file functon-0.0.2.dev0-py3-none-any.whl
.
File metadata
- Download URL: functon-0.0.2.dev0-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.2 Darwin/21.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f74cf92444aaf7544e973a3c7b07d87623477db57f6f906f42b5b57dd9ecdf08 |
|
MD5 | 0ea024e0abbca60e4fd0c014b701a242 |
|
BLAKE2b-256 | 4734f95345e41908bb7ae06ef98d1ed24496ed7e8e52a358fa2795a8b996f69b |