Skip to content

Commit

Permalink
Merge pull request #160 from DawnMagnet/main
Browse files Browse the repository at this point in the history
修改zh-docs中的错误
  • Loading branch information
lijunchen authored Feb 27, 2024
2 parents bbc9784 + e8ae5cd commit ccf5fd5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions zh-docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -522,14 +522,14 @@ enum List[T] {
Cons(T, List[T])
}

fn map[S, T](self: List[S], f: (S) => T) -> List[T] {
fn map[S, T](self: List[S], f: (S) -> T) -> List[T] {
match self {
Nil => Nil
Cons(x, xs) => Cons(f(x), map(xs, f))
}
}

fn reduce[S, T](self: List[S], op: (T, S) => T, init: T) -> T {
fn reduce[S, T](self: List[S], op: (T, S) -> T, init: T) -> T {
match self {
Nil => init
Cons(x, xs) => reduce(xs, op, op(init, x))
Expand Down

0 comments on commit ccf5fd5

Please sign in to comment.