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

Data.List: Gradually deprecate old String representation of lambda #764

Merged
merged 11 commits into from
Dec 17, 2020

Conversation

ujihisa
Copy link
Member

@ujihisa ujihisa commented Dec 16, 2020

  • This is not a breaking change.
  • This pull request does not change all the existing Data.List tests/documents, but works fine and documentation still makes sense.
    • I'm planning to keep working on the rest gradually.
  • Next steps after this pull request:
    • Make sure all the tests and docs at Data.List follow the new rule
    • Output warning message when Vim plugins use the old way, but
      still keeps the behaviour (CHANGELOG needed)
    • Remove old behaviour after a long time (CHANGELOG needed)

Copy link
Contributor

@tsuyoshicho tsuyoshicho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good progress, LGTM.

(small changing need for description)

test/Data/List.vimspec Outdated Show resolved Hide resolved
Co-authored-by: Tsuyoshi CHO <Tsuyoshi.CHO@Gmail.com>
Copy link
Contributor

@tsuyoshicho tsuyoshicho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let xs = range(0, 9)
echo s:L.filter(xs, function('Even'))
" [0, 2, 4, 6, 8]
echo s:L.filter(xs, 'v:val % 2 is 0')
" [0, 2, 4, 6, 8]

uniq_by(
\ ['vim', 'Vim', 'VIM', 'emacs', 'Emacs', 'EMACS', 'gVim', 'GVIM'],
\ 'tolower(v:val)') == ['vim', 'emacs', 'gVim']

echo s:L.max_by(
\ ['pineapple', 'orange', 'banana', 'apple'],
\ 'len(v:val)')
" pineapple
echo s:L.max_by([20, -50, -15, 30], function('abs'))
" -50

echo s:L.min_by(
\ ['pineapple', 'orange', 'banana', 'apple'],
\ 'len(v:val)')
" apple
echo s:L.min_by([20, -50, -15, 30], function('abs'))
" -15

function! Under5(x) abort
return a:x < 5
endfunction
echo s:L.span('v:val < 5', [1, 3, 5, 2])
" [[1, 3], [5, 2]]
echo s:L.span(function('Under5'), [1, 3, 5, 2])
" [[1, 3], [5, 2]]
echo s:L.span('v:val==1', [1, 2])
" [[1], [2]]
echo s:L.span('v:val > 3', [1, 2, 3, 4, 5])
" [[], [1, 2, 3, 4, 5]]
echo s:L.span('v:val < 3', [1, 2, 3, 4, 5])
" [[1, 2], [3, 4, 5]]

filter(),uniq_by,min_by,max_by,span changed in test, but not fix document.
(suggest late sorry)

What is need change?

@ujihisa
Copy link
Member Author

ujihisa commented Dec 17, 2020

Yes, that's the plan at the next changes 👍

@ujihisa ujihisa merged commit 8e26969 into master Dec 17, 2020
@ujihisa ujihisa deleted the list-tweaks branch December 17, 2020 17:00
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.

None yet

2 participants