Repository navigation
Text, regex, dictionary and list macros, and %cond - #16
Open
Demonstrandum wants to merge 1 commit into
Open
Demonstrandum wants to merge 1 commit into
Demonstrandum wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 084a429. Configure here.
| let items = list_of(value, node, "The list")?; | ||
| let range = range(items.len()); | ||
| let sliced = items.into_iter().skip(range.start).take(range.len()).collect(); | ||
| return Ok(Box::new([list_node(node, without_leading(sliced))])); |
There was a problem hiding this comment.
Slice realises entire lazy lists
Medium Severity
%slice on a list collects every item through list_of before taking the range, so slicing a lazy %range or %concat realises the whole source. %index-of does the same before searching. %take, %drop, %get, and %find already avoid that via List::slice and items().
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 084a429. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Fills the gaps in working with text and data.
Text (each keeps the kind of text it's given, so a symbol stays a symbol):
%upper,%lower,%capitalize,%trim(%slugify "Hello, World!")→"hello-world"(%replace "a" "o" "banana")→"bonono"%starts-with,%ends-with(%slice start [end] x)for text or lists, with negative indices counting from the endRegular expressions (the
regexcrate; a\is\\in a seam string):%regex/matches,%regex/find(every match),%regex/captures(first match and its groups, or nothing),%regex/replace(with$1references),%regex/splitDictionaries
(%set :title X :draft false %page): keys already present keep their place(%remove draft %page)(%merge %defaults %page): later values winLists
(%chunk 10 %posts)for pagination and grid rows%sum,%index-of(nothing if absent),(%partition f list)→((yes...) (no...))Control
(%cond (test body...) ...): only the first true clause's test and body are expandedAdds the
regexdependency. Tests, USAGE.md and the README checklist are updated.Note
Low Risk
New macro surface area and a
regexdependency; behavior is covered by tests and does not change auth, I/O, or existing expansion paths.Overview
Adds a large set of built-in data and text macros to the seam expander, implemented in a new
expander/data.rsmodule and wired throughexpander.rs.Text and regex: Case/transform helpers (
%upper,%lower,%capitalize,%trim,%slugify),%replace, prefix/suffix checks, and%slicefor atoms or lists. Regex support uses the newregexcrate via%regex/matches,find,captures,replace, andsplit.Dictionaries and lists:
%set,%remove, and%mergefor keyword dicts;%chunk,%sum,%index-of, and%partitionfor lists.%condexpands only the first true clause’s body (short-circuiting evaluation).Shared expander helpers in
code.rsare exposed to the new module. Tests, USAGE.md, and the README checklist document the macros.Reviewed by Cursor Bugbot for commit 084a429. Bugbot is set up for automated code reviews on this repo. Configure here.