Opal (programming language)

OPAL (OPtimized Applicative Language) is a functional programming language first developed at the Technical University of Berlin.

Example program

This is an example OPAL program, which calculates the GCD recursively.

Signature file (declaration)
   SIGNATURE GCD
   FUN GCD: nat ** nat -> nat
Implementation file (definition)
   IMPLEMENTATION GCD
   IMPORT Nat COMPLETELY
   DEF GCD(a,b) == IF a % b = 0 THEN b
                       ELSE IF a-b < b THEN GCD(b,a-b)
                           ELSE GCD(a-b,b)
                       FI
                   FI
gollark: I think this is unreasonable myself.
gollark: Alternatively, most customers don't care so they can get away with it and it's slightly more profitable.
gollark: Especially with how expensive they are.
gollark: I do not think it's appropriate to be locked into maintenance from Tesla only.
gollark: Despite other cars possibly being unsafe if repaired wrong, they do not deliberately lock out repairs.


This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.