husk-scheme-3.19.3: R5RS Scheme interpreter, compiler, and library.

CopyrightJustin Ethier
LicenseMIT (see LICENSE in the distribution)
Maintainergithub.com/justinethier
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell98

Language.Scheme.Numerical

Contents

Description

This module implements the numerical tower.

Synopsis

Generic functions

numSub :: [LispVal] -> ThrowsError LispVal Source #

Subtract the given numbers

numMul :: [LispVal] -> ThrowsError LispVal Source #

Multiply the given numbers

numDiv :: [LispVal] -> ThrowsError LispVal Source #

Divide the given numbers

numAdd :: [LispVal] -> ThrowsError LispVal Source #

Add the given numbers

numMod :: [LispVal] -> ThrowsError LispVal Source #

Take the modulus of the given numbers

numRationalize :: [LispVal] -> ThrowsError LispVal Source #

Convert the given number to a rational

numBoolBinopGt :: [LispVal] -> ThrowsError LispVal Source #

Numeric greater than

numBoolBinopGte :: [LispVal] -> ThrowsError LispVal Source #

Numeric greater than equal

numBoolBinopLt :: [LispVal] -> ThrowsError LispVal Source #

Numeric less than

numBoolBinopLte :: [LispVal] -> ThrowsError LispVal Source #

Numeric less than equal

numCast :: [LispVal] -> ThrowsError LispVal Source #

Accept two numbers and cast one of them to the appropriate type, if necessary

numDenominator :: [LispVal] -> ThrowsError LispVal Source #

Take the denominator of the given number

numNumerator :: [LispVal] -> ThrowsError LispVal Source #

Take the numerator of the given number

numInexact2Exact :: [LispVal] -> ThrowsError LispVal Source #

Convert an inexact number to exact

numExact2Inexact :: [LispVal] -> ThrowsError LispVal Source #

Convert an exact number to inexact

num2String :: [LispVal] -> ThrowsError LispVal Source #

Convert a number to a string; radix is optional, defaults to base 10

unpackNum :: LispVal -> ThrowsError Integer Source #

Extract an integer from the given value, throwing a type error if the wrong type is passed.

numericBinop :: (Integer -> Integer -> Integer) -> [LispVal] -> ThrowsError LispVal Source #

A helper function to perform a numeric operation on two values

Floating point functions

numFloor :: [LispVal] -> ThrowsError LispVal Source #

Floor the given number

numCeiling :: [LispVal] -> ThrowsError LispVal Source #

Take the ceiling of the given number

numTruncate :: [LispVal] -> ThrowsError LispVal Source #

Truncate the given number

numRound :: [LispVal] -> ThrowsError LispVal Source #

Round the given number

numExpt :: [LispVal] -> ThrowsError LispVal Source #

Raise the first number to the power of the second

numSqrt :: [LispVal] -> ThrowsError LispVal Source #

Take the square root of the given number

numExp :: [LispVal] -> ThrowsError LispVal Source #

Take the exponent of the given number

numLog :: [LispVal] -> ThrowsError LispVal Source #

Compute the log of a given number

Trigonometric functions

Complex functions

buildComplex Source #

Arguments

:: LispVal

Real part

-> LispVal

Imaginary part

-> ThrowsError LispVal

Complex number

Create a complex number

numMakePolar :: [LispVal] -> ThrowsError LispVal Source #

Create a complex number from its magnitude and phase (angle)

numRealPart :: [LispVal] -> ThrowsError LispVal Source #

Retrieve real part of a complex number

numImagPart :: [LispVal] -> ThrowsError LispVal Source #

Retrieve imaginary part of a complex number

numMagnitude :: [LispVal] -> ThrowsError LispVal Source #

The nonnegative magnitude of a complex number

numAngle :: [LispVal] -> ThrowsError LispVal Source #

The phase of a complex number

numMakeRectangular :: [LispVal] -> ThrowsError LispVal Source #

Create a complex number given its real and imaginary parts

Predicates

isComplex :: [LispVal] -> ThrowsError LispVal Source #

Predicate to determine if given number is complex. Keep in mind this does not just look at the types

isReal :: [LispVal] -> ThrowsError LispVal Source #

Predicate to determine if given number is a real. Keep in mind this does not just look at the types

isRational :: [LispVal] -> ThrowsError LispVal Source #

Predicate to determine if given number is a rational. Keep in mind this does not just look at the types

isInteger :: [LispVal] -> ThrowsError LispVal Source #

Predicate to determine if given number is an integer. Keep in mind this does not just look at the types; a floating point input value can return true, for example.

isNumber :: [LispVal] -> ThrowsError LispVal Source #

Predicate to determine if given value is a number

isFloatAnInteger :: LispVal -> Bool Source #

A utility function to determine if given value is a floating point number representing an whole number (integer).

isNumNaN :: [LispVal] -> ThrowsError LispVal Source #

Determine if the given value is not a number

isNumInfinite :: [LispVal] -> ThrowsError LispVal Source #

Determine if number is infinite

isNumFinite :: [LispVal] -> ThrowsError LispVal Source #

Determine if number is not infinite

isNumExact :: [LispVal] -> ThrowsError LispVal Source #

Determine if number is exact

isNumInexact :: [LispVal] -> ThrowsError LispVal Source #

Determine if number is inexact