9 Core Library Reference

A significant part of Wafl core library is presented in the previous chapters. Here we present a complete core library reference in a compact form. The functions and operators are listed in alphabetical order, organized by main sections. For each function its type and short description are specified.

Wafl interpreter can list all supported functions and operators. To get a compact list run:

clwafl -listlib

For more detailed list run:

clwafl -listlib -verbose

To find all functions with a substring str in their name run:

clwafl -listlib:str

or:

clwafl -listlib:str -verbose

For more details see Command Line Reference.

9.1 Main Library

Function / Type and Description

! A

(Bool -> Bool)
Boolean negation.

% A

(List['1] -> List['1])
Get a list tail.

* A

(List['1] -> '1)
Get a list head. Not defined on empty list.

- A

(Numeric['1] -> Numeric['1])
Unary negation operator.

A != B

('1 * '1 -> Bool)
Inequality comparison operator.

A $

('1 -> String)
Converts a value to a string.

A % B

(Int * Int -> Int)
Integer modulus.

A %% B

(Int * Int -> Int)
Integer modulus. Always positive.

A & B

(Int * Int -> Int)
Integer binary conjunction.

A && B

(Bool * Bool -> Bool)
Boolean conjunction.

A * B

(Numeric['1] * Numeric['1] -> Numeric['1])
Binary subtraction operator.

A ** B

(Numeric['1] * Numeric['1] -> Numeric['1])
Power operator: A ** B = A to the power of B

A + B

(Value['1] * Value['1] -> Value['1])
Binary addition operator.

A ++ B

(List['1] * List['1] -> List['1])
Append the second list elements to the first one.

A - B

(Numeric['1] * Numeric['1] -> Numeric['1])
Binary subtraction operator.

A .. B

(Int * Int -> List[Int])
Create a list of integers in the range:
    2..5 = [2,3,4,5]

A / B

(Numeric['1] * Numeric['1] -> Numeric['1])
Binary division operator.

A : B

('1 * List['1] -> List['1])
List construction operator.

A < B

(Value['1] * Value['1] -> Bool)
Check if A is less than B.

A << B

(Int * Int -> Int)
Integer left shift operator.

A <= B

(Value['1] * Value['1] -> Bool)
Check if A is less than or equal to B.

A = B

('1 * '1 -> Bool)
Equality comparison operator.

A > B

(Value['1] * Value['1] -> Bool)
Check if A is greater than B.

A >= B

(Value['1] * Value['1] -> Bool)
Check if A is greater than or equal to B.

A >> B

(Int * Int -> Int)
Integer right shift operator.

A | B

(Int * Int -> Int)
Integer binary disjunction.

A || B

(Bool * Bool -> Bool)
Boolean disjunction.

A[ : B ]

(SequenceStr['2]['1] * Int -> SequenceStr['2]['1])
Extracts a prefix of the sequence with N elements:
    seq[:N]

A[ B : C ]

(SequenceStr['2]['1] * Int * Int -> SequenceStr['2]['1])
Extracts a sequence segment from Nth to (M-1)th element:
    seq[N:M]

A[ B : ]

(SequenceStr['2]['1] * Int -> SequenceStr['2]['1])
Extracts a suffix of the sequence with N elements:
    seq[N:]

A[ B ]

(Indexable['1]['2]['3] * '2 -> '3)
Extracts an element from the indexable collection:
    col[idx]

EncodeUrlQuery

(Map[String][String] -> String)
Encode variable set for HTTP query string.

JoinValueSets

(Map[String][String] * Map[String][String] -> Map[String][String])
Joins two variable sets.

RemoveFromValueSet

(Map[String][String] * String -> Map[String][String])
Removes a variable with the given name from the variable set.

UpdateValueSet

(Map[String][String] * String * String -> Map[String][String])
Updates the variable set with given var-name and var-value..

abs

(Numeric['1] -> Numeric['1])
Absolute value.

acos

(Float -> Float)
Inverse cosine function.

append

(List['1] * List['1] -> List['1])
Append the second list elements to the first one.

asArray

(List['1] -> Array['1])
Converts a list to an array.

asBool

(Value['1] -> Bool)
Converts a value to a bool.

asChar

(PrimeNotString['1] -> String)
Converts a value to a character.

asFloat

(PrimeNotFloat['1] -> Float)
Converts a value to a float.

asInt

(PrimeNotInt['1] -> Int)
Converts a value to an integer.

asList

(Array['1] -> List['1])
Converts an array to a list.

asPreview

('1 -> String)
Converts a value to a shortened string.

asString

('1 -> String)
Converts a value to a string.

ascii

(String -> Int)
Gets ascii code of first character of the string.

aside

('1 * ('1 -> '2) -> '1)
Apply 2nd arg. to 1st, dispose result and return 1st arg:
    aside(x,fn) == fn(x).return(x)

asin

(Float -> Float)
Inverse sine function.

atan

(Float -> Float)
Inverse tangent function.

atan2

(Float * Float -> Float)
Inverse tangent function:
    atan2(y,x) = atan(y/x)

ceil

(Float -> Int)
Rounds a float to a closest greater or equal integer.

contains

(Sequence['2]['1] * '1 -> Bool)
Checks if the element is in the sequence:
    seq.contains(el)

cos

(Float -> Float)
Cosine function.

count

(Sequence['2]['1] * ('1 -> Bool) -> Int)
Count the sequence elements satisfying the condition:
    count(seq,cond)

countRep

(Sequence['2]['1] -> Map['1][Int])
Create a catalog from the sequence. Keys are the distinct elements, and values are the number of occurrences.

createMap

(Array[Value['1]] * Array['2] -> Map[Value['1]]['2])
Create a catalog from given arrays.

debugIsOn

( -> Bool)
Checks if the debug mode is turned ‘on’.

debugOff

('1 -> '1)
Turns debug mode ‘off’ and returns the argument.

debugOn

('1 -> '1)
Turns debug mode ‘on’ and returns the argument.

debugState

( -> String)
Evaluates the debug state string.

dirCreate

(String -> Bool)
Create a directory.

dirDelete

(String -> Bool)
Delete a directory, if it is empty

dirExists

(String -> Bool)
Check if exists a directory with the given name.

dirFiles

(String -> List[String])
Creates a list of all files satisfying the given filter.

dirSubdirs

(String -> List[String])
Creates a list of all subdirectories satisfying the given filter.

dynSqlCommand

(String -> Bool)
Dynamic execution of SQL command given in a string.

dynSqlQuery

(String -> Record[errCode:Int, errText:String, ok:Bool, result:List[Map[String][String]]])
Dynamic execution of SQL query given in a string.

empty

(Indexable['1]['2]['3] -> Bool)
Check if the collection is empty.

exists

(Sequence['2]['1] * ('1 -> Bool) -> Bool)
Check if there is any sequence element satisfying the condition:
    exists(sequence,cond)

exp

(Float -> Float)
Exponential function.

fileDelete

(String -> Bool)
Delete a file.

fileExists

(String -> Bool)
Check if exists a file with the given name.

fileNewTempName

( -> String)
Get a new temporary file name.

fileOrDirExists

(String -> Bool)
Check if exists a file or a directory with the given name.

fileRead

(String -> String)
Read complete file to a string.

fileReadPart

(String * Int * Int -> String)
Read a part of the file, from given 0-based position and with given length in bytes:
    fileReadPart( fname, pos, bytelen )

fileSize

(String -> Int)
Returns the file size.

fileWrite

(String * String -> String)
Write string to a file and truncate old content:
    fileWrite( fname, content )

fileWriteAppend

(String * String -> String)
Write string to a file by appending to the file end.
    fileWriteAppend( fname, content )

fileWriteAppendTo

(String * String -> String)
Write string to a file by appending to the file end.
    fileWriteAppendTo( content, fname )

fileWriteTo

(String * String -> String)
Write string to a file and truncate old content:
    fileWriteTo( content, fname )

filter

(Sequence['2]['1] * ('1 -> Bool) -> Sequence['2]['1])
Extracts the sequence elements which satisfy the given condition

filterMap

(Sequence['3]['1] * ('1 -> Bool) * ('1 -> '2) -> Sequence['3]['2])
Maps a function to sequence elements which satisfy the condition.
    mapFilter(seq,cond,fn) == map(filter(seq,cond),fn)

filterN

(Sequence['2]['1] * ('1 -> Bool) * Int -> Sequence['2]['1])
Extracts at most N elements which satisfy the given condition.

filter_par

(Sequence['2]['1] * ('1 -> Bool) -> Sequence['2]['1])
Extracts the sequence elements which satisfy the given condition.

filter_seq

(Sequence['2]['1] * ('1 -> Bool) -> Sequence['2]['1])
Extracts the sequence elements which satisfy the given condition.

find

(Sequence['2]['1] * ('1 -> Bool) -> Sequence['2][Int])
Finds the indexes of the elements which satisfy the given condition.

findKey

(Map['2]['1] * '2 -> Int)
Find a position of the given key, or -1 if not found.

findN

(Sequence['2]['1] * ('1 -> Bool) * Int -> Sequence['2][Int])
Find at most N indexes of the elements which satisfy the given condition.

findValue

(Map['2]['1] * '1 -> Int)
Find a position of the given value, or -1 if not found.

floor

(Float -> Int)
Rounds a float to a closest less or equal integer.

fold

(Sequence['2]['1] * ('1 * '1 -> '1) * '1 -> '1)
Sequence folding by an associative function:
    fold == foldl == foldr

fold_par

(Sequence['2]['1] * ('1 * '1 -> '1) * '1 -> '1)
Folding of sequence elements in parallel. [‘fn’ must be associative]: [‘zero’ must be ZERO, because it can be used many times]:
    fold_par(seq,fn,zero) == foldl(seq,fn,zero) == foldr(seq,fn,zero)

fold_seq

(Sequence['2]['1] * ('1 * '1 -> '1) * '1 -> '1)
Non-parallel folding of sequence by an associative function:
    fold_seq == foldl == foldr

foldl

(Sequence['3]['2] * ('1 * '2 -> '1) * '1 -> '1)
Left associative folding of sequence elements:
    foldl([a,b,c],fn,zero) = fn(fn(fn(zero,a),b),c)

foldr

(Sequence['3]['2] * ('2 * '1 -> '1) * '1 -> '1)
Right associative folding of sequence elements:
    foldr([a,b,c],fn,zero) = fn(a,fn(b,fn(c,zero)))

forall

(Sequence['2]['1] * ('1 -> Bool) -> Bool)
Check if the given condition applies to all sequence elements:
    forall(list,cond).

forced

(List['1] -> List['1])
Returns the list, but forces any delayed evaluation.

groupBy

(Sequence['3]['1] * ('1 -> '2) -> Map['2][List['1]])
Create a catalog from the sequence. Each catalog element is a list of all elements mapped to the key value by the given function.

hasKey

(Map['2]['1] * '2 -> Bool)
Check if there is a given key in the map.

hasValue

(Map['2]['1] * '1 -> Bool)
Check if there is a given value in the map.

hd

(Sequence['1]['2] -> '2)
Get the sequence head. Not defined on empty sequence.

ifNull

(String * String -> String)
Replace null with given value:
    ifNull(x,c) = if isNull(x) then c else x

in

('1 * Sequence['2]['1] -> Bool)
Checks if the element is in the sequence:
    el.in(seq)

intRange

(Int * Int -> List[Int])
Create a list of integers in the range:
    intRange(2,5) = [2,3,4]

intRangeBy

(Int * Int * Int -> List[Int])
Create a list of integers in the given range with a given step:
    intRange(2,9,2) = [2,4,6,8]

intRangeWithLast

(Int * Int -> List[Int])
Create a list of integers in the range:
    intRangeWithLast(2,5) = [2,3,4,5]

isNull

(String -> Bool)
Check if a string represents a database NULL value.

iterate

('1 * Int * Int * ('1 * Int -> '1) -> '1)
Left associative folding of specified integers range:
    iterate(zero,2,4,fn) = fn(fn(fn(zero,2),3),4)
        = zero.fn(2).fn(3).fn(4)
        = (2..4).foldl(fn,zero)

iterateBy

('1 * Int * Int * Int * ('1 * Int -> '1) -> '1)
Left associative folding of specified integers range by step:
    iterateBy(zero,2,6,2,fn) = fn(fn(fn(zero,2),4),6)
        = zero.fn(2).fn(4).fn(6)
        = [2,4,6].foldl(fn,zero)

key

(Map['2]['1] * Int -> '2)
Get Nth key (from 0).

keys

(Map['2]['1] -> Array['2])
Get map keys.

leftAggregate

(Sequence['3]['2] * ('1 * '2 -> '1) * '1 -> '1)
Left associative folding of sequence elements (foldl).

length

(Indexable['1]['2]['3] -> Int)
Get the collection size.

ln

(Float -> Float)
Natural logarithm.

log

(Float -> Float)
Logarithm for base 10.

log2

(Float -> Float)
Logarithm for base 2.

longerThan

(List['1] * Int -> Bool)
Check if list has more elements than the given integer.

map

(Sequence['2]['1] * ('1 -> '3) -> Sequence['2]['3])
Map the function to sequence elements:
    map(seq,fun)

mapIdx

(Sequence['1]['2] * (Int * '2 -> '3) -> Sequence['1]['3])
Map the function to sequence elements:
    mapIdx(seq,fun)

mapIdx_par

(Sequence['1]['2] * (Int * '2 -> '3) -> Sequence['1]['3])
Map the fun. to sequence elements (in parallel):
    mapIdx_par(seq,fun)

mapIdx_seq

(Sequence['1]['2] * (Int * '2 -> '3) -> Sequence['1]['3])
Map the function to sequence elements (non-parallel):
    mapIdx_seq(seq,fun)

map_par

(Sequence['2]['1] * ('1 -> '3) -> Sequence['2]['3])
Map the function to sequence elements (in parallel):
    map_par(seq,fun)

map_seq

(Sequence['2]['1] * ('1 -> '3) -> Sequence['2]['3])
Map the function to sequence elements (non-parallel):
    map_seq(seq,fun)

map_seq_opt

(Array[Int] * (Int -> Int) -> Array[Int])
DO NOT USE Map the function to array elements (non-parallel):
    map_seq(arr,fun)

mimeAsAttachment

(MimeResource * String -> MimeResource)
Adds the MIME resource object filename and flags it as an attachment.

mimeContent

(MimeResource -> String)
Get MIME content.

mimeFilename

(MimeResource -> String)
Get MIME filename.

mimeResource

(String * String -> MimeResource)
Creates a MIME resource object.

mimeSetFilename

(MimeResource * String -> MimeResource)
Adds the MIME resource object filename.

mimeType

(MimeResource -> String)
Get MIME resouce type.

newArray

(Int * '1 -> Array['1])
Creates an array with given number of elements of given value:
    newArray(5,'a') == [# 'a', 'a', 'a', 'a', 'a' #]

newArrayFn

(Int * (Int -> '1) -> Array['1])
Creates an array with given number of elements and computes each of the elements using given function on its index:
    newArrayFn(5,\x:x*x) == [# 0, 1, 4, 9, 16 #]

newArrayFn_par

(Int * (Int -> '1) -> Array['1])
Creates an array with given number of elements and computes each of the elements using given function on its index (in parallel):
    newArrayFn_par(5,\x:x*x) == [# 0, 1, 4, 9, 16 #]

newArrayFn_seq

(Int * (Int -> '1) -> Array['1])
Creates an array with given number of elements and computes each of the elements using given function on its index (non-parallel):
    newArrayFn_seq(5,\x:x*x) == [# 0, 1, 4, 9, 16 #]

newArrayFn_seq_opt

(Int * (Int -> '1) -> Array['1])
DO NOT USE!!! Creates an array with given number of elements and computes each of the elements using given function on its index (non-parallel):
    newArrayFn_seq_opt(5,\x:x*x) == [# 0, 1, 4, 9, 16 #]

parallel

('1 -> '1)
Mark an expression to be parallelized, if possible.

pow

(Float * Float -> Float)
Power function:
    pow(A,B) = A ** B = A to the power of B

random

(Int -> Int)
Returns a random value in range [0,A-1], or 0 for A<2.

regexMatch

(String * String -> Bool)
Check if a string matches given regular expression.

regexMatchI

(String * String -> Bool)
Check if a string matches given regular expression. Ignore letter case.

regexPos

(String * String -> Int)
Find the first regex matching position in the given string.

regexPosAll

(String * String -> List[Int])
Find all regex matching positions in the given string.

regexPosAllI

(String * String -> List[Int])
Find all regex matching positions in the given string. Ignore case.

regexPosI

(String * String -> Int)
Find the first regex matching position in the given string. Ignore case.

regexReplace

(String * String * String -> String)
Replace all matching of a regex with the given string.

regexReplaceI

(String * String * String -> String)
Replace all matching of a regex with the given string. Ignore case.

regexSearch

(String * String -> List[String])
Search for the regex matching in the given string.

regexSearchAll

(String * String -> List[List[String]])
Search for all regex matchings in the given string.

regexSearchAllI

(String * String -> List[List[String]])
Search for all regex matchings in the given string. Ignore letter case.

regexSearchI

(String * String -> List[String])
Search for the regex matching in the given string. Ignore letter case.

repeatUntil

('1 * ('1 -> '1) * ('1 -> Bool) -> '1)
Repeat the function evaluation until the condition is reached:
    repeatUntil(x,fn,cond) =
        if cond(x) then x
        else fn(x).repeatUntil(fn,cond)

return

('1 * '2 -> '2)
Evaluate both arguments, dispose the 1st result and return 2nd one.

rightAggregate

(Sequence['3]['2] * ('2 * '1 -> '1) * '1 -> '1)
Right associative folding of sequence elements (foldr).

round

(Float -> Int)
Rounds a float to a closest integer.

roundTo

(Float * Float -> Float)
Rounds a float value; 2nd arg. defines a lowest significant digit.
    roundTo( 123.456789, 0.01 ) = 123.46

sgn

(Numeric['1] -> Numeric['1])
Return sign(x) = x/abs(x) or zero if x is zero.

sin

(Float -> Float)
Sine function.

size

(Indexable['1]['2]['3] -> Int)
Get the collection size.

sort

(Sequence['2][Value['1]] -> Sequence['2][Value['1]])
Sort value sequence.

sortAscii

(Sequence['2][Value['1]] -> Sequence['2][Value['1]])
Sort string sequence by Ascii table.

sortBy

(Sequence['2]['1] * ('1 * '1 -> Bool) -> Sequence['2]['1])
Sort the sequence using given comparator.

sortUtf8

(Sequence['2][Value['1]] -> Sequence['2][Value['1]])
Sort string sequence by UTF-8 table.

sqrt

(Float -> Float)
Square root.

strBeg

(String * String -> Bool)
Check if the 2nd string is at the beginning of the 1st.

strCat

(String * String -> String)
String concatenation. Same as string addition.

strChars

(String -> List[String])
Splits a string to a list of characters.

strCountSub

(String * String -> Int)
Count occurences of substring in the given string:
    strCountSub('aaaaaA','aa') == 4

strCountSubDis

(String * String -> Int)
Count disjunct occurences of substring in the given string:
    strCountSub('aaaaaA','aa') == 2

strCountSubDisI

(String * String -> Int)
Same as strCountSubDis, but ignores letter case:
    strCountSub('aaaaaA','aa') == 3

strCountSubI

(String * String -> Int)
Same as strCountSub, but ignores letter case:
    strCountSub('aaaaaA','aa') == 5

strEncodeHtml

(String -> String)
Encodes the string for HTML.

strEncodeSql

(String -> String)
Encodes the string for SQL.

strEncodeUri

(String -> String)
Encodes the string for URI.

strEncodeWafl

(String -> String)
Encodes the string for Wafl code.

strEnd

(String * String -> Bool)
Check if the 2nd string is at the end of the 1st.

strJoin

(Sequence['1][String] * String -> String)
Joins (concatenates) a sequence of strings, adding the given separator.

strLTrim

(String -> String)
Trims all spaces from left side.

strLastPos

(String * String -> Int)
Finds last position of a substring in the string, or -1 if not found.

strLastPosI

(String * String -> Int)
Same as strLastPos, but ignores letter case.

strLeft

(String * Int -> String)
Returns first N characters of the string. If N is negative, returns all but last -N elements.

strLen

(String -> Int)
Get the string length.

strLocale

( -> String)
Get current locale name.

strLowerCase

(String -> String)
Converts all letters to lower case.

strNextLastPos

(String * String * Int -> Int)
Finds next last position of a substring in the string, before given pos.

strNextLastPosI

(String * String * Int -> Int)
Same as strNextLastPosI, but ignores letter case.

strNextPos

(String * String * Int -> Int)
Finds next position of a substring in the string, after given pos.

strNextPosI

(String * String * Int -> Int)
Same as strNextPos, but ignores letter case.

strPos

(String * String -> Int)
Finds first position of a substring in the string, or -1 if not found.

strPosI

(String * String -> Int)
Same as strPos, but ignores letter case.

strRTrim

(String -> String)
Trims all spaces from right side.

strReplace

(String * String * String * Int -> String)
Replaces Nth occurrence of substring with given string:
    strReplace('ababa','b','c',2) == 'abaca'

strReplaceAll

(String * String * String -> String)
Replaces all occurrences of substring with given string.

strReplaceAllI

(String * String * String -> String)
Same as strReplaceAll, but ignores letter case.

strReplaceI

(String * String * String * Int -> String)
Same as strReplace, but ignores letter case.

strReverse

(String -> String)
Reverses the string.

strRight

(String * Int -> String)
Returns last N characters of the string. If N is negative, returns all but first -N elements.

strSplit

(String * String -> List[String])
Splits a string to a list of string, by extracting the given separator.

strSplitLines

(String -> List[String])
Splits a string to a list of string, by extracting new-line separator.

strSplitLinesTrim

(String -> List[String])
Splits a string to a list of string, by extracting new-line separator. All spaces are trimmed from each segment from left and right side.

strSplitTrim

(String * String -> List[String])
Splits a string to a list of string, by extracting the given separator. All spaces are trimmed from each segment from left and right side.

strTrim

(String -> String)
Trims all spaces from the string.

strUpperCase

(String -> String)
Converts all letters to upper case.

sub

(SequenceStr['2]['1] * Int * Int -> SequenceStr['2]['1])
Extracts the subsequence from given 0-based position and given length:
    sub(seq,pos,len)

subList

(List['1] * Int * Int -> List['1])
Extracts the sub-list from given 0-based position and given length:
    subList(list,pos,len)

subStr

(String * Int * Int -> String)
Returns a substring from given position (from 0) and with given length.

sysEnvDetails

( -> Record[dirSep:String, maxInt:Int, minInt:Int, module:String, nlSep:String])
Get system environment description.

sysLargestFreeMemoryBlock

( -> Int)
Get current largest free memory block.

sysLastError

( -> String)
Get the last system error description, or empty string if no errors occurred.

sysLibContent

( -> String)
Print Wafl library content in a string.

tan

(Float -> Float)
Tangent function.

tl

(Sequence['1]['2] -> Sequence['1]['2])
Get the sequence tail.

toFmtJSON

('1 -> String)
Converts a value to a string in pretty JSON format.

toJSON

('1 -> String)
Converts a value to a string in JSON format.

toString

(Float * Int -> String)
Converts a value to a string with given precision.

utfAddBom

(String -> String)
Adds a UTF-8 BOM, if not already present.

utfAt

(String * Int -> String)
Returns a code point at given position, indexed by codepoints.

utfBom

( -> String)
Get UTF-8 BOM sequence.

utfChars

(String -> List[String])
Splits a string to a list of UTF-8 code points.

utfHasBom

(String -> Bool)
Check if a string begins with UTF-8 BOM.

utfIsBom

(String -> Bool)
Check if a string content is UTF-8 BOM.

utfIsValid

(String -> Bool)
Check if a string is a valid UTF-8 encoded string.

utfLeft

(String * Int -> String)
Returns first N UTF-8 code points of the string.

utfLen

(String -> Int)
Get UTF-8 length, as a number of complete code points.

utfRepInvalid

(String * String -> String)
Replace invalide code points with the given character.

utfReverse

(String -> String)
Reverses UTF-8 string.

utfRight

(String * Int -> String)
Returns last N UTF-8 code points of the string.

utfSlice

(String * Int * Int -> String)
Returns a substring between two given positions, indexing complete UTF-8 code points instead of characters.

utfSub

(String * Int * Int -> String)
Returns a substring from given position (from 0) and with given length, indexing complete UTF-8 code points instead of characters.

utfTrimBom

(String -> String)
Trims leading BOM, if present.

value

(Map['2]['1] * Int -> '1)
Get Nth value.

values

(Map['2]['1] -> Array['1])
Get map values.

zip

(Sequence['4]['1] * Sequence['4]['2] -> Sequence['4][Tuple['1, '2]])
Zips two sequences to a sequence of pairs.

zipBy

(Sequence['4]['1] * Sequence['4]['2] * ('1 * '2 -> '3) -> Sequence['4]['3])
Zips two sequences by given function:
    zipBy(seq1, seq2 ,fun)

zipByIdx

(Sequence['4]['1] * Sequence['4]['2] * (Int * '1 * '2 -> '3) -> Sequence['4]['3])
Zips two sequences and indexes by given function:
    zipByIdx(seq1, seq2 ,fun)

zipWith

(Sequence['4]['1] * Sequence['4]['2] * ('1 * '2 -> '3) -> Sequence['4]['3])
Zips two sequences by given function:
    zipWith(seq1, seq2 ,fun)
[Deprecated. Use ‘zipBy’.]

~ A

(Int -> Int)
Complement bits of an integer value.

9.2 Command Line Library

Function / Type and Description

$ A

(Int -> String)
Return a command line argument:
    $1 = cmdLineArgs()[1]

cmdEcho

('1 * String -> '1)
Echo 2nd argument to the console and return the 1st argument. [Deprecated. Use ‘echoTxt’.]

cmdExecute

(String -> String)
Execute the command in the active console and return the result.

cmdLastError

( -> Int)
Get integer code of last command status.

cmdLineArgs

( -> List[String])
Return a list of command line arguments.

cmdLineArgsCount

( -> Int)
Return a number of command line arguments.

cmdPrint

(String -> String)
Write a string to the console and return the same string. [Deprecated. Use ‘echo’.]

cmdSetExitCode

('1 * Int -> '1)
Set program exit code to second argument and return the first one.

cmdShellExecute

(String -> String)
Open new shell, execute the command in it and return the result.

cmdWafl

(String * List[String] -> String)
Run Wafl program file in a command line shell with given arguments and returns the result. All arguments are passed to Wafl program. No arguments apply to interpreter. The output is redirected to the caller’s output stream.

cmdWaflSrc

(String * List[String] -> String)
Run Wafl program source in a command line shell with given arguments and returns the result. All arguments are passed to Wafl program. No arguments apply to interpreter. The output is redirected to the caller’s output stream.

cmdWaflX

(String * RecordX[]['1] -> String)
Run Wafl program file in a command line shell with given options and returns the result. Options are specified as a record fields:
    cmdLineArgs - the list of command line arguments to pass
        to the program (List[String]);
        coutFile - the full filename of the output redirection file;
        if '*null*' is specified, output is discarded;
        if empty string is specified (default),
        the caller's output stream is used .

echo

('1 -> '1)
Write the argument’s string representation to the console and return the argument:
    echo(x) == echoTxt( x, x.asString() )

echoFn

('1 * ('1 -> String) -> '1)
Apply the function to the 1st arg. and write the result to the console:
    echoFn( x, fn ) == echoTxt( x, fn(x) )

echoLn

('1 -> '1)
Write the argument’s string representation and new line to the console and return the argument:
    echoLn(x) == echoTxt( x, x.asString() + '\n' )

echoTxt

('1 * String -> '1)
Write the second argument to the console and return the first argument.

input

(String -> String)
Write a string to the console, wait for input and return it.

9.3 Web Library

Function / Type and Description

Form

( -> Map[String][String])
Get form variable set.

FormValue

(String -> String)
Get value of a given form variable.

Service

( -> Map[String][String])
Get service variable set.

ServiceValue

(String -> String)
Get value of a given service variable.

Session

( -> Map[String][String])
Get session variable set.

SessionValue

(String -> String)
Get value of a given session variable.

answerAction

( -> String)
Automatic action URI generator for forms in questions.

ask

(String -> Map[String][String])
Ask a question by sending the given page content to the client. Returns the next client’s request.

httpGet

(String -> String)
Get WWW content using HTTP/HTTPS GET method.

httpGetSize

(String -> Int)
Get WWW content length using HTTP/HTTPS HEADER method.

httpGet_callback

(String * (Int * Int -> Int) -> String)
Get WWW content using HTTP/HTTPS GET method, with progress callback

httpHost

( -> String)
Get HTTP host for current request.

httpPathInfo

( -> String)
Get HTTP path info for current request.

httpScript

( -> String)
Get HTTP script for current request.

9.4 XML Library

This library is in development phase.

Function / Type and Description

xmlParse

(String -> XmlTag)
Parse XML tag from string.

xmlParseI

(String -> XmlTag)
Parse XML tag from string, ignoring letter case.

xmlSubTags

(XmlTag -> List[XmlTag])
Get all subtags of a XML tag.

xmlSubTagsFilter

(XmlTag * String -> List[XmlTag])
Get all subtags of a XML tag with appropriate filter.

xmlTagAttr

(XmlTag * String -> String)
Get value of a XML tag attribute.

xmlTagAttrs

(XmlTag -> List[Record[name:String, value:String]])
Get all XML tag attributes.

xmlTagContent

(XmlTag -> String)
Get XML tag content.

xmlTagName

(XmlTag -> String)
Get XML tag name.

xmlValidTag

(XmlTag -> Bool)
Check is tag is valid.

9.5 Drawing Library (SDL)

This library is in early development phase.

Drawing library is Wafl graphical library based on SDL2.

It is provided as an additional binary Wafl library libwSDL and has to be explicitly included (see section Libraries) like in the following example:

sdl::newDrawing()
.fillRect(...)
...
where {
    sdl = library 'SDL';
}

Function / Type and Description

bmpHeight

(SdlBitmap -> Int)
Get bitmap height.

bmpLoadPng

(String -> SdlBitmap)
Load bitmap image from a file.

bmpSub

(SdlBitmap * Int * Int * Int * Int -> SdlBitmap)
Cut out a part of a bitmap image to a new image.

bmpWidth

(SdlBitmap -> Int)
Get bitmap width.

drawBackColor

(SdlDrawing * Int -> SdlDrawing)
Set background color.

drawBmp

(SdlDrawing * SdlBitmap * Int * Int * Int * Int -> SdlDrawing)
Add bitmap image at given rectangle.

drawBmpAt

(SdlDrawing * SdlBitmap * Int * Int -> SdlDrawing)
Add bitmap image at given position.

drawBmpFull

(SdlDrawing * SdlBitmap -> SdlDrawing)
Add bitmap image at viewport.

drawCircle

(SdlDrawing * Int * Int * Int -> SdlDrawing)
Add a circle to the drawing.

drawClear

(SdlDrawing -> SdlDrawing)
Clears the drawing.

drawEllipse

(SdlDrawing * Int * Int * Int * Int -> SdlDrawing)
Add an ellipse to the drawing.

drawFlush

(SdlDrawing -> SdlDrawing)
Flushes the drawing.

drawLine

(SdlDrawing * Int * Int * Int * Int -> SdlDrawing)
Add a line to the drawing.

drawLineFrom

(SdlDrawing * Int * Int -> SdlDrawing)
Set ‘last point’.

drawLineFromRel

(SdlDrawing * Int * Int -> SdlDrawing)
Set ‘last point’ relative to the ‘last point’.

drawLineOfPixels

(SdlDrawing * Int * Array[Int] -> SdlDrawing)
Draw a row of pixels.

drawLineTo

(SdlDrawing * Int * Int -> SdlDrawing)
Add a line from ‘last point’ to the given point.

drawLineToRel

(SdlDrawing * Int * Int -> SdlDrawing)
Add a line from ‘last point’ to the relative given point.

drawPoint

(SdlDrawing * Int * Int -> SdlDrawing)
Draw a point.

drawPointC

(SdlDrawing * Int * Int * Int -> SdlDrawing)
Draw a point.

drawRect

(SdlDrawing * Int * Int * Int * Int -> SdlDrawing)
Add a rectangle to the drawing.

drawSaveJpeg

(SdlDrawing * String * Int -> SdlDrawing)
Save to JPEG file.

drawSavePng

(SdlDrawing * String -> SdlDrawing)
Save to PNG file.

drawSetColor

(SdlDrawing * Int -> SdlDrawing)
Set line color for following elements.

drawSetLineWidth

(SdlDrawing * Int -> SdlDrawing)
Set line width.

drawSetLogicalSize

(SdlDrawing * Int * Int -> SdlDrawing)
Set logical display size.

fillRect

(SdlDrawing * Int * Int * Int * Int -> SdlDrawing)
Add a filled rectangle to the drawing.

fillRectC

(SdlDrawing * Int * Int * Int * Int * Int -> SdlDrawing)
Add a filled rectangle, with given color, to the drawing.

newDrawing

( -> SdlDrawing)
Create a new empty drawing.

9.6 Timer Library

This library is in development phase.

Timer library is Wafl library for time measuring. It is provided as an additional binary Wafl library libwTimer and has to be explicitly included (see section Libraries) like in the following example:

...
.echoTxt( tlib::start(1)$ + '\n' )
...
.echoTxt( tlib::getPartial(1)$ + '\n' )
...
.echoTxt( tlib::getPartial(1)$ + '\n' )
.echoTxt( tlib::getTotal(1)$ + '\n' )

where {
    sdl = library 'SDL';
}

Function / Type and Description

getPartial

(Int -> Float)
Get time duration in seconds from last timer activity.

getTotal

(Int -> Float)
Get time duration in seconds from first timer activity.

start

(Int -> Int)
Start or reset a timer with given id.

9.7 Edlib Library

This library is in development phase.

Edlib library is Wafl library for comparison of biological sequences, based on Edlib C++ library.

It is provided as an additional binary Wafl library libwEdlib and has to be explicitly included (see section Libraries).

Function / Type and Description

alignment

(String * String -> String)
Compute string encoded alignment of two strings.

distance

(String * String -> Int)
Compute edit-distance of two strings.

modifications

(String * String -> String)
Compute string encoded modifications positions.

modificationsLst

(String * String -> String)
Compute string encoded modifications positions list.