Skip to content

[Repo Assist] feat: add ofList, ofArray, tryFind, find, choose, collect, partition, sort, sortWith, sortBy, rev to DList#260

Draft
github-actions[bot] wants to merge 2 commits intomasterfrom
repo-assist/improve-dlist-module-funcs-64a64fb904bc5372
Draft

[Repo Assist] feat: add ofList, ofArray, tryFind, find, choose, collect, partition, sort, sortWith, sortBy, rev to DList#260
github-actions[bot] wants to merge 2 commits intomasterfrom
repo-assist/improve-dlist-module-funcs-64a64fb904bc5372

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Expands the DList module with 11 standard collection functions that were previously absent, bringing DList closer to parity with the core List module.

Functions Added

Function Notes
ofList Build a DList from a plain 'T list
ofArray Build a DList from a 'T array
tryFind Return 'T option for first matching element
find Return 'T or raise KeyNotFoundException
choose Filter-and-map; returns a new DList<'U>
collect Monadic bind / flat-map
partition Split into two DLists by predicate
sort O(n log n) sort via Array round-trip, requires comparison
sortWith O(n log n) sort with custom comparer
sortBy O(n log n) sort by projection
rev O(n) reversal using fold

All implementations are consistent with their List/Array counterparts and verified by property-based tests.

Tests

11 property-based tests added to DListTest.fs, each verifying that the new DList function produces the same result as the equivalent List operation.

Test Status

✅ All 907 tests pass (0 failures, 2 skipped) via dotnet test. Fantomas formatting check passes.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@96b9d4c39aa22359c0b38265927eadb31dcf4e2a

… sort, sortWith, sortBy, rev to DList

Expand the DList module with 11 standard collection functions:

- ofList / ofArray: build a DList from an existing list or array
- tryFind / find: search for elements matching a predicate
- choose: filter-and-map, returning a new DList of Some values
- collect: monadic bind / flat-map over DList
- partition: split into two DLists based on a predicate
- sort / sortWith / sortBy: O(n log n) sorting via Array round-trip
- rev: O(n) reversal via fold

Add 11 property-based tests covering all new functions,
verifying consistency with the equivalent List operations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants