Function Name | Syntax | Input form | Output form |
---|---|---|---|
quote or ' (' is a short form of quote) |
(quote arg1) or 'arg1 | arg1 is any symbol | return the symbol arg1 without modification |
+ | (+ a1 a2 ... an) | 'n' numbers a1,a2 ... an | the sum of a1,a2, ... ,an => (a1 + a2 + .. +an) |
* | (* a1 a2 ... an) | 'n' numbers a1,a2 ... an | product of a1 a2 a3 ...an => (a1 * a2 * ... *an) |
- | (- a1 a2 ... an) | 'n' numbers a1,a2 ... an | subtract from a1,the sum of a2,a3,... an =>(a1 - (a2 + a3 + ... an)) |
/ | (/ a1 a2 ... an) | 'n' numbers a1,a2 ... an | Divide a1 by the product, of a2,a3 ... an =>(((a1/a2)/a3).../an) or =>(a1/(a2*a3*...an)) |
% | (% a1 a2) | 2 numbers a1,a2 | Return the remainder when a1 is divided by a2 =>(a1 % a2) |
Now onto some example programs that use the functions described above. Do evaluate them and see for yourself.
Code :
- (quote 5)
- (quote (+ 1 2))
- (+ 1 2)
- (+ 1 (+ 2 3))
- (- 100 (+ 20 5))
- (% (* 10 5) (+ 5))
- (* (-) (+))
- (quote (+ 1 2 (+ 3 4)))
When you evaluate the above programs in emacs you will get the following results :
- (quote 5) => 5
- (quote (+ 1 2)) => (+ 1 2)
- (+ 1 (+ 2 3)) => (+ 1 5) => 6
0 comments:
Post a Comment