• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

source-academy / py-slang / 23715943451

29 Mar 2026 06:25PM UTC coverage: 59.421% (+18.2%) from 41.233%
23715943451

Pull #81

github

web-flow
Merge b47bfeb8f into 7b1e59a17
Pull Request #81: Python chapter 2 (+ 3?) support

779 of 1553 branches covered (50.16%)

Branch coverage included in aggregate %.

442 of 651 new or added lines in 32 files covered. (67.9%)

17 existing lines in 4 files now uncovered.

2400 of 3797 relevant lines covered (63.21%)

3195.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

40.0
/src/stdlib/pairmutator.ts
1
import { Context } from "../cse-machine/context";
2
import { ControlItem } from "../cse-machine/control";
3
import { BuiltinValue, NoneValue, Value } from "../cse-machine/stash";
4
import { Validate } from "../stdlib";
1✔
5
import { Group, GroupName } from "./utils";
1✔
6

7
const pairmutatorBuiltins = new Map<string, BuiltinValue>();
1✔
8

9
class PairmutatorBuiltins {
10
  @Validate(2, 2, "set_head", true)
11
  static set_head(
1✔
12
    args: Value[],
13
    _source: string,
14
    _command: ControlItem,
15
    _context: Context,
16
  ): NoneValue {
NEW
17
    const head = args[0];
×
NEW
18
    const tail = args[1];
×
NEW
19
    if (head.type !== "list" || head.value.length !== 2) {
×
NEW
20
      throw new Error("set_head expects a pair as the first argument");
×
21
    }
NEW
22
    head.value[0] = tail;
×
NEW
23
    return { type: "none" };
×
24
  }
25

26
  @Validate(2, 2, "set_tail", true)
27
  static set_tail(
1✔
28
    args: Value[],
29
    _source: string,
30
    _command: ControlItem,
31
    _context: Context,
32
  ): NoneValue {
NEW
33
    const head = args[0];
×
NEW
34
    const tail = args[1];
×
NEW
35
    if (head.type !== "list" || head.value.length !== 2) {
×
NEW
36
      throw new Error("set_tail expects a pair as the first argument");
×
37
    }
NEW
38
    head.value[1] = tail;
×
NEW
39
    return { type: "none" };
×
40
  }
41
}
42
for (const builtin of Object.getOwnPropertyNames(PairmutatorBuiltins)) {
1✔
43
  if (
5✔
44
    typeof PairmutatorBuiltins[builtin as keyof typeof PairmutatorBuiltins] === "function" &&
7✔
45
    !builtin.startsWith("_")
46
  ) {
47
    pairmutatorBuiltins.set(builtin, {
2✔
48
      type: "builtin",
49
      func: PairmutatorBuiltins[
50
        builtin as keyof typeof PairmutatorBuiltins
51
      ] as BuiltinValue["func"],
52
      name: builtin,
53
    });
54
  }
55
}
56
export default {
1✔
57
  name: GroupName.PAIRMUTATORS,
58
  prelude: ``,
59
  builtins: pairmutatorBuiltins,
60
} as Group;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc