/* Unicode variable names (Rosetta code) in Picat. http://rosettacode.org/wiki/Unicode_variable_names """ Describe, and give a pointer to documentation on your languages use of characters beyond those of the ASCII character set in the naming of variables. Show how to: - Set a variable with a name including the 'Δ', (delta character), to 1 - Increment it - Print its value. """ From the Picat Guide: "A variable name is an identifier that begins with a capital letter or the underscore." Implicit: Character set of Picat is UTF-8. This Picat model was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ % import util. % import cp. main => go. go => % Delta (upper case) works Δ = 1, % println(Δ), Δ := Δ + 1, println(Δ), % Gamma (upper case) % This fails. % Γ = 1, Γ := 1, % (re)assignment works Γ := Γ + 1, println(Γ), % Using lower case delta give a syntax error % δ = 1, % println(δ), % δ := δ + 1, % println(δ), % All are available as chars. L = ['Δ','Γ','δ'], Ords = [ord(C) : C in L], println(ords=Ords), println(chars=[chr(O) : O in Ords]), nl.