Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow reduce and reduceRight to work on falsy values #15

Closed

Conversation

davidnurkkala
Copy link

@davidnurkkala davidnurkkala commented Aug 24, 2023

Had a problem where I was trying to detect state change by using an array of results returned by setter functions. Essentially,

if Sift.Array.reduce(results :: {boolean}, function(accumulator, changed)
  return accumulator or changed
end, false) then
  -- something changed
end

Found out that it assumed the initial value to not be a truthy value. Changed it to compare directly to nil instead.

@cxmeel
Copy link
Owner

cxmeel commented Aug 29, 2023

Merged into main

@cxmeel cxmeel closed this Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants