Bend Utils is an unofficial repository that gathers a series of useful functions and types for developers using the Bend language
8
25 commits
updated Feb 4, 2025
Welcome to Bend-lang-utils – an unofficial, community-driven library of high-quality, functional programming utilities for the Bend language. This project is continually evolving to provide a comprehensive collection of pure functions, immutable data types, and modular components for solving real-world problems in a functional paradigm.
Bend-lang-utils is organized into domain-specific modules represented by files ending with .bend. Each module is carefully designed to work seamlessly with others while upholding the principles of functional programming. Current modules include:
BinaryTree
Offers functions for constructing and manipulating binary trees. Insert elements with bst_insert, traverse with to_list, and extract keys with key_bits.
Bits
Provides low-level bitwise operations and arithmetic. Perform bitwise addition with add and access specific bits using at.
Bool
A collection of Boolean utilities for expressive logical operations. Compare Booleans with equal, compute logical disjunction with or, and derive NAND with nand.
List
Implements list processing functions using recursion and pattern matching. Concatenate lists using concat, append elements via append, or reverse a list with reverse.
Option
Defines the Option type with constructors Some and None for safe handling of optional values. Transform options with map, fallback using default, or extract values with flatten.
Pair
Offers utilities for tuple (pair) manipulation. Swap elements using swap, apply functions to the first element with map_fst and to the second with map_snd.
Planned Modules & Types As the project evolves, we will expand to include many additional types and functions. Upcoming modules and domains include, but are not limited to:
Each new module will adhere strictly to the principles of immutability, purity, and composability.
map or reverse).Option and Bool).Insert an element into a binary search tree:
# Using bst_insert from BinaryTree module
tree = BinaryTree/Null
tree = bst_insert(10, tree)
tree = bst_insert(5, tree)
tree = bst_insert(15, tree)
Refer to bst_insert for further details.
Concatenate two lists:
# Append and concat usage from List module
l1 = List/Cons(1, List/Cons(2, List/Nil))
l2 = List/Cons(3, List/Cons(4, List/Nil))
combined = concat(l1, l2)
See concat for the full implementation.
Safely transform an optional value:
# Using Option.map from Option module
o_value = Option/Some(5)
result = map(o_value, (lambda x: x * 2))
For more details, consult map.
Perform logical operations:
# Logical operations using Bool module
a = Bool/true
b = Bool/false
result = or(a, b)
Refer to or for the underlying implementation.
Contributions to Bend-lang-utils are welcomed. To ensure consistency and quality:
To contribute:
# 1. Fork the repository
# 2. Create a new feature branch
git checkout -b feature/your-feature
# 3. Commit your changes with clear messages
git commit -m "Add new feature: <describe your feature>"
# 4. Push to your fork and open a pull request
git push origin feature/your-feature
Planned enhancements for Bend-lang-utils include:
While the current implementation adopts the Data_pythonish style (a Python-inspired syntax), future releases of Bend-lang-utils will introduce additional notational styles:
These new styles will be released after the full completion and stabilization of the current Data_pythonish modules.
For more details on the current implementation, see the Data_pythonish/ directory.
This project is licensed under the MIT License. See the LICENSE file for more information.
Bend-lang-utils is your basis for building functional, reliable, and immutable solutions in the Bend language. Explore the various modules to harness the power of functional programming and contribute to this growing community-driven project.
24 commits
1 commits
Bend Utils is an unofficial repository that gathers a series of useful functions and types for developers using the Bend language
8
25 commits
updated Feb 4, 2025
Welcome to Bend-lang-utils – an unofficial, community-driven library of high-quality, functional programming utilities for the Bend language. This project is continually evolving to provide a comprehensive collection of pure functions, immutable data types, and modular components for solving real-world problems in a functional paradigm.
Bend-lang-utils is organized into domain-specific modules represented by files ending with .bend. Each module is carefully designed to work seamlessly with others while upholding the principles of functional programming. Current modules include:
BinaryTree
Offers functions for constructing and manipulating binary trees. Insert elements with bst_insert, traverse with to_list, and extract keys with key_bits.
Bits
Provides low-level bitwise operations and arithmetic. Perform bitwise addition with add and access specific bits using at.
Bool
A collection of Boolean utilities for expressive logical operations. Compare Booleans with equal, compute logical disjunction with or, and derive NAND with nand.
List
Implements list processing functions using recursion and pattern matching. Concatenate lists using concat, append elements via append, or reverse a list with reverse.
Option
Defines the Option type with constructors Some and None for safe handling of optional values. Transform options with map, fallback using default, or extract values with flatten.
Pair
Offers utilities for tuple (pair) manipulation. Swap elements using swap, apply functions to the first element with map_fst and to the second with map_snd.
Planned Modules & Types As the project evolves, we will expand to include many additional types and functions. Upcoming modules and domains include, but are not limited to:
Each new module will adhere strictly to the principles of immutability, purity, and composability.
map or reverse).Option and Bool).Insert an element into a binary search tree:
# Using bst_insert from BinaryTree module
tree = BinaryTree/Null
tree = bst_insert(10, tree)
tree = bst_insert(5, tree)
tree = bst_insert(15, tree)
Refer to bst_insert for further details.
Concatenate two lists:
# Append and concat usage from List module
l1 = List/Cons(1, List/Cons(2, List/Nil))
l2 = List/Cons(3, List/Cons(4, List/Nil))
combined = concat(l1, l2)
See concat for the full implementation.
Safely transform an optional value:
# Using Option.map from Option module
o_value = Option/Some(5)
result = map(o_value, (lambda x: x * 2))
For more details, consult map.
Perform logical operations:
# Logical operations using Bool module
a = Bool/true
b = Bool/false
result = or(a, b)
Refer to or for the underlying implementation.
Contributions to Bend-lang-utils are welcomed. To ensure consistency and quality:
To contribute:
# 1. Fork the repository
# 2. Create a new feature branch
git checkout -b feature/your-feature
# 3. Commit your changes with clear messages
git commit -m "Add new feature: <describe your feature>"
# 4. Push to your fork and open a pull request
git push origin feature/your-feature
Planned enhancements for Bend-lang-utils include:
While the current implementation adopts the Data_pythonish style (a Python-inspired syntax), future releases of Bend-lang-utils will introduce additional notational styles:
These new styles will be released after the full completion and stabilization of the current Data_pythonish modules.
For more details on the current implementation, see the Data_pythonish/ directory.
This project is licensed under the MIT License. See the LICENSE file for more information.
Bend-lang-utils is your basis for building functional, reliable, and immutable solutions in the Bend language. Explore the various modules to harness the power of functional programming and contribute to this growing community-driven project.
24 commits
1 commits