Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
Seasawher committed Mar 18, 2024
1 parent 6862b90 commit 331d99e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions Src/Problem14.lean
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ def dupli (l : List α) : List α :=

-- The following code is a test case and you should not change it.

example : dupli [1,2,3] = [1,1,2,2,3,3] := by rfl
example : dupli [1, 2, 3] = [1, 1, 2, 2, 3, 3] := by rfl

example : dupli ([] : List α) = [] := by rfl

example : dupli ['a','b','c','c','d'] = ['a','a','b','b','c','c','c','c','d','d'] := by rfl
example : dupli ['a', 'b', 'c', 'c', 'd']
= ['a', 'a', 'b', 'b', 'c', 'c', 'c', 'c', 'd', 'd'] := by rfl
14 changes: 7 additions & 7 deletions Src/Problem15.lean
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@

variable {α : Type}

def repli (l : List α)(n : Nat) : List α :=
def repli (l : List α) (n : Nat) : List α :=
-- sorry
match l with
| [] => []
| a :: b => (solorepl a n) ++ repli b n
where solorepl (x : α)(n : Nat) : List α :=
where solorepl (x : α) (n : Nat) : List α :=
match n with
| 0 => []
| Nat.succ m => x :: solorepl x m
| m + 1 => x :: solorepl x m
-- sorry

-- The following code is a test case and you should not change it.

example : repli [1,2,3] 3 = [1,1,1,2,2,2,3,3,3] := by rfl
example : repli [1, 2, 3] 3 = [1, 1, 1, 2, 2, 2, 3, 3, 3] := by rfl

example : repli [1,2,3] 2 = [1,1,2,2,3,3] := by rfl
example : repli [1, 2, 3] 2 = [1, 1, 2, 2, 3, 3] := by rfl

example : repli [1,2,3] 1 = [1,2,3] := by rfl
example : repli [1, 2, 3] 1 = [1, 2, 3] := by rfl

example : repli [1,2,3] 0 = [] := by rfl
example : repli [1, 2, 3] 0 = [] := by rfl

example : repli ([] : List α) 255 = [] := by rfl

0 comments on commit 331d99e

Please sign in to comment.