1
if the modification time of the file with name
filename1 is more recent than that of the file with name
filename2 or if the file with name filename2 does not
exist. Returns 0 otherwise.
%listSearch(%list(a,bb,ccc,dddd),%lambda(e,%[%slength(%e)>=3])) => 2
equal
to value. Example:
%listIndexOf(%list(a,b,c,d),b) => 1
listMap
creates a new list by applying mapping
element-wise to the elements of the lists and storing the results
in the corresponding elements of the resulting list. Example:
%listMap(%lambda(a,b,%[a+b]),%list(2,5,7),%list(4,2,9)) => %list(%'6',%'7',%'16')
0
, returns zero. Otherwise,
accumulates all elements of list through accumulator, which
must be a closure taking two arguments, in a left-associative
way. Examples:
%listLeftAccumulate(%lambda(a,b,%[a+b]),%list(1,2,3),0) => 6 %listLeftAccumulate(%lambda(a,b,acc%'('%a%','%b%')'), %list(a,b,c),zero) => acc(acc(a,b),c)
0
, returns zero. Otherwise,
accumulates all elements of list through accumulator, which
must be a closure taking two arguments, in a right-associative
way. Examples:
%listRightAccumulate(%lambda(a,b,acc%'('%a%','%b%')'), %list(a,b,c),zero) => acc(a,acc(b,c))
%listJoin(:,%list(the,quick,brown,fox)) => the:quick:brown:fox
Time values are represented in chpp
by hashes containing values
for some of the following keys:
year
month
day
hour
minute
second
$
), followed by any of the following
characters is treated specially:
$
$
.
d
1
for
the first day of the month.
m
1
for January.
b
B
Y
H
0
to 23
).
M
0
to 59
).
S
0
to 59
).
Example:
%timeToString($d $B $Y,%hash(day,29,month,12,year,1975)) => 29 December 1975
%encode(%timeFromString($d $B $Y,29 December 1975)) => %hash(%'year',%'1975',%'day',%'29',%'month',%'12')
This section describes chpp
's interface to relational databases,
called chdbc
(chpp
Database Connectivity). The interface
is a layer above the client libraries for the various database servers,
making it thus transparent to the user which database she is using.
Connections and results are represented by abstract datatypes. When
passing a connection or result to a chdbc
macro, do always pass
the value which was returned by the creating macro, not a copy (i.e. use
the reference form of variable access (see section Accessing Variables) to
pass connection and result parameters).
Drivers are currently implemented for mSQL and MySQL. The latter takes
a connection hash with keys user
and password
.
chdbc:
drivername://
hostname[:
port]/
dbname/
. A
valid example would be chdbc:mysql://localhost/test/
. hash
must be hash containing information required by the driver to connect to
the server, e.g. username and password. sqlConnect
returns a
value representing the connection to the server or a boolean value of
FALSE if the connection could not be made.
timeformat
$H:$M:$S
.
dateformat
$Y-$m-$d
.
datetimeformat
$Y-$m-$d $H:$M:$S
.
sqlQuery
, in the form of a list. Each row in this list is
represented as a hash whose keys are the column names of the
result. Values for columns representing time (time
, date
and datetime
) are automatically converted to chpp
's time
format (see section `time.chh').
type
The package `cgi.chh' provides rudimentary support for CGI scripting.
application/x-www-form-urlencoded
(both GET
and POST
) and multipart/form-data
.
Go to the first, previous, next, last section, table of contents.