Demo!

> code examples_

> expression patterns_

// the pattern:

declare_pattern

≔ "√" %W- <number> ⇒ float

➞ square_root (number);


// the usage:

if (n ∈ N ∧ n ≥ 0)

print (√n);

// the patterns:

declare_pattern
do_times_loop ≔

"do" <instruction>
"(" <integer>:times ")" "times"

⇒ loop ➞

{

for (int i = 1; i ≤ times; i++)

execute (instruction);

};



// the usage:

do {

print ("hello π!");

} (10) times;

> instruction patterns_

// the pattern:

declare_pattern sql_insert_statement ≔

"INSERT" "INTO" sql_table_name

"(" sql_column_name

{"," sql_column_name}:column_names

")" "VALUES" "("

sql_value {"," sql_value):values

")" ";"

⇒ sql_instruction ➞

{

check (size_of(column_names) = size_of(values),

"Wrong number of values!");


send_sql_command (current_database(), this);

};



// the usage:

INSERT INTO people VALUES ("Alfred", "Wissel"),

("Julika", "Häuser");

> DSL patterns_

AltStyle によって変換されたページ (->オリジナル) /