comparison runtime/doc/eval.txt @ 20766:821925509d8c v8.2.0935

patch 8.2.0935: flattening a list with existing code is slow Commit: https://github.com/vim/vim/commit/077a1e670ad69ef4cefc22103ca6635bd269e764 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jun 8 20:50:43 2020 +0200 patch 8.2.0935: flattening a list with existing code is slow Problem: Flattening a list with existing code is slow. Solution: Add flatten(). (Mopp, closes https://github.com/vim/vim/issues/3676)
author Bram Moolenaar <Bram@vim.org>
date Mon, 08 Jun 2020 21:00:04 +0200
parents 661eb972cb22
children 90b96fa35e4b
comparison
equal deleted inserted replaced
20765:ca776ec54a6c 20766:821925509d8c
2449 {expr2} is 0 2449 {expr2} is 0
2450 finddir({name} [, {path} [, {count}]]) 2450 finddir({name} [, {path} [, {count}]])
2451 String find directory {name} in {path} 2451 String find directory {name} in {path}
2452 findfile({name} [, {path} [, {count}]]) 2452 findfile({name} [, {path} [, {count}]])
2453 String find file {name} in {path} 2453 String find file {name} in {path}
2454 flatten({list} [, {maxdepth}]) List flatten {list} up to {maxdepth} levels
2454 float2nr({expr}) Number convert Float {expr} to a Number 2455 float2nr({expr}) Number convert Float {expr} to a Number
2455 floor({expr}) Float round {expr} down 2456 floor({expr}) Float round {expr} down
2456 fmod({expr1}, {expr2}) Float remainder of {expr1} / {expr2} 2457 fmod({expr1}, {expr2}) Float remainder of {expr1} / {expr2}
2457 fnameescape({fname}) String escape special characters in {fname} 2458 fnameescape({fname}) String escape special characters in {fname}
2458 fnamemodify({fname}, {mods}) String modify file name 2459 fnamemodify({fname}, {mods}) String modify file name
4512 it finds the file "tags.vim". 4513 it finds the file "tags.vim".
4513 4514
4514 Can also be used as a |method|: > 4515 Can also be used as a |method|: >
4515 GetName()->findfile() 4516 GetName()->findfile()
4516 4517
4518 flatten({list} [, {maxdepth}]) *flatten()*
4519 Flatten {list} up to {maxdepth} levels. Without {maxdepth}
4520 the result is a |List| without nesting, as if {maxdepth} is
4521 a very large number.
4522 The {list} is changed in place, make a copy first if you do
4523 not want that.
4524 *E964*
4525 {maxdepth} means how deep in nested lists changes are made.
4526 {list} is not modified when {maxdepth} is 0.
4527 {maxdepth} must be positive number.
4528
4529 If there is an error the number zero is returned.
4530
4531 Example: >
4532 :echo flatten([1, [2, [3, 4]], 5])
4533 < [1, 2, 3, 4, 5] >
4534 :echo flatten([1, [2, [3, 4]], 5], 1)
4535 < [1, 2, [3, 4], 5]
4536
4517 float2nr({expr}) *float2nr()* 4537 float2nr({expr}) *float2nr()*
4518 Convert {expr} to a Number by omitting the part after the 4538 Convert {expr} to a Number by omitting the part after the
4519 decimal point. 4539 decimal point.
4520 {expr} must evaluate to a |Float| or a Number. 4540 {expr} must evaluate to a |Float| or a Number.
4521 When the value of {expr} is out of range for a |Number| the 4541 When the value of {expr} is out of range for a |Number| the