source: project/release/3/misc-extn/trunk/misc-extn-numeric.scm

Last change on this file was 5437, checked in by Kon Lovett, 14 years ago

Release 3.0, where misc-extn.scm is rmvd & macros split into sep files.

File size: 662 bytes
Line 
1;;;; misc-extn-numeric.scm
2;;;; Kon Lovett, Jul '07
3
4;;; Arithmetic
5
6;; Immutable
7
8(define-macro (inc x) `(+ 1 ,x))
9
10(define-macro (dec x) `(- ,x 1))
11
12(define-macro (++ V) `(add1 ,V))
13
14(define-macro (-- V) `(sub1 ,V))
15
16(define-macro (fx++ V) `(fx+ ,V 1))
17
18(define-macro (fx-- V) `(fx- ,V 1))
19
20(define-macro (fp++ V) `(fp+ ,V 1.0))
21
22(define-macro (fp-- V) `(fp- ,V 1.0))
23
24;; Mutable
25
26(define-macro (++! V) `(set!/op ,V add1))
27
28(define-macro (--! V) `(set!/op ,V sub1))
29
30(define-macro (fx++! V) `(set!/op ,V fx+ 1))
31
32(define-macro (fx--! V) `(set!/op ,V fx- <> 1))
33
34(define-macro (fp++! V) `(set!/op ,V fp+ 1.0))
35
36(define-macro (fp--! V) `(set!/op ,V fp- <> 1.0))
Note: See TracBrowser for help on using the repository browser.