interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / si / rosetta / exercises / triangle / .meta / example.om

22 lines · 889 bytes Raw Blame History
1note Exercism-style exercise "triangle": https://exercism.org/tracks/python/exercises/triangle
2note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3note The sides a b c form a triangle when each is greater than 0 and the sum of any two is at least
4note the third. equilateral: a triangle with all three sides equal; isosceles: a triangle with at
5note least two sides equal; scalene: a triangle with all sides different.
6note Check it with: sh exercise.sh exercises/triangle
7om2
8fn istri a f64 b f64 c f64 to bool
9if or or le a 0.0 le b 0.0 le c 0.0
10ret false
11end
12ret and and ge add a b c ge add b c a ge add a c b
13end
14fn equilateral a f64 b f64 c f64 to bool
15ret and istri a b c and eq a b eq b c
16end
17fn isosceles a f64 b f64 c f64 to bool
18ret and istri a b c or or eq a b eq b c eq a c
19end
20fn scalene a f64 b f64 c f64 to bool
21ret and istri a b c and and ne a b ne b c ne a c
22end