//@ small-stack // string.repeat doubles its copies: linear in the result, and a large // count needs only about log2(count) frames (it once took one per copy). import std/io import std/list import std/string pub fn main :: -> () / { io.println (string.repeat "ab" 3) io.println ( "[" <> string.repeat "x" 0 <> string.repeat "x" (-2) <> string.repeat "" 5 <> "]" ) io.println (string.repeat "é" 5) let counts = list.range 0 17 let right = list.all counts fn n { string.byte_length (string.repeat "abc" n) == 3 * n } io.println (show right) let big = string.repeat "ab" 1000000 io.println (show (string.byte_length big)) io.println (string.slice big 1999990 2000000) } //> ababab //> [] //> ééééé //> True //> 2000000 //> ababababab