Stdlyb

From Swym Wiki
Jump to: navigation, search

The Swym standard library (affectionately known as Stdlyb) is a convenient collection of predefined functions and values that can be used in any Swym program.

Stdlyb comes in two levels: some built-in functionality that couldn't be implemented by users, and user-level code. The code can be viewed below:

View the user-level code for Stdlyb.

All together, Stdlyb defines the following:

[edit] Constants

true, false, void, novalues, PI.

[edit] Types

Number, Int, Value, Bool, Callable, Block, String, Array, Table, Type, Void

Type functions: Struct, Enum, Subtype, Array, Literal

[edit] Functions

Table functions (table, keys, values, inverse, select, selectWhere, frequencies, frequenciesToArray, categorize, categorizeBy)

Array accessor functions (at, atEnd, #st, #nd, #rd, #th, #stLast, #ndLast, #rdLast, last, random)

Array search & filtering functions (where, find, firstWhere, min, max, whereMin, whereMax, whereKey, firstWhereKey, distinct)

Array slicing functions (slice, starting, ending, trimStart, trimEnd, stem, middle, tail)

String functions (lowercase, uppercase, words, lines, s_plural)

Encoding and decoding functions (unicode, unicodeValue, unicodeToString, caesarEncode, caesarDecode, rot13, vigenereEncode, vigenereDecode, baseEncode, baseDecode, binaryEncode, binaryDecode, octalEncode, octalDecode, decimalEncode, decimalDecode, hexEncode, hexDecode, base64Encode, base64Decode)

Quantifier functions (some, every, none, no)

Miscellaneous array functions (array, length, each, accumulate, reduce, forEach, flatten, contains, startsWith, endsWith, splitAt, reverse, total, sum, product)

The if function.

The case function.

The + concatenation operator.

Math functions (sqrt, cos, sin, floor, ceiling, clamp, neg, degToRad, radToDeg, abs, differenceFrom)

Input and output functions (input, output, alert, print, println, trace)

Variable functions (var, ref, value)

Miscellaneous stdlyb functions (do, while, of, box, pair, for, is, in, tabulate)

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox