-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathClosure.txt
127 lines (89 loc) · 4.36 KB
/
Closure.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
*vital/Data/List/Closure.txt* The representation of Data.List for Data.Closure
Maintainer: aiya000 <aiya000.develop at gmail com>
==============================================================================
CONTENTS *Vital.Data.List.Closure-contents*
INTRODUCTION |Vital.Data.List.Closure-introduction|
TERM |Vital.Data.List.Closure.term|
INTERFACE |Vital.Data.List.Closure-interface|
Functions |Vital.Data.List.Closure-functions|
==============================================================================
INTRODUCTION *Vital.Data.List.Closure-introduction*
*Vital.Data.List.Closure* provides to pass
|Vital.Data.Closure-term-callable| to |Data.List| .
>
let s:V = vital#{plugin-name}#new()
let s:C = s:V.import('Data.Closure')
let s:LC = s:V.import('Data.List.Closure')
function! Plus(x, y) abort
return a:x + a:y
endfunction
let plus = s:C.from_funcref(function('Plus'))
echo s:LC.foldr(plus, 0, range(1, 10))
" 55
<
Notice:
This module doesn't have the job safety. I recommend to use |Data.List|
directly if you use Vim 8 or later. (This problem depends on unlifting of
{closure} to |Funcref|)
==============================================================================
TERM *Vital.Data.List.Closure-term*
{callable} *Vital.Data.List.Closure-term-callable*
|Vital.Data.Closure-term-callable|.
==============================================================================
INTERFACE *Vital.Data.List.Closure-interface*
------------------------------------------------------------------------------
FUNCTIONS *Vital.Data.List.Closure-functions*
map({list}, {callable}) *Vital.Data.List.Closure.map()*
Please see |Vital.Data.List.map()| .
uniq_by({list}, {callable}) *Vital.Data.List.Closure.uniq_by()*
Please see |Vital.Data.List.uniq_by()| .
sort({list}, {callable}) *Vital.Data.List.Closure.sort()*
Please see |Vital.Data.List.sort()| .
sort_by({list}, {callable}) *Vital.Data.List.Closure.sort_by()*
Please see |Vital.Data.List.sort_by()| .
max_by({list}, {callable}) *Vital.Data.List.Closure.max_by()*
Please see |Vital.Data.List.max_by()| .
min_by({list}, {callable}) *Vital.Data.List.Closure.min_by()*
Please see |Vital.Data.List.min_by()| .
span({callable}, {list}) *Vital.Data.List.Closure.span()*
Please see |Vital.Data.List.span()| .
break({callable}, {list}) *Vital.Data.List.Closure.break()*
Please see |Vital.Data.List.break()| .
take_while({callable}, {list}) *Vital.Data.List.Closure.take_while()*
Please see |Vital.Data.List.take_while()| .
drop_while({callable}, {list}) *Vital.Data.List.Closure.drop_while()*
Please see |Vital.Data.List.drop_while()| .
all({callable}, {list}) *Vital.Data.List.Closure.all()*
Please see |Vital.Data.List.all()| .
any({callable}, {list}) *Vital.Data.List.Closure.any()*
Please see |Vital.Data.List.any()| .
partition({callable}, {list}) *Vital.Data.List.Closure.partition()*
Please see |Vital.Data.List.partition()| .
map_accum({callable}, {list}, {init}) *Vital.Data.List.Closure.map_accum()*
Please see |Vital.Data.List.map_accum()| .
foldl({callable}, {init}, {list}) *Vital.Data.List.Closure.foldl()*
Please see |Vital.Data.List.foldl()| .
foldl1({callable}, {list}) *Vital.Data.List.Closure.foldl1()*
Please see |Vital.Data.List.foldl1()| .
foldr({callable}, {init}, {list}) *Vital.Data.List.Closure.foldr()*
Please see |Vital.Data.List.foldr()| .
foldr1({callable}, {list}) *Vital.Data.List.Closure.foldr1()*
Please see |Vital.Data.List.foldr1()| .
find({list}, {default}, {callable}) *Vital.Data.List.Closure.find()*
Please see |Vital.Data.List.find()| .
*Vital.Data.List.Closure.find_index()*
find_index({list}, {callable} [, {start} [, {default}]])
Please see |Vital.Data.List.find_index()| .
*Vital.Data.List.Closure.find_last_index()*
find_last_index({list}, {callable} [, {start} [, {default}]])
Please see |Vital.Data.List.find_last_index()| .
*Vital.Data.List.Closure.find_indices()*
find_indices({list}, {callable} [, {start}])
Please see |Vital.Data.List.find_indices()| .
group_by({list}, {callable}) *Vital.Data.List.Closure.group_by()*
Please see |Vital.Data.List.group_by()| .
*Vital.Data.List.Closure.binary_search()*
binary_search({list}, {callable}, [{func}, [{dict}]])
Please see |Vital.Data.List.binary_search()| .
==============================================================================
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl