4import Native.Basics as Native
6-- Convert radians to standard Elm angles (radians).
7radians : Float -> Float
10-- Convert degrees to standard Elm angles (radians).
11degrees : Float -> Float
12degrees d = d * Native.pi / 180
14-- Convert turns to standard Elm angles (radians).
15-- One turn is equal to 360°.
17turns r = 2 * Native.pi * r
19-- Start with polar coordinates (r,θ)
20-- and get out cartesian coordinates (x,y).
21fromPolar : (Float,Float) -> (Float,Float)
22fromPolar (r,t) = (r * Native.cos t, r * Native.sin t)
24-- Start with cartesian coordinates (x,y)
25-- and get out polar coordinates (r,θ).
26toPolar : (Float,Float) -> (Float,Float)
27toPolar (x,y) = (Native.sqrt (x^2 + y^2), Native.atan2 y x)
29(+) : number -> number -> number
32(-) : number -> number -> number
35(*) : number -> number -> number
38-- Floating point division.
39(/) : Float -> Float -> Float
42-- Integer division, remainder is discarded.
43div : Int -> Int -> Int
46-- Finds the remainder after dividing one number by another: ``4 `rem` 3 == 1``
47rem : Int -> Int -> Int
50-- Perform modular arithmetic: ``7 `mod` 2 == 1``
51mod : Int -> Int -> Int
54-- Exponentiation: `3^2 == 9`
55(^) : number -> number -> number
73-- You probably do not want to use this. Because it takes `(y/x)` as the argument
74-- there is no way to know where the negative signs come from so the resulting
75-- angle is always between π/2 and -π/2 (in quadrants I and IV).
79-- This helps you find the angle of a cartesian coordinate.
80-- You will almost certainly want to use this instead of `atan`.
81-- So `atan2 y x` computes *atan(y/x)* but also keeps track of which
82-- quadrant the angle should really be in. The result will be between
83-- π and -π, giving you the full range of angles.
84atan2 : Float -> Float -> Float
87-- Take the square root of a number.
88sqrt : number -> number
91-- Take the absolute value of a number.
95-- Calculate the logarithm of a number with a given base: `logBase 10 100 == 2`
96logBase : number -> number -> number
97logBase = Native.logBase
99-- Given two comparables, returns the smaller one.
100min : comparable -> comparable -> comparable
103-- Given two comparables, returns the larger one.
104max : comparable -> comparable -> comparable
107-- Clamps a number within a given range. With the expression `clamp 100 200 x`
108-- the results are as follows:
111-- * ` x if 100 <= x < 200`
112-- * `200 if 200 <= x`
113clamp : number -> number -> number -> number
116-- An approximation of pi.
120-- An approximation of e.
124-- Compare any two values for structural equality. Functions cannot be compared.
131(<) : comparable -> comparable -> Bool
134(>) : comparable -> comparable -> Bool
137(<=) : comparable -> comparable -> Bool
140(>=) : comparable -> comparable -> Bool
143-- Compare any two comparable values. Comparable values include `String`, `Char`,
144-- `Int`, `Float`, `Time`, or a list or tuple containing comparable values.
145-- These are also the only values that work as `Dict` keys or `Set` members.
146compare : comparable -> comparable -> Order
147compare = Native.compare
149-- Represents the relative ordering of two things.
150-- The relations are less than, equal to, and greater than.
151data Order = LT | EQ | GT
153-- The and operator. True if both inputs are True.
154(&&) : Bool -> Bool -> Bool
157-- The or operator. True if one or both inputs are True.
158(||) : Bool -> Bool -> Bool
161-- The exclusive-or operator. True if exactly one input is True.
162xor : Bool -> Bool -> Bool
165-- Negate a boolean value: `(not True == False)` and `(not False == True)`
169-- Equal to true. Useful as the last case of a multi-way-if.
176-- Round a number to the nearest integer.
180-- Truncate a decimal number, rounding towards zero.
181truncate : Float -> Int
182truncate = Native.truncate
184-- Floor function, rounding down.
188-- Ceiling function, rounding up.
189ceiling : Float -> Int
190ceiling = Native.ceiling
192-- Convert an integer into a float.
193toFloat : Int -> Float
194toFloat = Native.toFloat
196-- Convert almost any value to its string representation.
200-- Read an integer from a string
201readInt : String -> Maybe Int
202readInt = Native.readInt
204-- Read a float from a string.
205readFloat : String -> Maybe Float
206readFloat = Native.readFloat
210-- Function composition: `(f . g == (\\x -> f (g x)))`
211(.) : (b -> c) -> (a -> b) -> (a -> c)
214-- Forward function application `x |> f == f x`. This function is useful
215-- for avoiding parenthesis and writing code in a more natural way.
216-- Consider the following code to create a pentagon:
218-- scale 2 (move (10,10) (filled blue (ngon 5 30)))
220-- This can also be written as:
222-- ngon 5 30 |> filled blue
225(|>) : a -> (a -> b) -> b
228-- Function application `f <| x == f x`. This function is useful for avoiding
229-- parenthesis. Consider the following code to create a text element:
231-- text (monospace (toText "code"))
233-- This can also be written as:
235-- text . monospace <| toText "code"
236(<|) : (a -> b) -> a -> b
239-- Given a value, returns exactly the same value.
243-- Given a 2-tuple, returns the first value.
247-- Given a 2-tuple, returns the second value.
251-- Flips the order of the first two arguments to a function.
252flip : (a -> b -> c) -> (b -> a -> c)
255-- Change how arguments are passed to a function. This splits paired arguments
256-- into two separate arguments.
257curry : ((a,b) -> c) -> a -> b -> c
260-- Change how arguments are passed to a function. This combines two arguments
262uncurry : (a -> b -> c) -> (a,b) -> c
263uncurry = Native.uncurry
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list