on master help sign in
Fix #769, stop using infix ops that are not filled in properly
commitaa00bf8bd6e5c97bbdcff812e89c788fcf8f906f authorEvan Czaplicki <info@elm-lang.org> dateThu 11 Sep 2014, 07:34 (12 years ago) parentf6c9fbc
2 files changed+10−2
libraries/Basics.elm+2−2 libraries/Native/Basics.js+8
libraries/Basics.elm+2−2
@@ -163,11 +163,11 @@ sqrt = Native.Basics.sqrt
163163
164164{-| Negate any number: `negate 42 == -42` -}
165165negate : number -> number
166−negate n = -n
166+negate = Native.Basics.negate
167167
168168{-| Take the absolute value of a number. -}
169169abs : number -> number
170−abs n = if n < 0 then -n else n
170+abs = Native.Basics.abs
171171
172172{-| Calculate the logarithm of a number with a given base: `logBase 10 100 == 2` -}
173173logBase : Float -> Float -> Float
libraries/Native/Basics.js+8
@@ -18,6 +18,12 @@ Elm.Native.Basics.make = function(elm) {
1818 function logBase(base, n) {
1919 return Math.log(n) / Math.log(base);
2020 }
21+ function negate(n) {
22+ return -n;
23+ }
24+ function abs(n) {
25+ return n < 0 ? -n : n;
26+ }
2127
2228 function min(a, b) {
2329 return Utils.cmp(a,b) < 0 ? a : b;
@@ -82,6 +88,8 @@ Elm.Native.Basics.make = function(elm) {
8288
8389 sqrt: Math.sqrt,
8490 logBase: F2(logBase),
91+ negate: negate,
92+ abs: abs,
8593 min: F2(min),
8694 max: F2(max),
8795 clamp: F3(clamp),