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

source-academy / py-slang / 23602772308

26 Mar 2026 03:27PM UTC coverage: 58.649% (+17.4%) from 41.233%
23602772308

Pull #81

github

web-flow
Merge 202b78ea9 into 553cb45dc
Pull Request #81: Python chapter 2 (+ 3?) support

792 of 1640 branches covered (48.29%)

Branch coverage included in aggregate %.

427 of 594 new or added lines in 33 files covered. (71.89%)

17 existing lines in 4 files now uncovered.

2395 of 3794 relevant lines covered (63.13%)

3055.64 hits per line

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

41.94
/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 pairmutatorPrelude from "./pairmutator.prelude";
1✔
6
import { Group, GroupName } from "./utils";
1✔
7

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

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

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

© 2026 Coveralls, Inc