Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
7ed51d6
Initial plan
Copilot Nov 3, 2025
79a9178
feat(luarrow.utils.list): Implement list module with comprehensive fu…
Copilot Nov 3, 2025
7229e3f
refactor(luarrow.utils.list): Improve sort_by robustness with pcall
Copilot Nov 3, 2025
097376c
docs(luarrow.utils.list): Document sort_by edge case with boolean key…
Copilot Nov 3, 2025
996f6e3
refactor(luarrow.utils.list)!: Curry all functions for direct arrow u…
Copilot Nov 3, 2025
97fd4e9
docs(luarrow.utils.list): Add list module to API reference, examples,…
Copilot Feb 21, 2026
3b2d8ab
Update luarrow.lua/src/luarrow/utils/list.lua
aiya000 Feb 21, 2026
c1edaa5
Update luarrow.lua/src/luarrow/utils/list.lua
aiya000 Feb 21, 2026
c216118
Update spec/luarrow/utils/list_spec.lua
aiya000 Feb 21, 2026
81a488f
Update luarrow.lua/src/luarrow/utils/list.lua
aiya000 Feb 21, 2026
228c246
Update README.md
aiya000 Feb 26, 2026
4d4eacc
refactor(luarrow.utils.list)!: Split sort_by/sort_with into separate …
Copilot Feb 26, 2026
6430465
chore: Remove stale luarrow.lua/src/ directory (legacy pre-restructur…
Copilot Feb 27, 2026
2103385
feat(luarrow.utils.list): Add unique_by, document unique reference-eq…
Copilot Feb 28, 2026
70af445
docs: Fix api.md sort_by/sort_with, add unique_by; fix examples.md he…
Copilot Feb 28, 2026
3716ffc
fix(luarrow.utils.list): Validate nil keys in unique_by and group_by …
Copilot Feb 28, 2026
af32b73
fix(luarrow.utils.list): Add nil-key check in sort_by; document nil-k…
Copilot Feb 28, 2026
6c6af79
fix: Use error level 2 in sort_by; fix README/api.md anchor and sort_…
Copilot Feb 28, 2026
e026b40
fix(docs): Fix broken performance-considerations anchor in README.md
Copilot Mar 1, 2026
5a740a1
fix(luarrow.utils.list): Use error level 2 in foldl1, foldr1, maximum…
Copilot Mar 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 21 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Write **dramatically** cleaner, more expressive Lua code:
- **Haskell-inspired syntax** - Write `f * g % x` instead of `f(g(x))`
- **Zero dependencies** - Pure Lua implementation with no external dependencies
- **Excellent performance** - In LuaJIT environments (like Neovim), pre-composed functions have **virtually no overhead** compared to pure Lua
- See [Performance Benchmarks](./doc/examples.md#-performance-considerations) for detailed results
- See [Performance Benchmarks](./doc/examples.md#performance-considerations) for detailed results

> [!NOTE]
> **About the name:**
Expand Down Expand Up @@ -216,6 +216,16 @@ For practical examples and use cases, see **[./doc/examples.md](./doc/examples.m
- `let(x, y) % arrow(f)` -- Start an arrow pipeline with multiple values
- `fun(f) % let(x, y)` -- Start a fun pipeline with multiple values

**Quick reference for `luarrow.utils.list`:**
- `list.map(f)` -- Apply `f` to each element
- `list.filter(pred)` -- Keep elements satisfying `pred`
- `list.foldl(f, init)` -- Left fold with initial value
- `list.find(pred)` -- First element satisfying `pred`
- `list.sort_by(key)` -- Sort by key function
- `list.sort_with(cmp)` -- Sort with comparator function
- `list.group_by(f)` -- Group elements by key function
- ...and [many more](./doc/api.md#luarrowutilslist-api-reference)

## 🔄 Comparison Haskell-Style with Real Haskell

| Haskell | luarrow | Pure Lua |
Expand Down Expand Up @@ -272,40 +282,18 @@ local _ = 5
^ arrow(print) -- 25
```

### List Processing (`fun`)
### List Processing (`luarrow.utils.list`)

```lua
local fun = require('luarrow').fun

local map = function(f)
return function(list)
local result = {}
for i, v in ipairs(list) do
result[i] = f(v)
end
return result
end
end

local filter = function(predicate)
return function(list)
local result = {}
for _, v in ipairs(list) do
if predicate(v) then
table.insert(result, v)
end
end
return result
end
end

local numbers = {1, 2, 3, 4, 5, 6}

local is_even = function(x) return x % 2 == 0 end
local double = function(x) return x * 2 end

local result = fun(map(double)) * fun(filter(is_even)) % numbers
print(result) -- { 4, 8, 12 }
local arrow = require('luarrow').arrow
local list = require('luarrow.utils.list')

-- Curried list functions compose directly with arrow!
local _ = { 1, 2, 3 }
% arrow(list.map(function(x) return x + 10 end)) -- { 11, 12, 13 }
^ arrow(list.filter(function(x) return x % 2 ~= 0 end)) -- { 11, 13 }
^ arrow(list.find(function(x) return x > 10 end)) -- 11
^ arrow(print)
```

### Multi-Value Composition (`arrow` and `fun`)
Expand Down
Loading
Loading