samples/iyi/grid.iyi
The first program with a table in it - rows of cells, built from their.
# The first program with a table in it - rows of cells, built from their # coordinates, read across, down and along the diagonal. # # ./bin/iyi run samples/iyi/grid.iyi # # An array built by a block, a range asked for a value per position, and # the small set a list of numbers gets asked for: reversed, unique, paired # with another, one taken out. Like `basics`, `inventory` and `config`, this # documents no rule; it is here because the prelude grows only when a # program in this repository needs something (SPEC.md 0.1.0 item 3). module samples/grid n = 4 grid = Array(Array(Int32)).new(n) { |r| Array(Int32).new(n) { |c| r * n + c } } grid.each { |row| puts row.map { |v| v.to_s.rjust(3) }.join } # => 0 1 2 3 # => 4 5 6 7 # => 8 9 10 11 # => 12 13 14 15 puts grid.map(&.sum).sum # => 120 puts (0...n).map { |i| grid[i][i] } # => [0, 5, 10, 15] puts (0...n).map { |c| grid.map { |row| row[c] } }.first # => [0, 4, 8, 12] # 2. A list of numbers, asked the usual things. puts (1..5).to_a.reversed # => [5, 4, 3, 2, 1] puts (1..10).select { |i| i.even? } # => [2, 4, 6, 8, 10] puts (1..10).sum # => 55 puts [3, 1, 3, 2, 1].uniq # => [3, 1, 2] puts [1, 2, 3].zip(["a", "b", "c"]) # => [{1, "a"}, {2, "b"}, {3, "c"}] letters = ["b", "a", "c"] puts letters.index("c").inspect # => 2 puts letters.delete("a") # => a puts letters # => ["b", "c"] # 3. A line built piece by piece, then ended. 5.times { |i| print i } puts # => 01234
Press Run.
The pane no longer holds samples/iyi/grid.iyi. Run executes iyi-grid.wasm, the module the compiler built from the recorded file, so your edit is not in this run: there is no iyi compiler in this page. How this works
recorded with iyi 0.18.0 (built on Crystal 1.22.0-dev [2a9653052] (2026-10-18)) · Linux 7.0.0-38-generic x86_64, QEMU Virtual CPU version 2.5+ · 2026-10-19
You can type in the pane: nothing here compiles, so what you type cannot run, and the page says which bytes it is running the moment the text stops being the recorded file. There is no standard input, no filesystem and no threads on this target, and one sample fails on purpose for exactly that reason.
Run executes iyi-grid.wasm, the module the compiler built from this file, in your browser. How this works
Try it on your machine
Copy the program into grid.iyi, change something, and run it. Only a compiler on your own machine can run what you wrote.
$ iyi run grid.iyi