aiken-lang 1.1.19

Cardano smart contract language and toolchain
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
---
source: crates/aiken-lang/src/tests/format.rs
description: "Code:\n\npub fn drop(xs: List<a>, n: Int) -> List<a> {\n  if n <= 0 {\n    xs\n  } else {\n    when xs is {\n    [] ->\n      []\n    [x] -> [1, 2, 3]\n    [_x, ..rest] ->\n      drop(rest, n - 1)\n  }\n  }\n}\n"
---
pub fn drop(xs: List<a>, n: Int) -> List<a> {
  if n <= 0 {
    xs
  } else {
    when xs is {
      [] -> []
      [x] -> [1, 2, 3]
      [_x, ..rest] -> drop(rest, n - 1)
    }
  }
}