Skip to content

Core

Background

Given a file named "pen.json" with:

{
  "type": "library",
  "dependencies": {
    "Core": "pen:///core"
  }
}

Convert a number to a string

Given a file named "Foo.pen" with:

import Core'Number

f = \() string {
  Number'String(42)
}

When I run pen build

Then the exit status should be 0.

Sum numbers

Given a file named "Foo.pen" with:

import Core'Number

f = \() number {
  Number'Sum([number 1, 2, 3])
}

When I run pen build

Then the exit status should be 0.

Join strings

Given a file named "Foo.pen" with:

import Core'String

f = \() string {
  String'Join([string "hello", "world"], " ")
}

When I run pen build

Then the exit status should be 0.

Slice a string as bytes

Given a file named "Foo.pen" with:

import Core'String'Byte

f = \() string {
  Byte'Slice("foo", 1, 2)
}

When I run pen build

Then the exit status should be 0.