![]() |
VOOZH | about |
In Lisp data objects of type 'character' are referred to as characters. For representation purposes, we usually denote character objects by preceding a #\ symbol before the character. Any character can be represented by using the #\ symbol before the name of the character. For Example #\a represents a character 'a'.
Example 1:
Output:
Time Complexity: O(1)
Auxiliary Space: O(1)
Note: "terpri" is a command in Lisp that means "terminate printing" as it is used to terminate a line of output without which the output would be printed in one line.
There are some predefined special characters in Lisp which are:
In Lisp programming we don't use numeric comparison functions rather we make use of character comparing functions.
There are two sets of character comparing functions:
| S.No. | Case Sensitive Functions | Case-Insensitive Functions | Description |
|---|---|---|---|
| 1 | char= | char-equal | Checks if operands are equal or not |
| 2 | char/= | char-not-equal | Checks if operands are different or not |
| 3 | char<= | char-not-greaterp | Checks if the value of the left operand is greater than or equal to the value of the next right operand |
| 4 | char>= | char-not-lessp | Checks if the value of the left operand is less than or equal to the value of the next right operand |
| 5 | char< | char-lessp | Checks if the values of the operands are monotonically decreasing or not |
| 6 | char> | char-greaterp | Checks if the values of the operands are monotonically increasing or not |
Note: If in any of the above-mentioned cases the condition in description is satisfied, then it returns 'T' else returns 'NIL'.
Example 2:
Output:
Time Complexity: O(1)
Auxiliary Space: O(1)