First steps with Scarp v0.0.7

This lesson targets the interpreter and experimental native backend in published v0.0.7-alpha.3.

Join fixed arrays

array_concat(left, right) returns a new fixed-size array whose length is the sum of the operand lengths. Element types must match. The input arrays remain unchanged.

Scarp
bind left = [array: 2, 4];
bind right = [array: 6, 8];
bind joined = array_concat(left, right);
print(array_len(joined));
print(joined[0], joined[3]);
print(array_len(left));
text
4
2 8
2

Integer reductions

integer_gcd, its alias integer_hcf, and integer_lcm accept from two to 1024 integer arguments. A one-argument or zero-argument call is not supported. A zero operand gives an LCM of zero.

Scarp
print(integer_gcd(-18, 24, 30));
print(integer_hcf(18, 24, 30));
print(integer_lcm(3, 4, 5));
print(integer_lcm(3, 0, 5));
text
6
6
60
0

Lifetime and native backend

The interpreter can reuse a bounded set of frame buffers after ordinary calls. Returned immutable values remain valid across subsequent calls. This is not a process RAM cap or general cycle collector.

The experimental x86-64 ELF64 Rust API supports up to 16 required integer arguments, scalar conditional expressions, counted repeats and nested loop control. Its ABI is provisional. scarp exec still interprets source. Alpha.2 adds an experimental scarp native-object command and nonrecursive same-file direct calls. A separate alpha.5 native-exe command now emits bounded Linux scalar executables; general executable linking and external calls remain unsupported. Read the native-object tutorial.

Source evidence

Immutable upstream evidence: array example, integer example, and native contract.

For alpha.3 additions and their limits, see generics and strings and native aggregate locals.

Alpha.5 tensor and native executable lesson.

Search documentation

Tips: use "exact phrase", -exclude, title:term, body:term, or section:guide. Search stays on this device.