Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -24,12 +24,18 @@ BEGIN
# do the sort .... #
END # configurable sort # ;
# example calls #
[ 1 : 2, 1 : 3 ]STRING data := ( ( "a", "bb", "cde" ), ( "x", "abcdef", "Q" ) );
BEGIN # example calls #
[ 1 : 2, 1 : 3 ]STRING data := ( ( "a", "bb", "cde" ), ( "x", "abcdef", "Q" ) );
# sort data, default comparison, first column, reverse order #
configurable sort( data, ( TRUE ) );
# sort data, second column, ignore first chaacter when sorting, normal order #
configurable sort( data, ( 2, ( STRING a, STRING b )INT: default compare( a[ LWB a + 1 : ], b[ LWB b + 1 : ] ) ) );
# default sort #
configurable sort( data, () )
# sort data, default comparison, first column, reverse order #
configurable sort( data, ( TRUE ) );
# sort data, second column, ignore first chaacter when sorting, normal order #
configurable sort( data, ( 2
, ( STRING a, STRING b )INT: default compare( a[ LWB a + 1 : ]
, b[ LWB b + 1 : ]
)
)
);
# default sort #
configurable sort( data, () )
END

View file

@ -0,0 +1,20 @@
struct Params {
a int // default value is 0
b int
c int = 20
}
fn a_fn(p Params) int {
return p.a + p.b + p.c
}
fn main() {
w := a_fn(Params{a: 1, b: 2, c: 3}) // same order, with new value given to `c`
println("w = ${w}")
x := a_fn(Params{c: 3, b: 2, a: 1}) // different order
println("x = ${x}")
y := a_fn(Params{c: 2}) // only one field
println("y = ${y}")
z := a_fn(Params{}) // no fields, so given value of `c` and default values used
println("z = ${z}")
}