https://github.com/darky/gluple
Tuple methods for Gleam
https://github.com/darky/gluple
gleam tuple
Last synced: 12 months ago
JSON representation
Tuple methods for Gleam
- Host: GitHub
- URL: https://github.com/darky/gluple
- Owner: darky
- Created: 2024-05-09T17:57:17.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-19T16:25:30.000Z (over 1 year ago)
- Last Synced: 2025-02-23T20:47:19.214Z (12 months ago)
- Topics: gleam, tuple
- Language: Gleam
- Homepage:
- Size: 29.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gluple
[](https://hex.pm/packages/gluple)
[](https://hexdocs.pm/gluple/)


Tuple methods for Gleam
```sh
gleam add gluple
```
```gleam
import gluple/reflect as gr
import gluple/addition as ga
import gluple/transform as gt
import gluple/removal as grm
pub fn main() {
gr.is_tuple(#(1, 2, 3)) // True
gr.tuple_size(#(1, True, "test")) // Ok(3)
gr.tuple_element(#("test"), 0) // Ok(dynamic.from("test"))
gr.tuple_to_list(#(1, 2, 3)) // Ok([dynamic.from(1), dynamic.from(2), dynamic.from(3)])
gr.list_to_tuple([1, 2, 3]) // dynamic.from(#(1, 2, 3))
ga.append2(#(1, True), "test") // #(1, True, "test")
{
use _n, _b, <- ga.with_append2(#(1, True))
"test"
} // #(1, True, "test")
gt.replace_last2(#(1, True), "test") // #(1, "test")
{
use _n, _b, <- ga.with_replace2(#(1, True))
"test"
} // #(1, "test")
#(1, True) |> grm.remove_first2 // #(True)
}
```
Further documentation can be found at .
## Development
```sh
gleam run # Run the project
gleam test # Run the tests
gleam shell # Run an Erlang shell
```