Ballyboden book Leinster final place with one-sided win over Garrycastle
Westmeath legend Dessie Dolan played his last game of club football this afternoon.
by Conor McKennaBallyboden St. Enda’s (Dublin) 3-14
Garrycastle (Westmeath) 0-12
Conor McKenna reports from TEG Cusack Park
BALLYBODEN ST ENDA’S booked their place in the Leinster final, following an 11 point victory over Garrycastle, in what was a one sided game of football in TEG Cusack Park.
The moment of this match arrived in the 50th minute, when Mickey Greene replaced Dessie Dolan and the latter received a standing ovation which befitted his status, as virtually everyone in the stadium stood up to applaud.
Dolan announced his retirement after the Westmeath county final and the Garrycastle contingent took one final opportunity to pay tribute to their best ever footballer.
It was a point from Dolan which opened the scoring, before Colm Basquel’s effort levelled the tie.
The first goal of the game came in the sixth minute, courtesy of Robbie McDaid, who finished to the net at the end of an excellent solo run.
Ballyboden then registered the next four points in succession to stretch their lead to seven, though Garrycastle responded with scores from Dessie Dolan and Eoin Monaghan.
Ballyboden responded with the next three points and it was tit for tat until the interval, with the Dublin side holding a 1-10 to 0-5 lead at the break.
Garrycastle scored the first three points of the second half courtesy of Dessie Dolan, with Ros McGarry opening his sides second half account with a 35th minute point.
Dessie Dolan responded with a free for Garrycastle, though that was as good as it got for the Westmeath side and the games key score may have been Colm Basquel’s 53rd minute goal, which left nine points between the teams.
James Holland added another major in the 57th minute, though the outcome of the game was long decided at that stage.
Ballyboden held out for an 11-point win and will now face Eire Og in the Leinster final, while Garrycastle must plan for 2020 without the best player they have ever produced.
Scorers for Ballyboden St Enda’s: Colm Basquel 1-3 (2fs), Robbie McDaid 1-1, James Holland 1-0, Ryan Basquel and Ross McGarry 0-3 each, Alan Flood 0-2, Conal Keaney (1f) and Darren O’Reilly 0-1 each.
Scorers for Garrycastle: Dessie Dolan 0-7 (6f), Eoin Monaghan, James Dolan, Jason Nugent, Ger Heneghan (1f) and James Sheerin 0-1 each.
Ballyboden St. Enda’s
1. Darragh Gogan
2. Bob Dwan
3. Shane Clayton
4. Kieran Kennedy
17. Sean Gibbons
6. Robbie McDaid
22. Brian Bobbett
9. Declan O’Mahoney
19. Donogh McCabe
12. Alan Flood
11. Colm Basquel
10. Darren O’Reilly
14. Ryan Basquel
15. Warren Egan
13. Ros McGarry
Subs:
8. Michael Darragh Macauley for McCabe (43)
18. Conal Keaney for Flood (45)
20. Tom Hayes for Egan (50)
21. James Holland for O’Mahoney (55)
23. Cian Murray for R Basquel (58)
26. Ciaran O’Reilly for McGarry (60)
Garrycastle
1. Sean Brennan
4. Mark McCallon
6. John Gaffey
3. Jack Donohue
9. Doron Harte
2. Matthew Guiheen
7. Gary McCallon
8. Justin Barrett
13. James Sheerin
30. Andrew Monaghan
14. Alex Gardiner
12. Michael Monaghan
11. Eoin Monaghan
5. James Dolan
15. Dessie Dolan
Subs:
23. Jason Nugent for E Monaghan (h-t)
20. Conor Cosgrove for D Dolan (50)
21. Mickey Greene for A Monaghan (50)
28. Eoin Mulvihil for Donoghue (55)
25. Ger Heneghan for M Monaghan (57)


Hey, what are you doing back here?
You don't look like you work here.  Perhaps you should head back home and I won't tell the boss.


public class Player extends BaseActor
| Modifier and Type | Field and Description |
|---|---|
static int |
BOUNDARIES_X |
static int |
BOUNDARIES_Y |
private long |
damageScreenActiveTime |
static int |
HEIGHT |
private boolean |
isHit |
private int |
life |
private static int |
MOVEMENT_SPEED |
private long |
playerStarActiveTime |
private long |
score |
private boolean |
starPickupActive |
static int |
TEXTURE_HEIGHT |
static int |
TEXTURE_WIDTH |
static int |
WIDTH |
| Constructor and Description |
|---|
Player(int x,
int y)
Creates player with default
life count of 3. |
Player(int x,
int y,
int l)
Creates player.
|
| Modifier and Type | Method and Description |
|---|---|
long |
getDamageScreenActiveTime()
Gets
damageScreenActiveTime time value. |
int |
getLife()
Gets player life.
|
long |
getPlayerStarActiveTime()
Gets
playerStarActiveTime . |
long |
getScore()
Gets player score
|
void |
hitEnemy(long t)
Sets all the values if player has been hit.
|
void |
hitLifePickup()
Performs actions that are required if
LifePickup is touched. |
boolean |
isHit()
Gets
isHit value. |
boolean |
isStarPickupActive()
Gets
starPickupActive state. |
private void |
movePlayerDown(float delta)
Decreases player y coordinates.
|
private void |
movePlayerLeft(float delta)
Decreases player x coordinates.
|
private void |
movePlayerRight(float delta)
Increases player x coordinates.
|
private void |
movePlayerUp(float delta)
Increases player y coordinates.
|
private void |
playerBoundaries()
Makes sure player does not leave game area.
|
void |
setDamageScreenActiveTime(long damageScreenActiveTime)
Sets
damageScreenActiveTime time value. |
void |
setHit(boolean hit)
Sets
isHit value. |
private void |
setLife(int l)
Sets life.
|
void |
setPlayerStarActiveTime(long playerStarActiveTime)
Sets
playerStarActiveTime . |
void |
setScore()
Adds 10 to
score . |
void |
setScore(int s)
Adds some
int to score . |
void |
setStarPickupActive(boolean starPickupActive)
Sets
starPickupActive . |
void |
update(float delta)
Update player location according to user input.
|
public static final int WIDTH
public static final int HEIGHT
public static final int TEXTURE_WIDTH
public static final int TEXTURE_HEIGHT
public static final int BOUNDARIES_X
public static final int BOUNDARIES_Y
private static final int MOVEMENT_SPEED
private int life
private long score
private long playerStarActiveTime
private long damageScreenActiveTime
private boolean starPickupActive
private boolean isHit
public Player(int x, int y)
life
count of 3.x
- player x coordinatesy
- player y coordinatespublic Player(int x, int y, int l)
x
- player x coordinatesy
- player y coordinatesl
- player life
countpublic void update(float delta)
delta
- frame delta timeprivate void movePlayerRight(float delta)
delta
- frame delta timeprivate void movePlayerLeft(float delta)
delta
- frame delta timeprivate void movePlayerUp(float delta)
delta
- frame delta timeprivate void movePlayerDown(float delta)
delta
- frame delta timeprivate void playerBoundaries()
private void setLife(int l)
l
- int
valuepublic void hitEnemy(long t)
t
- time in nanosecondspublic void hitLifePickup()
LifePickup
is touched.public long getScore()
score
public void setScore()
score
.public void setScore(int s)
int
to score
.s
- requires int
public int getLife()
life
public boolean isStarPickupActive()
starPickupActive
state.true
or false
public void setStarPickupActive(boolean starPickupActive)
starPickupActive
.starPickupActive
- true
or false
public long getPlayerStarActiveTime()
playerStarActiveTime
.public void setPlayerStarActiveTime(long playerStarActiveTime)
playerStarActiveTime
.playerStarActiveTime
- time in nanosecondspublic boolean isHit()
isHit
value.true
or false
public void setHit(boolean hit)
isHit
value.hit
- true
or false
public long getDamageScreenActiveTime()
damageScreenActiveTime
time value.public void setDamageScreenActiveTime(long damageScreenActiveTime)
damageScreenActiveTime
time value.damageScreenActiveTime
- time in nanoseconds


Status: Passed, as amended, Jun89 X3J13Issue: SUBTYPEP-TOO-VAGUE
References: CLtL p. 72-73
Category: CLARIFICATION
Edit History: Version 1, 11 Jul 1988 (Sandra Loosemore)
Version 2, 19 Jul 1988 (Sandra Loosemore)
Version 3, 6-Oct-88 (Masinter)
Version 4, 7-Oct-88 (Masinter, per Moon's comments)
Version 5, 15-Mar-89 Steele
Version 6, 2-Jul-89 Masinter (as per Jun89X3J13)
Problem Description:
[From version 4]
The description of SUBTYPEP allows it to return a second value of NIL
when the relationship between the two types cannot be determined. In
some cases this is a reasonable thing to do because it is impossible
to tell (if the SATISFIES type specifier is involved), and in other
cases the relationships between types are not well-defined (for
example, the VALUES type specifier or the list form of the FUNCTION
type specifier).
Some implementations, however, have apparently interpreted this to
mean that it is permissible for SUBTYPEP to "give up" and return a
second value of NIL in some cases where it actually would be possible
to determine the relationship. This makes it difficult to depend on
subtype relationships in portable code.
[Addition for version 5]
There are two problems with version 4. First is that of the first three
bulleted points in the version 4 proposal:
* Clarify that SUBTYPEP will return a second value of NIL
only when either of the type specifiers involves the SATISFIES, NOT,
AND, OR, MEMBER. SUBTYPEP will not return a second
value of NIL when both arguments involve only the words in Table 4-1, or
names of DEFSTRUCT- or DEFCLASS-defined types, or user-defined deftypes
that expand into only those words and/or names.
* SUBTYPEP should signal an error when handed (for either argument)
a type specifier that involves VALUES or the list form of the FUNCTION
type.
* SUBTYPEP must always return values T T in the case where the two
type specifiers (or their expansions) are EQUAL.
any two have significant overlap, and indeed all three can overlap;
version 4 contained no indication of how this conflict should be resolved.
Second is that version 4 calls for SUBTYPEP to signal an error (at least at
high safety)even when the arguments are valid type specifiers, but this can
make it harder to use SUBTYPEP. These are cases that returning NIL NIL
was supposed to cover.
This version replaces the three bulleted points above with a single point
and some observations about its consequences. This version eliminates
the requirement to signal an error.
Proposal: SUBTYPEP-TOO-VAGUE:CLARIFY-MORE
A type specifier "involves" a word like SATISFIES, MEMBER, NOT, etc.
if it either contains it directly as a type specifier,
or as the result of expansion of a DEFTYPE defined type specifier.
(While the type specifiers listed in CLtL Table 4-1 and names of
DEFSTRUCT or DEFCLASS-defined types may, in some cases, be implemented
in terms of DEFTYPE, they are to be regarded for this purpose as not
being "user-defined". Therefore, SUBTYPEP must regard elements as
primitive with respect to the question of returning NIL NIL.)
* Clarify that SUBTYPEP is permitted to return NIL NIL only when
at least one argument involves SATISFIES, AND, OR, NOT, MEMBER,
VALUES, or the list form of FUNCTION.
Note that one consequence of this is that if neither argument
involves any of these type specifiers, then SUBTYPEP is obliged
to determine the relationship accurately. In particular, SUBTYPEP
must return T T if the arguments are EQUAL and do not involve
any of the above-stated type specifiers.
* Clarify that the relationships between types reflected by SUBTYPEP
are those specific to the particular implementation. For example, if
an implementation supports only a single type of floating-point numbers,
in that implementation (SUBTYPEP 'FLOAT 'LONG-FLOAT) would return T T
(since the two types would be identical).
Rationale:
Specifying the behavior of SUBTYPEP makes it more useful. Otherwise,
programs cannot rely on any more than NIL NIL as return values.
It is generally conceded that it is impossible to determine the
relationships between types defined with the SATISFIES specifier.
MEMBER, AND, OR, and NOT are messy to deal with.
Current Practice:
The implementation of SUBTYPEP in (the original) HPCL does not try to
expand type specifiers defined with DEFTYPE and does not recognize
EQUAL type specifiers as being equivalent. Most other implementations
appear to be substantially in conformance with the proposal.
Cost to implementors:
Some implementations will have to rewrite and/or extend parts of SUBTYPEP.
Cost to users:
Its hard to imagine a portable program that depends heavily
on SUBTYPEP. This proposal does not require any implementation
to "handle" fewer cases of SUBTYPEP.
Benefits:
An area of confusion in the language is cleared up. Usages of SUBTYPEP
will be more portable.
Discussion:
The handling of FLOAT and SINGLE-FLOAT appeared to be the
consensus from a discussion on the common-lisp mailing list some
time ago.
It would not be too onerous to require implementations to handle
the cases where one but not the other type specifier involves
OR, AND, NOT or MEMBER, but the specification becomes
cumbersome.
A related issue is clarifying what kinds of type specifiers must be
recognized by functions such as MAKE-SEQUENCE and COERCE. For example,
HPCL complains that (SIMPLE-ARRAY (UNSIGNED-BYTE *) (*)) is not a valid
sequence type when passed to MAKE-SEQUENCE, although SUBTYPEP does
recognize it to be a subtype of SEQUENCE. Should this proposal be
extended to deal with these issues, or is another proposal in order?
The rules for comparing the various type specifiers (such as ARRAY)
need to be spelled out in detail.


Random spellbook/scroll generator
Wizard only
All
Cantrip
1st
2nd
3rd
4th
5th
6th
7th
8th
9th
Generate


Pollard’s rho
Consider the execution history of Pollard’s rho for factorization:
Printing the factor 73 of 1387
Pollard’s rho is the heuristic approach for finding the factors of a number n. Factorization of a number is the process of decomposing the number into the product of primes. Pollard’s rho method is the heuristic approach so there is no specified running time or the guaranteed success rate exists but its effective in practice.
POLLARD’S-RHO algorithm
1. First, initialize the variable i to 1 and assign a random value to x1 by using random number generator variable y stores the recent value of xi when where k stores the even numbers starting from 2. After that we move to the loop which iterates until we find all the factors of number n.
2. Update the value of xi by squaring its most recent value and then find the greatest common divisor d by using function gcd and check if it the required value and print it.
Execution of algorithm POLLARD-RHO for n=1387:
Initially
Until all factors of n are not found:
This process repeats 16 times yieldsand =595
So greatest common divisor
The divisors of 219 are {3, 73} and the divisors of 1387 are {19, 73}
Here 73 is the greatest common divisor of both and hence it computes.
Hence after 16 times of execution of POLLARD-RHO algorithm the value of x and y are 595 and 814 then it results in greatest common divisor 73 which is the factor of 1387.
Pollard’s rho algorithm is the best algorithm for calculating the factors of a number n.
This algorithm is based on the concept of heuristics so it always gives the best result but we can’t calculate the accurate running time of this algorithm because its loop iterates forever.
Considering t, this represents the length from the first value to the first repeated value of x in the sequence andrepresents the length of the cycle that has been produced.
For the values of t and u the algorithm of Pollard’s rho can be modified so that it returns these values at the same time when it’s calculating the factors. Algorithm is as:
POLLARD-RHO (n)
// initialize array for storing the cycle length
1.
2.
3.
4.
5. while TRUE
6.
// calculating next value of xi using recurrence
7.
// calculating greatest common divisor d
8.
// check if d is non-trivial
9. if and
10. print d
// search if d is in A or not
11. if
12. put d in
13. else if
// calculating the length of cycle u and tail
14. and
// update values of y and k for equal values of i and k
16. if
23.
24.In this algorithm first we initialize an array for the storage of cycle length, a variable i to 1 and assign a random value to by using random number generator. A variable y stores the recent value ofwhen where k stores the even numbers starting from 2.
After that we move to the loop which iterates until we find all the factors of number n.
Update the value of by squaring its most recent value and then find the greatest common divisor d by using function gcd and check if it the required value and print it. In this way all the factors of number are printed.
For running time of the algorithm we find the number of steps that are executed before the repetition of x begins and for the smallest values of t and u such that is where p is the factor of n.
Hence in the Pollard’s rho algorithm for t, the tail length and is cycle length of the rho contains their smallest values such that forthe running time is as it finds its first factor as p.
Pollard’s rho is the heuristic approach for finding the factors of a number n.
Factorization of a number is the process of decomposing the number into the product of primes.
Pollard’s rho method is the heuristic approach so there is no specified running time or the guaranteed success rate exists. But it is effective in practice.
Refer chapter 31, section 31.9 of the textbook for POLLARD’S-RHO algorithm.
The lines 1 to 4 in the algorithm are initializing statements.
These lines have no impact on the number of steps that the algorithm requires to compute factors.
The number of steps required to calculate the factor of the form is dependent on the loop in the line 5 and the block of statements from line 6 to 13.
The POLLARD’S-RHO(n) algorithm takes steps to discover one of the prime factor of the given number . Also the prime factor, .
If there exist another prime factor for the number , then to discover this prime factor ; the while loop in the algorithm POLLARD’S-RHO(n) will take steps again.
If there exist prime factors for the number , then to discover this prime factors ; the while loop in the algorithm POLLARD’S-RHO(n) will take steps.
Therefore, the number of steps required to the algorithm POLLARD’S-RHO( n ) to find the factor of the form is steps, where is a prime and .
Pollard’s rho is the heuristic approach for finding the factors of a number n. Factorization of a number is the process of decomposing the number into the product of primes. Pollard’s rho method is the heuristic approach so there is no specified running time or the guaranteed success rate exists but its effective in practice.
Refer the page number 976 in the textbook for POLLARD’S ROW algorithm, in this algorithm we execute the step 8 that iscalculation in every recurrence of the while loop which is its main disadvantage.
So the computation of gcd(greatest common divisor) every time can be minimized , if we keep the product of values stored in an array and then use it to find the greatest common divisor, which would eliminate the overhead involved.
The algorithm can be modified by using these steps:
1. The call to the functionshould not be made each time.
2. Take an array A and store the valuesthe array.
3. Use the stored values from the array while computation.
4. The size of the batch would be decided by the length of the cycles of the pollard -rho algorithm.
After implementing these changes in the POLLARD’S ROW algorithm it will again give the correct values of the factor of any number. The only changes will be as it will reduce the computational overhead. The value of u would decide the batch length for a ß bit number n.
Hence we can get rid of recursive gcd computation by grouping the xi products in a row by using an array and then using this computation so that we need not to calculate the gcd again and again.


23/12/18
Grin is a privacy-enhanced coin that uses MimbleWimble to obfuscate addresses and amount from the public blockchain records.
The goal of this audit is to assess the security of the extensions added to libsecp256k1 in order to support privacy features, in particular the bulletproofs range proofs and the aggsig module.
The section below describe the issues discovered, in perceived order of severity (starting with the highest severity), and proposes mitigations. The last section reports minor observations to improve the application.
The main primitive operations are secp256k1 arithmetic and HMAC-SHA-256. We reviewed the code and looked for issues related to do:
Furthremore, we tried to assess the safety of the changes introduced compared to the original Bulletproofs protocol, but have not formally assessed the security of the modified system.
The audit was carried out in limited time (7 hours, including reporting), and consisted in manual code review, and dynamic analysis based on the unit tests included.
At ./src/ecmult_gen_impl.h:153, the line bits = 0
aims to overwrite the value of private exponent bits. However compilers may remove the corresponding instructions, since the variable bits
is no longer used.
Likewise, the subsequent “clear” functions could be optimized out:
bits = 0;
secp256k1_ge_clear(&add);
secp256k1_scalar_clear(&gnb);
}
Furthermore, in aggsig’s main_impl.h the following memset may also be optimized out (as evidently noted by the developers):
memset(data, 0, 32); /* TODO proper clear */
There is no simple solution guaranteed to work, the best is to review the binaries generated and check that those operations haven’t been removed by the compiler.
secp256k1_aggsig_sign_single()
checks some but not all pointers’ nullity. Is this on purpose?
Likewise for secp256k1_aggsig_verify_single()
and secp256k1_aggsig_add_signatures_single(()
(where sigs
is checked but not the sigs[i]
).
In secp256k1_aggsig_verify_single()
, if secp256k1_ecmult_multi_var()
fails then the scratch
buffer will not be freed:
scratch = secp256k1_scratch_space_create(ctx, 1024*4096);
/* Compute sG - eP, which should be R */
if (!secp256k1_ecmult_multi_var(&ctx->ecmult_ctx, scratch, &pk_sum, &g_sc, secp256k1_aggsig_verify_callback_single, &cbdata, 1)) {
return 0;
}
secp256k1_scratch_space_destroy(scratch);
Too, in secp256k1_bulletproof_rangeproof_prove()
, secp256k1_scratch_deallocate_frame()
is only called if the function succeeds, hence it may return 0 without deallocating the scratch frame.
The value of secp256k1_scratch_space_create(ctx, 1024*4096)
in secp256k1_aggsig_verify_single()
and in secp256k1_aggsig_build_scratch_and_verify()
is not verified. The checked_malloc()
would display an error, but would still return NULL to the caller.
Too, in secp256k1_bulletproof_rangeproof_prove()
, the tge = malloc(2*sizeof(secp256k1_ge));
are not checked.
These mallocs are unlikely to fail but it’s still a bit safer to check them.
secp256k1_compute_sighash_single()
always returns 1 with scalar_low_impl.hProbably a non-issue, just
secp256k1_compute_sighash_single()
returns the following, given an uninitialized int overflow
:
secp256k1_scalar_set_b32(r, output, &overflow);
return !overflow;
However overflow
will always be 0 when using scalar_low_impl.h:
static void secp256k1_scalar_set_b32(secp256k1_scalar *r, const unsigned char *b32, int *overflow) {
const int base = 0x100 % EXHAUSTIVE_TEST_ORDER;
int i;
*r = 0;
for (i = 0; i < 32; i++) {
*r = ((*r * base) + b32[i]) % EXHAUSTIVE_TEST_ORDER;
}
/* just deny overflow, it basically always happens */
if (overflow) *overflow = 0;
}
Hence secp256k1_compute_sighash_single()
always returns 1 in this case. This does not happen with the 8x32 nor 4x64 implementations.
The same behavior occurs in secp256k1_computer_sighash()
.
At the end of secp256k1_bulletproof_rangeproof_prove()
:
ret = secp256k1_bulletproof_rangeproof_prove_impl(&ctx->ecmult_ctx, scratch, proof, plen, tau_x, tge, nbits, value, min_value, blinds, commitp, n_commits, &value_genp, gens, nonce, secondary_nonce, extra_commit, extra_commit_len, message);
if (t_one != NULL && tau_x == NULL) {
secp256k1_pubkey_save(t_one, &tge[0]);
secp256k1_pubkey_save(t_two, &tge[1]);
}
secp256k1_scratch_deallocate_frame(scratch);
return ret;
Two potential improvements here:
If the proof fails (ret != 0
), aren’t the secp256k1_pubkey_save()
useless?
Why isn’t there an additional check t_two != NULL
?
I didn’t get why the HMAC finalize is done here:
void secp256k1_aggsig_context_destroy(secp256k1_aggsig_context *aggctx) {
if (aggctx == NULL) {
return;
}
memset(aggctx->pubkeys, 0, aggctx->n_sigs * sizeof(*aggctx->pubkeys));
memset(aggctx->secnonce, 0, aggctx->n_sigs * sizeof(*aggctx->secnonce));
memset(aggctx->progress, 0, aggctx->n_sigs * sizeof(*aggctx->progress));
free(aggctx->pubkeys);
free(aggctx->secnonce);
free(aggctx->progress);
secp256k1_rfc6979_hmac_sha256_finalize(&aggctx->rng);
free(aggctx);
}
In secp256k1_bulletproof_rangeproof_prove()
the only valid values of nbits
are < 64
and have a Hamming weight of 1 bit. This may be checked during the ARG_CHECK()
sequence to avoid doing costly arithmetic operations before nbits
is eventually rejected in secp256k1_bulletproof_rangeproof_prove_impl()
.


Implementations of ASCII Tables using 7-bit ASCII as well as UTF-8 characters for borders. The implementations come in different versions (currently V1 and V2) with various degrees of flexibility and customization. The usage of each version is explained in the related package description (package v1 and package v2).
This blog post explains how to get UTF-8 support in the whole tool chain. Updates will be at the SKB Wiki on UTF-8.


Holy Diver
You've been down too long in the midnight sea
Oh, what's becoming of me?
Ride the tiger
You can see his stripes but you know he's clean
Oh, don't you see what I mean?


| |
Name |
Description |
|
|
Atomics |
Extensions to System.Threading.Interlocked. |
|
|
CodeGen |
Utility functinos for code generation. |
|
|
Decimals |
Extension methods on System.Decimal. |
|
|
Doubles |
Extension methods on System.Double. |
|
|
Either<TFirst, TSecond, TThird, TFourth> |
This type encapsulates either a value of type TFirst,
TSecond, TThird or
TFourth. |
|
|
Either<TFirst, TSecond, TThird> |
This type encapsulates either a value of type TFirst,
TSecond, or TThird. |
|
|
Either<TFirst, TSecond> |
This type encapsulates either a value of type TFirst,
or TSecond. |
|
|
Empty |
An empty/void value. |
|
|
Endian |
Endian conversions. |
|
|
Events |
Extension methods to safely trigger events. Triggering events
using Raise() is both null-safe and thread-safe. Delegates
are still required to ensure the state they are accessing
is valid. |
|
|
ImmutableValue<T> |
An immutable value. |
|
|
Integers |
Extensions for core int values. |
|
|
Lazy |
Convenience methods for lazy values. |
|
|
Lazy<T> |
A thread-safe lazy value. |
|
|
MetaExtensions |
Various simple meta-programming extensions. |
|
|
NonNull<T> |
This class encapsulates a non-null reference. An of this class instance serves as evidence
that the encapsulated reference is not null. |
|
|
Null |
Convenience functions. |
|
|
Option |
Option operations. |
|
|
Option<T> |
Represents a possibly null value. |
|
|
Pair<T0, T1> |
A 2-element tuple type. |
|
|
Quad<T0, T1, T2, T3> |
A 4-element tuple type. |
|
|
Ref<T> |
Simple reference. |
|
|
Singles |
Extension methods on System.Single. |
|
|
Triple<T0, T1, T2> |
A three-element tuple. |
|
|
Tuple |
Tuple convenience functions. |
|
|
TypeConstraint<T, TBase> |
Specifies a subtyping type constraint relationship. You use this constraint
primarily when compiling with other code that specifies ITypeConstraint. |
|
|
TypeConstraint<T> |
Specifies a type constraint that normally C# would not be able to enforce. |
|
|
Types |
Extensions to System.Type. |
|
|
Union128 |
Represents a 128-bit decimal union. |
|
|
Union16 |
Represents a 16-bit union. |
|
|
Union32 |
Represents a 32-bit union. |
|
|
Union64 |
Represents a 64-bit union. |
|
|
Weak<T> |
Exposes a strongly typed interface to an encapsulated WeakReference. |


List of all members.
Static Public Member Functions |
| static string | ToString (float value) |
| | Convert a float into a string representation.
|
| static string | ToString (Double value) |
| | Convert a Double into a string representation.
|
| static string | ToString (int value) |
| | Convert an int into a string representation.
|
| static string | ToString (uint value) |
| | Convert an unsigned int into a string representation.
|
| static string | ToString (short value) |
| | Convert a short into a string representation.
|
| static string | ToString (ushort value) |
| | Convert an unsigned an unsigned short into a string representation.
|
| static string | ToString (byte value) |
| | Convert a byte into a string representation.
|
| static float | ToFloat (String value) |
| | Converts a string to a float.
|
| static Double | ToDouble (String value) |
| | Converts a string representation to a double.
|
| static Int32 | ToInt32 (String value) |
| | Converts a string representation to an int 32.
|
| static UInt32 | ToUInt32 (String value) |
| | Converts a string representation to a u int 32.
|
| static UInt16 | ToUInt16 (String value) |
| | Converts a string representation to a u int 16.
|
| static Int16 | ToInt16 (String value) |
| | Converts a string representation to an int 16.
|
| static byte | ToByte (String value) |
| | Converts a string representation to a byte.
|
| static byte[] | EscapedStringToBytes (String value) |
| | Converts an escaped string to a bytes array.
|
| static byte[] | StringToBytes (string value) |
| | Converts a string to a bytes array.
|
| static byte[] | CharsToBytes (char[] value) |
| | Converts a char array to a bytes array.
|
Properties |
| Encoding | StringEncoder [set] |
| | Sets the string encoder.
|
Member Function Documentation
Converts a char array to a bytes array.
- Parameters:
-
| value | The value to be converted. |
- Returns:
- input value as a byte array.
Converts an escaped string to a bytes array.
- Parameters:
-
| value | The value to be converted. |
- Returns:
- input value as an escaped string.
Converts a string to a bytes array.
- Parameters:
-
| value | The value to be converted. |
- Returns:
- input value as a byte array.
Converts a string representation to a byte.
- Parameters:
-
| value | The value to be converted. |
- Returns:
- Input string as a byte?
Converts a string representation to a double.
- Parameters:
-
| value | The value to be converted. |
- Returns:
- Input string as a Double?
Converts a string to a float.
- Parameters:
-
| value | The value to be converted. |
- Returns:
- Input string as a float?
Converts a string representation to an int 16.
- Parameters:
-
| value | The value to be converted. |
- Returns:
- This object as an Int16?
Converts a string representation to an int 32.
- Parameters:
-
| value | The value to be converted. |
- Returns:
- This object as an Int32?
Convert a float into a string representation.
- Parameters:
-
| value | The value to be converted. |
- Returns:
- A string representation of this object.
Convert a Double into a string representation.
- Parameters:
-
| value | The value to be converted. |
- Returns:
- A string representation of this object.
Convert an int into a string representation.
- Parameters:
-
| value | The value to be converted. |
- Returns:
- A string representation of this object.
Convert an unsigned int into a string representation.
- Parameters:
-
| value | The value to be converted. |
- Returns:
- A string representation of this object.
Convert a short into a string representation.
- Parameters:
-
| value | The value to be converted. |
- Returns:
- A string representation of this object.
Convert an unsigned an unsigned short into a string representation.
- Parameters:
-
| value | The value to be converted. |
- Returns:
- A string representation of this object.
Convert a byte into a string representation.
- Parameters:
-
| value | The value to be converted. |
- Returns:
- A string representation of this object.
Converts a string representation to a u int 16.
- Parameters:
-
| value | The value to be converted. |
- Returns:
- Input string as a UInt16?
Converts a string representation to a u int 32.
- Parameters:
-
| value | The value to be converted. |
- Returns:
- Input string as a UInt32?
Property Documentation
Sets the string encoder.
The string encoder.
The documentation for this class was generated from the following file:
- D:/My Documents/Github/Arduino/Own Arduino libraries/CmdMessenger/Arduino-CmdMessenger/extras/CSharp/CommandMessenger/BinaryConverter.cs


A version of Abel's lemma: Let \(K\) be a convex subset of \(\mathbf{R}^n\) and suppose we have a sequence \(a_1,\ldots,a_n\in\mathbf{R}^n\) so that \(\sum_{i=1}^N a_i \in K\) for all \(0\le N\le n\). If \(1\ge \phi_1\ge\ldots\ge\phi_n\ge 0\), then \(\sum_{i=1}^n \phi_ia_i \in K\) as well.


| PERLOOTUT(1) | Perl Programmers Reference Guide | PERLOOTUT(1) |
If you are reading this in the future then it's possible that the state of the art has changed. We recommend you start by reading the perlootut document in the latest stable release of Perl, rather than this version.
By default, Perl's built-in OO system is very minimal, leaving you to do most of the work. This minimalism made a lot of sense in 1994, but in the years since Perl 5.0 we've seen a number of common patterns emerge in Perl OO. Fortunately, Perl's flexibility has allowed a rich ecosystem of Perl OO systems to flourish.
If you want to know how Perl OO works under the hood, the perlobj document explains the nitty gritty details.
This document assumes that you already understand the basics of Perl syntax, variable types, operators, and subroutine calls. If you don't understand these concepts yet, please read perlintro first. You should also read the perlsyn, perlop, and perlsub documents.
Perl's OO system is class-based. Class-based OO is fairly common. It's used by Java, C++, C#, Python, Ruby, and many other languages. There are other object orientation paradigms as well. JavaScript is the most popular language to use another paradigm. JavaScript's OO system is prototype-based.
An object represents a single discrete thing. For example, an object might represent a file. The attributes for a file object might include its path, content, and last modification time. If we created an object to represent /etc/hostname on a machine named "foo.example.com", that object's path would be "/etc/hostname", its content would be "foo\n", and it's last modification time would be<PHONE_NUMBER> seconds since the beginning of the epoch.
The methods associated with a file might include "rename()" and "write()".
In Perl most objects are hashes, but the OO systems we recommend keep you from having to worry about this. In practice, it's best to consider an object's internal data structure opaque.
All objects belong to a specific class. For example, our /etc/hostname object belongs to the "File" class. When we want to create a specific object, we start with its class, and construct or instantiate an object. A specific object is often referred to as an instance of a class.
In Perl, any package can be a class. The difference between a package which is a class and one which isn't is based on how the package is used. Here's our "class declaration" for the "File" class:
package File;
In Perl, there is no special keyword for constructing an object. However, most OO modules on CPAN use a method named "new()" to construct a new object:
my $hostname = File->new( path => '/etc/hostname', content => "foo\n", last_mod_time =><PHONE_NUMBER>, );
(Don't worry about that "->" operator, it will be explained later.)
Blessing
As we said earlier, most Perl objects are hashes, but an object can be an instance of any Perl data type (scalar, array, etc.). Turning a plain data structure into an object is done by blessing that data structure using Perl's "bless" function.
While we strongly suggest you don't build your objects from scratch, you should know the term bless. A blessed data structure (aka "a referent") is an object. We sometimes say that an object has been "blessed into a class".
Once a referent has been blessed, the "blessed" function from the Scalar::Util core module can tell us its class name. This subroutine returns an object's class when passed an object, and false otherwise.
use Scalar::Util 'blessed'; print blessed($hash); # undef print blessed($hostname); # File
Constructor
A constructor creates a new object. In Perl, a class's constructor is just another method, unlike some other languages, which provide syntax for constructors. Most Perl classes use "new" as the name for their constructor:
my $file = File->new(...);
In Perl, methods are simply subroutines that live in a class's package. Methods are always written to receive the object as their first argument:
sub print_info { my $self = shift; print "This file is at ", $self->path, "\n"; } $file->print_info; # The file is at /etc/hostname
What makes a method special is how it's called. The arrow operator ("->") tells Perl that we are calling a method.
When we make a method call, Perl arranges for the method's invocant to be passed as the first argument. Invocant is a fancy name for the thing on the left side of the arrow. The invocant can either be a class name or an object. We can also pass additional arguments to the method:
sub print_info { my $self = shift; my $prefix = shift // "This file is at "; print $prefix, ", ", $self->path, "\n"; } $file->print_info("The file is located at "); # The file is located at /etc/hostname
Perl has no special syntax for attributes. Under the hood, attributes are often stored as keys in the object's underlying hash, but don't worry about this.
We recommend that you only access attributes via accessor methods. These are methods that can get or set the value of each attribute. We saw this earlier in the "print_info()" example, which calls "$self->path".
You might also see the terms getter and setter. These are two types of accessors. A getter gets the attribute's value, while a setter sets it. Another term for a setter is mutator
Attributes are typically defined as read-only or read-write. Read-only attributes can only be set when the object is first created, while read-write attributes can be altered at any time.
The value of an attribute may itself be another object. For example, instead of returning its last mod time as a number, the "File" class could return a DateTime object representing that value.
It's possible to have a class that does not expose any publicly settable attributes. Not every class has attributes and methods.
While the two classes may differ in many ways, when it comes to the "print_content()" method, they are the same. This means that we can try to call the "print_content()" method on an object of either class, and we don't have to know what class the object belongs to!
Polymorphism is one of the key concepts of object-oriented design.
For example, we could create an "File::MP3" class which inherits from "File". An "File::MP3" is-a more specific type of "File". All mp3 files are files, but not all files are mp3 files.
We often refer to inheritance relationships as parent-child or "superclass"/"subclass" relationships. Sometimes we say that the child has an is-a relationship with its parent class.
"File" is a superclass of "File::MP3", and "File::MP3" is a subclass of "File".
package File::MP3; use parent 'File';
The parent module is one of several ways that Perl lets you define inheritance relationships.
Perl allows multiple inheritance, which means that a class can inherit from multiple parents. While this is possible, we strongly recommend against it. Generally, you can use roles to do everything you can do with multiple inheritance, but in a cleaner way.
Note that there's nothing wrong with defining multiple subclasses of a given class. This is both common and safe. For example, we might define "File::MP3::FixedBitrate" and "File::MP3::VariableBitrate" classes to distinguish between different types of mp3 file.
Overriding methods and method resolution
Inheritance allows two classes to share code. By default, every method in the parent class is also available in the child. The child can explicitly override a parent's method to provide its own implementation. For example, if we have an "File::MP3" object, it has the "print_info()" method from "File":
my $cage = File::MP3->new( path => 'mp3s/My-Body-Is-a-Cage.mp3', content => $mp3_data, last_mod_time =><PHONE_NUMBER>, title => 'My Body Is a Cage', ); $cage->print_info; # The file is at mp3s/My-Body-Is-a-Cage.mp3
If we wanted to include the mp3's title in the greeting, we could override the method:
package File::MP3; use parent 'File'; sub print_info { my $self = shift; print "This file is at ", $self->path, "\n"; print "Its title is ", $self->title, "\n"; } $cage->print_info; # The file is at mp3s/My-Body-Is-a-Cage.mp3 # Its title is My Body Is a Cage
The process of determining what method should be used is called method resolution. What Perl does is look at the object's class first ("File::MP3" in this case). If that class defines the method, then that class's version of the method is called. If not, Perl looks at each parent class in turn. For "File::MP3", its only parent is "File". If "File::MP3" does not define the method, but "File" does, then Perl calls the method in "File".
If "File" inherited from "DataSource", which inherited from "Thing", then Perl would keep looking "up the chain" if necessary.
It is possible to explicitly call a parent method from a child:
package File::MP3; use parent 'File'; sub print_info { my $self = shift; $self->SUPER::print_info(); print "Its title is ", $self->title, "\n"; }
The "SUPER::" bit tells Perl to look for the "print_info()" in the "File::MP3" class's inheritance chain. When it finds the parent class that implements this method, the method is called.
We mentioned multiple inheritance earlier. The main problem with multiple inheritance is that it greatly complicates method resolution. See perlobj for more details.
Encapsulation is important for several reasons. First, it allows you to separate the public API from the private implementation. This means you can change that implementation without breaking the API.
Second, when classes are well encapsulated, they become easier to subclass. Ideally, a subclass uses the same APIs to access object data that its parent class uses. In reality, subclassing sometimes involves violating encapsulation, but a good API can minimize the need to do this.
We mentioned earlier that most Perl objects are implemented as hashes under the hood. The principle of encapsulation tells us that we should not rely on this. Instead, we should use accessor methods to access the data in that hash. The object systems that we recommend below all automate the generation of accessor methods. If you use one of them, you should never have to access the object as a hash directly.
Earlier, we mentioned that the "File" class's "last_mod_time" accessor could return a DateTime object. This is a perfect example of composition. We could go even further, and make the "path" and "content" accessors return objects as well. The "File" class would then be composed of several other objects.
Roles are an alternative to inheritance for providing polymorphism. Let's assume we have two classes, "Radio" and "Computer". Both of these things have on/off switches. We want to model that in our class definitions.
We could have both classes inherit from a common parent, like "Machine", but not all machines have on/off switches. We could create a parent class called "HasOnOffSwitch", but that is very artificial. Radios and computers are not specializations of this parent. This parent is really a rather ridiculous creation.
This is where roles come in. It makes a lot of sense to create a "HasOnOffSwitch" role and apply it to both classes. This role would define a known API like providing "turn_on()" and "turn_off()" methods.
Perl does not have any built-in way to express roles. In the past, people just bit the bullet and used multiple inheritance. Nowadays, there are several good choices on CPAN for using roles.
We strongly recommend that you use one of these systems. Even the most minimal of them eliminates a lot of repetitive boilerplate. There's really no good reason to write your classes from scratch in Perl.
If you are interested in the guts underlying these systems, check out perlobj.
"Moose" provides a complete, modern OO system. Its biggest influence is the Common Lisp Object System, but it also borrows ideas from Smalltalk and several other languages. "Moose" was created by Stevan Little, and draws heavily from his work on the Perl 6 OO design.
Here is our "File" class using "Moose":
package File; use Moose; has path => ( is => 'ro' ); has content => ( is => 'ro' ); has last_mod_time => ( is => 'ro' ); sub print_info { my $self = shift; print "This file is at ", $self->path, "\n"; }
"Moose" provides a number of features:
"Moose" provides a layer of declarative "sugar" for defining classes. That sugar is just a set of exported functions that make declaring how your class works simpler and more palatable. This lets you describe what your class is, rather than having to tell Perl how to implement your class.
The "has()" subroutine declares an attribute, and "Moose" automatically creates accessors for these attributes. It also takes care of creating a "new()" method for you. This constructor knows about the attributes you declared, so you can set them when creating a new "File".
"Moose" lets you define roles the same way you define classes:
package HasOnOffSwitch; use Moose::Role; has is_on => ( is => 'rw', isa => 'Bool', ); sub turn_on { my $self = shift; $self->is_on(1); } sub turn_off { my $self = shift; $self->is_on(0); }
In the example above, you can see that we passed "isa => 'Bool'" to "has()" when creating our "is_on" attribute. This tells "Moose" that this attribute must be a boolean value. If we try to set it to an invalid value, our code will throw an error.
Perl's built-in introspection features are fairly minimal. "Moose" builds on top of them and creates a full introspection layer for your classes. This lets you ask questions like "what methods does the File class implement?" It also lets you modify your classes programmatically.
"Moose" describes itself using its own introspection API. Besides being a cool trick, this means that you can extend "Moose" using "Moose" itself.
There is a rich ecosystem of "Moose" extensions on CPAN under the MooseX <https://metacpan.org/search?q=MooseX> namespace. In addition, many modules on CPAN already use "Moose", providing you with lots of examples to learn from.
"Moose" is a very powerful tool, and we can't cover all of its features here. We encourage you to learn more by reading the "Moose" documentation, starting with Moose::Manual <https://metacpan.org/pod/Moose::Manual>.
Of course, "Moose" isn't perfect.
"Moose" can make your code slower to load. "Moose" itself is not small, and it does a lot of code generation when you define your class. This code generation means that your runtime code is as fast as it can be, but you pay for this when your modules are first loaded.
This load time hit can be a problem when startup speed is important, such as with a command-line script or a "plain vanilla" CGI script that must be loaded each time it is executed.
Before you panic, know that many people do use "Moose" for command-line tools and other startup-sensitive code. We encourage you to try "Moose" out first before worrying about startup speed.
"Moose" also has several dependencies on other modules. Most of these are small stand-alone modules, a number of which have been spun off from "Moose". "Moose" itself, and some of its dependencies, require a compiler. If you need to install your software on a system without a compiler, or if having any dependencies is a problem, then "Moose" may not be right for you.
Moo
If you try "Moose" and find that one of these issues is preventing you from using "Moose", we encourage you to consider Moo next. "Moo" implements a subset of "Moose"'s functionality in a simpler package. For most features that it does implement, the end-user API is identical to "Moose", meaning you can switch from "Moo" to "Moose" quite easily.
"Moo" does not implement most of "Moose"'s introspection API, so it's often faster when loading your modules. Additionally, none of its dependencies require XS, so it can be installed on machines without a compiler.
One of "Moo"'s most compelling features is its interoperability with "Moose". When someone tries to use "Moose"'s introspection API on a "Moo" class or role, it is transparently inflated into a "Moose" class or role. This makes it easier to incorporate "Moo"-using code into a "Moose" code base and vice versa.
For example, a "Moose" class can subclass a "Moo" class using "extends" or consume a "Moo" role using "with".
The "Moose" authors hope that one day "Moo" can be made obsolete by improving "Moose" enough, but for now it provides a worthwhile alternative to "Moose".
It is, however, very simple, pure Perl, and it has no non-core dependencies. It also provides a "Moose-like" API on demand for the features it supports.
Even though it doesn't do much, it is still preferable to writing your own classes from scratch.
Here's our "File" class with "Class::Accessor":
package File; use Class::Accessor 'antlers'; has path => ( is => 'ro' ); has content => ( is => 'ro' ); has last_mod_time => ( is => 'ro' ); sub print_info { my $self = shift; print "This file is at ", $self->path, "\n"; }
The "antlers" import flag tells "Class::Accessor" that you want to define your attributes using "Moose"-like syntax. The only parameter that you can pass to "has" is "is". We recommend that you use this Moose-like syntax if you choose "Class::Accessor" since it means you will have a smoother upgrade path if you later decide to move to "Moose".
Like "Moose", "Class::Accessor" generates accessor methods and a constructor for your class.
Here's our "File" class once more:
package File; use Class::Tiny qw( path content last_mod_time ); sub print_info { my $self = shift; print "This file is at ", $self->path, "\n"; }
That's it!
With "Class::Tiny", all accessors are read-write. It generates a constructor for you, as well as the accessors you define.
You can also use Class::Tiny::Antlers for "Moose"-like syntax.
"Role::Tiny" provides some of the same features as Moose's role system, but in a much smaller package. Most notably, it doesn't support any sort of attribute declaration, so you have to do that by hand. Still, it's useful, and works well with "Class::Accessor" and "Class::Tiny"
"Moose" is the maximal option. It has a lot of features, a big ecosystem, and a thriving user base. We also covered Moo briefly. "Moo" is "Moose" lite, and a reasonable alternative when Moose doesn't work for your application.
"Class::Accessor" does a lot less than "Moose", and is a nice alternative if you find "Moose" overwhelming. It's been around a long time and is well battle-tested. It also has a minimal "Moose" compatibility mode which makes moving from "Class::Accessor" to "Moose" easy.
"Class::Tiny" is the absolute minimal option. It has no dependencies, and almost no syntax to learn. It's a good option for a super minimal environment and for throwing something together quickly without having to worry about details.
Use "Role::Tiny" with "Class::Accessor" or "Class::Tiny" if you find yourself considering multiple inheritance. If you go with "Moose", it comes with its own role implementation.
In addition, plenty of code in the wild does all of its OO "by hand", using just the Perl built-in OO features. If you need to maintain such code, you should read perlobj to understand exactly how Perl's built-in OO works.
For small systems, Class::Tiny and Class::Accessor both provide minimal object systems that take care of basic boilerplate for you.
For bigger projects, Moose provides a rich set of features that will let you focus on implementing your business logic. Moo provides a nice alternative to Moose when you want a lot of features but need faster compile time or to avoid XS.
We encourage you to play with and evaluate Moose, Moo, Class::Accessor, and Class::Tiny to see which OO system is right for you.
| 2020-02-11 | perl v5.30.3 |


--- layout: archive title: Zulip Chat Archive permalink: /stream/113488-general/topic/yay.html ---
I feel like having to pick a topic makes me less likely to post random garbage. Is this a good thing? Or should we have a 'party' thread? :-)
Anyway, Leo just fixed two of my issues within 24 hours (turned out they were just one issue, but hey).
I think "ASSERTION VIOLATION" is one of the things that turns his head
I'm on 6 assertion violation issues. Gotta catch 'em all.
Oooh, and 5 more segfaults. :-)
that's a pretty good track record. I wonder if it's worth setting up fuzz testing for Lean
{% endraw %}Last updated: Apr 24 2020 at 19:02 UTC


Man held for sexual assault on minor
by Staff ReporterThe Karumathampatti police have arrested a 21-year-old man for alleged sexual assault on a minor girl.
The police said that K. Roymon, a resident of SPB Colony near Pallipalayam in Erode, was arrested on Monday.
According to the police, the accused was in a relationship with a 17-year-old girl hailing from Namakkal who worked in a powerloom unit at Karumathampatti. He took the girl to Kerala around 10 days ago in the pretext of marrying her.
As the girl went missing, her parents lodged a complaint with the Karumathampatti police.
During investigation, it was found that the accused was staying in Kerala with the girl.
The police arrested him when he came to Coimbatore along with the girl.
He was arrested for offences under Sections 366 (Kidnapping, abducting or inducing woman to compel her marriage) of the IPC and 5 (i) (Aggravated sexual assault) and 6 (Punishment for aggravated sexual assault) of the Protection of Children from Sexual Offences Act. He was produced before a court and remanded in judicial custody, the police added.


Szalinski is a tool for automatically inferring loops in the form of Folds, Maps, and Tabulates from flat CSG based 3D models. Szalinski uses Equality Saturation, a powerful compiler optimization technique together with a new idea called Inverse Transformations to automatically find loops.


Palletes is a single page javascript application that allows user to upload and search color schemes based on criteria such as categories and the base color. Schemes can be created, updated, and deleted by the user that created the scheme. The colors of the scheme can be copied and pasted.
Initial Site Release.
Quality of life improvements and debugging.
Add ability to load color schemes via applications REST api.
Expand Search Engine to allow fuzzy logic searches
Create NPM package that allows the user to load the schemes from the rest api.
Create fundation of css framework with flex, grids, typography,
etc.
Integrate framework with npm package.
Add ability to customize css propertizes such as border radius and
typography.
Code will be made avalible through the NPM package.
Develop functionality for the types besides "UI"
The site is developed fully with the ability for users to sell their themes.


{% extends "layout.html" %} {% block page_title %} Contact the Ministry of Justice {% endblock %} {% block content %} Your complaint The Ministry of Justice is responsible for courts, prisons and probations services. Read more about what we do. What is your complaint? {% endblock %}
The Ministry of Justice is responsible for courts, prisons and probations services. Read more about what we do.


What style of vacation do you want?
Do you enjoy snow?
Will you be traveling alone?
Are you comfortable traveling in a non-english speaking country?
Do you enjoy hiking long distances?

What kind of alcohol do you enjoy?
Over two million people visit Whistler annually, primarily for alpine skiing and snowboarding and, in summer, mountain biking at Whistler Blackcomb. Its pedestrian village has won numerous design awards and Whistler has been voted among the top destinations in North America by major ski magazines since the mid-1990s. During the 2010 Winter Olympics, Whistler hosted most of the alpine, Nordic, luge, skeleton, and bobsled events, though freestyle skiing and all snowboarding events were hosted at Cypress Mountain near Vancouver.
The islands are a popular destination for US citizens. In 2006 a total of 825,603 people visited the islands (of whom 443,987 were cruise ship passengers). Tourists frequent the numerous white sand beaches, visit The Baths on Virgin Gorda, snorkel the coral reefs near Anegada, or experience the well-known bars of Jost Van Dyke. The BVI are known as one of the world's greatest sailing destinations, and charter sailboats are a very popular way to visit less accessible islands. Every year since 1972 the BVI has hosted the Spring Regatta, which is a seven-day collection of sailing races throughout the islands.
Originally a remote backpacking destination, the region has attracted increasing numbers of upmarket visitors, cruise passengers rounding Cape Horn or visiting Antarctica, and adventure and activity holiday-makers. Principal tourist attractions include the Perito Moreno glacier, the Valdés Peninsula, the Argentine Lake District and Ushuaia and Tierra del Fuego. Tourism has created new markets locally and for export for traditional crafts such as Mapuche handicrafts, guanaco textiles, and confectionery and preserves.
The centre of Paris contains the most visited monuments in the city, including the Notre Dame Cathedral and the Louvre as well as the Sainte-Chapelle; Les Invalides, where the tomb of Napoleon is located, and the Eiffel Tower are located on the Left Bank south-west of the centre. The banks of the Seine from the Pont de Sully to the Pont d'Iéna have been listed as a UNESCO World Heritage Site since 1991. Other landmarks are laid out east to west along the historic axis of Paris, which runs from the Louvre through the Tuileries Garden, the Luxor Column in the Place de la Concorde, the Arc de Triomphe, to the Grande Arche of La Défense.
The bay consists of a dense cluster of some 1,600 limestone monolithic islands each topped with thick jungle vegetation, rising spectacularly from the ocean. Several of the islands are hollow, with enormous caves. Hang Đầu Gỗ (Wooden stakes cave) is the largest grotto in the Hạ Long area. French tourists visited in the late 19th century, and named the cave Grotte des Merveilles. Its three large chambers contain large numerous stalactites and stalagmites (as well as 19th-century French graffiti). There are two bigger islands, Tuần Châu and Cát Bà, that have permanent inhabitants, as well as tourist facilities including hotels and beaches. There are a number of beautiful beaches on the smaller islands.


Write a Main Program
Now that you have written your first program, you can write some more programs to do various integration-related tasks.
This tutorial provides instructions on how to write a main program. This involves a simple integration scenario where you can call a public weather forecast API and do some customization to the data obtained. The weather forecast API provides the weather forecast for the next five days and provides new records every three hours. Using this data, you will learn how to use Ballerina to find the average temperature and convert the result from Kelvin to Celsius.
This tutorial consists of the following main sections.
- Create a new main program
- Add a connector
- Call the connector
- View the response
- Extract content from JSON
- Calculate average temperature
- Convert Kelvin to Celcius
- Call the function and print the result
- Get information from the weather forecast API
Prerequisites: Download Ballerina and set it up. For instructions on how to do this, see the Quick Tour. For more information on the weather forecast API, see Get information from the weather forecast API.
Create a new main program
There are main programs and services, but this tutorial focuses on main programs only. A service normally continues to run and can be invoked by a REST API when required. A main program, on the other hand, will just run once. Main programs can be executed just like a Java main program.
It is time to create a main program to solve your integration problem.
- If the Composer is not already running, run it as described in the Quick Tour.
- On the Welcome page, click File and select New from the dropdown list.
- On the tool palette that you see on the left of the Composer, click the Main Function icon and drag it to the canvas.
Add a connector
Now that you have added a main program, you need a connector to connect to the external weather API. The connector ideal for this is the HTTP Client Connector since you are invoking an HTTP endpoint.
Connectors represents network services that are used by a Ballerina program. The term "network services" here is meant in the broadest possible sense - Ballerina is designed to connect with everything from a database to a JMS queue to an OAuth protected API to LDAP servers and more. Thus connectors are the representation of any such remote service in Ballerina.
Graphically, connectors are modeled as a separate lifeline to represent its independent and parallel execution. However, that lifeline is not a programmable thread of execution for the Ballerina developer - it only exists to represent the remote system.
Connectors may need to have usage specific parameters and hence must be instantiated prior to use. For example, an HTTP connector will need the URL to connect to in the minimum.
- On the tool palette, click More Connectors to see a list of all available connectors.
- From the list that appears, expand ballerina.net.http and drag a ClientConnector onto the canvas.
- Add the endpoint URL (http://api.openweathermap.org/data/2.5/forecast?appid=f6f43202ba90c14ab13479aa2a2beefb&q=Washington,US) within quotation marks "" as the connector endpoint. You can also change the name of the endpoint to something suitable. For more information on how to get this URL and call it to get the JSON content, see Get information from the weather forecast API.
Call the connector
When you add a connector, you need to have a way of calling a connector and those are called actions.
A connector comes with a set of actions that represent the interactions that one can have with the remote service. Actions can be one directional or bi-directional and represent blocking from the calling worker's perspective. That is, the calling thread is blocked until the action has completed its remote interaction.
In the case of the HTTP connector you are using in this tutorial, the actions are listed out under the connector in the tool palette.
- Add an action by dragging one of the actions from the tool palette onto the canvas. In this instance, you need to add a GET action as this is a GET request to the weather forecast API. Place the GET action under the main program you added.
- To call the connector from the main program, draw an arrow to the connector from the action.
-
You also need to pass a message to the connector from the main program. To do this, you must first add a variable.
1. Define a message in the variable you just added. Curly brackets {} are used to denote an empty message. The default message is defined as the letter m.
The
message
type is an opaque type used to represent a request to aresource
. This approach allows theresource
to be network-protocol independent, even though a givenresource
is always tied to a particular protocol because aservice
can only be bound to one network protocol at a time. -
The GET request action for the HTTP connector requires you to pass some parameters in the request. This includes the connector, the request path, and the message. In this tutorial, forecastAPI is the name of the connector that is passed. The request path is an additional string that can be passed in the request. You can set this up so that the request path includes the API key and country code. This will be portrayed in a different tutorial. In this instance, an empty string is passed "". Additionally, you can pass the message m.
View the response
Prior to doing further changes, you can view the output to see if the call to the API works.
-
You can print the message to see the output of what you have set up. To do this, you need to find a print function. You can use the search at the top of the tool palette for this, or you can click More Libraries and find it under the ballerina.lang.system library.
1. Drag and drop the print function onto the main program and print message m. 1. Save your file by clicking File and Save As. Provide an appropriate name for you .bal file. 1. Click the Run button and click Application to run this file. You can see the output in the console of the Ballerina Composer.
The output contains a JSON payload. This tutorial aims to access the JSON payload and extract the contents under list. This enables you to obtain the temperature forecast in Kelvin for the next five days. For more information, see Call the API using the URL.
Once you have viewed this, you can remove the print
function by hovering over it and clicking the trash can icon.
Extract content from JSON
The next step is to obtain the JSON payload content.
JSON is a textual format for representing a collection of values: a simple value (string, number, “true”, “false”, “null”), an array of values or an object. Ballerina also understands the JSON Schema and allows one to declare that a JSON document must conform to a particular schema.
Ballerina has a variable type named “json” that can represent any JSON value. Thus it is a built-in union type in Ballerina whose value can be any one of a string, a float, a boolean, an array of any or a map of any. We provide utility functions to read a JSON document to create a JSON typed value. The lexical representation of a value of that type is JSON, thus simply printing a JSON typed variable results in a JSON string.
JSON variables are declared in the following way:
json VariableName;
This is a variable that may hold any JSON document.
- Use the search, or navigate to a function called getJsonPayload, which is in the ballerina.lang.messages library. This library contains functions that enable you to modify and use messages in various ways.
- Drag and drop this onto the main program in the canvas. This automatically applies this function on message m since that is the default message.
- Modify the name of the JSON function you added to something meaningful.
- To get the data under list, you need to add a variable from the tool palette to the main function in the canvas.
- Modify the variable so that you can get the data under list. In this example, .list is a JSON path.
> The dot notation (.) enables you to invoke any of the attributes available in the JSON. These JSON paths can be used to access the contents of an attribute. For example, if
json j = {a:"hello"}
you can accesshello
usingj.a
. When considering the example used in this tutorial, ifjson j = {list:[1,2,3]}
you can access the list usingj.list
. This is done because all the content that you need resides within the list attribute in the JSON file.
Calculate average temperature
Now that you have extracted the content from the JSON, Ballerina needs to do the calculations. This involves using a conditional statement like while
.
A while
statement provides a way to execute a series of statements as long as a Boolean expression is met. In the Composer, you can drag the While icon from the tool palette to the canvas to add the statement to your program.
A while
statement is defined as follows:
while (BooleanExpression) {
Statement;+
}
-
Add a
variable
and define an integer that gets the number of instances of the data. Set this asint dataCount = jsons:getInt(forcastDataList,"$.length()")
. The weather API lists multiple instances of the temperature and this variable ensures that you find the number of instances of the temperature in the data sets and assigns it todataCount
.You use a .length JSON path here to access an inbuilt function of the JSON. In this case, length is an inbuilt function of JSON.
-
Add another
variable
calledint i = 0
by dragging a variable from the tool palette to the canvas. You can use this integer to get the exact number of instances of the data you need to do the calculation. - Drag and drop a
while
statement from the tool palette to the canvas. -
Set the
while
condition toi < dataCount
to make this condition loop until it reaches thedataCount
value.1. Add an
assignment
to thewhile
loop by dragging it from the tool palette to the canvas. 1. Specify the assignment value asi = i + 1
. This incrementsi
until it is equal to thedataCount
. So if there are 5 data sets,i
will be 5 when it comes out of thewhile
loop.1. Add a
variable
and declare it as afloat
. Afloat
supports 64-bit IEEE754 arithmetic. The sum of all the temperatures can be assigned to this value type.1. Add another
variable
and declare the value calculated as afloat
. This must be inside thewhile
condition. This is used to calculate the temperature for each data set. In this case,forecastDataList[i].main.temp
is basically used to get the temperature from the JSON for each data set. This is then assigned to thefloat
using the<float>
statement. The whole thing is assigned to the variabletemp
.1. Add another assignment to add each temperature value the
sumTemp
float that was declared earlier. 1. Add an assignment to calculate the average temperature. This is done by dividing the sum of all the temperatures by the number of temperatures or thedataCount
.
Convert Kelvin to Celcius
The next aspect of this tutorial is to convert the average temperature from Kelvin to Celcius.
- Add a
function
by dragging it from the tool palette to the canvas. A function is a single operation that is intended to be a unit of reusable functionality. You can define additional functions within your Ballerina programs. All library functions are found inballerina.*
packages under thesrc
directory in your Ballerina distribution. If the function is in another package and is marked public, you can import that package using the Imports box in the upper left corner of the canvas, and then drag the Function Invocation icon to the canvas. All functions are private to the package unless explicitly declared to be public with thepublic
keyword. You can invoke functions from a resource or a function within the same package without importing. - Provide a name for the
function
and also add a parameter calledfloat KelvinTemp
that returns afloat
value. - Add a
return
statement by dragging it from the tool palette to the canvas. Thereturn
statement evaluates the expression, stops the current function, and returns the result of the expression to the caller. -
In the
return
statement, do the calculation to convert Kelvin to Celcius by subtracting 273.15 from the Kelvin temperature.
Call the function and print the result
Once the function is added, it is available on the tool palette and can be dragged onto the canvas when you need to call it.
-
Drag the function you created onto the canvas, assign a float value, and apply the function on the average Celcius temperature.
1. Drag two
println
functions to the canvas and assignavgTemp
to one to display the average temperature in Kelvin and assigncelciusTemp
to the other to display the average temperature in Celcius. 1. Run the main program as an application. You will see the following output in the console.
Get information from the weather forecast API
In order to get this tutorial to work, you need to obtain some information from the public API for use in Ballerina. This section showcases how to get the URL and how to call it.
Get the API key
You can access the weather forecast API and obtain the API key from it using the following steps. The key is used as part of the URL that is called by Ballerina.
- Go to https://openweathermap.org/ and click Sign Up to register your account.
- Once you have signed up for an account, log in using your credentials.
- In the home page that appears, click API keys. You can copy the Key that is already generated for you.
Identify the country code
The weather forecast API can be done for any country. Washington (USA) is used in our example. You need to identify the exact code to use to pass this parameter in the URL.
- Click API in the top level menu and click the API doc button under 5 day / 3 hour forecast.
- The page that appears provides details about the API and provides sample calls for different types of requirements. Under the By city ID section, you can access a JSON file from http://bulk.openweathermap.org/sample/. This includes all the country codes available.
Call the API using the URL
Now that you have got the API key and the country code, you can identify the URL that you need to call from Ballerina. The URL is something similar to the following: http://api.openweathermap.org/data/2.5/forecast?appid=f6f43202ba90c14ab13479aa2a2beefb&q=Washington,US.
Here the
appid
is the API key and the country code isWashington,US
.
Use a tool that can interact with HTTP APIs. In this instance we use Postman, which is a Google Chrome app. Paste the URL above in the Enter request URL text box and change the request type to GET. In the JSON response you can see the list part of the response contans the temperature (temp) in Kelvin.


Consider the following 3 block level elements, they will stack on top of each other on default settings
After adding display: flex;
to the parent container of the 3 div blocks. We get the following result:
Notice how this looks similar adding display: inline-block;
to all the divs inside the container
In both cases, the important take away is that the div blocks wrap to the width of the content and allows them to be displayed in a single row. This means that if we give
a width to each of the div's which are called flex items
, we can now easily use this power to generate layouts. Here's an example of the 3 div's given a width (33.33333% each):
There will be a better way of doing this however which we will explore later.
One other fundamental notion of flexboxes is the ability to wrap around infinitely. This is shown below:
Notice here that flexbox works too perfectly. It does fit all items in a row but at the expense of overflowing the containers. We can fix this by adding
flex-wrap: wrap;
Side note: We can also choose the direction of the flex layout with flex-direction: row, flex-direction: column, flex-direction: row-reverse, flex-direction: column-reverse
Now the interesting part is the controlling the actual flex items
size & proportion. This is done by adding flex
. Flex takes
three values, with them being flex-grow, flex-shrink, flex-basis
.
Flex-grow works as a unitless proportion. If we set flex: 1
to all the 3 divs, then each will take up equal sizes.
Notice how flex: 1
provided nearly identical/better results than setting each of the div's width to 33.3333%
The second part of flex, flex-shrink
will be covered later.
Flex-basis is the minimum size value that the flex item should occupy. This is not unitless, so you can give it a percentage like we did, 33.3333%. When used in combination
with flex-grow
, flex basis will give the minimum space, and rest of the space exceeding that will be proportional. This may or may not be what you want. Notice
when compared with the traditional grid systems using floats, flexbox still is really the same. Flexbox was not made for grids, but for layouts. However, one can emulate a grid system with flexbox just as it has been done with floats. But the nice thing about flexboxes are that it comes with variety of positioning concepts that we normally use. For example, we can use align-items
for vertical centering, and justify-content
for horizontal centering.


T-Shirt Design Editor
My Designs
Editor Options
create_new_folder
New
save
Save
undo
Undo
redo
Redo
add_a_photo
Add Image
text_fields
Add Text
file_upload
Upload "{{mainCtrl.file.name}}"


|
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
| Class Summary | |
|---|---|
| AbstractFontSettingDialog | Abstract class for a font selection dialog. |
| Coprocessor0Window | Sets up a window to display registers in the UI. |
| Coprocessor1Window | Sets up a window to display Coprocessor 1 registers in the Registers pane of the UI. |
| DataSegmentWindow | Represents the Data Segment window, which is a type of JInternalFrame. |
| EditCopyAction | Action for the Edit -> Copy menu item |
| EditCutAction | Action for the Edit -> Cut menu item |
| EditFindReplaceAction | Action for the Edit -> Find/Replace menu item |
| Editor | Manage the file being edited. |
| EditPane | Represents one file opened for editing. |
| EditPasteAction | Action for the Edit -> Paste menu item |
| EditRedoAction | Action for the Edit -> Redo menu item |
| EditSelectAllAction | Action for the Edit -> Copy menu item |
| EditTabbedPane | Tabbed pane for the editor. |
| EditUndoAction | Action for the Edit -> Undo menu item |
| ExecutePane | Container for the execution-related windows. |
| FileCloseAction | Action for the File -> Close menu item |
| FileCloseAllAction | Action for the File -> Close All menu item |
| FileDumpMemoryAction | Action for the File -> Save For Dump Memory menu item |
| FileExitAction | Action for the File -> Exit menu item |
| FileNewAction | Action for the File -> New menu item |
| FileOpenAction | Action for the File -> Open menu item |
| FilePrintAction | Action for the File -> Print menu item |
| FileSaveAction | Action for the File -> Save menu item |
| FileSaveAllAction | Action for the File -> Close All menu item |
| FileSaveAsAction | Action for the File -> Save As menu item |
| FileStatus | Used to store and return information on the status of the current ASM file that is being edited in the program. |
| GuiAction | parent class for Action subclasses to be defined for every menu/toolbar option. |
| HardcopyWriter | |
| HelpAboutAction | Action for the Help -> About menu item |
| HelpHelpAction | Action for the Help -> Help menu item |
| LabelsWindow | Represents the Labels window, which is a type of JInternalFrame. |
| MainPane | Creates the tabbed areas in the UI and also created the internal windows that exist in them. |
| MessagesPane | Creates the message window at the bottom of the UI. |
| NumberDisplayBaseChooser | Use to select base for displaying numbers. |
| PopupListener | |
| RegistersPane | Contains tabbed areas in the UI to display register contents |
| RegistersWindow | Sets up a window to display registers in the UI. |
| RepeatButton | RepeatButton is a JButton which contains a timer
for firing events while the button is held down. |
| RunAssembleAction | Action class for the Run -> Assemble menu item (and toolbar icon) |
| RunBackstepAction | Action for the Run -> Backstep menu item |
| RunClearBreakpointsAction | Action class for the Run menu item to clear execution breakpoints that have been set. |
| RunGoAction | Action class for the Run -> Go menu item (and toolbar icon) |
| RunPauseAction | Action class for the Run -> Pause menu item (and toolbar icon) |
| RunResetAction | Action for the Run -> Reset menu item |
| RunSpeedPanel | Class for the Run speed slider control. |
| RunStepOverAction | Action for the Run -> Step Over menu item |
| RunStepAction | Action for the Run -> Step menu item |
| RunStopAction | Action class for the Run -> Stop menu item (and toolbar icon) |
| RunToggleBreakpointsAction | Action class for the Run menu item to clear execution breakpoints that have been set. |
| SettingsAddressDisplayBaseAction | Action class for the Settings menu item to control number base (10 or 16) of memory addresses. |
| SettingsAssembleAllAction | Action class for the Settings menu item to determine whether assemble operation applies only to current file or to all files in its directory. |
| SettingsAssembleOnOpenAction | Action class for the Settings menu item to control automatic assemble of file upon opening. |
| SettingsDelayedBranchingAction | Action class for the Settings menu item to control delayed branching. |
| SettingsEditorAction | Action class for the Settings menu item for text editor settings. |
| SettingsExceptionHandlerAction | Action class for the Settings menu item for optionally loading a MIPS exception handler. |
| SettingsExtendedAction | Action class for the Settings menu item to control use of extended (pseudo) instructions or formats. |
| SettingsHighlightingAction | Action class for the Settings menu item for text editor settings. |
| SettingsLabelAction | Action class for the Settings menu item to control display of Labels window (symbol table). |
| SettingsMemoryConfigurationAction | Action class for the Settings menu item for text editor settings. |
| SettingsPopupInputAction | Action class for the Settings menu item to control use of popup dialog for input syscalls. |
| SettingsProgramArgumentsAction | Action class for the Settings menu item to control whether or not program arguments can be entered and used. |
| SettingsSelfModifyingCodeAction | Action class for the Settings menu item to control whether the running MIPS program can write to the text segment or branch to the data segment. |
| SettingsStartAtMainAction | Action class for the Settings menu item to control whether or not assembler warnings are considered errors. |
| SettingsValueDisplayBaseAction | Action class for the Settings menu item to control number base (10 or 16) of memory/register contents. |
| SettingsWarningsAreErrorsAction | Action class for the Settings menu item to control whether or not assembler warnings are considered errors. |
| TextSegmentWindow | Creates the Text Segment window in the Execute tab of the UI |
| ToolAction | Connects a MarsTool class (class that implements MarsTool interface) to the Mars menu system by supplying the response to that tool's menu item selection. |
| ToolLoader | This class provides functionality to bring external Mars tools into the Mars system by adding them to its Tools menu. |
| VenusUI | Top level container for Venus GUI. |
| Exception Summary | |
|---|---|
| HardcopyWriter.PrintCanceledException | This is the exception class that the HardcopyWriter constructor throws when the user clicks "Cancel" in the print dialog box. |
|
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |


| Field | Value |
|---|---|
| ChannelRef | {{channel.getRef().getChannelId()}}[{{channel.getRef().getName()}}] |
| Data | {{channelDataStr}} |
| Channels | |
| Subchannels | |
| Sockets | |
| Channel trace summary | {{traceSummary}} |
| Channel trace events |
No events recorded |
Channel does not exist


Toggle navigation
Save
Space
Data Explore
By Topic
By Country
By Data Source
About
About us
Feedback
Login/Sign up
Space
Settings
Sign out
Datanium Prototype
An online public data analysis tool as seen on the
Github
page


Cycle Fitness
Choose Your Path.
Welcome to Cycle Fitness, a bike shop with a new take on cycling.
Here people discover how cycling can help them rekindle their relationship with nature and grow closer to their families.
Have a look around - Cycle Fitness is your one stop cycling shop! Just click the icon in the top left corner to get started.


Welcome to HostelBook where we make booking your hostel a fast and easy process. Forget the hustle of running around looking for a place to stay. Let your fingers do the walking.
Some texe...
Another text...


Official Links
Events and Giveaways
Then contribute to the Cloud Community! Join the discussion with other developers, and make your products and projects better.


Module pl.List
Python-style list class
Based on original code by Nick Trout.
Please Note: methods that change the list will return the list. This is to allow for method chaining, but please note that ls = ls:sort() does not mean that a new copy of the list is made. In-place (mutable) methods are marked as returning 'the list' in this documentation.
See the Guide for further discussion
See http://www.python.org/doc/current/tut/tut.html, section 5.1
Note: The comments before some of the functions are from the Python docs and contain Python code.
Written for Lua version 4.0
Redone for Lua 5.1, Steve Donovan.
Functions
| List:new (t) | Create a new list |
| List:append (i) | Add an item to the end of the list |
| List:extend (L) | Extend the list by appending all the items in the given list |
| List:insert (i, x) | Insert an item at a given position |
| List:put (x) | Insert an item at the begining of the list |
| List:remove (i) | Remove an element given its index |
| List:remove_value (x) | Remove the first item from the list whose value is given |
| List:pop (i) | Remove the item at the given position in the list, and return it |
| List:index (x, idx) | Return the index in the list of the first item whose value is given |
| List:contains (x) | does this list contain the value? |
| List:count (x) | Return the number of times value appears in the list |
| List:sort (cmp) | Sort the items of the list, in place |
| List:reverse () | Reverse the elements of the list, in place |
| List:slice (first, last) | Emulate list slicing |
| List:clear () | empty the list |
| List.range (start, finish) | Emulate Python's range(x) function |
| List:len () | list:len() is the same as #list. |
| List:chop (i1, i2) | Remove a subrange of elements |
| List:splice (idx, list) | Insert a sublist into a list equivalent to 's[idx:idx] = list' in Python |
| List:slice_assign (i1, i2, seq) | general slice assignment s[i1:i2] = seq |
| List:__concat (L) | concatenation operator |
| List:__eq (L) | equality operator == |
| List:join (delim) | join the elements of a list using a delimiter |
| List:concat (delim) | join a list of strings |
| List:__tostring () | how our list should be rendered as a string |
| List:foreach (fun, ...) | call the function for each element of the list |
| List:filter (fun, optional, arg) | create a list of all elements which match a function |
| List.split (s, delim) | split a string using a delimiter |
| List:map (fun, arg1, ...) | apply a function to all elements |
| List:transform (fun, ..., t) | apply a function to all elements, in-place |
| List:map2 (fun, ..., ls) | apply a function to elements of two lists |
| List:mapm (name, ...) | apply a named meethod to all elements |
| List:reduce (fun) | 'reduce' a list using a binary function |
| List:partition (fun, ...) | partition a list using a classifier function |
| List:iter () | return an iterator over all values. |
| List.iterate (seq) | Create an iterator over a seqence |
Functions
- List:new (t)
-
Create a new list
Can optionally pass a table;
passing another instance of List will cause a copy to be created
we pass anything which isn't a simple table to iterate() to work out
an appropriate iterator
Parameters:
t
: An optional list-like table
Usage:
ls = List(); ls = List {1,2,3,4}
Returns:
-
a new List
see also:
- List:append (i)
-
Add an item to the end of the list
Parameters:
i
: An item
Returns:
-
the list
- List:extend (L)
-
Extend the list by appending all the items in the given list
equivalent to 'a[len(a):] = L'.
Parameters:
L
: Another List
Returns:
-
the list
- List:insert (i, x)
-
Insert an item at a given position
i is the index of the
element before which to insert.
Parameters:
i
: index of element before whichh to insertx
: A data item
Returns:
-
the list
- List:put (x)
-
Insert an item at the begining of the list
Parameters:
x
: a data item
Returns:
-
the list
- List:remove (i)
-
Remove an element given its index
(equivalent of Python's del s[i])
Parameters:
i
: the index
Returns:
-
the list
- List:remove_value (x)
-
Remove the first item from the list whose value is given
(This is called 'remove' in Python; renamed to avoid confusion
with table.remove)
Return nil if there is no such item.
Parameters:
x
: A data value
Returns:
-
the list
- List:pop (i)
-
Remove the item at the given position in the list, and return it
If no index is specified, a:pop() returns the last item in the list.
The item is also removed from the list.
Parameters:
i
: An index
Returns:
-
the item
- List:index (x, idx)
-
Return the index in the list of the first item whose value is given
Return nil if there is no such item.
Parameters:
x
: A data valueidx
: where to start search (default 1)
Returns:
-
the index, or nil if not found.
- List:contains (x)
-
does this list contain the value?
Parameters:
x
: A data value
Returns:
-
true or false
- List:count (x)
-
Return the number of times value appears in the list
Parameters:
x
: A data value
Returns:
-
number of times x appears
- List:sort (cmp)
-
Sort the items of the list, in place
Parameters:
cmp
: an optional comparison function; '<' is used if not given.
Returns:
-
the list
- List:reverse ()
-
Reverse the elements of the list, in place
Returns:
-
the list
- List:slice (first, last)
-
Emulate list slicing
like 'list[first:last]' in Python.
If first or last are negative then they are relative to the end of the list
eg. slice(-2) gives last 2 entries in a list, and
slice(-4,-2) gives from -4th to -2nd
Parameters:
first
: An indexlast
: An index
Returns:
-
a new List
- List:clear ()
-
empty the list
Returns:
-
the list
- List.range (start, finish)
-
Emulate Python's range(x) function
Include it in List table for tidiness
Parameters:
start
: A numberfinish
: A number greater than start; if zero, then 0..start-1
Usage:
List.range(0,3) == List {0,1,2,3}
- List:len ()
- list:len() is the same as #list.
- List:chop (i1, i2)
-
Remove a subrange of elements
equivalent to 'del s[i1:i2]' in Python.
Parameters:
i1
: start of rangei2
: end of range
Returns:
-
the list
- List:splice (idx, list)
-
Insert a sublist into a list
equivalent to 's[idx:idx] = list' in Python
Parameters:
idx
: indexlist
: list to insert
Usage:
l = List{10,20}; l:splice(2,{21,22}); assert(l == List{10,21,22,20})
Returns:
-
the list
- List:slice_assign (i1, i2, seq)
-
general slice assignment s[i1:i2] = seq
Parameters:
i1
: start indexi2
: end indexseq
: a list
Returns:
-
the list
- List:__concat (L)
-
concatenation operator
Parameters:
L
: another List
Returns:
-
a new list consisting of the list with the elements of the new list appended
- List:__eq (L)
-
equality operator ==
True iff all elements of two lists are equal.
Parameters:
L
: another List
Returns:
-
true or false
- List:join (delim)
-
join the elements of a list using a delimiter
This method uses tostring on all elements.Parameters:
delim
: a delimiter string, can be empty.
Returns:
-
a string
- List:concat (delim)
-
join a list of strings
Uses table.concat directly.Parameters:
delim
: a delimiter
Returns:
-
a string
- List:__tostring ()
-
how our list should be rendered as a string
Uses join().
see also:
- List:foreach (fun, ...)
-
call the function for each element of the list
Parameters:
fun
: a function or callable object...
:
- List:filter (fun, optional, arg)
-
create a list of all elements which match a function
Parameters:
fun
: a boolean functionoptional
: argument to be passed as second argument of the predicatearg
:
Returns:
-
a new filtered list.
- List.split (s, delim)
-
split a string using a delimiter
Parameters:
s
: the stringdelim
: the delimiter (default spaces)
Returns:
-
a List of strings
see also:
- List:map (fun, arg1, ...)
-
apply a function to all elements
Any extra arguments will be passed to the function
Parameters:
fun
: a function of at least one argumentarg1
: an optional argument...
: arbitrary extra arguments.
Returns:
-
a new list: {f(x) for x in self}
see also:
- List:transform (fun, ..., t)
-
apply a function to all elements, in-place
Any extra arguments are passed to the function.
Parameters:
fun
: A function that takes at least one argument...
: arbitrary extra arguments.t
:
- List:map2 (fun, ..., ls)
-
apply a function to elements of two lists
Any extra arguments will be passed to the function
Parameters:
fun
: a function of at least two arguments...
: arbitrary extra arguments.ls
:
Returns:
-
a new list: {f(x,y) for x in self, for x in arg1}
see also:
- List:mapm (name, ...)
-
apply a named meethod to all elements
Any extra arguments will be passed to the method.
Parameters:
name
: name of method...
: extra arguments
Returns:
-
a new list of the results
see also:
- List:reduce (fun)
-
'reduce' a list using a binary function
Parameters:
fun
: a function of two arguments
Returns:
-
result of the function
see also:
- List:partition (fun, ...)
-
partition a list using a classifier function
The function may return nil, but this will be converted to the string key '
'. Parameters:
fun
: a function of at least one argument...
: will also be passed to the function
Returns:
-
a table where the keys are the returned values, and the values are Lists
of values where the function returned that key. It is given the type of Multimap.
see also:
- List:iter ()
- return an iterator over all values.
- List.iterate (seq)
-
Create an iterator over a seqence
This captures the Python concept of 'sequence'.
For tables, iterates over all values with integer indices.
Parameters:
seq
: a sequence; a string (over characters), a table, a file object (over lines) or an iterator function
Usage:
for x in iterate {1,10,22,55} do io.write(x,',') end ==> 1,10,22,55
for ch in iterate 'help' do do io.write(ch,' ') end ==> h e l p


Cape Town City sack Benni McCarthy as head coach
Cape Town - Benni McCarthy has been sacked as head coach of Cape Town City Football Club.
The news was confirmed by the club in the early hours of Monday morning.
The statement read: "Cape Town City Football Club has terminated the employment of coach Benni McCarthy, with immediate effect following a run of performance that saw the club win two in the last 18 games.
"The club thanks Benni for his service over the last three seasons and wishes him well in his next endeavour. He now becomes an integral part of the club’s history and are proud of the successes we shared together. "
Vasili Manousakis has been appointed as caretaker coach, with a new head coach to be announced in due course.
The statement concluded: "The future represents very exciting times for Cape Town City on and off the field, as we remain dedicated to our big plans and aspirations."
McCarthy, a former Bafana Bafana star, had been Cape Town City head coach since 2017.
Former Ajax Cape Town coach, Muhsin Ertugral is believed to be a front-runner for the vacant post as the club search for a replacement for the outgoing McCarthy.
- Compiled by Herman Mostert


--- layout: archive title: Zulip Chat Archive permalink: /stream/113488-general/topic/bundled.20in.20category_theory.html ---
I just discovered bundled
in category_theory.category
:
structure bundled (c : Type u → Type v) := (α : Type u) [str : c α]
This seems very useful. In particular, I'm thinking it can help me remove [decidable_eq α]
that I have to state everywhere by allowing me to bundle the condition. So, I have a couple of questions:
1. I think it would be helpful to define this outside the category_theory
directory because it's not inherently tied to category theory. Do people agree? Should it be in data/bundled.lean
or somewhere else?
2. Do the [
/]
brackets do anything different from (
/)
here? #print bundled
doesn't give any clue.
3. What does str
abbreviate? I've typically seen str
for string, but I don't think that makes sense here. Is it structure
? If so, why? It seems more like a type function being bundled with its parameter, so I'm not clear where the structure
comes in.
I believe that the only difference the []
makes within the structure is that you can use type class inference within the structure itself. So I am going to stick my neck out and suggest that in this case, where we don't need str to be inferred in any of the other fields, the []
is no different to ()
. Apologies if I've written something misleading / wrong here. I think the way to make type class inference pick up on str
is to have the obvious instance immediately after the definition of the structure.
I think Johannes suggested the [ ]
here, and I never thought too hard about it.
str
is indeed for structure
. We earlier had carrier
instead of a
.
Regarding bundled
, I've found that it has limited use, because as soon as you're past the first round of examples, you want to bundle up multiple typeclasses, and you're back to writing a custom structure for each set of typeclasses you're interested in.
I can see how it is not suitable for more involved structures. This applies as well to sigma
, subtype
, etc. (And, even for cases that fit those, it often seems better to define your own structure.) That said, it is still a unique point in the design space and useful for many cases in which you don't need/want to define a structure.
The binder types (brackets) used in a structure declaration are reflected in the structure's constructor
Aah so my post is inaccurate. Thanks Sebastian.
The binder types (brackets) used in a structure declaration are reflected in the structure's constructor
@Sebastian Ullrich Ah, of course. Thanks!
Here's the resulting PR.
I added a comment: https://github.com/leanprover/mathlib/pull/390#discussion_r223174490
@[reducible] def Meas : Type (u+1) := bundled measurable_space instance (x : Meas) : measurable_space x := x.inst
The comment says:
Would it be possible to autogenerate these instances? Everytime we bundle a class we want an instance like this. This probably means that bundled
has to become meta. I don't know. But I think it would take away one of those "minor annoyances" if all these instances would just be there, automagically.
You can't hook in to inductive aux theorem generation, but you can have a derive handler
You could add an attribute to Meas
that does the instance generation
but I don't think you will gain much over just writing that one line
it's not like there are that many bundled classes. This is a negligible fraction of the work
{% endraw %}Last updated: Apr 24 2020 at 19:02 UTC


Check if the spotify response has an expired token {"error": {"status": 401, "message": "The access token expired"}}
check if the reponse is ok or not axios always sends the following status:200 statusText:"OK"
code:"ENOTFOUND" config:Object {adapter: , transformRequest: Object, transformResponse: Object, …} errno:"ENOTFOUND" host:"api.spotify.com" hostname:"api.spotify.com" message:"getaddrinfo ENOTFOUND api.spotify.com api.spotify.com:443" port:443
perform a delete request
Response returns a paylod with the following...
data:
perform a post request
perform a put request
Generated using TypeDoc
get the response http status code axios always sends the following status:200 statusText:"OK"


Maryland Carbon Monitoring System
✖
As of July 9th, 2014, we are experiencing technical difficulty loading maps. Loading times may be up to 30 seconds per map, or loading may fail. We are working to improve this as soon as possible.