Changeset 39389 in project


Ignore:
Timestamp:
11/25/20 20:54:08 (7 weeks ago)
Author:
Kon Lovett
Message:

type is interface

Location:
release/5/fx-utils/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/5/fx-utils/trunk/fx-inlines.scm

    r38103 r39389  
    2626
    2727(: fxzero? (fixnum --> boolean))
    28 ;
     28(: fxpositive? (fixnum --> boolean))
     29(: fxnatural? (fixnum --> boolean))
     30(: fxnegative? (fixnum --> boolean))
     31(: fxnon-positive? (fixnum --> boolean))
     32(: fxclosed-right? (fixnum fixnum fixnum --> boolean))
     33(: fxclosed? (fixnum fixnum fixnum --> boolean))
     34(: fxclosed-left? (fixnum fixnum fixnum --> boolean))
     35(: fxabs (fixnum --> fixnum))
     36(: fxadd1 (fixnum --> fixnum))
     37(: fxsub1 (fixnum --> fixnum))
     38(: fxsqr (fixnum --> fixnum))
     39(: fxcub (fixnum --> fixnum))
     40
     41;;
     42
    2943(define (fxzero? n) (fx= 0 n))
    3044
    31 (: fxpositive? (fixnum --> boolean))
    32 ;
    3345(define (fxpositive? n) (fx< 0 n))
    3446
    35 (: fxnatural? (fixnum --> boolean))
    36 ;
    3747(define (fxnatural? n) (fx<= 0 n))
    3848
    39 (: fxnegative? (fixnum --> boolean))
    40 ;
    4149(define (fxnegative? n) (fx> 0 n))
    4250
    43 (: fxnon-positive? (fixnum --> boolean))
    44 ;
    4551(define (fxnon-positive? n) (fx>= 0 n))
    4652
    4753;;
    4854
    49 (: fxclosed-right? (fixnum fixnum fixnum --> boolean))
    50 ;
    5155(define (fxclosed-right? l x h) (and (fx< l x) (fx<= x h)))
    5256
    53 (: fxclosed? (fixnum fixnum fixnum --> boolean))
    54 ;
    5557(define (fxclosed? l x h) (and (fx<= l x) (fx<= x h)))
    5658
    57 (: fxclosed-left? (fixnum fixnum fixnum --> boolean))
    58 ;
    5959(define (fxclosed-left? l x h) (and (fx<= l x) (fx< x h)))
    6060
     
    6565;;
    6666
    67 (: fxabs (fixnum --> fixnum))
    68 ;
    6967(define (fxabs n) (if (fxnegative? n) (fxneg n) n))
    7068
    7169;;
    7270
    73 (: fxadd1 (fixnum --> fixnum))
    74 ;
    7571(define (fxadd1 n) (fx+ n 1))
    7672
    77 (: fxsub1 (fixnum --> fixnum))
    78 ;
    7973(define (fxsub1 n) (fx- n 1))
    8074
    81 (: fxsqr (fixnum --> fixnum))
    82 ;
    8375(define (fxsqr n) (fx* n n))
    8476
    85 (: fxcub (fixnum --> fixnum))
    86 ;
    8777(define (fxcub n) (fx* n (fx* n n)))
    8878
  • release/5/fx-utils/trunk/fx-utils.scm

    r39381 r39389  
    7171
    7272(: C_uword_log2 (number --> number))
    73 ;
     73(: *fxrandom (fixnum -> fixnum))
     74#;(: C_pow2log2 (number --> number))
     75(: fxrandom (#!optional fixnum fixnum -> fixnum))
     76(: fxlog2 (fixnum --> fixnum))
     77(: fxpow2log2 (fixnum --> fixnum))
     78(: fxdistance* (fixnum fixnum fixnum fixnum --> fixnum))
     79(: fxdistance (fixnum fixnum fixnum fixnum --> fixnum))
     80(: fxquo-and-mod (fixnum fixnum --> fixnum fixnum))
     81(: fxmax-and-min (fixnum #!rest fixnum --> fixnum fixnum))
     82(: fx% (fixnum fixnum --> fixnum))
     83
     84;;
     85
    7486(define C_uword_log2 (foreign-lambda long C_uword_log2 unsigned-long))
    7587
    7688;;
    7789
    78 (: *fxrandom (fixnum -> fixnum))
    79 ;
    8090(define-inline (*fxrandom x) (##core#inline "C_random_fixnum" x))
    8191
    8292#|
    83 (: C_pow2log2 (number --> number))
    84 ;
    8593(define C_pow2log2
    8694  (foreign-lambda* unsigned-long ((long n))
     
    92100;;
    93101
    94 (: fxrandom (#!optional fixnum fixnum -> fixnum))
    95 ;
    96102(define (fxrandom #!optional (lim most-positive-fixnum) (low 0))
    97103  (fx+ low (*fxrandom (fx- lim low))) )
     
    99105;;
    100106
    101 (: fxlog2 (fixnum --> fixnum))
    102 ;
    103107(define (fxlog2 n) (C_uword_log2 n))
    104108
    105 (: fxpow2log2 (fixnum --> fixnum))
    106 ;
    107109(define (fxpow2log2 n)
    108110  (cond
     
    113115;;
    114116
    115 (: fxdistance* (fixnum fixnum fixnum fixnum --> fixnum))
    116 ;
    117117(define (fxdistance* x1 y1 x2 y2) (fx+ (fxsqr (fx- x1 x2)) (fxsqr (fx- y1 y2))))
    118118
    119 (: fxdistance (fixnum fixnum fixnum fixnum --> fixnum))
    120 ;
    121119(define (fxdistance x1 y1 x2 y2) (fx/ (fxdistance* x1 y1 x2 y2) 2))
    122120
    123121;;
    124122
    125 (: fxquo-and-mod (fixnum fixnum --> fixnum fixnum))
    126 ;
    127123(define (fxquo-and-mod fxn fxd) (values (fx/ fxn fxd) (fxmod fxn fxd)))
    128124
    129125;;
    130126
    131 (: fxmax-and-min (fixnum #!rest fixnum --> fixnum fixnum))
    132 ;
    133127(define (fxmax-and-min fx . fxs)
    134128  (let loop ((fxs fxs) (mx fx) (mn fx))
     
    137131      (let ((cur (car fxs)))
    138132        (loop (cdr fxs) (fxmax mx cur) (fxmin mn cur)) ) ) ) )
     133;;
     134
     135(define (fx% n p) (fx/ (fx* p n) 100))
    139136
    140137#|
    141 ;;
    142 
    143 (: fx% (fixnum fixnum --> fixnum))
    144 ;
    145 (define (fx% n p) (fx/ (fx* p n) 100))
    146 
    147138;;
    148139
Note: See TracChangeset for help on using the changeset viewer.