vipsi - the friendly vip script interpreter

Operators

Automatic type casting

Vipsi command syntax: Operators
Operators
Glossary: Operator
Operators
which only take one type of Vipsi command syntax: Arguments
Glossary: Arguments
argument
Flow control: try … thentry their best, to Text functions: convert
Instructions: convert
convert
any type of Vipsi command syntax: Arguments
Glossary: Arguments
argument
to Flow control: if … then
Flow control: try … then
the
required type. In Operators: Add "+"addition, Flow control: if … thenif a Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
is supplied to an Vipsi command syntax: Operators
Operators
Glossary: Operator
operator
which takes no Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
lists
, Flow control: if … then
Flow control: try … then
then
Flow control: if … then
Flow control: try … then
the
operation is applied to all items in Flow control: if … then
Flow control: try … then
the
Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
.

Type casting

Numeric addition
vipsi> 123 + "456"  579
vipsi> "47" + "11"  58
vipsi> 1000 + "abc"
***** Operators: Bitwise Not "~"
Operators: Boolean Negation "!"
not
a Glossary: number, num_valnumber
vipsi> 1000 + "abc"

Operators: Bitwise Not "~"
Operators: Boolean Negation "!"
Not
numeric Glossary: Operator
Glossary: Operand
operands
are silently converted to Glossary: number, num_valnumber. Flow control: if … thenIf conversion fails, an error is generated Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
Flow control: if … then
Flow control: try … then
the
program aborts, except Flow control: if … thenif you catch Flow control: if … then
Flow control: try … then
the
error with Flow control: try … thentry.

Text concatenation
123 # "456"  = "123456"
50 # 6000    = "506000"

Flow control: if … then
Flow control: try … then
The
non-text Glossary: Operator
Glossary: Operand
operands
are silently converted Text functions: stringto text.

List concatenation
123 ## {4,5,6}  =  { 123, 4, 5, 6 }
123 ## "anton"  =  { 123, "anton" }

Non-list Glossary: Operator
Glossary: Operand
operands
are silently converted to Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
lists
.

Operators: Bitwise Not "~"
Operators: Boolean Negation "!"
Note
: you must be cautious, Flow control: if … thenif you want to append a Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
as Instructions: newnew item to another Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
, that you don't append Flow control: if … then
Flow control: try … then
the
contents of Flow control: if … then
Flow control: try … then
the
Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
. see --> Operators: Append List to Variable "##="concatenate lists.

No automatic type casting for comparisons

Operators: Automatic type castingAutomatic type casting is Operators: Bitwise Not "~"
Operators: Boolean Negation "!"
not
performed for comparison Vipsi command syntax: Operators
Operators
Glossary: Operator
operators
. There are ambiguities which can't be resolved. Flow control: if … thenIf Glossary: Valuevalues of different Data Types
Invariants: Data types
data type
are compared Flow control: if … then
Flow control: try … then
then
an error is generated.

Expanded operation on list:

Numeric addition, one argument is a list
123 + {4,5,6}  =  {127,128,129}

Flow control: if … then
Flow control: try … then
The
operation is performed on every item of Flow control: if … then
Flow control: try … then
the
Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
.

Numeric addition, both arguments are lists
{1,2,3} + {4,5,6}  =  {5,7,9}

Flow control: if … then
Flow control: try … then
The
operation is performed on every pair of matching Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
items. Excess items on either side are left as is.

List expansion for boolean and triadic selection operators

Boolean Vipsi command syntax: Operators
Operators
Glossary: Operator
operators
&& Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
|| Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
Flow control: if … then
Flow control: try … then
the
Operators: Select "? :"triadic operator ?: are Operators: Bitwise Not "~"
Operators: Boolean Negation "!"
not
yet expanded for Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
Vipsi command syntax: Arguments
Glossary: Arguments
arguments
. (Version 0.8.7)

No List expansion for comparisons

Comparison Vipsi command syntax: Operators
Operators
Glossary: Operator
operators
are Operators: Bitwise Not "~"
Operators: Boolean Negation "!"
not
expanded for Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
lists
because comparison Vipsi command syntax: Operators
Operators
Glossary: Operator
operators
generally don't Text functions: convert
Instructions: convert
convert
their arguments, Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
you Flow control: do … loopdo can Operators: Comparisons > < >= <= != ==compare Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
lists
. So either you pass two Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
lists
Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
they are compared as entities, returning a boolean Glossary: Valuevalue of 0 Operators: Boolean Or with Variable "||="
Operators: Bitwise Or with Variable "|="
Operators: Bitwise Or "|"
Operators: Boolean Or "||"
or
1, Operators: Boolean Or with Variable "||="
Operators: Bitwise Or with Variable "|="
Operators: Bitwise Or "|"
Operators: Boolean Or "||"
or
Flow control: if … then
Flow control: try … then
the
comparison Vipsi command syntax: Operators
Operators
Glossary: Operator
operators
complain about mixed Data Types
Invariants: Data types
data types
.

Valid HTML   Valid CSS