Table of Contents
Last update: 16.09.2025.
A large part of the Wafl core library has already been presented in the previous chapters. Here we present a more complete reference of the Wafl library in a compact form. The functions and operators are listed in alphabetical order and organized by main sections. For each function, its type and a short description are specified.
This chapter is mostly generated automatically, by processing the available information embedded in the Wafl interpreter, binary libraries and Wafl libraries. As a consequence, there may exist some formatting issues.
Wafl Core Library consists of the functions embedded in the Wafl
interpreter. The Wafl interpreter can list all supported functions and
operators. To get a compact list, use the option -listlib
or a shorthand ?
:
clwafl -listlib
clwafl ?
For more detailed report, add the option -verbose
or a
shorthand ??
:
clwafl -listlib -verbose
clwafl ??
To find all functions that have the given substring (in the following
example - str
) in their name, add the substring to the
command line:
clwafl -listlib:str
clwafl ? str
or:
clwafl -listlib:str -verbose
clwafl ?? str
For further details please consult the Command Line Reference.
Function / Type and Description
! A
(Bool -> Bool)
Negates the given logical
value.
- A
(Numeric['1] -> Numeric['1])
Unary negation
operator.
A != B
('1 * '1 -> Bool)
Not-equal-to operator.
A % B
(Int * Int -> Int)
Integer remainder
operator.
A %% B
(Int * Int -> Int)
Integer modulus operator.
Always positive.
A & B
(Int * Int -> Int)
Bitwise AND operator.
A && B
(Bool * Bool -> Bool)
Boolean conjunction
operator.
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
(Numeric['1] * Numeric['1] -> Numeric['1])
Binary subtraction operator.
A / B
(Numeric['1] * Numeric['1] -> Numeric['1])
Binary division operator.
A < B
(Value['1] * Value['1] -> Bool)
Less-than
operator.
A << B
(Int * Int -> Int)
Bitwise left shift
operator.
A <= B
(Value['1] * Value['1] -> Bool)
Less-than-or-equal-to operator.
A == B
('1 * '1 -> Bool)
Equal-to operator.
A > B
(Value['1] * Value['1] -> Bool)
Greater-than
operator.
A >= B
(Value['1] * Value['1] -> Bool)
Greater-than-or-equal-to operator.
A >> B
(Int * Int -> Int)
Integer right shift
operator.
A | B
(Int * Int -> Int)
Bitwise OR operator.
A || B
(Bool * Bool -> Bool)
Boolean disjunction
operator.
EncodeUrlQuery
(Map[String][String] -> String)
Encodes 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.
aside
('1 * ('1 -> '2) -> '1)
Applies 2nd arg. to
1st, discards the result and returns 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)
between
(Numeric['1] * Numeric['1] * Numeric['1] -> Bool)
Checks whether the 1st arg. lies between 2nd and 3rd arguments.
x.between(a,b) == x >= a and x <= b
cos
(Float -> Float)
Cosine function.
debugIsOn
( -> Bool)
Checks whether 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.
dynSqlCommand
(String -> Bool)
Executes SQL command given in a
string dynamically.
dynSqlQuery
(String -> Record[errCode:Int, errText:String, ok:Bool,
result:List[Map[String][String]]])
Executes SQL
query given in a string dynamically.
exp
(Float -> Float)
Exponential function.
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)
ln
(Float -> Float)
Natural logarithm.
log
(Float -> Float)
Logarithm to the base 10.
log2
(Float -> Float)
Logarithm to the base 2.
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.
repeatUntil
('1 * ('1 -> '1) * ('1 -> Bool) -> '1)
Repeats the function evaluation until the condition is met:
repeatUntil(x,fn,cond) =
if cond(x) then x
else fn(x).repeatUntil(fn,cond)
return
('1 * '2 -> '2)
Evaluates both arguments,
discards the 1st result and returns 2nd one.
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])
Returns sign(x) =
x/abs(x) or zero if x is zero.
sin
(Float -> Float)
Sine function.
sqrt
(Float -> Float)
Square root.
sysEnvDetails
( -> Record[dirSep:String, maxInt:Int, minInt:Int, module:String,
nlSep:String])
Returns system environment
description.
sysLargestFreeMemoryBlock
( -> Int)
Returns largest free memory block.
sysLastError
( -> String)
Returns the last system error
description, or empty string if no errors occurred.
sysLibContent
( -> String)
Prints the Wafl library content in
a string.
tan
(Float -> Float)
Tangent function.
~ A
(Int -> Int)
Bitwise NOT operator.
Function / Type and Description
A $
('1 -> String)
Converts a value to a string.
asArray
(Sequence['1]['2] -> Array['2])
Converts a
sequence 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
(Sequence['1]['2] -> List['2])
Converts a
sequence 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)
Returns ascii code of the first
character of the string.
ceil
(Float -> Int)
Rounds a float to a closest not
smaller integer.
floor
(Float -> Int)
Rounds a float to a closest not
greater integer.
round
(Float -> Int)
Rounds a float to a closest
integer.
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 float value
to a string with given precision.
Function / Type and Description
A ++ B
(SequenceStr['1]['2] * SequenceStr['1]['2] -> SequenceStr['1]['2])
Appends the the second sequence to the first sequence.
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]
append
(SequenceStr['1]['2] * SequenceStr['1]['2] -> SequenceStr['1]['2])
Appends the second sequence to the first sequence.
appendAll
(Sequence['1][SequenceStr['2]['3]] -> SequenceStr['2]['3])
Appends all sequences in the given sequence.
contains
(Sequence['2]['1] * '1 -> Bool)
Checks whether
the element is contained in the sequence:
seq.contains(el)
count
(Sequence['2]['1] * ('1 -> Bool) -> Int)
Counts the sequence elements that fulfill the condition:
count(seq,cond)
countRep
(Sequence['2]['1] -> Map['1][Int])
Creates a
catalog from the sequence. Keys are the distinct elements, and values
are the number of occurrences.
cross
(Sequence['4]['1] * Sequence['4]['2] -> Sequence['4][Tuple['1, '2]])
Crosses two sequences to a sequence of pairs.
crossBy
(Sequence['4]['1] * Sequence['4]['2] * ('1 * '2 -> '3)
-> Sequence['4]['3])
Crosses two sequences by
given function:
crossBy(seq1, seq2 ,fun)
crossByIdx
(Sequence['4]['1] * Sequence['4]['2] * (Int * '1 * Int * '2 -> '3)
-> Sequence['4]['3])
Crosses two sequences and
indexes by given function:
crossByIdx(seq1, seq2 ,fun)
empty
(Indexable['1]['2]['3] -> Bool)
Checks whether
the collection is empty.
exists
(Sequence['2]['1] * ('1 -> Bool) -> Bool)
Checks whether any sequence element fulfills the condition:
exists(sequence,cond)
filter
(Sequence['2]['1] * ('1 -> Bool) -> Sequence['2]['1])
Extracts the sequence elements that meet the given condition
filterMap
(Sequence['3]['1] * ('1 -> Bool) * ('1 -> '2) -> Sequence['3]['2])
Maps a function to sequence elements that meet the condition.
filterMap(seq,cond,fn) == map(filter(seq,cond),fn)
[Deprecated. Use selectMap
.]
filterN
(Sequence['2]['1] * ('1 -> Bool) * Int -> Sequence['2]['1])
Extracts at most N elements that meet the given condition.
[Deprecated. Use selectN
.]
filter_seq
(Sequence['2]['1] * ('1 -> Bool) -> Sequence['2]['1])
Extracts the sequence elements that meet the given condition.
[Deprecated. Use select_seq
.]
find
(Sequence['2]['1] * ('1 -> Bool) -> Sequence['2][Int])
Finds the indexes of the elements that meet the given
condition.
findEq
(Sequence['2]['1] * '1 -> Sequence['2][Int])
Finds the indexes of the elements equal to the given value.
findEqFirst
(Sequence['2]['1] * '1 -> Int)
Finds the index
of the first element equal to the given value.
findEqN
(Sequence['2]['1] * '1 * Int -> Sequence['2][Int])
Finds at most N indices of the elements equal to the given
value.
findFirst
(Sequence['2]['1] * ('1 -> Bool) -> Int)
Finds the index of the first element that meets the condition.
findN
(Sequence['2]['1] * ('1 -> Bool) * Int -> Sequence['2][Int])
Finds at most N indices of elements that meet the given
condition.
fold
(Sequence['2]['1] * ('1 * '1 -> '1) * '1 -> '1)
Returns the sequence fold by an associative function:
fold == foldl == foldr
fold_seq
(Sequence['2]['1] * ('1 * '1 -> '1) * '1 -> '1)
Non-parallel fold of sequence by an associative function:
fold_seq == foldl == foldr
foldl
(Sequence['3]['2] * ('1 * '2 -> '1) * '1 -> '1)
Returns the left associative fold 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)
Returns the right associative fold of sequence elements:
foldr([a,b,c],fn,zero) = fn(a,fn(b,fn(c,zero)))
forall
(Sequence['2]['1] * ('1 -> Bool) -> Bool)
Checks whether the given condition applies to all sequence
elements:
forall(list,cond).
groupBy
(Sequence['3]['1] * ('1 -> '2) -> Map['2][List['1]])
Creates a catalog from the sequence. Each catalog element is a list
of all elements mapped to the key value by the given function.
in
('1 * Sequence['2]['1] -> Bool)
Checks whether
the element is in the sequence:
el.in(seq)
leftAggregate
(Sequence['3]['2] * ('1 * '2 -> '1) * '1 -> '1)
Returns the left associative fold of sequence elements.[Deprecated.
Use foldl
.]
length
(Indexable['1]['2]['3] -> Int)
Returns the size
of the collection.
longerThan
(SequenceStr['1]['2] * Int -> Bool)
Checks
whether the sequence is longer than the given integer.
map
(Sequence['2]['1] * ('1 -> '3) -> Sequence['2]['3])
Maps the function to sequence elements:
map(seq,fun)
mapFilter
(Sequence['3]['1] * ('1 -> '2) * ('2 -> Bool) -> Sequence['3]['2])
Maps a function to sequence elements and filter the results.
mapFilter(seq,fn,cond) == filter(map(seq,fn),cond)
[Deprecated. Use mapSelect
.]
mapIdx
(Sequence['1]['2] * (Int * '2 -> '3) -> Sequence['1]['3])
Maps the function to sequence elements:
mapIdx(seq,fun)
mapIdx_seq
(Sequence['1]['2] * (Int * '2 -> '3) -> Sequence['1]['3])
Maps the function to sequence elements (non-parallel):
mapIdx_seq(seq,fun)
mapSelect
(Sequence['3]['1] * ('1 -> '2) * ('2 -> Bool) -> Sequence['3]['2])
Maps a function to sequence elements and filter the results.
mapSelect(seq,fn,cond) == select(map(seq,fn),cond)
map_seq
(Sequence['2]['1] * ('1 -> '3) -> Sequence['2]['3])
Maps the function to sequence elements (non-parallel):
map_seq(seq,fun)
map_seq_opt
(Array[Int] * (Int -> Int) -> Array[Int])
DO
NOT USE Maps the function to array elements (non-parallel):
map_seq(arr,fun)
nonEmpty
(Indexable['1]['2]['3] -> Bool)
Checks whether
the collection is non-empty.
rightAggregate
(Sequence['3]['2] * ('2 * '1 -> '1) * '1 -> '1)
Returns the right associative fold of sequence
elements.[Deprecated. Use foldr
.]
select
(Sequence['2]['1] * ('1 -> Bool) -> Sequence['2]['1])
Extracts the sequence elements that meet the given condition
selectByIdx
(Sequence['2]['1] * Sequence['2][Int] -> Sequence['2]['1])
Extracts the sequence elements with given indexes.
selectDistinct
(Sequence['2]['1] -> Sequence['2]['1])
Extracts
the locally distinct sequence elements.
selectFrom
(Sequence['2]['1] * ('1 -> Bool) -> Sequence['2]['1])
Extracts the sequence elements, from the first one that satisfies
the condition, until the end.
selectMap
(Sequence['3]['1] * ('1 -> Bool) * ('1 -> '2) -> Sequence['3]['2])
Maps a function to sequence elements that meet the condition.
selectMap(seq,cond,fn) == map(select(seq,cond),fn)
selectN
(Sequence['2]['1] * ('1 -> Bool) * Int -> Sequence['2]['1])
Extracts at most N elements that meet the given condition.
selectTrue
(Sequence['2]['1] * Sequence['2][Bool] -> Sequence['2]['1])
Extracts the sequence elements for which the corresponding flag is
true.
selectUntil
(Sequence['2]['1] * ('1 -> Bool) -> Sequence['2]['1])
Extracts the sequence elements from the first one until the one
satisfying the condition.
selectWhile
(Sequence['2]['1] * ('1 -> Bool) -> Sequence['2]['1])
Extracts the sequence elements from the first one until the one not
satisfying the condition.
select_seq
(Sequence['2]['1] * ('1 -> Bool) -> Sequence['2]['1])
Extracts the sequence elements that meet the given condition.
size
(Indexable['1]['2]['3] -> Int)
Returns the size
of the collection.
sort
(Sequence['2][Value['1]] -> Sequence['2][Value['1]])
Sorts value sequence.
sortAscii
(Sequence['1][String] -> Sequence['1][String])
Sorts string sequence by Ascii table.
sortBy
(Sequence['2]['1] * ('1 * '1 -> Bool) -> Sequence['2]['1])
Sorts the sequence using given comparator.
sortUtf8
(Sequence['1][String] -> Sequence['1][String])
Sorts string sequence by UTF-8 table.
strLen
(String -> Int)
Returns the length of the
character string.
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)
[Deprecated. Use
sub
.]
subStr
(String * Int * Int -> String)
Returns a
substring from given position (from 0) and with given length.
[Deprecated. Use sub
.]
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
.]
Function / Type and Description
% A
(List['1] -> List['1])
Extracts a list tail.
* A
(List['1] -> '1)
Extracts a list head. Not
defined for empty list.
A .. B
(Int * Int -> List[Int])
Returns the list of
integers in the range:
2..5 = [2,3,4,5]
A : B
('1 * List['1] -> List['1])
Operator that
constructs a new list from the given head and tail.
forced
(List['1] -> List['1])
Returns the list, but
forces any delayed evaluation.
hd
(List['1] -> '1)
Extracts the list head. Not
defined for empty list.
intRange
(Int * Int -> List[Int])
Returns the list of
integers in the range:
intRange(2,5) = [2,3,4]
intRangeBy
(Int * Int * Int -> List[Int])
Returns the list
of integers in the given range with a given step:
intRangeBy(2,10,2) = [2,4,6,8]
intRangeWithLast
(Int * Int -> List[Int])
Returns the list of
integers in the range:
intRangeWithLast(2,5) = [2,3,4,5]
tl
(List['1] -> List['1])
Extracts the list
tail.
Function / Type and Description
newArray
(Int * '1 -> Array['1])
Generates an array with
given number of elements of given value:
newArray(5,'a') == [# 'a', 'a', 'a', 'a', 'a' #]
newArrayFn
(Int * (Int -> '1) -> Array['1])
Generates 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_seq
(Int * (Int -> '1) -> Array['1])
Generates 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!!! Generates 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 #]
Function / Type and Description
ifNull
(String * String -> String)
Replaces null with
the given value:
ifNull(x,c) = if isNull(x) then c else x
isNull
(String -> Bool)
Checks whether a string is a
database NULL value.
strBeg
(String * String -> Bool)
Checks whether the 2nd
string is at the beginning of the 1st.
strCat
(String * String -> String)
String
concatenation. The same as string addition.
strChars
(String -> List[String])
Splits a string to a
list of characters.
strCountSub
(String * String -> Int)
Count occurrences of
substring in the given string:
strCountSub('aaaaaA','aa') == 4
strCountSubDis
(String * String -> Int)
Count disjunct
occurrences of substring in the given string:
strCountSub('aaaaaA','aa') == 2
strCountSubDisI
(String * String -> Int)
Same as strCountSubDis,
but ignores upper and lower case:
strCountSub('aaaaaA','aa') == 3
strCountSubI
(String * String -> Int)
Same as strCountSub,
but ignores upper and lower 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)
Checks whether the 2nd
string is at the end of the 1st.
strHasSub
(String * String -> Bool)
Checks if the string
contain the given substring.
strHasSubI
(String * String -> Bool)
Checks if the string
contain the given substring, and ignores upper and lower case.
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 upper and lower case.
strLeft
(String * Int -> String)
Returns first N
characters of the string. If N is negative, returns all but last -N
elements.
strLocale
( -> String)
Returns the 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 upper and lower 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 upper and lower 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 upper and lower 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 upper and lower case.
strReplaceI
(String * String * String * Int -> String)
Same
as strReplace, but ignores upper and lower 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 both
sides.
strUpperCase
(String -> String)
Converts all letters to upper
case.
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)
Returns UTF-8 BOM sequence.
utfChars
(String -> List[String])
Splits a string to a
list of UTF-8 code points.
utfHasBom
(String -> Bool)
Checks whether a string begins
with UTF-8 BOM.
utfIsBom
(String -> Bool)
Checks whether a string content
is UTF-8 BOM.
utfIsValid
(String -> Bool)
Checks whether 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)
Returns UTF-8 length, as a
number of complete code points.
utfLessThan
(String * String -> Bool)
String less than
operator replacement for UTF-8.
utfRepInvalid
(String * String -> String)
Replaces 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.
Function / Type and Description
regexMatch
(String * String -> Bool)
Checks whether a
string matches given regular expression.
regexMatchI
(String * String -> Bool)
Checks whether a
string matches given regular expression. Ignores upper and lower
case.
regexPos
(String * String -> Int)
Finds the first regex
matching position in the given string.
regexPosAll
(String * String -> List[Int])
Finds all regex
matching positions in the given string.
regexPosAllI
(String * String -> List[Int])
Finds all regex
matching positions in the given string. Ignores upper and lower
case.
regexPosI
(String * String -> Int)
Finds the first regex
matching position in the given string. Ignores upper and lower case.
regexReplace
(String * String * String -> String)
Replaces
all matching of a regex with the given string.
regexReplaceI
(String * String * String -> String)
Replaces
all matching of a regex with the given string. Ignores upper and lower
case.
regexSearch
(String * String -> List[String])
Searches for
the regex matching in the given string.
regexSearchAll
(String * String -> List[List[String]])
Searches
for all regex matchings in the given string.
regexSearchAllI
(String * String -> List[List[String]])
Searches
for all regex matchings in the given string. Ignores upper and lower
case.
regexSearchI
(String * String -> List[String])
Searches for
the regex matching in the given string. Ignores upper and lower
case.
Function / Type and Description
dirCreate
(String -> Bool)
Creates a directory.
dirDelete
(String -> Bool)
Deletes a directory, if it is
empty
dirExists
(String -> Bool)
Checks whether a directory with
the given name exists.
dirFiles
(String -> List[String])
Returns the list of
files that fulfill the given filter.
dirSubdirs
(String -> List[String])
Returns the list of
subdirs that fulfill the given filter.
fileDelete
(String -> Bool)
Deletes a file.
fileErrors
( -> Bool)
Checks if some errors were detected
since last reset.
fileErrorsMsgs
( -> List[String])
Returns the list of all
detected file op. error messages.
fileErrorsReset
( -> Bool)
Clears all detected error
messages.
fileExists
(String -> Bool)
Checks whether a file with the
given name exists.
fileLastError
( -> Bool)
Checks if last file op. produced
errors.
fileLastErrorMsg
( -> String)
Returns last file op. error
message, or empty string otherwise.
fileNewTempName
( -> String)
Generates a new temporary file
name.
fileOrDirExists
(String -> Bool)
Checks whether a file or a
directory with the given name exists.
fileRead
(String -> String)
Reads entire file to a
string.
fileReadPart
(String * Int * Int -> String)
Reads 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.
fileTruncate
(String -> Bool)
Truncates a file. Returns false
if truncate fails or file does not exist.
fileWrite
(String * String -> String)
Writes string to a
file and truncates old content:
fileWrite( fname, content )
fileWriteAppend
(String * String -> String)
Writes string to a
file by appending to the file end.
fileWriteAppend( fname, content )
fileWriteAppendTo
(String * String -> String)
Writes string to a
file by appending to the file end.
fileWriteAppendTo( content, fname )
fileWriteTo
(String * String -> String)
Writes string to a
file and truncates old content:
fileWriteTo( content, fname )
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. Shows single-line output and supports the input. Returns
the entire output as a 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)
Execute the command in the
active console. Shows all outputs and supports the input. Returns the
entire output as a result.
cmdWafl
(String * List[String] -> String)
Run Wafl
program file in a command line shell with given arguments and return 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 return
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 return the
result. Options are specified as a record:
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 .
conSupportsCtrlCodes
( -> Bool)
Checks whether console output
supports control codes.
echo
('1 -> '1)
Write the argument’s string
representation to the console and return the argument:
echo(x) == echoTxt( x, x.asString() )
echoCtrl
('1 * String -> '1)
Writes the second argument
to the console and return the first argument, but only if the console
terminal supports controls codes.
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' )
echoOff
('1 -> '1)
Disables console output for the
expression. Only the input
function can print the
prompt.
echoSilent
('1 -> '1)
Completely disables console output
for the expression. Even the input
function cannot print a
prompt.
echoTxt
('1 * String -> '1)
Writes 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.
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. [Deprecated. Use Curl
library.]
httpGetSize
(String -> Int)
Get WWW content length using
HTTP/HTTPS HEADER method. [Deprecated. Use Curl
library.]
httpGet_callback
(String * (Int * Int -> Int) -> String)
Get
WWW content using HTTP/HTTPS GET method, with progress callback.
[Deprecated. Use Curl
library.]
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.
mimeAsAttachment
(MimeResource * String -> MimeResource)
Adds the
MIME resource object filename and flags it as an attachment.
mimeContent
(MimeResource -> String)
Returns the MIME
content.
mimeFilename
(MimeResource -> String)
Returns the MIME
filename.
mimeResource
(String * String -> MimeResource)
Creates a MIME
resource object.
mimeSetFilename
(MimeResource * String -> MimeResource)
Adds the
MIME resource object filename.
mimeType
(MimeResource -> String)
Returns the MIME
resource type.
Function / Type and Description
filter_par
(Sequence['2]['1] * ('1 -> Bool) -> Sequence['2]['1])
Extracts the sequence elements that fulfill the given condition.
[Deprecated. Use select_par
.]
fold_par
(Sequence['2]['1] * ('1 * '1 -> '1) * '1 -> '1)
Folds the 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)
mapIdx_par
(Sequence['1]['2] * (Int * '2 -> '3) -> Sequence['1]['3])
Maps the fun. to sequence elements (in parallel):
mapIdx_par(seq,fun)
map_par
(Sequence['2]['1] * ('1 -> '3) -> Sequence['2]['3])
Maps the function to sequence elements (in parallel):
map_par(seq,fun)
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 #]
parallel
('1 -> '1)
Marks an expression to be
parallelized, if possible.
select_par
(Sequence['2]['1] * ('1 -> Bool) -> Sequence['2]['1])
Extracts the sequence elements that fulfill the given
condition.
sequential
('1 -> '1)
Force the expression to run
sequentially.
This library is currently under development.
Function / Type and Description
Binary libraries are libraries written in C/C++ and distributed with
Wafl interpreter. The Wafl interpreter can list the content of a binary
library using a library name as a listlib
option parameter
(or ?
option parameter). For more detailed report add the
-verbose
option or use ??
:
clwafl -listlib:libname
clwafl ? libname
Instead of a library name (e.g. Timer
), a filename with
or without extension can be used (libwTimer
,
libwTimer.dll
or libwTimer.so
). Option
-verbose
(or the ??
shorthand) can be used to
get a more detailed report:
clwafl -listlib:libname -verbose
clwafl ?? libname
For further details please consult the Command Line Reference.
This library is currently under development.
The Curl library is planned to be a basic Wafl interface for libCurl.
Function / Type and Description
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.
This library is currently under development.
The Curl library is planned to be a basic Wafl interface for libCurl.
Function / Type and Description
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.
This library is currently under development.
The Drawing library is a Wafl graphics library based on SDL2.
It is provided as an additional binary Wafl library
libwSDL
and must be explicitly included (see section Libraries), as in the following
example:
::newDrawing()
sdl
.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.
drawFlushClear
(SdlDrawing -> SdlDrawing)
Flushes the drawing
and returns an empty 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.
This library is currently under development.
The Timer library is a Wafl library for time measurement. It
is provided as an additional binary Wafl library libwTimer
and must be explicitly included (see section Libraries), as 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 {
tlib = library 'Timer';
}
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.
This library is currently under development.
The Edlib library is a Wafl library for comparison of biological sequences, based on the Edlib C++ library.
It is provided as an additional binary Wafl library
libwEdlib
and must 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.
Wafl libraries are libraries written in Wafl and distributed with
Wafl interpreter. The Wafl interpreter can generate a library
documentation using -doc
option with library file name, or
using ??
option:
clwafl -doc Console.wlib
clwafl ?? Console.wlib
The format of the library documentation can be selected using the
doc:<format>
option, where
<format>
can be one of markdown
,
text
and textWithColors
.
clwafl -doc:markdown Console.wlib
If no format is specified, a default format is selected depending on
the context. If the program output is redirected, markdown
is used, if the shell terminal supports ANSI colors,
textWithColors
is used, otherwise the text
format is used.
Further details can be found in the Command Line Reference.
Colors.wlib
library contains the functions for color
models conversions and handling. Each color model is based on a 32-bit
integer.
This library is currently under development.
Function / Type and Description
asString ( rgb )
(Int -> String) Convert RGB value to string.
b (
rgb )
(Int -> Int)
Extract blue component of an RGB value.
cssHex ( rgb )
(Int -> String)
Convert RGB value to CSS hex representation.
g ( rgb )
(Int -> Int)
Extract green component of an RGB value.
gray ( rgb )
(Int -> Int)
Convert RGB value to a grayscale value.
h ( rgb )
(Int -> Int)
Convert RGB color value to hue component of HSV model (HSB)
hex ( rgb )
(Int -> String)
Convert RGV value to hex representation.
hsv ( h, s, v
)
(Int * PrimeNotFloat['1] * PrimeNotFloat['2] -> Int)
Convert hsv model color value to RGB
r ( rgb )
(Int -> Int)
Extract red component of an RGB value.
rgb ( r, g, b )
(Int * Int * Int -> Int)
Construct a RGB value with givenn components.
We assume BE ordering:
rgb =
0x00RRGGBB`rgb_fromCssHex ( hex ) <br/>
(String
->
Int)<br/>
Convert
a string representation of a hex
number<br/>
to
the corresponding
color.<br/>
The
hex string must have prefix
#
.rgb_fromHex ( hex ) <br/>
(String
->
Int)<br/>
Convert
a string representation of a hex
number<br/>
to
the corresponding
color.<br/>
The
hex string may not have any
prefix.s ( rgb ) <br/>
(Int
->
Int)<br/>
Convert
RGB color value to saturation component of HSV model
(HSB)v ( rgb ) <br/>
(Int
->
Int)<br/>
Convert
RGB color value to lightness component of HSV model
(HSB)Libraries -------------------------------------------------------------------- ccc <br/>
Alias
for library Wafl_Console_Library`
Console.wlib
library contains the ANSI console control
sequences and the functions that generate ANSI console control
sequences.
This library is currently under development.
Function / Type and Description
bgSet ( n )
('1 -> String) Set background color from 256 colors palette.
bgSet24 ( r, g, b )
('1 * '2 * '3 -> String)
Set RGB background color.
charsDelete ( n )
('1 -> String)
Delete
ncharacters from the current position.
charsErase ( n )
('1 -> String)
Replace
ncharacters with blank space.
charsInsert ( n )
('1 -> String)
Insert
nblank characters to the current position.
fgSet ( n )
('1 -> String)
Set text color from 256 colors palette.
fgSet24 ( r,
g, b )
('1 * '2 * '3 -> String)
Set RGB text color.
linesDelete ( n )
('1 -> String)
Delete
nlines.
linesInsert ( n )
('1 -> String)
Insert
nblank lines.
moveCol ( col )
('1 -> String)
Move the cursor to the given column.
moveDown ( n )
('1 -> String)
Move the cursor down for
nlines.
moveDownBeg ( n )
('1 -> String)
Move the cursor down for
nlines and to the line start.
moveLeft ( n )
('1 -> String)
Move the cursor left for
ncolumns.
moveRight ( n )
('1 -> String)
Move the cursor right for
ncolumns.
moveTo
( line, col )
('1 * '2 -> String)
Move the cursor to the given position.
moveUp ( n )
('1 -> String)
Move the cursor up for
nlines.
moveUpBeg (
n )
('1 -> String)
Move the cursor up for
nlines and to the line start.
viewScrollDown ( n )
('1 -> String)
Scroll the window down and move the cursor up.
viewScrollUp ( n )
('1 -> String)
Scroll the window up and move the cursor down.
Csv.wlib
library contains the functions for CSV file
processing.
This library is currently under development.
Function / Type and Description
addUtf8Mark ( str )
(String -> String) Add UTF-8 prefix to the given string. If there is already a UTF-8 prefix, it will not add a second.
build ( lst, rowDelimiter, colDelimiter )
(Sequence['2][Sequence['1][String]] * String * String -> String)
Parse CSV content from a list of rows.
<br/> `Parses the content to a list of rows, where each row is a list of columns.` <br/> `**Note**: Assume no UTF-8 prefix is present.` parse ( body, rowDelimiter, colDelimiter ) <br/> `(String * String * String -> List[List[String]])` <br/> `Parse CSV content.` <br/>
Parses the content to a list of rows, where each row is a list of columns.
**Note**: Assume no UTF-8 prefix is present.
readFile ( filename, rowDelimiter, colDelimiter )
(String * String * String -> List[List[String]])
Read CSV file.
<br/> `Reads the file and parse it to a list of rows,` <br/> `where each row is a list of columns.` <br/> `If UTF8 file is processed, the UTF prefix is removed from the beginning.` removeUtf8Mark ( str ) <br/> `(String -> String)` <br/> `Remove UTF-8 prefix from the given string, if one exist.` utf8mark () <br/> `( -> String)` <br/> `Get UTF-8 prefix content.` <br/>
**TODO**: Not implemented, yet.
writeFile ( lst,
filename, rowDelimiter, colDelimiter )
(Sequence['2][Sequence['1][String]] * String * String * String -> String)
Write CSV file.
<br/> `Takes a list of rows, where each row is a list of columns,` <br/> `and formats it to CSV using the given delimiters.` <br/> `Finally, writes the generated document to the given file.` <br/>
**Note**: No UTF prefix is added
writeFileUtf8 (
lst, filename, rowDelimiter, colDelimiter )
(Sequence['2][Sequence['1][String]] * String * String * String -> String)
Write CSV file.
`<br/>
Takes
a list of rows, where each row is a list of
columns,<br/>
and
formats it to CSV using the given
delimiters.<br/>
Finally,
writes the generated document to the given
file,<br/>
with
a UTF-8 prefix added to the beginning.`
Paths.wlib
library contains some functions for paths
processing.
This library is currently under development.
Function / Type and Description
dirCreateAll ( dir )
(String -> Bool) Create directory and parent directories, if not exist. If './a/b/c/d' is given, all four dirs are created, if already not exist.
pathFileNoExt ( fname )
(String -> String)
Extract a filename from full path without extension.
<br/> `Assume `fname` has no '/' at the end.` <br/> `Discard path and keep extension.` pathFilePath ( fname ) <br/> `(String -> String)` <br/> `Extract a folder path from full path.` <br/>
If fname has '/' at the end, the whole string is returned.
If no slash is in the string, empty string is returned.
pathFileWithExt ( fname )
(String -> String)
Extract a filename from full path.
`<br/>
Assume
fname
has no ‘/’ at the
end.<br/>
Discard
path and keep extension.`
Replace.wlib
library contains some additional functions
for sequence element replacing. This is a temporary library. Because of
its significance, it will be implemented as a part of the core library.
It is intended to be used as Replace::...
so the names have
no replace
prefix.
Function / Type and Description
at ( seq, idxs, y )
(Sequence['2]['1] * Sequence['3][Int] * '1 -> Sequence['2]['1]) Replace all elements of a
seqat the given positions
idxsby the given value.
atFn ( seq, idxs, fn )
(Sequence['2]['1] * Sequence['3][Int] * ('1 -> '1) -> Sequence['2]['1])
Replace all elements
xof a
seqat the given positions
idxsby
fn(x).
atFnIdx ( seq, idxs, fn )
(Sequence['2]['1] * Sequence['3][Int] * (Int * '1 -> '1)
-> Sequence['2]['1])
Replace all elements
xof a
seqat the given positions
idxsby
fn(i,x).
atSeq ( seq, idxs, values )
(Sequence['2]['1] * Sequence['3][Int] * Indexable['4][Int]['1]
-> Sequence['2]['1])
Replace all elements of a
seqat the given positions
idxsby the given values.
cond ( seq, theCond, y )
(Sequence['2]['1] * ('1 -> Bool) * '1 -> Sequence['2]['1])
Replace all elements
xof a
seqthat fulfill
cond(x)by the value
y.
condFn ( seq, cond, fn )
(Sequence['2]['1] * ('1 -> Bool) * ('1 -> '1) -> Sequence['2]['1])
Replace all elements
xof a
seqthat fulfill
cond(x)by the value
fn(x).
condFnIdx ( seq, cond, fn )
(Sequence['2]['1] * (Int * '1 -> Bool) * (Int * '1 -> '1)
-> Sequence['2]['1])
Replace all elements
xof a
seqthat fulfill
cond(i,x)by the value
fn(i,x).
condIdx ( seq, cond, y )
(Sequence['2]['1] * (Int * '1 -> Bool) * '1 -> Sequence['2]['1])
Replace all elements
xof a
seqthat fulfill
cond(i,x)by the value
y.
eq ( seq, y, z )
(Sequence['2]['1] * '1 * '1 -> Sequence['2]['1])
Replace all elements of a
seqthat are equal to
yby the value
z.
Test.wlib
library contains test functions, used in Wafl
test development.
Function / Type and Description
descSection ( sectionName )
('1 -> '1) Get the section description.
descTest
( suitename, teststr, test )
('4 * '3 * RecordX[desc:'1, ok:'2]['5] -> Record[desc:'1, ok:'2, test:'3])
Get the test description.
reportResults ( x )
('1 -> '1)
Default test runner report generator.
`<br/>
Its
purpose is to make possible the direct evaluation of test
programs,<br/>
without
the runner
support.test ( arg1 ) <br/>
(’1
-> Record[desc:String,
ok:’1])<br/>
The
basic test function. Test if the argument is
true
.testDiff ( arg1, arg2 ) <br/>
(’1
* ’1 -> Record[desc:String,
ok:Bool])<br/>
Test
if the two arguments are
different.testEq ( arg1, arg2 ) <br/>
(’1
* ’1 -> Record[desc:String,
ok:Bool])<br/>
Test
if the two arguments are
equal.testEqEps ( arg1, arg2, eps ) <br/>
(Numeric[’1]
* Numeric[’1] * Numeric[’1] -> Record[desc:String,
ok:Bool])<br/>
Test
if the two float arguments are Different at most for
eps
.testFalse ( arg1 ) <br/>
(Bool
-> Record[desc:String,
ok:Bool])<br/>
Test
if the argument is
false
.testGE ( arg1, arg2 ) <br/>
(Value[’1]
* Value[’1] -> Record[desc:String,
ok:Bool])<br/>
Test
if the first argument is greater than or equal to the second
argument.testGT ( arg1, arg2 ) <br/>
(Value[’1]
* Value[’1] -> Record[desc:String,
ok:Bool])<br/>
Test
if the first argument is greater than the second
argument.testLE ( arg1, arg2 ) <br/>
(Value[’1]
* Value[’1] -> Record[desc:String,
ok:Bool])<br/>
Test
if the first argument is less than or equal to the second
argument.testLT ( arg1, arg2 ) <br/>
(Value[’1]
* Value[’1] -> Record[desc:String,
ok:Bool])<br/>
Test
if the first argument is less than the second argument.`
TestRunner.wlib
library contains functions for running
the Wafl test programs and formatting the results.
Function / Type and Description
analyzeAllTestsInFolder ( dirName, options )
(String * RecordX[reportfile:String]['1] -> List[Tuple[String, String, String, String]]) Analyze all test files in the folder. Returns a listy of tuples: [ {# fnName, fileName, sectionName, testCode #} ]
analyzeAllTestsInSubfolders ( folder, options )
(String * RecordX[reportfile:String]['1] -> List[Tuple[String, String,
String, String]])
Analyze all the tests in the folder and its subfolders.
<br/> `Returns a list of tuples:` <br/> `[ {# fnName, fileName, sectionName, testCode #} ]` analyzeSingleTest ( testFileName, options ) <br/> `(String * RecordX[reportfile:String]['1] -> List[Tuple[String, String,` <br/> `String, String]])` <br/> `Analyze single test file code.` <br/>
Returns a list of tuples:
[ {# fnName, fileName, sectionName, testCode #} ]
analyzeTestProgramCode ( prgCode, options )
(String * '1 -> List[Tuple[String, String, String]])
Extract test cases data from given program code.
<br/> `Returns a listy of tuples:` <br/> `[ {# fnName, sectionName, testCode #} ]` analyzeTestsInFile ( filename, options ) <br/> `(String * '1 -> List[Tuple[String, String, String, String]])` <br/> `Returns a listy of tuples:` <br/> `[ {# fnName, fileName, sectionName, testCode #} ]` analyzeUsageDesc () <br/> `( -> String)` <br/> `Get the default analyzer usage description.` defaultAnalyzer () <br/> `( -> String)` <br/> `Default test Analyzer` <br/>
The test analyzer is to be used as a program, i.e. to write
the programs to analyze a collection of the tests.
A typical test analyzer is implemented as follows:
<br/> `wtr::defaultAnalyzer()` <br/> `where {` <br/> `wtr = library file 'testRunner.wlib';` <br/> `}` <br/>
For details on the command line arguments,
please read
analyzeUsageDescfunction definition.
The current version processes only the functions.
The operators are not processed.
defaultRunner
()
( -> String)
Default test runner.
<br/> `The test runner is to be used as a program, i.e. to write` <br/> `the programs to run a collection of the tests.` <br/> `A typical test runner is implemented as follows:` <br/>
wtr::defaultRunner()
where {
wtr = library file 'testRunner.wlib';
}
<br/> `For details on the command line arguments,` <br/> `please read `usageDesc` function definition.` doReportRunnerResults ( testResults, repMode ) <br/> `(Sequence['4][RecordX[sectionName:String,` <br/> `tests:Sequence['2][RecordX[desc:String, ok:Bool, test:String]['1]]]['3]]` <br/> `* String -> String)` <br/> `A general test reporter.` <br/>
Generates a result report from the given testing results.
formatAnalyzerReport ( lst, options )
(Sequence['3][TupleX[String, String, String, '1]['2]]
* RecordX[detailedreport:Bool, fullreport:Bool]['4] -> String)
Format test analyzer report.
formatAnalyzerReportFull ( lst )
(Sequence['3][TupleX[String, String, String, '1]['2]] -> String)
Format test analyzer report. Full Mode.
formatAnalyzerReportShort ( lst )
(Sequence['2][TupleX[String]['1]] -> String)
Format test analyzer report. Short Mode.
nonTestedFunctionsReport ( lst )
(Sequence['2][TupleX[String]['1]] -> String)
Report on the functions without tests.
Does not check operators!
processProgramCode (
prgCode, options )
(String * RecordX[detailedreport:Bool, fullreport:Bool]['1] -> String)
Prepares a test program for evaluation.
<br/> `While any original test programs may run directly,` <br/> `it is required to process it, by replacing some of the elements` <br/> `(section names, report processing functions)` <br/> `to provide for standardized reports, in a more readable form.` programOutputHead ( kind, filename, options ) <br/> `(String * String * RecordX[reportfile:String]['1] -> String)` reportRunnerResults ( testResults ) <br/> `(Sequence['4][RecordX[sectionName:String,` <br/> `tests:Sequence['2][RecordX[desc:String, ok:Bool, test:String]['1]]]['3]]` <br/> `-> String)` <br/> `Test reporter, a basic version.` <br/>
Generates a typical result report from the given testing results.
reportRunnerResultsDetailed ( testResults )
(Sequence['4][RecordX[sectionName:String,
tests:Sequence['2][RecordX[desc:String, ok:Bool, test:String]['1]]]['3]]
-> String)
Test reporter, a detailed version.
<br/> `Generates a detail result report from the given testing results.` reportRunnerResultsFull ( testResults ) <br/> `(Sequence['4][RecordX[sectionName:String,` <br/> `tests:Sequence['2][RecordX[desc:String, ok:Bool, test:String]['1]]]['3]]` <br/> `-> String)` <br/> `Test reporter, a full version.` <br/>
Generates a full result report from the given testing results.
runAllTestsInSubfolders ( folder, options )
(String * RecordX[detailedreport:Bool, fullreport:Bool,
reportfile:String]['1] -> String)
Run all test Wafl programs in the given folder and all of its
direct subfolders, using the given options.
<br/> `No program will run in the deeper subfolders.` <br/> `It is expected that all the programs use the same test library` <br/> `to check the conditions and report results.` <br/> `The report is saved to the given report file.` runSingleTest ( testFileName, options ) <br/> `(String * RecordX[detailedreport:Bool, fullreport:Bool,` <br/> `reportfile:String]['1] -> String)` <br/> `Run single test program, using the given options.` theAnalyzer ( options ) <br/> `(RecordX[detailedreport:Bool, directory:String, file:String,` <br/> `fullreport:Bool, help:Bool, reportfile:String]['1] -> String)` <br/> `Test analyzer.` <br/>
*See
defaultAnalyzer()for details.*
theRunner ( options )
(RecordX[detailedreport:Bool, directory:String, file:String,
fullreport:Bool, help:Bool, lastreport:Bool, reportfile:String]['1]
-> String)
Test runner.
<br/> `*See `defaultRunner()` for details.*` usageDesc () <br/> `( -> String)` <br/> `Get the default runner usage description.` writeReportToFile ( report ) <br/> `(String -> String)` <br/> `Write the report to the file specified with argument `-repFile:<filename>`.` <br/>
This function evaluates as a part of the tests,
and thus requires explicit argument checking.