Relations and actions (defined by one or more rules) have a sub-type relationship based on this data sub-type relationships and their modes of use, specified by their moded argument types. For functions the sub-type relation just depends on argument and value types as there is only one mode of use - all arguments ground and ground value returned. As an example of the role of modes, suppose the higher order argument type specifies the relation given as an argument will only be used to check integer values. We can pass in a relation that checks or generates number values. A more flexible check or generate relation that handles numbers can be used where only integer values will be tested.
QuLog is a fully integrated LP/FP language in that function calls can appear as or inside arguments to relation calls, and relational queries can be used as tests in function rules, and in set expression arguments of function calls.
The compiler does type checking of function, relation and action definitions, assisted by type inference for data terms and variables. We believe that type declarations, linked with mode of use declarations for relations and action procedures, are very useful active documentation of the program. Also, because we have union types and sub-types, type inference on code could be very complex in some cases. Type inference on data terms will assign the term the minimum type in the sub-type lattice.
This user guide assumes familiarity with Prolog and higher order functional programming, as in languages such as Haskell or Scala.
In Section 3 we briefly discuss syntax and in Section 4 we discuss type declarations. In Section 5 we discuss the relation rule part of QuLog , in Section 6 we discuss the function rule part and in Section 7 we discuss the action rule part of QuLog. Lastly, in Section 8 we give examples of using the QuLog interpreter.
All QuLog and TeleoR program files use the .qlg extension. The QuLog examples below are nearly all from the file examples/introduction/qlexamples.qlg