Documentation ¶
Index ¶
- Constants
- Variables
- func AbsBigInt(c zc.Calc)
- func AbsComplex(c zc.Calc)
- func AbsDecimal(c zc.Calc)
- func AbsFloat(c zc.Calc)
- func AbsRational(c zc.Calc)
- func AcosComplex(c zc.Calc)
- func AcosFloat(c zc.Calc)
- func AcoshComplex(c zc.Calc)
- func AcoshFloat(c zc.Calc)
- func AddBigFloat(c zc.Calc)
- func AddBigInt(c zc.Calc)
- func AddComplex(c zc.Calc)
- func AddDateTimeDuration(c zc.Calc)
- func AddDecimal(c zc.Calc)
- func AddDuration(c zc.Calc)
- func AddDurationDateTime(c zc.Calc)
- func AddFloat(c zc.Calc)
- func AddRational(c zc.Calc)
- func AndBigInt(c zc.Calc)
- func AndBool(c zc.Calc)
- func Anno(c zc.Calc)
- func Apply(c zc.Calc)
- func AsinComplex(c zc.Calc)
- func AsinFloat(c zc.Calc)
- func AsinhComplex(c zc.Calc)
- func AsinhFloat(c zc.Calc)
- func Atan2Float(c zc.Calc)
- func AtanComplex(c zc.Calc)
- func AtanFloat(c zc.Calc)
- func AtanhComplex(c zc.Calc)
- func AtanhFloat(c zc.Calc)
- func Average(c zc.Calc)
- func Bin(c zc.Calc)
- func Bit(c zc.Calc)
- func Bits(c zc.Calc)
- func Bytes(c zc.Calc)
- func CMYKToRGB(calc zc.Calc)
- func CeilDecimal(c zc.Calc)
- func CeilFloat(c zc.Calc)
- func CharToCodePoint(c zc.Calc)
- func Clear(c zc.Calc)
- func ClearAll(c zc.Calc)
- func CodePointToChar(c zc.Calc)
- func Coeff(c zc.Calc)
- func ColorSample(calc zc.Calc)
- func Complex(c zc.Calc)
- func Conj(c zc.Calc)
- func CosComplex(c zc.Calc)
- func CosFloat(c zc.Calc)
- func CoshComplex(c zc.Calc)
- func CoshFloat(c zc.Calc)
- func CotComplex(c zc.Calc)
- func DM(c zc.Calc)
- func DMRound(c zc.Calc)
- func DMS(c zc.Calc)
- func DMSIs(c zc.Calc)
- func DMSRound(c zc.Calc)
- func Date(c zc.Calc)
- func DateTime(c zc.Calc)
- func DateTimeIs(c zc.Calc)
- func DayYear(c zc.Calc)
- func Dec(c zc.Calc)
- func DecBigInt(c zc.Calc)
- func DecDMS(c zc.Calc)
- func DecFloat(c zc.Calc)
- func DecRational(c zc.Calc)
- func Denom(c zc.Calc)
- func DivBigFloat(c zc.Calc)
- func DivComplex(c zc.Calc)
- func DivDecimal(c zc.Calc)
- func DivFloat(c zc.Calc)
- func DivRational(c zc.Calc)
- func DivRemBigInt(c zc.Calc)
- func DivRemDec(c zc.Calc)
- func Down(c zc.Calc)
- func Drop(c zc.Calc)
- func Dup(c zc.Calc)
- func EarthRadiusFn(c zc.Calc)
- func EqBigInt(c zc.Calc)
- func EqComplex(c zc.Calc)
- func EqDecimal(c zc.Calc)
- func EqFloat(c zc.Calc)
- func EqRational(c zc.Calc)
- func Eval(c zc.Calc)
- func ExpComplex(c zc.Calc)
- func ExpFloat(c zc.Calc)
- func Factorial(c zc.Calc)
- func Fibonacci(c zc.Calc)
- func Filter(c zc.Calc)
- func FloorDecimal(c zc.Calc)
- func FloorFloat(c zc.Calc)
- func Fold(c zc.Calc)
- func Get(c zc.Calc)
- func GtBigInt(c zc.Calc)
- func GtDecimal(c zc.Calc)
- func GtFloat(c zc.Calc)
- func GtRational(c zc.Calc)
- func GtStr(c zc.Calc)
- func GteBigInt(c zc.Calc)
- func GteDecimal(c zc.Calc)
- func GteFloat(c zc.Calc)
- func GteRational(c zc.Calc)
- func GteStr(c zc.Calc)
- func HSLToRGB(calc zc.Calc)
- func Haversine(c zc.Calc)
- func HexBigInt(c zc.Calc)
- func Hours(c zc.Calc)
- func Imag(c zc.Calc)
- func Int(c zc.Calc)
- func Inv(c zc.Calc)
- func Is(c zc.Calc)
- func Join(c zc.Calc)
- func JoinBits(c zc.Calc)
- func Left(c zc.Calc)
- func Len(c zc.Calc)
- func LocalZone(c zc.Calc)
- func LocalZoneGet(c zc.Calc)
- func Log10Complex(c zc.Calc)
- func Log10Float(c zc.Calc)
- func Log2Float(c zc.Calc)
- func LogComplex(c zc.Calc)
- func LogFloat(c zc.Calc)
- func Lower(c zc.Calc)
- func Lsh(c zc.Calc)
- func LtBigInt(c zc.Calc)
- func LtDecimal(c zc.Calc)
- func LtFloat(c zc.Calc)
- func LtRational(c zc.Calc)
- func LtStr(c zc.Calc)
- func LteBigInt(c zc.Calc)
- func LteDecimal(c zc.Calc)
- func LteFloat(c zc.Calc)
- func LteRational(c zc.Calc)
- func LteStr(c zc.Calc)
- func Map(c zc.Calc)
- func Md5(c zc.Calc)
- func Minutes(c zc.Calc)
- func MinutesDMS(c zc.Calc)
- func ModBigInt(c zc.Calc)
- func ModDecimal(c zc.Calc)
- func ModFloat(c zc.Calc)
- func MulBigFloat(c zc.Calc)
- func MulBigInt(c zc.Calc)
- func MulComplex(c zc.Calc)
- func MulDecimal(c zc.Calc)
- func MulFloat(c zc.Calc)
- func MulRational(c zc.Calc)
- func NegBigFloat(c zc.Calc)
- func NegBigInt(c zc.Calc)
- func NegDecimal(c zc.Calc)
- func NegFloat(c zc.Calc)
- func NegRational(c zc.Calc)
- func NoAnno(c zc.Calc)
- func NotBigInt(c zc.Calc)
- func NotBool(c zc.Calc)
- func Now(c zc.Calc)
- func NowRestore(c zc.Calc)
- func NowSet(c zc.Calc)
- func Num(c zc.Calc)
- func Oct(c zc.Calc)
- func OrBigInt(c zc.Calc)
- func OrBool(c zc.Calc)
- func PhaseComplex(c zc.Calc)
- func PolarComplex(c zc.Calc)
- func PowBigInt(c zc.Calc)
- func PowComplex(c zc.Calc)
- func PowFloat(c zc.Calc)
- func Proj(c zc.Calc)
- func RGBToCMYK(calc zc.Calc)
- func RGBToHSL(calc zc.Calc)
- func Rand(c zc.Calc)
- func RandChoice(c zc.Calc)
- func RandInt(c zc.Calc)
- func RandSeed(c zc.Calc)
- func RandSeedGet(c zc.Calc)
- func RationalBigInt(c zc.Calc)
- func RationalFloat(c zc.Calc)
- func RationalIs(c zc.Calc)
- func Real(c zc.Calc)
- func Recall(c zc.Calc)
- func RectComplex(c zc.Calc)
- func RemBigInt(c zc.Calc)
- func RemFloat(c zc.Calc)
- func Repeat(c zc.Calc)
- func Reverse(c zc.Calc)
- func Right(c zc.Calc)
- func Roll(c zc.Calc)
- func Rot13(c zc.Calc)
- func RoundComplex(c zc.Calc)
- func RoundDecimal(c zc.Calc)
- func RoundFloat(c zc.Calc)
- func RoundingMode(c zc.Calc)
- func RoundingModeGet(c zc.Calc)
- func Rsh(c zc.Calc)
- func ScientificNotation(c zc.Calc)
- func ScientificNotationBigInt(c zc.Calc)
- func Seconds(c zc.Calc)
- func SecondsDMS(c zc.Calc)
- func Sequence(c zc.Calc)
- func Set(c zc.Calc)
- func Sha1(c zc.Calc)
- func Sha1Hmac(c zc.Calc)
- func Sha224(c zc.Calc)
- func Sha224Hmac(c zc.Calc)
- func Sha256(c zc.Calc)
- func Sha256Hmac(c zc.Calc)
- func Sha384(c zc.Calc)
- func Sha384Hmac(c zc.Calc)
- func Sha512(c zc.Calc)
- func Sha512Hmac(c zc.Calc)
- func Shuffle(c zc.Calc)
- func SignBigFloat(c zc.Calc)
- func SignBigInt(c zc.Calc)
- func SignDecimal(c zc.Calc)
- func SignFloat(c zc.Calc)
- func SignRational(c zc.Calc)
- func SinComplex(c zc.Calc)
- func SinFloat(c zc.Calc)
- func SinhComplex(c zc.Calc)
- func SinhFloat(c zc.Calc)
- func Size(c zc.Calc)
- func Sort(c zc.Calc)
- func SortStr(c zc.Calc)
- func Split(c zc.Calc)
- func SplitBits(c zc.Calc)
- func SqrtBigFloat(c zc.Calc)
- func SqrtComplex(c zc.Calc)
- func SqrtFloat(c zc.Calc)
- func Store(c zc.Calc)
- func SubBigFloat(c zc.Calc)
- func SubBigInt(c zc.Calc)
- func SubComplex(c zc.Calc)
- func SubDateTime(c zc.Calc)
- func SubDateTimeDuration(c zc.Calc)
- func SubDecimal(c zc.Calc)
- func SubDuration(c zc.Calc)
- func SubFloat(c zc.Calc)
- func SubRational(c zc.Calc)
- func Swap(c zc.Calc)
- func Take(c zc.Calc)
- func TanComplex(c zc.Calc)
- func TanFloat(c zc.Calc)
- func TanhComplex(c zc.Calc)
- func TanhFloat(c zc.Calc)
- func Time(c zc.Calc)
- func TimeZone(c zc.Calc)
- func Tone(c zc.Calc)
- func UTF8Decode(c zc.Calc)
- func UTF8Encode(c zc.Calc)
- func UTM(c zc.Calc)
- func Unescape(c zc.Calc)
- func Up(c zc.Calc)
- func Upper(c zc.Calc)
- func VariancePop(c zc.Calc)
- func VarianceSamp(c zc.Calc)
- func Version(c zc.Calc)
- func Xor(c zc.Calc)
Constants ¶
const EarthRadius = 6371000
Variables ¶
var Emoji = map[string]string{}/* 1870 elements not displayed */
var Entities = map[string]string{}/* 2089 elements not displayed */
var TimeZones = map[string]string{}/* 598 elements not displayed */
Functions ¶
func AbsBigInt ¶
oper abs func AbsBigInt p0:BigInt -- BigInt func AbsDecimal p0:Decimal -- Decimal func AbsFloat p0:Float -- Float func AbsRational p0:Rational -- Rational title Absolute value
desc If *p0* is less than zero, the negated value of *p0*, otherwise *p0*. end
example -6 -- -6 abs -- 6 end
func AbsComplex ¶
oper abs func AbsComplex p0:Complex -- Float title Distance from zero in complex plane
desc The distance of *p0* from zero in the complex plane. end
example 2+2i abs 5 round -- 2.82843 end
func AbsDecimal ¶
func AbsRational ¶
func AcosComplex ¶
func AcosFloat ¶
oper acos func AcosFloat p0:Float -- Float title Inverse cosine
desc Inverse cosine of *p0* in radians. end
example 0.5 acos 5 round -- 1.0472 end
func AcoshComplex ¶
oper acosh func AcoshComplex p0:Complex -- Complex title Inverse hyperbolic cosine
desc Inverse hyperbolic cosine of *p0* end
example 2+2i acosh 5 round -- 1.73432+0.81655i end
func AcoshFloat ¶
oper acosh func AcoshFloat p0:Float -- Float title Inverse hyperbolic cosine
desc Inverse hyperbolic cosine of *p0* in radians. end
example 2 acosh 5 round -- 1.31696 end
func AddBigFloat ¶
func AddBigInt ¶
oper add func AddBigInt p0:BigInt p1:BigInt -- BigInt func AddDecimal p0:Decimal p1:Decimal -- Decimal func AddBigFloat p0:BigFloat p1:BigFloat -- BigFloat func AddFloat p0:Float p1:Float -- Float func AddRational p0:Rational p1:Rational -- Rational func AddComplex p0:Complex p1:Complex -- Complex alias a alias + title Addition
desc Adds the value of *p1* to *p0*. end
example 6 -- 6 2 -- 6 | 2 a -- 8 end
func AddComplex ¶
func AddDateTimeDuration ¶
func AddDecimal ¶
func AddDuration ¶
oper add func AddDuration p0:Duration p1:Duration -- Duration func AddDurationDateTime p0:Duration p1:DateTime -- Duration func AddDateTimeDuration p0:DateTime p1:Duration -- Duration alias a alias + title Time or duration addition
desc Adds a duration and time or adds two durations. end
example c 3:30pm -- 3:30pm 2h add -- Mon Jan 2 2006 5:30:00pm -0700 MST c 2h30m -- 2h30m 45m add -- 3h 15m end
func AddDurationDateTime ¶
func AddRational ¶
func AndBigInt ¶
oper and func AndBigInt p0:BigInt p1:BigInt -- BigInt title Bitwise and
desc The bitwise and of `p0` and `p1` end
example 0b1100 -- 0b1100 0b1010 -- 0b1100 | 0b1010 and bin -- 0b1000 end
func AndBool ¶
oper and func AndBool p0:Bool p1:Bool -- Bool title Logical conjunction
desc The logical conjunction of *p0* and *p1*. end
example c true true and -- true c true false and -- false c false false and -- false end
func Anno ¶
oper anno func Anno p0:Val anno:Str -- p0:Val alias annotate title Annotate value
desc Annotate the value of *p0* with *anno*. end
example 42 -- 42 'the answer' anno -- 42 # the answer end
func Apply ¶
oper apply func Apply args:Val* fn:Str nargs:Int -- Val* title Apply a function using arguments on stack
desc Evaluates the expression in *fn* by first popping *nargs* off the stack and pushing them back as a single argument. This is useful for higher order functions, like map, where some of the arguments are from existing results found on the stack. end
example 1 2 3 4 -- 1 | 2 | 3 | 4 n -- 1 | 2 | 3 | 4 | 4 # size [swap sub] [map] 2 apply -- 3 | 2 | 1 | 0 end
func AsinComplex ¶
oper asin func AsinComplex p0:Complex -- Complex title Inverse sine
desc Inverse sine of *p0*. end
example 0.5+2i asin 5 round -- 0.22102+1.46572i end
func AsinFloat ¶
oper asin func AsinFloat p0:Float -- Float title Inverse sine
desc Inverse sine of *p0* in radians. end
example 0.5 asin 5 round -- 0.5236 end
func AsinhComplex ¶
oper asinh func AsinComplex p0:Complex -- Complex title Inverse hyperbolic sine
desc Inverse hyperbolic sine of *p0*. end
example 2+2i asinh 5 round -- 0.75425+1.73432i end
func AsinhFloat ¶
oper asinh func AsinhFloat p0:Float -- Float title Inverse hyperbolic sine
desc Inverse hyperbolic sine of *p0* in radians. end
example 2 asinh 5 round -- 1.44364 end
func Atan2Float ¶
oper atan2 func Atan2Float p0:Float p1:Float -- Float title Inverse tangent
desc Inverse tangent of *p0*\/*p1*. end
example 1 2 atan2 5 round -- 0.46365 end
func AtanComplex ¶
oper atan func AtanComplex p0:Complex -- Complex title Inverse tangent
desc Inverse tangent of *p0*. end
example 0.5+2i atan 5 round -- 1.42155+0.50037i end
func AtanFloat ¶
oper atan func AtanFloat p0:Float -- Float title Inverse tangent
desc Inverse tangent of *p0* in radians. end
example 0.5 atan 5 round -- 0.46365 end
func AtanhComplex ¶
oper atanh func AtanhComplex p0:Complex -- Complex title Inverse hyperbolic tangent
desc Inverse hyperbolic tangent of *p0*. end
example 0.5+2i atanh 5 round --0.09642+1.12656i end
func AtanhFloat ¶
oper atanh func AtanhFloat p0:Float -- Float title Inverse hyperbolic tangent
desc Inverse hyperbolic tangent of *p0* in radians. end
example 0.5 atanh 5 round -- 0.54931 end
func Average ¶
oper average func Average BigInt* -- BigInt func - Decimal* -- Decimal func - Float* -- Float func - Rational* -- Rational func - Complex* -- Complex alias avg title Average
desc The average of all items on the stack. end
example 0 100 25 75 avg -- 50 end
func Bin ¶
oper bin func Bin p0:BigInt -- BigInt title Binary conversion
desc Convert the value of *p0* to a binary number. end
example 0x0f -- 0x0f bin -- 0b1111 end
func Bit ¶
oper bit func Bit p0:BigInt n:Int -- Uint title Bit value
desc The value of the *n*th bit of *p0*. end
example 0b100 -- 0b100 2 bit -- 1 end
func Bits ¶
oper bits func Bits p0:BigInt -- Int title Length in bits
desc The length of *p0* in bits. end
example 0b11111 -- 0b11111 bits -- 5 end
func Bytes ¶
oper bytes func Bytes p0:BigInt -- Int title Length in bytes
desc The length of *p0* in bytes. end
example 0x1ff -- 0x1ff bytes -- 2 end
func CMYKToRGB ¶
oper cmyk-rgb func CMYKToRGB c:Uint8 m:Uint8 y:Uint8 k:Uint8 -- r:Uint8 g:Uint8 b:Uint8 title CMYK to RGB color space
desc Convert the CMYK color *c*, *m*, *y*, *k*, to the RGB color space as *r*, *b*, *g*. end
example 0 127 191 127 -- 0 | 127 | 191 | 127 cmyk-rgb -- 128 | 64 | 32 end
func CeilDecimal ¶
oper ceil func NoOp p0:BigInt -- BigInt func CeilDecimal p0:Decimal -- Decimal func CeilFloat p0:Float -- Float title Ceiling
desc The nearest integer value greater than or equal to *p0*. end
example 6.12 -- 6.12 ceil -- 7 end
func CharToCodePoint ¶
oper char-codepoint func CharToCodePoint p0:Char -- Int32 alias char-cp title Character to code point
desc Converts the character *p0* into an integer code point. end
example [°] -- ° char-cp -- 176 hex -- 0xb0 end
func Clear ¶
oper clear func Clear Val* -- alias c title Clear the stack
desc Remove all items from the stack. end
example 1 -- 1 2 -- 1 | 2 clear -- end
func ClearAll ¶
oper clear-all func ClearAll Val* -- alias ca title Clear stack and memory
desc Remove all items from the stack and any stacks stored in memory. end
example 1 -- 1 2 -- 1 | 2 store -- *stored* clear-all -- *cleared* recall -- memory empty end
func CodePointToChar ¶
oper codepoint-char func CodePointToChar p0:Int32 -- Char alias cp-char title Code point to character
desc Coverts the code point *p0* to a character. end
example 0xb0 -- 0xb0 cp-char -- ° end
func Coeff ¶
oper coeff func Coeff p0:Decimal -- BigInt title Coefficient
desc The value of *p0* without the decimal point. end
example 12.345 coeff -- 12345 end
func ColorSample ¶
oper color-sample func ColorSample r:Uint8 g:Uint8 b:Uint8 -- Str title Render a sample of a color
desc Render five spaces with a background color of *r*, *g*, and *b*. The terminal in use must be able to support 24-bit ANSI color codes. end
func Complex ¶
oper complex func Complex r:Float i:Float -- Complex title Complex from real and imaginary
desc A complex number from a real *r* and an imaginary *i* number. end
example 6 -- 6 12 -- 6 | 12 complex -- 6+12i end
func Conj ¶
oper conj func Conj p0:Complex -- Complex title Complex conjugate
desc The complex conjugate of *p0* end
example 5+3i conj -- 5-3i end
func CosComplex ¶
oper cos func CosComplex p0:Complex -- Complex title Cosine
desc Cosine of *p0*. end
example 2+2i cos 5 round -- -1.56563-3.29789i end
func CosFloat ¶
oper cos func CosFloat p0:Float -- Float title Cosine
desc Cosine of *p0* in radians. end
example 2 cos 5 round -- -0.41615 end
func CoshComplex ¶
oper cosh func CoshComplex p0:Complex -- Complex title Hyperbolic cosine
desc Hyperbolic cosine of *p0*. end
example 2+2i cosh 5 round -- -1.56563+3.29789i end
func CoshFloat ¶
oper cosh func CoshFloat p0:Float -- Float title Hyperbolic cosine
desc Hyperbolic cosine of *p0* in radians. end
example 2 cosh 5 round -- 3.7622 end
func CotComplex ¶
oper cot func CotComplex p0:Complex -- Complex title Cotangent
desc Cotangent of *p0*. end
example 2+3i cot 5 round -- -0.00374-0.99676i end
func DM ¶
oper deg-min func DM p0:DMS -- DMS alias dm title Angle in degrees and minutes
desc Reformat the angle *p0* to degrees and minutes example 10.1234 dm -- 10° 7.404000000000011′ end
func DMRound ¶
oper deg-min-round func DMRound p0:DMS n:Int -- DMS alias dmr title Rounded angle in degrees and minutes
desc Reformat the angle *p0* to degrees and minutes and round the minutes to *n* places. end
example 12.57611 3 dmr -- 12° 34.567′ end
func DMS ¶
oper deg-min-sec func DMS p0:DMS -- DMS alias dms title Angle in degrees and minutes
desc Reformat the angle *p0* to degrees, minutes, and seconds. end
example -76.856944 dms -- -76° 51′ 24.9984″ end
func DMSIs ¶ added in v5.12.0
oper dms? func DMSIs p0:Str -- Bool alias dec-min-sec? title Checks value can be parsed as degree, minutes, seconds
desc Returns `true` if the value *p0* can be parsed as an angle with degrees, minutes, and seconds. end
example c [10° 30′ 45″] dms? -- true c [10 30 45 ] dms? -- false end
func DMSRound ¶
oper deg-min-sec-round func DMSRound p0:DMS n:Int -- DMS alias dmsr title Rounded angle in degrees, minutes, seconds
desc Reformat the angle *p0* to degrees, minutes, and seconds, and round the seconds to *n* places. end
example -76.856944 0 dmsr -- -76° 51′ 25″ end
func Date ¶
oper date func Date p0:DateTime -- Date title Formats to a common date layout
desc Formats date/time *p0* to a common date layout. Time information, if any, is removed. end
example '2006-01-02T15:04:05 UTC -- 2006-01-02T15:04:05 UTC date -- Mon Jan 2 2006 end
func DateTime ¶
oper datetime func DateTime p0:DateTime -- DateTime alias dt title Formats to a common date/time layout
desc Formats a date/time to a common layout. end
example '2006-01-02T15:04:05 UTC -- 2006-01-02T15:04:05 UTC datetime -- Mon Jan 2 2006 3:04:05pm UTC end
func DateTimeIs ¶ added in v5.12.0
oper datetime? func DateTimeIs p0:Str -- Bool alias dt? title Checks value can be parsed as a `DateTime`
desc Returns `true` if the value *p0* can be parsed as a DateTime. end
example c [2 May 2023] datetime? -- true c [2 Nay 2023] datetime? -- false end
func DayYear ¶
oper day-year func DayYear p0:DateTime -- Int alias doy title Day of year
desc Day of year for a given date *p0*. end
example 2006-03-15 -- 2006-03-15 day-year -- 74 end
func Dec ¶
oper dec func Dec p0:Decimal -- Decimal func DecFloat p0:Float -- Decimal title Decimal number
desc Pops *p0* from the stack and formats it as a `Decimal`. end
example 1e3 dec -- 1000 end
func DecBigInt ¶
oper dec func DecBigInt p0:BigInt -- BigInt title Decimal conversion
desc Convert the value of *p0* to a decimal number. end
example 0xf -- 0xf dec -- 15 end
func DecDMS ¶
oper dec func DecDMS p0:DMS -- Decimal title DMS angle to decimal degrees
desc Convert the DMS angle *p0* to decimal degrees. end
example 10d7m24.24s dec -- 10.1234 end
func DecRational ¶
oper dec func DecRational p0:Rational -- Decimal title Decimal number
desc Pops *p0* from the stack and formats it as a `Decimal`. end
example 1/2 dec -- 0.5 end
func Denom ¶
oper denom func Denom p0:Rational -- BigInt title Denominator
desc The denominator of rational number *p0*. end
example 2/3 denom -- 3 end
func DivBigFloat ¶
func DivComplex ¶
func DivDecimal ¶
oper div func DivDecimal p0:Decimal p1:Decimal -- Decimal func DivBigFloat p0:BigFloat p1:BigFloat -- BigFloat func DivFloat p0:Float p1:Float -- Float func DivRational p0:Rational p1:Rational -- Rational func DivComplex p0:Complex p1:Complex -- Complex alias d alias / title Division
desc Divides the value of *p0* by *p1*. If *p1* is zero, a 'division by zero' error is raised. end
example 6 -- 6 2 -- 6 | 2 d -- 3 end
func DivRational ¶
func DivRemBigInt ¶ added in v5.8.0
func DivRemDec ¶ added in v5.8.0
oper div-rem func DivRemDec p0:Decimal p1:Decimal p:Int32 -- r:Decimal q:Decimal func DivRemBigInt p0:BigInt p1:BigInt -- r:Decimal q:Decimal alias dr title Division with remainder
desc Divides *p0* by *p1* with the precision *p* and returns the quotient *q* and remainder *r*. The following shows how to divide one dollar with three people which gives a quotient of $0.33 and a remainder of one cent. end
example 1.00 3 2 div-rem -- 0.01 # remainder | 0.33 end
func Down ¶
oper down func Down Val* -- Val* alias dn title Rotate stack downward
desc Rotate items on the stack by moving downward.
In the interactive calculator, the top of the stack is towards the bottom of the terminal so downward means seeing all items moves toward the bottom. The top of the stack wraps around to be the bottom of the stack. end
example 1 2 3 -- 1 | 2 | 3 down -- 3 | 1 | 2 down -- 2 | 3 | 1 end
func Drop ¶
oper drop func Drop Val -- title Drop top item from stack
desc Remove the top item from the stack. end
example 1 -- 1 2 -- 1 | 2 drop -- 1 end
func Dup ¶
oper dup func Dup p0:Val -- p0:Val p0:Val title Duplicate top stack item
desc Duplicate the top item on the stack. end
example 1 -- 1 dup -- 1 | 1 end
func EarthRadiusFn ¶
oper earth-radius func EarthRadiusFn -- Int title Average radius of the Earth
desc The volumetric mean radius of the Earth in meters.
Source: https://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html end
example earth-radius -- 6371000 # m end
func EqBigInt ¶
oper eq func EqBigInt p0:BigInt p1:BigInt -- BigInt func EqDecimal p0:Decimal p1:Decimal -- Decimal func EqFloat p0:Float p1:Float -- Float func EqRational p0:Rational p1:Rational -- Rational func EqComplex p0:Complex p1:Complex -- Complex func Is p0:Str p1:Str -- Str title Equal
desc `true` if *p0* and *p1* are equal, otherwise `false`. end
example c 1234.56 1,234.56 eq -- true c 1234.56 1234.56000 eq -- true c 1234.56 $1,234.56 eq -- true c 1234.56 +1,234.56 eq -- true end
func EqRational ¶
func Eval ¶
oper eval func Eval expr:Str -- Val* title Evaluate top of stack
desc Evaluate *expr* as if it was input to the calculator. end
example [1 2 add -- 1 2 add eval -- 3 end
func ExpComplex ¶
oper exp func ExpComplex p0:Complex -- Complex title Natural exponential
desc Natural exponential of *p0*. end
example 2+2i exp 5 round -- -3.07493+6.71885i end
func ExpFloat ¶
oper exp func ExpFloat p0:Float -- Float title Natural exponential
desc Natural exponential of *p0*. end
example 2 exp 5 round -- 7.38906 end
func Factorial ¶
oper factorial func Factorial n:BigInt -- BigInt alias fact title Factorial
desc The product of all positive integers less than or equal to *n*. If *n* is negative, an invalid argument error is displayed. end
example c 3 fact -- 6 c 10 fact -- 3628800 end
func Fibonacci ¶ added in v5.5.0
oper fibonacci func Fibonacci n:Int -- BigInt* alias fib title Fibonacci sequence
desc Calculates the *n*th element in the Fibonacci sequence. The value of *n* must be equal to or greater than zero. end
example 1 5 seq /fib map -- 1 | 1 | 2 | 3 | 5 end
func Filter ¶
oper filter func Filter Val* expr:Str -- Val* title Filter items in the stack
desc Filter the stack by keeping items that are true when evaluated by expression *expr*. end
example 1 2 3 4 5 6 -- 1 | 2 | 3 | 4 | 5 | 6 [2 mod 0 eq] filter -- 2 | 4 | 6 end
func FloorDecimal ¶
oper floor func NoOp p0:BigInt -- BigInt func FloorDecimal p0:Decimal -- Decimal func FloorFloat p0:Float -- Float title Floor
desc The nearest integer value less than or equal to *p0*. end
example 6.12 -- 6.12 floor -- 6 end
func FloorFloat ¶
func Fold ¶
oper fold func Fold Val* expr:Str -- Val alias reduce title Reduce items to a single value
desc Reduce the stack to a single value using the expression *expr*. An 'invalid function' error is raised if *expr* does not reduce. end
example 1 2 3 4 5 -- 1 | 2 | 3 | 4 | 5 [add] fold -- 15 end
func GtBigInt ¶
oper gt func GtBigInt p0:BigInt p1:BigInt -- Bool func GtDecimal p0:Decimal p1:Decimal -- Bool func GtRational p0:Rational p1:Rational -- Bool func GtFloat p0:Float p1:Float -- Bool func GtStr p0:Str p1:Str -- Bool alias greater-than title Greater than
desc `true` if *p0* is greater than *p1*, otherwise `false`. end
example c 1 0 gt -- true c 0 0 gt -- false c -1 0 gt -- false end
func GtRational ¶
func GteBigInt ¶
oper gte func GteBigInt p0:BigInt p1:BigInt -- Bool func GteDecimal p0:Decimal p1:Decimal -- Bool func GteRational p0:Rational p1:Rational -- Bool func GteFloat p0:Float p1:Float -- Bool func GteStr p0:Str p1:Str -- Bool alias greater-than-or-equal title Greater than or equal
desc `true` if *p0* is greater than or equal *p1*, otherwise `false`. end
example c 1 0 gte -- true c 0 0 gte -- true c -1 0 gte -- false end
func GteDecimal ¶
func GteRational ¶
func HSLToRGB ¶
oper hsl-rgb func HSLToRGB h:Float s:Float l:Float -- r:Uint8 g:Uint8 b:Uint8 title HSL to RGB color space
desc Convert the HSL color *h*, *s*, *l* to the RGB color space as *r*, *g*, *b*. end
example 20 0.6 0.314 -- 20 | 0.6 | 0.314 hsl-rgb -- 128 | 64 | 32 end
func Haversine ¶
oper haversine func Haversine lat0:DMS lon0:DMS lat1:DMS lon1:DMS -- Float title Great circle distance between two points
desc Calculates the great circle distance between (*lat0*, *lon0*) and (*lat1*, *lon1*) using the haversine formula.
The following shows the great circle distance between Washington, DC and New York, NY:
example 38°54′17″N 77°00′59″W -- 38°54′17″N | 77°00′59″W 40°42′46″N 74°00′22″W -- 38°54′17″N | 77°00′59″W | 40°42′46″N | 74°00′22″W haversine 2 round -- 326364.76 # m m-km 2 round -- 326.36 # km km-mi 2 round -- 202.79 # mi end
func HexBigInt ¶
oper hex func HexBigInt p0:BigInt -- BigInt title Hexadecimal conversion
desc Convert the value of *p0* to a hexadecimal number. end
example 0b1111 -- 0b1111 hex -- 0xf end
func Hours ¶
oper hours func Hours p0:Duration -- Float title Hours in duration
desc Converts the duration *p0* into hours. end
example 10h20m30s -- 10h20m30s hours 2 round -- 10.34 end
func Imag ¶
oper imag func Imag p0:Complex -- Float title Imaginary number from complex
desc The imaginary number part of complex number *p0* end
example 3+4i imag -- 4 end
func Inv ¶
oper inv func Inv p0:Rational -- Rational title Inverse
desc Returns the inverse which is 1/*p0*. end
example 1/2 inv -- 2 end
func Is ¶
oper is func Is p0:Str p1:Str -- Bool title Byte equality
desc `true` if *p0* and *p1* are the same, byte by byte. end
example c 1.2 1.20 is -- false c 1.2 1.2 is -- true end
func Join ¶
oper join func Join Val* sep:Str -- Str title Join stack elements
desc Join all stack elements into a single string separated by *sep*. end
example 128 8 74 2 -- 128 | 8 | 74 | 2 '.' join -- 128.8.74.2 end
func JoinBits ¶ added in v5.5.0
oper join-bits func JoinBits BigInt* n:Int -- BigInt* alias joinb title Join a binary number by bit width
desc Join all numbers in the stack, which contain *n* bits into a single number. If a value on the stack contains more than *n* bits, an error is raised. end
example c 0xa 0xb 0xc 0xd 4 joinb hex -- 0xabcd c 0xab 0xcd 8 joinb hex -- 0xabcd end
func Left ¶
oper left func Left p0:Str n:Int -- Str title Left substring
desc Substring of *s* from the left.
If *n* is positive, *m* characters are taken from the left. If *n* is negative, characters are taken from the left until there are *n* characters remaining. If *n* is zero, *s* is returned without change.
If the absolute value of *n* is greater then then length of *s*, an 'illegal arguments' error is raised. end
example 'abcdef -- abcdef 4 left -- abcd -1 left -- abc end
func Len ¶
oper len func Len p0:Str -- Int title Length of text in characters
desc Length of text in characters. end
example c 'abcd' len -- 4 c '🥇🥈🥉👏' len -- 4 end
func LocalZone ¶
oper local-zone func LocalZone p0:Str -- title Sets the local time zone
desc Sets the local time zone to *p0*. end
exammple now time -- 3:04:05pm -0700 MST c [est] local-zone -- *local time zone is now 'EST'* now time -- 5:04:05pm -0500 EST c Asia/Jakarta local-zone -- *local time zone is now 'Asia/Jakarta'* now time -- 5:04:05am +0700 end
func LocalZoneGet ¶
oper local-zone= func LocalZoneGet -- Str title Gets the local time zone
desc Gets the local time zone. end
example local-zone= -- MST end
func Log10Complex ¶
oper log10 func Log10Complex p0:Complex -- Complex title Decimal logarithm
desc Decimal logarithm of *p0*. end
example 50+20i log10 5 round -- 1.7312+0.16525i end
func Log10Float ¶
oper log10 func Log10Float p0:Float -- Float title Decimal logarithm
desc Decimal logarithm of *p0*. end
example 50 log10 5 round -- 1.69897 end
func Log2Float ¶
oper log2 func Log2Float p0:Float -- Float title Binary logarithm
desc Binary logarithm of *p0*. end
example 250 log2 5 round -- 7.96578 end
func LogComplex ¶
oper log func LogComplex p0:Complex -- Complex title Natural logarithm
desc Natural logarithm of *p0*. end
example 8+2i log 5 round -- 2.10975+0.24498i end
func LogFloat ¶
oper log func LogFloat p0:Float -- Float title Natural logarithm
desc Natural logarithm of *p0*. end
example 8 log 5 round -- 2.07944 end
func Lower ¶
oper lower func Lower p0:Str -- Str title Lowercase
desc Converts the string *p0* to lowercase. end
example 'AbCd -- AbCd lower -- abcd end
func Lsh ¶
oper lsh func Lsh p0:BigInt n:Uint -- BigInt alias left-shift title Left shift bits
desc Shifts all bits in *p0* to the left by *n*. end
example 0b10 -- 0b10 2 lsh bin -- 0b1000 end
func LtBigInt ¶
oper lt func LtBigInt p0:BigInt p1:BigInt -- Bool func LtDecimal p0:Decimal p1:Decimal -- Bool func LtRational p0:Rational p1:Rational -- Bool func LtFloat p0:Float p1:Float -- Bool func LtStr p0:Str p1:Str -- Bool alias less-than title Less than
desc `true` if *p0* is less than *p1*, otherwise `false`. end
example c 1 0 lt -- false c 0 0 lt -- false c -1 0 lt -- true end
func LtRational ¶
func LteBigInt ¶
oper lte func LteBigInt p0:BigInt p1:BigInt -- Bool func LteDecimal p0:Decimal p1:Decimal -- Bool func LteRational p0:Rational p1:Rational -- Bool func LteFloat p0:Float p1:Float -- Bool func LteStr p0:Str p1:Str -- Bool alias less-than-or-equal title Less than or equal
desc `true` if *p0* is less than or equal to *p1*, otherwise `false`. end
example c 1 0 lte -- false c 0 0 lte -- true c -1 0 lte -- true end
func LteDecimal ¶
func LteRational ¶
func Map ¶
oper map func Map Val* expr:Str -- Val* title Apply a function to each item on the stack
desc Apply expression *expr* to each value in the stack. end
example 1 2 3 4 5 -- 1 | 2 | 3 | 4 | 5 [2 mul] map -- 2 | 4 | 6 | 8 | 10 end
func Md5 ¶ added in v5.5.0
oper md5 func Md5 p0:Str -- Str title MD5 hash function
desc Hash *p0* with the MD5 function. end
example 'Behind the tree! -- Behind the tree! md5 -- 0xbbce0fb98a6a1b308e589d1408968ac2 end
func Minutes ¶
oper minutes func Minutes p0:Duration -- Float title Minutes in duration
desc Converts the duration *p0* into minutes. end
example 10h20m30s -- 10h20m30s minutes 2 round -- 620.5 end
func MinutesDMS ¶
oper minutes func MinutesDMS p0:DMS -- Decimal title Angle in minutes
desc Converts the angle *p0* to minutes. end
example 10d30m minutes -- 630 end
func ModBigInt ¶
oper mod func ModBigInt p0:BigInt p1:BigInt -- BigInt func ModDecimal p0:Decimal p1:Decimal -- Decimal func ModFloat p0:Float p1:Float -- Float title Modulus
desc The modulus when *p0* is divided by *p1*. If *p1* is zero, a 'division by zero' error is raised. end
example -7 2 mod -- 1 end
func ModDecimal ¶
func MulBigFloat ¶
func MulBigInt ¶
oper mul func MulBigInt p0:BigInt p1:BigInt -- BigInt func MulDecimal p0:Decimal p1:Decimal -- Decimal func MulBigFloat p0:BigFloat p1:BigFloat -- BigFloat func MulFloat p0:Float p1:Float -- Float func MulRational p0:Rational p1:Rational -- Rational func MulComplex p0:Complex p1:Complex -- Complex alias m alias * title Multiplication
desc Multiplies *p0* by *p1*. end
example 6 -- 6 2 -- 6 | 2 m -- 12 end
func MulComplex ¶
func MulDecimal ¶
func MulRational ¶
func NegBigFloat ¶
func NegBigInt ¶
oper neg func NegBigInt p0:BigInt -- BigInt func NegDecimal p0:Decimal -- Decimal func NegBigFloat p0:BigFloat -- BigFloat func NegFloat p0:Float -- Float func NegRational p0:Rational -- Rational title Negation
desc Changes the sign of `p0`. end
example -6 -- -6 neg -- 6 neg -- -6 end
func NegDecimal ¶
func NegRational ¶
func NoAnno ¶
oper no-anno func NoAnno p0:Val -- p0:Val alias noa alias no-annotation title Remove annotation
desc Remove the annotation, if any, from *p0*. end
example 42 -- 42 'the answer' anno -- 42 # the answer noa -- 42 end
func NotBigInt ¶
oper not func NotBigInt p0:BigInt -- BigInt title Bitwise not
desc The bitwise not of *p0*. end
example 0b101 -- 0b101 not bin -- -0b110 end
func NotBool ¶
oper not func NotBool Bool -- Bool title Negation
desc If `true`, returns `false`, otherwise returns `true`. end
example true not -- false not -- true end
func Now ¶
oper now func Now -- DateTime title Current date and time
desc The current date and time. If `now-set` has been called, that date and time will be returned instead. end
example now -- Mon Jan 2 2006 3:04:05pm -0700 MST end
func NowRestore ¶
oper now- func NowRestore -- title Cancel now override
desc Cancel override of the value returned by now. end
func NowSet ¶
oper now= func NowSet p0:DateTime -- title Override now value
desc Override the value returned by `now`. Useful for to mocking current time while testing. end
example 'Nov 5 1955 01:22 -- Nov 5 1955 01:22 now= -- *now set to 'Sat Nov 5 1955 1:22:00am -0700 MST'* now -- Sat Nov 5 1955 1:22:00am -0700 MST end
func Num ¶
oper num func Num p0:Rational -- BigInt title Numerator
desc The numerator of rational number *p0*. end
example 2/3 num -- 2 end
func Oct ¶
oper oct func Oct p0:BigInt -- BigInt title Octal conversion
desc Convert the value of *p0* to an octal number. end
example 0b1111 -- 0b1111 oct -- 0o17 end
func OrBigInt ¶
oper or func OrBigInt p0:BigInt p1:BigInt -- BigInt title Bitwise or
desc The bitwise or of *p0* and *p1*. end
example 0b1100 -- 0b1100 0b1010 -- 0b1100 | 0b1010 or bin -- 0b1110 end
func OrBool ¶
oper or func OrBool p0:Bool p1:Bool -- Bool title Logical disjunction
desc The logical disjunction of *p0* and *p1*. end
example c true true or -- true c true false or -- true c false false or -- false end
func PhaseComplex ¶
func PolarComplex ¶
oper polar func PolarComplex p0:Complex -- r:Float θ:Float title Complex to polar
desc The absolute value *r* and phase *θ* of *p0*. end
example 2i polar pi div 1 round -- 2 | 0.5 end
func PowBigInt ¶
oper pow func PowBigInt p0:BigInt p1:BigInt -- BigInt func PowFloat p0:Float p1:Float -- Float func PowComplex p0:Complex p1:Complex -- Complex alias ** alias ^ title Exponentiation
desc Raises *p0* to the power of *p1*. end
example 6 -- 6 2 -- 6 | 2 pow -- 36 end
func PowComplex ¶
func Proj ¶
oper proj func Proj p0:Float p1:Float s:Str t:Str -- Float Float title Transform coordinate
desc Transform coordinate (*p0*, *p1*) in coordinate system *s* to a coordinate in system *t*. The order of the coordinates is defined by the coordinate system and it may be (lat, lon) or (x, y). end
example 39.203611 -76.856944 -- 39.203611 | -76.856944 epsg.wgs-84 18n epsg.utm -- 39.203611 | -76.856944 | EPSG:4326 | EPSG:32618 proj -- 339660.12559342897 | 4.341014551927999e06 end
func RGBToCMYK ¶
oper rgb-cmyk func RGBToCMYK r:Uint8 g:Uint8 b:Uint8 -- c:Uint8 m:Uint8 y:Uint8 k:Uint8 title RGB to CMYK color space
desc Convert the RGB color *r*, *b*, *g* to the CMYK color space as *c*, *m*, *y*, *k*. end
example 128 64 32 -- 128 | 64 | 32 rgb-cmyk -- 0 | 127 | 191 | 127 end
func Rand ¶
oper rand func Rand -- Float title Random float
desc Random number between 0 and 1. end
example 0 rand-seed -- *seed set to 0* rand -- 0.9451961492941164 end
func RandChoice ¶
oper rand-choice func RandChoice ... a0:Val ... -- a0:Val title Randomly select item on stack
desc Randomly select an item on the stack. end
example 2 rand-seed -- *seed set to 2* 1 2 3 4 5 6 -- 1 | 2 | 3 | 4 | 5 | 6 rand-choice -- 5 end
func RandInt ¶
oper rand-int func RandInt n:Int -- Int title Random integer
desc Random integer between 1 and *n*. end
example 0 rand-seed -- *seed set to 0* 10 rand-int -- 5 end
func RandSeed ¶
oper rand-seed func RandSeed seed:Int64 -- title Set the random number seed
desc Sets the random number *seed*. end
example 1 rand-seed -- *seed set to 1* 10 rand-int -- 2 end
func RandSeedGet ¶
oper rand-seed= func RandSeedGet -- Int64 title Get the random number seed
desc Gets the random number seed. end
example 3 rand-seed -- *seed set to 3* rand-seed= -- 3 end
func RationalBigInt ¶
func RationalFloat ¶
func RationalIs ¶ added in v5.12.0
oper rational? func RationalIs p0:Str -- Bool title Checks value can be parsed as a rational
desc Returns `true` if the value *p0* can be parsed as a Rational. end
example c 1/2 rational? -- true c 1+2i rational? -- false end
func Real ¶
oper real func Real p0:Complex -- Float title Real number from complex
desc The real number part of complex number *p0* end
example 3+4i real -- 3 end
func Recall ¶
oper recall func Recall Val* -- Val* Val* alias re title Recall stack from memory
desc Recall a stack from memory. The recalled stack is placed before an existing items on the current stack. Memory is also a stack so that multiple stacks can be stored at one time. end
example 1 2 3 4 store average -- 2.5 recall -- 1 | 2 | 3 | 4 | 2.5 end
func RectComplex ¶
oper rect func RectComplex r:Float θ:Float -- Complex title Polar to complex
desc The complex number with polar coordinates *r* and *θ*. end
example 2 0.5 pi mul rect imag -- 2 end
func RemBigInt ¶
oper rem func RemBigInt p0:BigInt p1:BigInt -- BigInt func RemFloat p0:Float p1:Float -- Float title Remainder
desc The remainder when *p0* is divided by *p1*. If *p1* is zero, a 'division by zero' error is raised. end
example -7 -- -7 2 -- -7 | 2 rem -- -1 end
func Repeat ¶
oper repeat func Repeat expr:Val n:Int -- Val* title Repeat the execution of a function
desc Repeat execution of expression *expr* for *n* times. end
example 1 -- 1 [2 mul] 8 repeat -- 256 end
func Reverse ¶
oper reverse func Reverse Val* -- Val* alias rev title Reverse stack
desc Reverses the elements on the stack. end
example 1 2 3 4 5 -- 1 | 2 | 3 | 4 | 5 reverse -- 5 | 4 | 3 | 2 | 1 end
func Right ¶
oper right func Right p0:Str n:Int -- Str title Right substring
desc Substring of *p0* from the right.
If *n* is positive, *n* characters are taken from the right. If *n* is negative, characters are taken from the right until there are *n* characters remaining. If *n* is zero, *s* is returned without change.
If the absolute value of *n* is greater then then length of *s*, an 'illegal arguments' error is raised. end
example 'abcdef -- abcdef 4 right -- cdef -1 right -- def end
func Roll ¶
oper roll func Roll dice:Str -- Int* title Dice roller
desc Rolls dice as specified by *dice* in standard dice notation. The argument *dice* may start with the number of dice to roll, followed by the literal character `d`, and then the number of faces found on each die. For example, use `3d6` to roll three six sided dice. end
example 99 rand-seed -- *seed set to 99* 3d6 roll -- 6 | 2 | 1 sum -- 9 end
func Rot13 ¶
oper rotate-13 func Rot13 p0:Str -- Str alias rot13 title Rotate characters by 13
desc Rotate all characters in string *p0* by 13. end
example 'Behind the tree! -- Behind the tree! rot13 -- Oruvaq gur gerr! rot13 -- Behind the tree! end
func RoundComplex ¶
oper round func RoundComplex p0:Complex n:Int -- Complex alias r title Round to a given precision
desc Rounds the real and imaginary numbers of *p0* to *n* digits using the half up rounding mode. end
example 1.047197551196598+5.948293i 3 round -- 1.047+5.948i end
func RoundDecimal ¶
oper round func RoundDecimal d:Decimal n:Int -- Decimal func RoundFloat d:Float n:Int -- Float alias r title Round to a given precision
desc Rounds the number *n* to *d* digits using the current rounding mode. end
example 2 3 div -- 0.6666666666666666666 2 round -- 0.67 end
func RoundFloat ¶
func RoundingMode ¶
oper rounding-mode func RoundingMode -- Str title Set method to use in rounding
desc Sets the mode to be used when rounding. Valid modes are:
- `half-up` - `ceil` - `down` - `floor` - `half-even` - `up`
end
example 1.01 0.05 mul -- 0.0505 2 round -- 0.05 'up' rounding-mode -- *rounding-mode set to 'up'* c 1.01 0.05 mul -- 0.0505 2 round -- 0.06 end
func RoundingModeGet ¶
oper rounding-mode= func RoundingModeGet -- Str title Method to use in rounding
desc Gets the current rounding mode end
example rounding-mode= -- half-up end
func Rsh ¶
oper rsh func Rsh p0:BigInt n:Uint -- BigInt alias right-shift title Right shift bits
desc Shifts all bits in *p0* to the right by *n*. end
example 0b1000 -- 0b1000 2 rsh bin -- 0b10 end
func ScientificNotation ¶
oper scientific-notation func ScientificNotation p0:Float -- Float func ScientificNotationBigInt p0:BigInt -- Float alias sn title Scientific notation
desc Formats the value *p0* using scientific notation. end
example 1234 sn -- 1.234e03 end
func Seconds ¶
oper seconds func Seconds p0:Duration -- Float title Seconds in duration
desc Converts the duration *p0* into seconds. end
example 10h20m30s -- 10h20m30s seconds -- 37230 end
func SecondsDMS ¶
oper seconds func SecondsDMS p0:DMS -- Decimal title Angle in seconds
desc Converts the angle *p0* to seconds. end
example 10d30m seconds -- 37800 end
func Sequence ¶ added in v5.5.0
oper sequence func Sequence p0:BigInt p1:BigInt -- BigInt* alias seq title Sequence of integers
desc Adds the integers from *p0* to *p1* to the stack. If *p0* is greater than *p1*, the list of integers is in decreasing order end
example 4 8 seq -- 4 | 5 | 6 | 7 | 8 c 8 4 seq -- 8 | 7 | 6 | 5 | 4 end
func Sha1 ¶ added in v5.5.0
oper sha1 func Sha1 p0:Str -- Str title SHA-1 hash function
desc Hash *p0* with the SHA-1 function. end
example 'Behind the tree! -- Behind the tree! sha1 -- 0xda6e7f530a9b42a679944f0c9fc0f86ae5534450 end
func Sha1Hmac ¶ added in v5.5.0
oper sha1hmac func Sha1Hmac p0:Str key:Str -- Str title SHA-1 keyed hash function
desc Hash *p0* with *key* using the SHA-1 function end
example 'Behind the tree!' /swordfish -- Behind the tree! | swordfish sha1hmac -- 0x75859001097e8ad6907a879d340170ef571c8e5c end
func Sha224 ¶ added in v5.5.0
oper sha224 func Sha224 p0:Str -- Str title SHA-224 hash function
desc Hash *p0* with the SHA-224 function. end
example 'Behind the tree! -- Behind the tree! sha224 -- 0x15eac2f886e0e09a44ce08da58f3386b707885150d6142d1a6e7c608 end
func Sha224Hmac ¶ added in v5.5.0
oper sha224hmac func Sha224Hmac p0:Str key:Str -- Str title SHA-224 keyed hash function
desc Hash *p0* with *key* using the SHA-224 function end
example 'Behind the tree!' /swordfish -- Behind the tree! | swordfish sha224hmac -- 0x30ecbacd9aedf890b796eb79032105382ce323f18835f9bbb3867c4a end
func Sha256 ¶ added in v5.5.0
oper sha256 func Sha256 p0:Str -- Str title SHA-256 hash function
desc Hash *p0* with the SHA-256 function. end
example 'Behind the tree! -- Behind the tree! sha256 -- 0x5e19fc5f8ec2aabccef7970385bb9151a421f398d048ced2b2c86757aafebfc3 end
func Sha256Hmac ¶ added in v5.5.0
oper sha256hmac func Sha256Hmac p0:Str key:Str -- Str title SHA-256 keyed hash function
desc Hash *p0* with *key* using the SHA-256 function end
example 'Behind the tree!' /swordfish -- Behind the tree! | swordfish sha256hmac -- 0x0155d56d7485e9db843792ff48b97a1a96ae0655a92ad7c2324d71ed0410b907 end
func Sha384 ¶ added in v5.5.0
oper sha384 func Sha384 p0:Str -- Str title SHA-384 hash function
desc Hash *p0* with the SHA-384 function. end
example 'Behind the tree! -- Behind the tree! sha384 -- 0x54489c547782d201bb0c8c2c81e77e034695067c98087bd949d13de752dd3843323c7244c1d15776ad52093598420dca end
func Sha384Hmac ¶ added in v5.5.0
oper sha384hmac func Sha384Hmac p0:Str key:Str -- Str title SHA-384 keyed hash function
desc Hash *p0* with *key* using the SHA-384 function end
example 'Behind the tree!' /swordfish -- Behind the tree! | swordfish sha384hmac -- 0x401d0de7dd5cdf1ed82002cc1a696ec8d3d636b0388b89cc6f33ec4b237382a16b976f4773c3b0a3979392289a0ceaf9 end
func Sha512 ¶ added in v5.5.0
oper sha512 func Sha512 p0:Str -- Str title SHA-512 hash function
desc Hash *p0* with the SHA-512 function. end
example 'Behind the tree! -- Behind the tree! sha512 -- 0x431777a80ed22c45b4fe0dc8c7e3a07d8d20df3b796a39068f2fc6f57cd69b6c60f4a6e3151189b97a1ad2fe5888c255e93f28c1e6c9b6f0241b10c34f8f9e86 end
func Sha512Hmac ¶ added in v5.5.0
oper sha512hmac func Sha512Hmac p0:Str key:Str -- Str title SHA-512 keyed hash function
desc Hash *p0* with *key* using the SHA-512 function end
example 'Behind the tree!' /swordfish -- Behind the tree! | swordfish sha512hmac -- 0x8e4074cf371bc7e83cd508e9a3d4c0ecd9e014aa808f3234b05de26ddad9895ad6d375651b3ac8231806ccd0b9cd477f3df024c1ecd75032a0e827e7f2f98fcf end
func Shuffle ¶
oper shuffle func Shuffle Val* -- Val* title Shuffle the stack
desc Shuffle the stack. end
example 0 rand-seed -- *seed set to 0* 1 2 3 4 5 6 -- 1 | 2 | 3 | 4 | 5 | 6 shuffle -- 5 | 4 | 1 | 3 | 2 | 6 end
func SignBigFloat ¶
func SignBigInt ¶
oper sign func SignBigInt p0:BigInt -- Int func SignDecimal p0:Decimal -- Int func SignBigFloat p0:BigFloat -- Int func SignFloat p0:Float -- Int func SignRational p0:Rational -- Int title Sign
desc Returns `-1` if *p0* is negative, `1` if *p0* is positive, or `0` if *p0* is zero. end
example c -6 sign -- -1 c 6 sign -- 1 c 0 sign -- 0 end
func SignDecimal ¶
func SignRational ¶
func SinComplex ¶
oper sin func SinComplex p0:Complex -- Complex title Sine
desc Sine of *p0*. end
example 2+2i sin 5 round -- 3.42095-1.50931i end
func SinFloat ¶
oper sin func SinFloat p0:Float -- Float title Sine
desc Sine of *p0* in radians. end
example 2 sin 5 round -- 0.9093 end
func SinhComplex ¶
oper sinh func SinhComplex p0:Complex -- Complex title Hyperbolic sine
desc Hyperbolic sine of *p0*. end
example 2+2i sinh 5 round -- -1.50931+3.42095i end
func SinhFloat ¶
oper sinh func SinhFloat p0:Float -- Float title Hyperbolic sine
desc Hyperbolic sine of *p0* in radians. end
example 2 sinh 5 round -- 3.62686 end
func Size ¶
oper size func Size Val* -- Val* n:Int title Size of the current stack alias n
desc Number of items on the stack. end
example 1 1 1 1 -- 1 | 1 | 1 | 1 n -- 1 | 1 | 1 | 1 | 4 # size end
func Sort ¶
oper sort func Sort Val* -- Val* title Type-aware stack sort
desc Sorts the stack in a type-aware way. When two elements on the stack are compared for their sort order, a common type between those values is found and the comparison operation uses that type. If a common type cannot be found, the comparison is performed as plain text. Use `sort-str` to treat all values on the stack as strings. end
example c 3 1 2 sort -- 1 | 2 | 3 c 003 01.1 2 sort -- 01.1 | 2 | 003 end
func SortStr ¶
oper sort-str func SortStr Val* -- Val* title String based stack sort
desc Sorts the stack by their values as strings. Use `sort` for a type-aware sort. end
example c 003 01.1 2 sort-str -- 003 | 01.1 | 2 end
func Split ¶
oper split func Split p0:Str sep:Str -- Str* title Split string
desc Split *p0* into multiple strings that are separated by *sep*. end
example 128.8.74.2 -- 128.8.74.2 '.' split -- 128 | 8 | 74 | 2 end
func SplitBits ¶ added in v5.5.0
oper split-bits func SplitBits p0:BigInt n:Int -- BigInt* alias splitb title Split a binary number by bit width
desc Split *p0* every *n* bits starting with the least significant bit. end
example c 0xabcd 4 splitb /hex map -- 0xa | 0xb | 0xc | 0xd c 0xabcd 8 splitb /hex map -- 0xab | 0xcd end
func SqrtBigFloat ¶
oper sqrt func SqrtFloat p0:Float -- Float func SqrtBigFloat p0:BigFloat -- BigFloat func - p0:Float -- Complex func SqrtComplex p0:Complex -- Complex alias square-root title Square root
desc The square root of *p0*. If *p0* is a positive or zero then a Float is returned. If *p0* is negative, a Complex is returned. end
example 256 -- 256 sqrt -- 16 end
func SqrtComplex ¶
func Store ¶
oper store func Store Val* -- Val* alias st title Store stack to memory
desc Store a copy of the current stack to memory for later recall. Memory is also a stack so that multiple stacks can be stored at one time. end
example 1 2 3 4 store average -- 2.5 recall -- 1 | 2 | 3 | 4 | 2.5 end
func SubBigFloat ¶
func SubBigInt ¶
oper sub func SubBigInt p0:BigInt p1:BigInt -- BigInt func SubDecimal p0:Decimal p1:Decimal -- Decimal func SubBigFloat p0:BigFloat p1:BigFloat -- BigFloat func SubFloat p0:Float p1:Float -- Float func SubRational p0:Rational p1:Rational -- Rational func SubComplex p0:Complex p1:Complex -- Complex alias s alias - title Subtraction
desc Subtract *p1* from *p0*. end
example 6 -- 6 2 -- 6 | 2 s -- 4 end
func SubComplex ¶
func SubDateTime ¶
func SubDateTimeDuration ¶
func SubDecimal ¶
func SubDuration ¶
oper sub func SubDuration p0:Duration p1:Duration -- Duration func SubDateTimeDuration p0:DateTime p1:Duration -- Duration func SubDateTime p0:DateTime p1:DateTime -- Duration alias s alias - title Time or duration subtraction desc Subtracts a duration from a time or subtracts two durations. end
example c 3:30pm 2h sub -- Mon Jan 2 2006 1:30:00pm -0700 MST c 2h30m 45m sub -- 1h 45m c 3:30pm 1:30pm sub -- 2h end
func SubRational ¶
func Swap ¶
oper swap func Swap p0:Val p1:Val -- p1:Val p0:Val alias sw title Swap top two items on the stack
desc Swap the first two items on the stack. end
example 1 2 -- 1 | 2 swap -- 2 | 1 swap -- 1 | 2 end
func Take ¶
oper take func Take Val* n:Int -- Val* title Take elements from the stack
desc Take the top *n* elements from the stack and discard the rest. end
example 1 2 3 4 5 -- 1 | 2 | 3 | 4 | 5 2 take -- 4 | 5 end
func TanComplex ¶
oper tan func TanComplex p0:Complex -- Complex title Tangent
desc Tangent of *p0*. end
example 2+2i tan 5 round -- -0.02839+1.02384i end
func TanFloat ¶
oper tan func TanFloat p0:Float -- Float title Tangent
desc Tangent of *p0* in radians. end
example 2 tan 5 round -- -2.18504 end
func TanhComplex ¶
oper tanh func TanhComplex p0:Complex -- Complex title Hyperbolic tangent
desc Hyperbolic tangent of *p0*. end
example 2+2i tanh 5 round -- 1.02384-0.02839i end
func TanhFloat ¶
oper tanh func TanhFloat p0:Float -- Float title Hyperbolic tangent
desc Hyperbolic tangent of *p0* in radians. end
example 2 tanh 5 round -- 0.96403 end
func Time ¶
oper time func Time p0:DateTime -- Time title Formats to a common time layout
desc Formats a date/time with the common time layout. Date information, if any, is discarded. end
example '2006-01-02T15:04:05 UTC -- 2006-01-02T15:04:05 UTC time -- 3:04:05pm UTC end
func TimeZone ¶
oper timezone func TimeZone p0:DateTime zone:Str -- DateTime alias tz title Convert time to another time zone
desc Converts time *p0* to a given time *zone*. end
example now -- Mon Jan 2 2006 3:04:05pm -0700 MST [PST] tz -- Mon Jan 2 2006 2:04:05pm -0800 PST Asia/Jakarta tz -- Tue Jan 3 2006 5:04:05am +0700 WIB end
func Tone ¶
oper tone func Tone p0:Str tone:Int -- Str title Apply a skin tone to an emoji
desc Apply a skin *tone*, an integer between 1 and 5 inclusive, to the first character in *p0* which should be an emoji that supports a skin tone. end
example :waving-hand: -- 👋 2 tone -- 👋🏽 end
func UTF8Decode ¶
oper utf8-decode func UTF8Decode p0:BigInt -- Str alias u8de title Decode UTF-8 bytes
desc Decode UTF-8 bytes in *p0* into to a string. end
example 0x3534c2b0 -- 0x3534c2b0 utf8-decode -- 54° end
func UTF8Encode ¶
oper utf8-encode func UTF8Encode p0:Str -- BigInt alias u8en title Encode UTF-8 bytes
desc Encode a string into UTF-8 bytes. end
example 54° -- 54° utf8-encode hex -- 0x3534c2b0 end
func UTM ¶
oper epsg.utm func UTM p0:Str -- Str title Universal Transverse Mercator (WGS-84)
desc The EPGS code for the given UTM zone *p0*. The zone should be a number between 1 and 60 inclusive and is followed by a hemisphere designator of 'n' or 's'. end
example 17n epsg.utm -- EPSG:32617 end
func Unescape ¶ added in v5.10.0
oper unescape func Unescape p0:Str -- Str alias unesc title Unescape
desc Unescapes characters in a string value that are prefixed by a backslash. The escape sequences as defined for Go strings are used. A value such as `\n` is converted to a new line. Values such as `\x7f`, `\u007f`, '\U0000007f`, and `\077` are converted to the characters of that code point. end
example "\u65e5\u672c\u8a9e" -- \u65e5\u672c\u8a9e unescape -- 日本語 c "\U000065e5\U0000672c\U00008a9e" -- \U000065e5\U0000672c\U00008a9e unescape -- 日本語 c "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e" -- \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e unescape -- 日本語 end
func Up ¶
oper up func Up Val* -- Val* title Rotate items upward
desc Rotate items on the stack by moving upward.
In the interactive calculator, the top of the stack is towards the bottom of the terminal so upwards means seeing all items move toward the top. The bottom of the stack wraps around to be the top of the stack. end
example 1 2 3 -- 1 | 2 | 3 up -- 2 | 3 | 1 up -- 3 | 1 | 2 end
func Upper ¶
oper upper func Upper p0:Str -- Str title Uppercase
desc Convert string *p0* to uppercase. end
example 'AbCd -- AbCd upper -- ABCD end
func VariancePop ¶
oper variance-pop func VariancePop BigInt* -- BigInt func - Decimal* -- Decimal func - Float* -- Float func - Rational* -- Rational alias var-p title Population variance
desc Variance of the stack where it contains the entire population end
example 2 4 4 4 5 5 7 9 -- 2 | 4 | 4 | 4 | 5 | 5 | 7 | 9 var-p -- 4 end
func VarianceSamp ¶
oper variance-samp func VarianceSamp BigInt* -- BigInt func - Decimal* -- Decimal func - Float* -- Float func - Rational* -- Rational alias var-s title Sample variance
desc Variance of the stack where it contains a sample of the population end
example 2 4 4 4 5 5 7 9 -- 2 | 4 | 4 | 4 | 5 | 5 | 7 | 9 var-s 2 round -- 4.57 end
Types ¶
This section is empty.