interplane.Get Omega
Read in your language

omega-rosetta

aien-dev/omega-rosetta

Brought by drakestapleton

branch main Branches Tags History

omega-rosetta / exercises / allergies / allergies.om

16 lines · 795 bytes Raw Blame History
1note Exercism-style exercise "allergies": https://exercism.org/tracks/python/exercises/allergies
2note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3note The allergens in score order are eggs 1, peanuts 2, shellfish 4, strawberries 8, tomatoes 16,
4note chocolate 32, pollen 64, cats 128; a score is the sum of the allergens (higher bits are ignored).
5note allergicto is true when score includes item; list writes the allergens of score, in that order,
6note joined by commas, into o and returns the number of bytes written.
7note Check it with: sh exercise.sh exercises/allergies
8om2
9fn allergicto item view uchar * score ulong to bool
10note replace this line with your solution
11trap 13
12end
13fn list score ulong o edit uchar * to ulong
14note replace this line with your solution
15trap 13
16end