Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/smintfy/yip
Yip is a toy interpreted functional programming language.
https://github.com/smintfy/yip
interpreter learning programming-language python recreational zig
Last synced: 17 days ago
JSON representation
Yip is a toy interpreted functional programming language.
- Host: GitHub
- URL: https://github.com/smintfy/yip
- Owner: Smintfy
- Created: 2024-07-24T10:03:04.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-11-07T11:37:23.000Z (3 months ago)
- Last Synced: 2024-11-26T09:18:04.930Z (3 months ago)
- Topics: interpreter, learning, programming-language, python, recreational, zig
- Language: Python
- Homepage:
- Size: 319 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# yip
yip is a toy interpreted functional programming language.**NOTE**: Currently in the process of being re-written in zig.
### Example
1. Square root approximation with binary search
```clj
; Find the square root of a number using binary search
(fn sqrt [x]
(do
(set tolerance 1e-15) ; up to 15 digit accuracy.
(set low 0)
(set high x)
(set guess (/ (+ low high) 2))
(while (> (abs (- (* guess guess) x)) tolerance)
(do
(if (< (* guess guess) x)
(swap low guess)
(swap high guess)) ; else
(swap guess (/ (+ low high) 2))))
(write "The square root of " x " is: " guess)))(sqrt [2]) ; print out 1.414213562373095
```