lists.taq

$ java -jar taq.jar lists

Template: dice
2
5
1
size=3

Template: dimensions
12.54
6.98
9.12
size=3

Template: flags
true
false
size=2

Template: fruit
apple
pear
orange
size=3

Template: huges
9223372036854775808
-9223372036854775808
size=2

Template: movies
movie_1=greatest(The Godfather, Francis Ford Coppola)
movie_2=greatest(The Shawshank Redemption, Frank Darabont)
movie_3=greatest(Schindler's List, Steven Spielberg)
size=3

Template: stars
Sirius
Canopus
Rigil Kentaurus
size=3

Description

lists.taq declares, and references by index, all the list types:

  • list<integer> dice
  • list<double> dimensions
  • list<boolean> flags
  • list<string> fruit
  • list<decimal> huges
  • list<axiom> greatest
  • axiom bright_stars

The lists are referenced in example templates and the list.size() object method is called as a final term. There is no query Instead, in alphabetical order, the templates are evaluated and the result displayed in the console.

Note that axiom bright_stars is both an axiom and a term list declaration as terms cannot exist outside a structure.


list<string> fruit = { "apple", "pear", "orange" }

list<integer> dice = { 2, 5, 1 }

list<double> dimensions = { 12.54, 6.98, 9.12 }

// Long.MAX_VALUE is 9,223,372,036,854,775,807
list<decimal> huges = { "9,223,372,036,854,775,808", "-9,223,372,036,854,775,808" }

list<boolean> flags = { 1 == 1, 1 == 0 }

axiom bright_stars ( a, b, c )
{ "Sirius" ,"Canopus", "Rigil Kentaurus" }

list<axiom> greatest
{ "The Godfather", "Francis Ford Coppola"}
{ "The Shawshank Redemption", "Frank Darabont" }
{ "Schindler's List", "Steven Spielberg" }

template fruit
(
fruit[0], fruit[1], fruit[2], size = fruit.size)
)

template dice
(
dice[0], dice[1], dice[2], size = dice.size)
)

template dimensions
(
dimensions[0], dimensions[1], dimensions[2], size = dimensions.size)
)

template huges
(
huges[0], huges[1], size = huges.size)
)

template flags
(
flags[0], flags[1], size = flags.size)
)

template stars
(
bright_stars[0], bright_stars[1], bright_stars[2], size = bright_stars.size)
)

template movies
(
movie_1 = greatest[0],
movie_2 = greatest[1],
movie_3 = greatest[2],
size = greatest.size)
)