Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jesselpalmer/flip
FLIP - Functional Language for Intuitive Programming
https://github.com/jesselpalmer/flip
Last synced: 11 days ago
JSON representation
FLIP - Functional Language for Intuitive Programming
- Host: GitHub
- URL: https://github.com/jesselpalmer/flip
- Owner: jesselpalmer
- License: mit
- Created: 2023-10-22T01:46:19.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-28T14:30:45.000Z (about 1 year ago)
- Last Synced: 2024-10-06T10:41:39.948Z (about 1 month ago)
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FLIP
FLIP - Functional Language for Intuitive Programming
Example:
```flip
// Define a function to check if a number is odd
define isOdd(n) = n % 2 != 0;// Define a function to square a number
define square(n) = n * n;// Define a function to sum a list
define sumList(l) = reduce(l, 0, (acc, x) => acc + x);// Define the main function to process the list
define processList(numbers) {
let oddNumbers = filter(numbers, isOdd); // Filter the odd numbers
let squaredNumbers = map(oddNumbers, square); // Square the odd numbers
return sumList(squaredNumbers); // Sum the squared numbers
}// Sample input and execution
let inputNumbers = [1, 2, 3, 4, 5];
let result = processList(inputNumbers);
print(result); // Output: 1^2 + 3^2 + 5^2 = 1 + 9 + 25 = 35```