Do you want BuboFlash to help you learning these things? Click here to log in or create user.

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

; The integer 1. +1 ; Also the integer 1. -1 ; The integer -1. 9000000000000000000 ; The floating-point number 9e18. 0 ; The integer 0. -0 ; The integer 0. <span>The syntax for integers in bases other than 10 uses ‘ # ’ followed by a letter that specifies the radix: ‘ b ’ for binary, ‘ o ’ for octal, ‘ x ’ for hex, or ‘ radix r ’ to specify radix radix . Case is not significant for the letter that specifies the radix. Thus, ‘ #b integer ’ reads integer in binary, and ‘ # radix r integer ’ reads integer in radix radix . Allowed values of radix run from 2 to 36. For example: #b101100 ⇒ 44 #o54 ⇒ 44 #x2c ⇒ 44 #24r1k ⇒ 44 To understand how various functions work on integers, especially the bitwise operators (see Bitwise Operations), it is often helpful to view the numbers in their binary form. In 30-bi

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

kers.) Since the actual arguments to such functions may be either numbers or markers, we often give these arguments the name number-or-marker . When the argument value is a marker, its position value is used and its buffer is ignored. <span>Variable: most-positive-fixnum The value of this variable is the largest integer that Emacs Lisp can handle. Typical values are 2**29 - 1 on 32-bit and 2**61 - 1 on 64-bit platforms. Variable: most-negative-fixnum The value of this variable is the smallest integer that Emacs Lisp can handle. It is negative. Typical values are -2**29 on 32-bit and -2**61 on 64-bit

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

ition value is used and its buffer is ignored. Variable: most-positive-fixnum The value of this variable is the largest integer that Emacs Lisp can handle. Typical values are 2**29 - 1 on 32-bit and 2**61 - 1 on 64-bit platforms. <span>Variable: most-negative-fixnum The value of this variable is the smallest integer that Emacs Lisp can handle. It is negative. Typical values are -2**29 on 32-bit and -2**61 on 64-bit platforms. In Emacs Lisp, text characters are represented by integers. Any integer between zero and the value of (max-char) , inclusive, is considered to be valid as a character. See Character C

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

and 2**61 - 1 on 64-bit platforms. Variable: most-negative-fixnum The value of this variable is the smallest integer that Emacs Lisp can handle. It is negative. Typical values are -2**29 on 32-bit and -2**61 on 64-bit platforms. <span>In Emacs Lisp, text characters are represented by integers. Any integer between zero and the value of (max-char) , inclusive, is considered to be valid as a character. See Character Codes. Next: Float Basics, Up: Numbers [Contents][Index] <span><body><html>

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

sp. Here are read syntaxes for these special floating-point values: infinity ‘ 1.0e+INF ’ and ‘ -1.0e+INF ’ not-a-number ‘ 0.0e+NaN ’ and ‘ -0.0e+NaN ’ The following functions are specialized for handling floating-point numbers: <span>Function: isnan x This predicate returns t if its floating-point argument is a NaN, nil otherwise. Function: frexp x This function returns a cons cell ( s . e ) , where s and e are respectively the significand and exponent of the floating-point number x . If x is finite

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

the same as x . If x is a NaN, then s is also a NaN. If x is zero, then e is 0. Function: ldexp sig &optional exp This function returns a floating-point number corresponding to the significand sig and exponent exp . <span>Function: copysign x1 x2 This function copies the sign of x2 to the value of x1 , and returns the result. x1 and x2 must be floating point. Function: logb x This function returns the binary exponent of x . More precisely, the value is the logarithm base 2 of |x|, rounded down to an integer. (logb 10) ⇒ 3 (logb

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

s a floating-point number corresponding to the significand sig and exponent exp . Function: copysign x1 x2 This function copies the sign of x2 to the value of x1 , and returns the result. x1 and x2 must be floating point. <span>Function: logb x This function returns the binary exponent of x . More precisely, the value is the logarithm base 2 of |x|, rounded down to an integer. (logb 10) ⇒ 3 (logb 10.0e20) ⇒ 69 Next: Predicates on Numbers, Previous: Integer Basics, Up: Numbers [Contents][Index] <span><body><html>

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

loatp can take any type of Lisp object as argument (they would not be of much use otherwise), but the zerop predicate requires a number as its argument. See also integer-or-marker-p and number-or-marker-p , in Predicates on Markers. <span>Function: floatp object This predicate tests whether its argument is floating point and returns t if so, nil otherwise. Function: integerp object This predicate tests whether its argument is an integer, and returns t if so, nil otherwise. Function: numberp object This predicate tests whether i

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

a number as its argument. See also integer-or-marker-p and number-or-marker-p , in Predicates on Markers. Function: floatp object This predicate tests whether its argument is floating point and returns t if so, nil otherwise. <span>Function: integerp object This predicate tests whether its argument is an integer, and returns t if so, nil otherwise. Function: numberp object This predicate tests whether its argument is a number (either integer or floating point), and returns t if so, nil otherwise. Function: natnump objec

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

p object This predicate tests whether its argument is floating point and returns t if so, nil otherwise. Function: integerp object This predicate tests whether its argument is an integer, and returns t if so, nil otherwise. <span>Function: numberp object This predicate tests whether its argument is a number (either integer or floating point), and returns t if so, nil otherwise. Function: natnump object This predicate (whose name comes from the phrase “natural number”) tests to see whether its argument is a nonnegative integer, and returns t if so, nil o

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

s whether its argument is an integer, and returns t if so, nil otherwise. Function: numberp object This predicate tests whether its argument is a number (either integer or floating point), and returns t if so, nil otherwise. <span>Function: natnump object This predicate (whose name comes from the phrase “natural number”) tests to see whether its argument is a nonnegative integer, and returns t if so, nil otherwise. 0 is considered non-negative. wholenump is a synonym for natnump . Function: zerop number This predicate tests whether its argument is zero, and returns t if so, nil otherwise. The argument must be a number. (zerop x) is equivalent to (= x 0

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

is predicate (whose name comes from the phrase “natural number”) tests to see whether its argument is a nonnegative integer, and returns t if so, nil otherwise. 0 is considered non-negative. wholenump is a synonym for natnump . <span>Function: zerop number This predicate tests whether its argument is zero, and returns t if so, nil otherwise. The argument must be a number. (zerop x) is equivalent to (= x 0) . <span><body><html>

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

en you test whether two values are the same object. By contrast, = compares only the numeric values of the objects. In Emacs Lisp, each integer is a unique Lisp object. Therefore, eq is equivalent to = where integers are concerned. <span>It is sometimes convenient to use eq for comparing an unknown value with an integer, because eq does not report an error if the unknown value is not a number—it accepts arguments of any type. By contrast, = signals an error if the arguments are not numbers or markers. However, it is better programming practice to use = if you can, even for comparing integers. Sometimes it is useful to compare numbers with equal , which treats two numbers as equal if they have the same data type (both integers, or both floating point) and the same value.

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

unknown value is not a number—it accepts arguments of any type. By contrast, = signals an error if the arguments are not numbers or markers. However, it is better programming practice to use = if you can, even for comparing integers. <span>Sometimes it is useful to compare numbers with equal , which treats two numbers as equal if they have the same data type (both integers, or both floating point) and the same value. By contrast, = can treat an integer and a floating-point number as equal. See Equality Predicates. There is another wrinkle: because floating-point arithmetic is not exact, it is often a bad idea to check for equality of floating-point values. Usually it i

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

eference Manual: Numeric Conversions Next: Arithmetic Operations, Previous: Comparison of Numbers, Up: Numbers [Contents][Index] 3.5 Numeric Conversions To convert an integer to floating point, use the function float . <span>Function: float number This returns number converted to floating point. If number is already floating point, float returns it unchanged. There are four functions to convert floating-point numbers to integers; they differ in how they round. All accept an argument number and an optional argument divisor . Both argument

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

it unchanged if it already is an integer. If divisor is non- nil , they divide number by divisor and convert the result to an integer. If divisor is zero (whether integer or floating point), Emacs signals an arith-error error. <span>Function: truncate number &optional divisor This returns number , converted to an integer by rounding towards zero. (truncate 1.2) ⇒ 1 (truncate 1.7) ⇒ 1 (truncate -1.2) ⇒ -1 (truncate -1.7) ⇒ -1 Function: floor number &optional divisor This returns number , converted to an integer by rounding downward (towards negative infinity). If divisor is specified, this uses th

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

rror. Function: truncate number &optional divisor This returns number , converted to an integer by rounding towards zero. (truncate 1.2) ⇒ 1 (truncate 1.7) ⇒ 1 (truncate -1.2) ⇒ -1 (truncate -1.7) ⇒ -1 <span>Function: floor number &optional divisor This returns number , converted to an integer by rounding downward (towards negative infinity). If divisor is specified, this uses the kind of division operation that corresponds to mod , rounding downward. (floor 1.2) ⇒ 1 (floor 1.7) ⇒ 1 (floor -1.2) ⇒ -2 (floor -1.7) ⇒ -2 (floor 5.99 3) ⇒ 1 Function: ceiling number &optional divisor This returns number , converted to an integer by rounding upward (towards positive infinity). (ceiling 1.2) ⇒ 2 (ceiling 1.7)

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

). If divisor is specified, this uses the kind of division operation that corresponds to mod , rounding downward. (floor 1.2) ⇒ 1 (floor 1.7) ⇒ 1 (floor -1.2) ⇒ -2 (floor -1.7) ⇒ -2 (floor 5.99 3) ⇒ 1 <span>Function: ceiling number &optional divisor This returns number , converted to an integer by rounding upward (towards positive infinity). (ceiling 1.2) ⇒ 2 (ceiling 1.7) ⇒ 2 (ceiling -1.2) ⇒ -1 (ceiling -1.7) ⇒ -1 Function: round number &optional divisor This returns number , converted to an integer by rounding towards the nearest integer. Rounding a value equidistant between two integers

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

: ceiling number &optional divisor This returns number , converted to an integer by rounding upward (towards positive infinity). (ceiling 1.2) ⇒ 2 (ceiling 1.7) ⇒ 2 (ceiling -1.2) ⇒ -1 (ceiling -1.7) ⇒ -1 <span>Function: round number &optional divisor This returns number , converted to an integer by rounding towards the nearest integer. Rounding a value equidistant between two integers returns the even integer. (round 1.2) ⇒ 1 (round 1.7) ⇒ 2 (round -1.2) ⇒ -1 (round -1.7) ⇒ -2 Next: Arithmetic Operations, Previous: Comparison of Numbers, Up: Numbers [Contents][Index] <span><body><html>

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

gous to the C operator ++ —it does not increment a variable. It just computes a sum. Thus, if we continue, foo ⇒ 4 If you want to increment the variable, you must use setq , like this: (setq foo (1+ foo)) ⇒ 5 <span>Function: 1- number-or-marker This function returns number-or-marker minus 1. Function: + &rest numbers-or-markers This function adds its arguments together. When given no arguments, + returns 0. (+) ⇒ 0 (+ 1) ⇒ 1 (+ 1 2 3 4) ⇒ 10

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

GNU Emacs Lisp Reference Manual: Rounding Operations Next: Bitwise Operations, Previous: Arithmetic Operations, Up: Numbers [Contents][Index] 3.7 Rounding Operations The functions ffloor , fceiling , fround , and ftruncate take a floating-point argument and return a floating-point result whose value is a nearby integer. ffloor returns the nearest integer below; fceiling , the nearest integer above; ftruncate , the nearest integer in the direction towards zero; fround , the nearest integer. Function: ffloor float This function rounds float to the next lower integral value, and returns that value as a floating-point number. Function: fceiling float This function ro

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

on acts on the individual bits of such a sequence. For example, shifting moves the whole sequence left or right one or more places, reproducing the same pattern “moved over”. The bitwise operations in Emacs Lisp apply only to integers. <span>Function: lsh integer1 count lsh , which is an abbreviation for logical shift, shifts the bits in integer1 to the left count places, or to the right if count is negative, bringing zeros into the vacated bits. If count is negative, lsh shifts zeros into the leftmost (most-significant) bit, producing a positive result even if integer1 is negative. Contrast this with ash , below. Here are two examples of lsh , shifting a pattern of bits one place to the left. We show only the low-order eight bits of the binary pattern; the re

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

) ; left shift ⇒ -2 In binary, the argument looks like this: ;; Decimal 536,870,911 0111...111111 (30 bits total) which becomes the following when left shifted: ;; Decimal -2 1111...111110 (30 bits total) <span>Function: ash integer1 count ash (arithmetic shift) shifts the bits in integer1 to the left count places, or to the right if count is negative. ash gives the same results as lsh except when integer1 and count are both negative. In that case, ash puts ones in the empty bit positions on the left, while lsh puts zeros in those bit positions. Thus, with ash , shifting the pattern of bits one place to the right looks like this: (ash -6 -1) ⇒ -3 ;; Decimal -6 becomes decimal -3. 1111...111010 (30 bits total) ⇒ 1111..

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

; = 0000...000001 (ash 5 -2) ⇒ 1 (lsh -5 -2) ; -5 = 1111...111011 ⇒ 268435454 ; = 0011...111110 (ash -5 -2) ; -5 = 1111...111011 ⇒ -2 ; = 1111...111110 <span>Function: logand &rest ints-or-markers This function returns the “logical and” of the arguments: the n th bit is set in the result if, and only if, the n th bit is set in all the arguments. (“Set” means that the value of the bit is 1 rather than 0.) For example, using 4-bit binary numbers, the “logical and” of 13 and 12 is 12: 1101 combined with 1100 produces 1100. In bo

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

= 0000...001100 (logand 14 13 4) ; 14 = 0000...001110 ; 13 = 0000...001101 ; 4 = 0000...000100 ⇒ 4 ; 4 = 0000...000100 (logand) ⇒ -1 ; -1 = 1111...111111 <span>Function: logior &rest ints-or-markers This function returns the “inclusive or” of its arguments: the n th bit is set in the result if, and only if, the n th bit is set in at least one of the arguments. If there are no arguments, the result is zero, which is an identity element for this operation. If logior is passed just one argument, it returns that argument. ; 30-bit binary values (logior 12 5) ; 12 = 0000...001100 ; 5 = 0000...000101 ⇒ 13 ; 13 = 0000...001101 (logior 12 5 7) ; 12 = 0

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

; 5 = 0000...000101 ⇒ 13 ; 13 = 0000...001101 (logior 12 5 7) ; 12 = 0000...001100 ; 5 = 0000...000101 ; 7 = 0000...000111 ⇒ 15 ; 15 = 0000...001111 <span>Function: logxor &rest ints-or-markers This function returns the “exclusive or” of its arguments: the n th bit is set in the result if, and only if, the n th bit is set in an odd number of the arguments. If there are no arguments, the result is 0, which is an identity element for this operation. If logxor is passed just one argument, it returns that argument. ; 30-bit binary values (logxor 12 5) ; 12 = 0000...001100 ; 5 = 0000...000101 ⇒ 9 ; 9 = 0000...001001 (logxor 12 5 7) ; 12 = 0

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

; 5 = 0000...000101 ⇒ 9 ; 9 = 0000...001001 (logxor 12 5 7) ; 12 = 0000...001100 ; 5 = 0000...000101 ; 7 = 0000...000111 ⇒ 14 ; 14 = 0000...001110 <span>Function: lognot integer This function returns the logical complement of its argument: the n th bit is one in the result if, and only if, the n th bit is zero in integer , and vice-versa. (lognot 5) ⇒ -6 ;; 5 = 0000...000101 (30 bits total) ;; becomes ;; -6 = 1111...111010 (30 bits total) Next: Math Functions, Previous: Rounding Operations, Up: Numbers

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

value of (atan y ) is a number between -pi/2 and pi/2 (exclusive) whose tangent is y . If the optional second argument x is given, the value of (atan y x) is the angle in radians between the vector [ x , y ] and the X axis. <span>Function: exp arg This is the exponential function; it returns e to the power arg . Function: log arg &optional base This function returns the logarithm of arg , with base base . If you don’t specify base , the natural base e is used. If arg or base is ne

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

If the optional second argument x is given, the value of (atan y x) is the angle in radians between the vector [ x , y ] and the X axis. Function: exp arg This is the exponential function; it returns e to the power arg . <span>Function: log arg &optional base This function returns the logarithm of arg , with base base . If you don’t specify base , the natural base e is used. If arg or base is negative, log returns a NaN. Function: expt x y This function returns x raised to power y . If both arguments are integers and y is positive, the result is an integer; in this case, overflow causes tru

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

to the power arg . Function: log arg &optional base This function returns the logarithm of arg , with base base . If you don’t specify base , the natural base e is used. If arg or base is negative, log returns a NaN. <span>Function: expt x y This function returns x raised to power y . If both arguments are integers and y is positive, the result is an integer; in this case, overflow causes truncation, so watch out. If x is a finite negative number and y is a finite non-integer, expt returns a NaN. Function: sqrt arg This returns the square root of arg . If arg is finite and less than zero, sqrt returns a NaN. In addition, Emacs defines the following common mathematical

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

te non-integer, expt returns a NaN. Function: sqrt arg This returns the square root of arg . If arg is finite and less than zero, sqrt returns a NaN. In addition, Emacs defines the following common mathematical constants: <span>Variable: float-e The mathematical constant e (2.71828…). Variable: float-pi The mathematical constant pi (3.14159…). Next: Random Numbers, Previous: Bitwise Operations, Up: Numbers [Contents][Index] <span><body></html

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

This returns the square root of arg . If arg is finite and less than zero, sqrt returns a NaN. In addition, Emacs defines the following common mathematical constants: Variable: float-e The mathematical constant e (2.71828…). <span>Variable: float-pi The mathematical constant pi (3.14159…). Next: Random Numbers, Previous: Bitwise Operations, Up: Numbers [Contents][Index] <span><body><html>

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

the random function always generates the same sequence of numbers. By default, Emacs initializes the random seed at startup, in such a way that the sequence of values of random (with overwhelming likelihood) differs in each Emacs run. <span>Sometimes you want the random number sequence to be repeatable. For example, when debugging a program whose behavior depends on the random number sequence, it is helpful to get the same behavior in each program run. To make the sequence repeat, execute (random "") . This sets the seed to a constant value for your particular Emacs executable (though it may differ for other Emacs builds). You can use other strings to choose various seed values. Function: random &optional limit This function returns a pseudo-random integer. Repeated calls return a series of pseudo-random integers. If limit is a positive integer, the

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

make the sequence repeat, execute (random "") . This sets the seed to a constant value for your particular Emacs executable (though it may differ for other Emacs builds). You can use other strings to choose various seed values. <span>Function: random &optional limit This function returns a pseudo-random integer. Repeated calls return a series of pseudo-random integers. If limit is a positive integer, the value is chosen to be nonnegative and less than limit . Otherwise, the value might be any integer representable in Lisp, i.e., an integer between most-negative-fixnum and most-positive-fixnum (see Integer Basics). If limit is t , it means to choose a new seed as if Emacs were restarting. If limit is a string, it means to choose a new seed based on the string’s contents. Previous: Math Functions, Up: Numbers [Contents][Index] <span><body><html>

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

u can operate on them with the general array and sequence functions documented in Sequences Arrays Vectors. For example, you can access or change individual characters in a string using the functions aref and aset (see Array Functions). <span>However, note that length should not be used for computing the width of a string on display; use string-width (see Size of Displayed Text) instead. There are two text representations for non- ASCII characters in Emacs strings (and in buffers): unibyte and multibyte. For most Lisp programming, you don’t need to be concerned with the

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

al characters in a string using the functions aref and aset (see Array Functions). However, note that length should not be used for computing the width of a string on display; use string-width (see Size of Displayed Text) instead. <span>There are two text representations for non- ASCII characters in Emacs strings (and in buffers): unibyte and multibyte. For most Lisp programming, you don’t need to be concerned with these two representations. See Text Representations, for details. Sometimes key sequences are represented as unibyte st

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

ings with string-match (see Regexp Search). The functions match-string (see Simple Match Data) and replace-match (see Replacing Match) are useful for decomposing and modifying strings after matching regular expressions against them. <span>Like a buffer, a string can contain text properties for the characters in it, as well as the characters themselves. See Text Properties. All the Lisp primitives that copy text from strings to buffers or other strings also copy the properties of the characters being copied. See Text, for information about functions that display strings or copy them into buffers. See Character Type, and String Type, for information about the syntax of characters and strings

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

xt: Creating Strings, Previous: String Basics, Up: Strings and Characters [Contents][Index] 4.2 Predicates for Strings For more information about general sequence and array predicates, see Sequences Arrays Vectors, and Arrays. <span>Function: stringp object This function returns t if object is a string, nil otherwise. Function: string-or-null-p object This function returns t if object is a string or nil . It returns nil otherwise. Function: char-or-string-p object This function returns

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

4.2 Predicates for Strings For more information about general sequence and array predicates, see Sequences Arrays Vectors, and Arrays. Function: stringp object This function returns t if object is a string, nil otherwise. <span>Function: string-or-null-p object This function returns t if object is a string or nil . It returns nil otherwise. Function: char-or-string-p object This function returns t if object is a string or a character (i.e., an integer), nil otherwise. <span><body><html>

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

and Arrays. Function: stringp object This function returns t if object is a string, nil otherwise. Function: string-or-null-p object This function returns t if object is a string or nil . It returns nil otherwise. <span>Function: char-or-string-p object This function returns t if object is a string or a character (i.e., an integer), nil otherwise. <span><body><html>

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

Strings, Previous: Predicates for Strings, Up: Strings and Characters [Contents][Index] 4.3 Creating Strings The following functions create strings, either from scratch, or by putting strings together, or by taking them apart. <span>Function: make-string count character This function returns a string made up of count repetitions of character . If count is negative, an error is signaled. (make-string 5 ?x) ⇒ "xxxxx" (make-string 0 ?x) ⇒ "" Other functions to compare with this one include make-vector (see Vectors) and make-list (see B

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

negative, an error is signaled. (make-string 5 ?x) ⇒ "xxxxx" (make-string 0 ?x) ⇒ "" Other functions to compare with this one include make-vector (see Vectors) and make-list (see Building Lists). <span>Function: string &rest characters This returns a string containing the characters characters . (string ?a ?b ?c) ⇒ "abc" Function: substring string start &optional end This function returns a new string which consists of those characters from string in the range from (and including) the character a

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

h this one include make-vector (see Vectors) and make-list (see Building Lists). Function: string &rest characters This returns a string containing the characters characters . (string ?a ?b ?c) ⇒ "abc" <span>Function: substring string start &optional end This function returns a new string which consists of those characters from string in the range from (and including) the character at the index start up to (but excluding) the character at the index end . The first character is at index zero. (substring "abcdefg" 0 3) ⇒ "abc" In the above example, the index for ‘ a ’ is 0, the index for ‘ b ’ is 1, and the index for ‘ c ’ is 2. The index 3—which is the fourth character in the string—marks the character position up to which the substring is copied. Thus, ‘ abc ’ is copied from the string "abcdefg" . A negative number counts from the end of the string, so that -1 signifies the index of the last character of the string. For example: (substring "abcdefg" -3 -1) ⇒ "ef" In this example, the index for ‘ e ’ is -3, the index for ‘ f ’ is -2, and the index for ‘ g ’ is -1. Therefore, ‘ e ’ and ‘ f ’ are included, and ‘ g ’ is excluded. When nil is used for end , it stands for the length of the string. Thus, (substring "abcdefg" -3 nil) ⇒ "efg" Omitting the argument end is equivalent to specifying nil . It follows that (substring string 0) returns a copy of all of string . (substring "abcdefg" 0) ⇒ "abcdefg" But we recommend copy-sequence for this purpose (see Sequence Functions). If the characters copied from string have text properties, the properties are copied into the new string also. See Text Properties. substring also accepts a vector for the first argument. For example: (substring [a b (c) "d"] 1 3) ⇒ [b (c)] A wrong-type-argument error is signaled if start is not an integer or if end is neither an integer nor nil . An args-out-of-range error is signaled if start indicates a character following end , or if either integer is out of range for string . Contrast this function with buffer-substring (see Buffer Contents), which returns a string containing a portion of the text in the current buffer. The beginning of a string is at index 0, but the beginning of a buffer is at index 1. Function: substring-no-properties string &optional start end This works like substring but discards all text properties from the value. Also, start may be omitted or nil , wh

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

Contrast this function with buffer-substring (see Buffer Contents), which returns a string containing a portion of the text in the current buffer. The beginning of a string is at index 0, but the beginning of a buffer is at index 1. <span>Function: substring-no-properties string &optional start end This works like substring but discards all text properties from the value. Also, start may be omitted or nil , which is equivalent to 0. Thus, (substring-no-properties string ) returns a copy of string , with all text properties removed. Function: concat &rest sequences This function returns a new string consisting of the characters in the arguments passed to it (along with their text properties, if any). The a

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

like substring but discards all text properties from the value. Also, start may be omitted or nil , which is equivalent to 0. Thus, (substring-no-properties string ) returns a copy of string , with all text properties removed. <span>Function: concat &rest sequences This function returns a new string consisting of the characters in the arguments passed to it (along with their text properties, if any). The arguments may be strings, lists of numbers, or vectors of numbers; they are not themselves changed. If concat receives no arguments, it returns an empty string. (concat "abc" "-def") ⇒ "abc-def" (concat "abc" (list 120 121) [122]) ⇒ "abcxyz" ;; nil is an empty sequence. (concat "abc" nil "-def") ⇒ "abc-def" (concat "The " "quick brown " "fox.") ⇒ "The quick brown fox." (concat) ⇒ "" This function always constructs a new string that is not eq to any existing string, except when the result is the empty string (to save space, Emacs makes only one empty multibyte string). For information about other concatenation functions, see the description of mapconcat in Mapping Functions, vconcat in Vector Functions, and append in Building Lists. For concaten

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

scription of mapconcat in Mapping Functions, vconcat in Vector Functions, and append in Building Lists. For concatenating individual command-line arguments into a string to be used as a shell command, see combine-and-quote-strings. <span>Function: split-string string &optional separators omit-nulls trim This function splits string into substrings based on the regular expression separators (see Regular Expressions). Each match for separators defines a splitting point; the substrings between splitting points are made into a list, which is returned. If omit-nulls is nil (or omitted), the result contains null strings whenever there are two consecutive matches for separators , or a match is adjacent to the beginning or end of string . If omit-nulls is t , these null strings are omitted from the result. If separators is nil (or omitted), the default is the value of split-string-default-separators . As a special case, when separators is nil (or omitted), null strings are always omitted from the result. Thus: (split-string " two words ") ⇒ ("two" "words") The result is not ("" "two" "words" "") , which would rarely be useful. If you need such a result, use an explicit value for separators : (split-string " two words " split-string-default-separators) ⇒ ("" "two" "words" "") More examples: (split-string "Soup is good food" "o") ⇒ ("S" "up is g" "" "d f" "" "d") (split-string "Soup is good food" "o" t) ⇒ ("S" "up is g" "d f" "d") (split-string "Soup is good food" "o+") ⇒ ("S" "up is g" "d f" "d") Empty matches do count, except that split-string will not look for a final empty match when it already reached the end of the string using a non-empty match or when string is empty: (split-string "aooob" "o*") ⇒ ("" "a" "" "b" "") (split-string "ooaboo" "o*") ⇒ ("" "" "a" "b" "") (split-string "" "") ⇒ ("") However, when separators can match the empty string, omit-nulls is usually t , so that the subtleties in the three previous examples are rarely relevant: (split-string "Soup is good food" "o*" t) ⇒ ("S" "u" "p" " " "i" "s" " " "g" "d" " " "f" "d") (split-string "Nice doggy!" "" t) ⇒ ("N" "i" "c" "e" " " "d" "o" "g" "g" "y" "!") (split-string "" "" t) ⇒ nil Somewhat odd, but predictable, behavior can occur for certain “non-greedy” values of separators that can prefer empty matches over non-empty matches. Again, such values rarely occur in practice: (split-string "ooo" "o*" t) ⇒ nil (split-string "ooo" "\\|o+" t) ⇒ ("o" "o" "o") If the optional argument trim is non- nil , it should be a regular expression to match text to trim from the beginning and end of each substring. If trimming makes the substring empty, it is treated as null. If you need to split a string into a list of individual command-line arguments suitable for call-process or start-process , see split-string-and-unquote. Variable: split-string-d

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

each substring. If trimming makes the substring empty, it is treated as null. If you need to split a string into a list of individual command-line arguments suitable for call-process or start-process , see split-string-and-unquote. <span>Variable: split-string-default-separators The default value of separators for split-string . Its usual value is "[ \f\t\n\r\v]+" . Next: Modifying Strings, Previous: Predicates for Strings, Up: Strings and Characters [Contents][Index] <span><body><html>

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |