Changeset 4493

Show
Ignore:
Timestamp:
10/07/08 04:19:46 (7 weeks ago)
Author:
pmoura
Message:

Added predicates is_ascii/1, is_white_space/1, is_quote/1, is_period/1, is_punctation/1, and parenthesis/2 to the library entities "characterp" and "character".

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/library/character.lgt

    r4492 r4493  
    99        date is 2008/10/7, 
    1010        comment is 'Character predicates.']). 
     11 
     12    is_ascii(Char) :- 
     13        char_code(Char, Code), 
     14        Code >= 0, 
     15        Code =< 127. 
    1116 
    1217    is_alpha('_'). 
     
    6469    is_vowel('U'). 
    6570 
     71    is_white_space(' '). 
     72    is_white_space('\t'). 
     73 
    6674    is_layout(' '). 
    6775    is_layout('\t'). 
     76    is_layout('\f'). 
     77    is_layout('\r'). 
    6878    is_layout('\n'). 
     79    is_layout('\v'). 
    6980 
    7081    is_quote(''''). 
     
    7889    is_punctation('?'). 
    7990    is_punctation('!'). 
     91 
     92    is_period('.'). 
     93    is_period('?'). 
     94    is_period('!'). 
     95 
     96    parenthesis('(', ')'). 
     97    parenthesis('[', ']'). 
     98    parenthesis('{', '}'). 
    8099 
    81100    lower_upper(a, 'A'). 
  • trunk/library/characterp.lgt

    r4492 r4493  
    77        date is 2008/10/7, 
    88        comment is 'Character protocol.']). 
     9 
     10    :- public(is_ascii/1). 
     11    :- mode(is_ascii(+char), zero_or_one). 
     12    :- info(is_ascii/1, [ 
     13        comment is 'True if the argument is an ASCII character.', 
     14        argnames is ['Char']]). 
    915 
    1016    :- public(is_alphanumeric/1). 
     
    6874        argnames is ['Char']]). 
    6975 
     76    :- public(is_white_space/1). 
     77    :- mode(is_white_space(+char), zero_or_one). 
     78    :- info(is_white_space/1, [ 
     79        comment is 'True if the argument is a white space character (a space or a tab) inside a line of characters.', 
     80        argnames is ['Char']]). 
     81 
    7082    :- public(is_layout/1). 
    7183    :- mode(is_layout(+char), zero_or_one). 
     
    8395    :- mode(is_punctation(+char), zero_or_one). 
    8496    :- info(is_punctation/1, [ 
    85         comment is 'True if the argument is a punctation character.', 
     97        comment is 'True if the argument is a sentence punctation character.', 
    8698        argnames is ['Char']]). 
     99 
     100    :- public(is_period/1). 
     101    :- mode(is_period(+char), zero_or_one). 
     102    :- info(is_period/1, [ 
     103        comment is 'True if the argument is a character that ends a sentence.', 
     104        argnames is ['Char']]). 
     105 
     106    :- public(parenthesis/2). 
     107    :- mode(parenthesis(?char, ?char), zero_or_more). 
     108    :- mode(parenthesis(+char, ?char), zero_or_one). 
     109    :- mode(parenthesis(?char, +char), zero_or_one). 
     110    :- info(parenthesis/2, [ 
     111        comment is 'Recognises and converts between open and close parenthesis.', 
     112        argnames is ['Char1', 'Char2']]). 
    87113 
    88114    :- public(lower_upper/2). 
     
    91117    :- mode(lower_upper(?char, +char), zero_or_one). 
    92118    :- info(lower_upper/2, [ 
    93         comment is 'Converts between lower and upper case letters.', 
     119        comment is 'Recognises and converts between lower and upper case letters.', 
    94120        argnames is ['Char1', 'Char2']]). 
    95121 
  • trunk/RELEASE_NOTES.txt

    r4492 r4493  
    5656    Added predicates plus/3 and succ/2 to the library object "integer". 
    5757 
    58     Added predicates is_quote/1 and is_punctation/1 to the library entities  
    59     "characterp" and "character". 
     58    Added predicates is_ascii/1, is_white_space/1, is_quote/1, is_period/1, 
     59    is_punctation/1, and parenthesis/2 to the library entities "characterp" 
     60    and "character". 
    6061 
    6162    Modified the implementation of the predicate product/2 in the library