Download Flora-2: User`s Manual
Transcript
25 PRIMITIVE DATA TYPES 111 Examples: • "abc"ˆˆ string • ’abc’ • ”a string\n"ˆˆ string • ’a string\n’ • ’a\tstring\b’ • ’string with a \’quoted\’ substring’ Caveat: The long form and the short form must really be the same, i.e., "abc"ˆˆ string and abc must denote the same constant. However, this has not been implemented yet. To extract the atom part from a long data type one should use the method rawValue. For instance, ?"abc"ˆˆ string[ rawValue->?X]@ basetype. 25.12 The Primitive Type list This is the usual Prolog list type. The members of this type have the form [elt1, ..., eltn]ˆˆ list (short form [elt1, ..., eltn]) and belong to class list. The following methods are available from the standard module basetype: Class methods: • list[=> isTypeOf( object)] • list[ toType( list) => list] Other methods: • list[*=> contains( list)] Tells if a list object contains the method’s argument as a sublist. • list[*=> member( object)] The method’s argument and the list-object may not be fully ground. In this case, the method succeeds, if the argument to the method unifies with a member of the list. • list[ append( list) *=> list] • list[ length *=> long] Computes the length of the list. • list[ reverse *=> list]