interplane.Get Omega
Read in your language

omega-rosetta

aien-dev/omega-rosetta

Brought by drakestapleton

branch main Branches Tags History

omega-rosetta / exercises / pascals-triangle / .meta / example.om

20 lines · 642 bytes Raw Blame History
1note Exercism-style exercise "pascals-triangle": https://exercism.org/tracks/python/exercises/pascals-triangle
2note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3note rows writes the first count rows of Pascal's triangle into o, row after row (1, 1 1, 1 2 1, ...),
4note and returns how many numbers it wrote.
5note Check it with: sh exercise.sh exercises/pascals-triangle
6om2
7fn rows count ulong o edit ulong * to ulong
8for r ulong count
9s = div mul r add r 1 2
10for c ulong add r 1
11v = ulong 1
12if and gt c 0 lt c r
13b = sub sub add s c r 1
14v = add get o b get o add b 1
15end
16put o add s c v
17end
18end
19ret div mul count add count 1 2
20end