forked from leanprover/human-eval-lean
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHumanEval28.lean
More file actions
48 lines (34 loc) · 788 Bytes
/
HumanEval28.lean
File metadata and controls
48 lines (34 loc) · 788 Bytes
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
module
def concatenate (strings : List String) : String :=
String.join strings
theorem toList_concatenate {strings : List String} :
(concatenate strings).toList = strings.flatMap String.toList := by
simp [concatenate]
/-!
## Prompt
```python3
from typing import List
def concatenate(strings: List[str]) -> str:
""" Concatenate list of strings into a single string
>>> concatenate([])
''
>>> concatenate(['a', 'b', 'c'])
'abc'
"""
```
## Canonical solution
```python3
return ''.join(strings)
```
## Tests
```python3
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([]) == ''
assert candidate(['x', 'y', 'z']) == 'xyz'
assert candidate(['x', 'y', 'z', 'w', 'k']) == 'xyzwk'
```
-/