on master help sign in
Add negate function
commitb4850a2ce137516d24a27c06708cc765f1d7b4cf authorEvan Czaplicki <info@elm-lang.org> dateWed 20 Aug 2014, 12:25 (12 years ago) parentadaa555
2 files changed+6−1
changelog.md+1 libraries/Basics.elm+5−1
changelog.md+1
@@ -8,6 +8,7 @@
88 * Add Debug.crash
99 * Add List.indexedMap and List.filterMap
1010 * Add Maybe.map
11+ * Add Basics.negate
1112 * Add --bundle-runtime flag which creates stand-alone Elm programs
1213 * Error on ambiguious use of imported variables
1314 * Replace dependency on Pandoc with cheapskate+kate
libraries/Basics.elm+5−1
@@ -22,7 +22,7 @@ are your tuples so big?
2222@docs not, (&&), (||), xor, otherwise
2323
2424# Mathematics
25−@docs (+), (-), (*), (/), (^), (//), rem, (%), abs, sqrt, clamp, logBase, e
25+@docs (+), (-), (*), (/), (^), (//), rem, (%), negate, abs, sqrt, clamp, logBase, e
2626
2727# Trigonometry
2828@docs pi, cos, sin, tan, acos, asin, atan, atan2
@@ -161,6 +161,10 @@ atan2 = Native.Basics.atan2
161161sqrt : Float -> Float
162162sqrt = Native.Basics.sqrt
163163
164+{-| Negate any number: `negate 42 == -42` -}
165+negate : number -> number
166+negate n = -n
167+
164168{-| Take the absolute value of a number. -}
165169abs : number -> number
166170abs = Native.Basics.abs