@@ -5,29 +5,42 @@ Namespace std.syntax
55'iDkP from GaragePixel
66'Since 2018-2025
77
8+ 'Note: In monkey library, the bad implemented min/max functions must be deactivated
9+ 'in order to make the multitypes min/max functions to works
10+
11+ Function Min<T>:T(a:T,b:T) Where T Implements INumeric
12+ 'the limit value, if returned, is casted to the initial type
13+ Return a<b ? a Else b
14+ End
15+
816Function Min<T1,T2>:T1(a:T1,b:T2) Where T1 Implements INumeric And
917 T2 Implements INumeric
1018 'the limit value, if returned, is casted to the initial type
1119 Return Cast<T1>(a<b ? a Else b)
1220End
1321
22+
1423Function Min<T>:T Ptr(a:T Ptr,b:T Ptr) Where T Implements INumeric
1524
1625 Return a[0]<b[0] ? a Else b
1726End
1827
19- ' Function Min<T>:T(a:T Ptr,b:T Ptr) Where T Implements INumeric
20- ' 'return type overload?
21- ' Return a[0]<b[0] ? a[0] Else b[0]
22- ' End
28+ Function Min<T>:T(a:T Ptr,b:T Ptr) Where T Implements INumeric
29+ 'return type overload?
30+ Return a[0]<b[0] ? a[0] Else b[0]
31+ End
2332
24- Function Min<T1,T2>:T1(a:T1 Ptr,b:T2 Ptr) Where T1 Implements INumeric And
33+ Function Min<T1,T2>:T1(a:T1 Ptr,b:T2 Ptr) Where T1 Implements INumeric And
2534 T2 Implements INumeric
2635 'the limit value, if returned, is casted to the initial type
2736 Return Cast<T1>(a[0]<b[0] ? a[0] Else b[0])
2837End
2938
3039Function Min<T>:T(a:T,b:T,c:T) Where T Implements INumeric
40+
41+ '3 arguments breaks the overloading of the language min/max stuff
42+ 'So the language library non-native stuff was undoned,
43+ 'and in the the word we'll have peace!
3144
3245 Return a<b ? (a<c ? a Else c) Else (b<c ? c Else b)
3346End
@@ -51,6 +64,10 @@ Function Min<T1,T2,T3>:T1(a:T1 Ptr,b:T2 Ptr,c:T3 Ptr) Where T1 Implements INu
5164 Return Cast<T1>(a[0]<b[0] ? (a[0]<c[0] ? a[0] Else c[0]) Else (b[0]<c[0] ? b[0] Else c[0]))
5265End
5366
67+ Function Max<T>:T(a:T,b:T) Where T Implements INumeric
68+ Return a<b ? b Else a
69+ End
70+
5471Function Max<T1,T2>:T1(a:T1,b:T2) Where T1 Implements INumeric And
5572 T2 Implements INumeric
5673 Return a<b ? b Else a
0 commit comments