-
Notifications
You must be signed in to change notification settings - Fork 1
/
greater-of.fs
57 lines (46 loc) · 1.25 KB
/
greater-of.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
\ galope/greater-of.fs
\ This file is part of Galope
\ http:https://programandala.net/en.program.galope.html
\ Author: Marcos Cruz (programandala.net), 2014, 2017.
\ ==============================================================
require ./nup.fs
: (greater-of) ( x1 x2 -- x1 x1 | x1 x1' )
nup nup <= if invert then ;
: greater-of \ Compilation: ( -- of-sys )
\ Run-time: ( x1 x2 -- | x1 )
postpone (greater-of) postpone of ; immediate compile-only
\ doc{
\
\ greater-of \ Compilation: ( -- of-sys )
\ \ Run-time: ( x1 x2 -- | x1 )
\
\ A variant of ``of`` that compares using ``>``.
\
\ Usage example:
\
\ ----
\ : test ( x -- )
\ case
\ 10 of ." ten!" endof
\ 15 greater-of ." greater than 15" endof
\ ." less than 10 or 11..15"
\ endcase ;
\ ----
\
\ See: `less-of`, `between-of`, `within-of`, `or-of`, `any-of`,
\ `default-of`.
\
\ }doc
\ ==============================================================
\ Change log
\ 2014-02-12: Written.
\
\ 2014-02-15: '>r dup dup r>' changed to 'nup nup'.
\
\ 2014-03-12: Usage example.
\
\ 2017-08-17: Update change log layout and source style.
\
\ 2017-10-24: Improve documentation.
\
\ 2017-11-14: Update documentation.