Elm Exactly

Figuredynamic-basis-elm

Figure 48, The Values of Basics Written in Elm, in Section D.3 Values Written in Elm.

abs n =
  if lt n 0 then -n else n

logBase base number =
  fdiv
    (Elm.Kernel.Basics.log number)
    (Elm.Kernel.Basics.log base)

radians angleInRadians =
  angleInRadians

degrees angleInDegrees =
  fdiv (mul angleInDegrees pi) 180

turns angleInTurns =
  mul (mul 2 pi) angleInTurns
fromPolar (radius, theta) =
  ( mul radius (cos theta)
  , mul radius (sin theta)
  )

toPolar ( x, y ) =
  ( sqrt (add (mul x x) (mul y y))
  , atan2 y x
  )

composeL g f x =
  g (f x)

composeR f g x =
  g (f x)

apR x f =
  f x

apL f x =
  f x

identity x =
  x

always a _ =
  a

never (JustOneMore nvr) =
  never nvr
Figure 48: The Values of Basics Written in Elm
Read it in its chapter·Permanent address: /standard/figures/dynamic-basis-elm

Referred to from

Tests (0)

No test of the suite checks this figure yet.

Discussions

Discuss this figure·Search the discussions on GitHub

Discussions are on GitHub; one about this figure has [fig:dynamic-basis-elm] in its title.

A Standard Definition of Elm? (Draft version 0.4) © Rupert Smith. The text is licensed under CC BY 4.0: share and adapt it freely, with credit and a link to the licence.