const std = @import("std"); const Allocator = std.mem.Allocator; // NOTE: right now, only numbers. pub const Value = f64; pub fn printValue(stdout: var, value: Value) !void { try stdout.print("{}", value); } pub const ValueList = struct { count: usize, values: []Value, allocator: *Allocator, pub fn init(allocator: *Allocator) !ValueList { return ValueList{ .count = 0, .allocator = allocator, .values = try allocator.alloc(Value, 0), }; } pub fn write(self: *ValueList, value: Value) !void { if (self.values.len < self.count + 1) { self.values = try self.allocator.realloc( self.values, self.count + 1, ); } self.values[self.count] = value; self.count += 1; } };