Sequences - Xref - Builds - loop


App: manual Page: fragments/sequences_1
PHP
HTML
fragments/sequences_1.pad
Result
<p>{sequence '1..8'}{$sequence} {/sequence}</p>
<p>{sequence fibonacci, rows=8}{$sequence} {/sequence}</p>
<p>{sequence prime, from=10, rows=6}{$sequence} {/sequence}</p>
<p>{sequence 'A..F'}{$sequence} {/sequence}</p>

App: manual Page: lvl_occ/6
PHP
HTML
lvl_occ/6.pad
Result
<table border='1'>
{sequence 3}
<tr>
{sequence 5}
<td>{echo ($-2 * 10) + $-1}</td>
{/sequence}
</tr>
{/sequence}
</table>

App: manual Page: pages/levels_and_occurrences
PHP
HTML
pages/levels_and_occurrences.pad
Result
<p>
{block}
PAD is data driven, the PAD data concepts are named Level and Occurence
<br><br>
Below example: <br>
- Is two levels deep <br>
- The level 'row' has 3 occurences<br>
- The level 'column' has 5 occurences<br><br>
{/block}
{example 'lvl_occ/1', skipNames, center}
</p>

{block}
If not specifield for a PAD tag then default it has 1 occurence.
<br><br><hr><br>
Just for fun, below the above example implemented in a few different ways.
<br>
Hopefully all this magic will be explained in this manual.
{/block}

<p>
{sequence '2..12', name='xxx'}
{example 'lvl_occ/{$xxx}', skipNames{notFirst},skipOpen,skipHeader{/notFirst}{notLast},skipClose{/notLast}}
{/sequence}
</p>

App: manual Page: pages/sequences
PHP
HTML
pages/sequences.pad
Result
{meta title='Sequences'}

<p>The <code>{sequence}</code> tag generates values instead of reading them: a
range, a mathematical series, letters - 122 types, each iterated like any data
tag:</p>

{example 'fragments/sequences_1'}

<p>That is the smallest corner of a whole subsystem: plays that keep, remove or flag terms,
stores that pass a sequence from one tag to the next, actions that transform it, and random
draws with their own rules. It has an application of its own, which is its manual:</p>

<p><b><a href="{$padHost}sequence/">The sequence application</a></b> - every type, play,
action and option, demonstrated live.</p>
<h2>Seeing and hearing them</h2>

<p>A sequence is data like any other, so {tag 'chart'} and {tag 'sparkline'} draw it
straight away with <code>sequence=</code>:</p>

{example 'fragments/sequences_2'}

<p>The sequence application has three pages built on that: the
<a href="{$padHost}sequence/?gallery">Gallery</a> draws every type beside the OEIS entry its
terms come from, <a href="{$padHost}sequence/?listen">Listen</a> plays a sequence as notes -
Recamán's is the famous one - in an audio file written into the page, and
<a href="{$padHost}sequence/?guess">Guess</a> shows the start of a sequence and asks for the
next term.</p>

App: regression/errors Page: syntax/a_literal_of_another_sequence_call_lets_no_eval_run
PHP
syntax/a_literal_of_another_sequence_call_lets_no_eval_run.php
HTML
syntax/a_literal_of_another_sequence_call_lets_no_eval_run.pad
Result
<?php

// Only a literal parameter of the eval sequence is an expression the template wrote: the
// value spliced into sequence:repeat(2, '...') was taken for one, and sequence:eval(2, $q),
// refused on its own, then ran the same value from the request.

$q = '0 + php:abs(-3)';

?>
{echo sequence:repeat(2, '{$q}')}{echo sequence:eval(2, $q)}

App: regression/errors Page: syntax/a_play_build_strategy_must_be_one_the_type_has
PHP
HTML
syntax/a_play_build_strategy_must_be_one_the_type_has.pad
Result
{sequence 5, push='s'}{pull:s make, prime, build='fixed'}{$sequence} {/pull:s}

App: regression/errors Page: syntax/a_resume_prefix_is_no_type
PHP
HTML
syntax/a_resume_prefix_is_no_type.pad
Result
{sequence 5, push='x'}{resume:x add=1}

App: regression/framework Page: data/a_bare_count_is_a_sequence_of_that_many
PHP
HTML
data/a_bare_count_is_a_sequence_of_that_many.pad
Result
{sequence 3}x{/sequence}

App: regression/framework Page: data/and_it_numbers_them_from_one_when_given_a_name
PHP
HTML
data/and_it_numbers_them_from_one_when_given_a_name.pad
Result
{sequence 3, name='n'}
{$n},
{/sequence}

App: regression/framework Page: expressions/and_it_reads_as_a_value_in_a_condition
PHP
HTML
expressions/and_it_reads_as_a_value_in_a_condition.pad
Result
{if sequence:square(6) eq 36}
y
{/if}

App: regression/framework Page: expressions/any_type_answers_the_same_way
PHP
HTML
expressions/any_type_answers_the_same_way.pad
Result
{if sequence:prime(8) eq 19}
y
{/if}

App: regression/framework Page: lenient/a_resume_prefix_is_no_type_and_leaves_the_store_alone
PHP
lenient/a_resume_prefix_is_no_type_and_leaves_the_store_alone.php
HTML
lenient/a_resume_prefix_is_no_type_and_leaves_the_store_alone.pad
Result
<?php

// The lenient walk under test: with the syntax check off, what cannot run passes the
// value through or yields empty, and the walk carries on.

$padCheckSyntax = FALSE;

?>
[{sequence 5, push='x'}{resume:x add=1}][{pull:x}{$sequence} {/pull:x}]

App: regression/framework Page: lenient/a_sequence_parameter_that_is_no_number_takes_its_default
PHP
lenient/a_sequence_parameter_that_is_no_number_takes_its_default.php
HTML
lenient/a_sequence_parameter_that_is_no_number_takes_its_default.pad
Result
<?php

// The lenient walk under test: with the syntax check off, what cannot run passes the
// value through or yields empty, and the walk carries on.

$padCheckSyntax = FALSE;

?>
[{sequence '1;2;3', from='abc'}{$sequence} {/sequence}][{sequence 3, increment='x'}{$sequence} {/sequence}][{sequence 3, skip='x'}{$sequence} {/sequence}][{sequence 3, minimal='x'}{$sequence} {/sequence}][{sequence prime, to='x', rows=3}{$sequence} {/sequence}]

App: regression/framework Page: lenient/a_term_position_below_1_or_with_a_fraction_has_no_term
PHP
lenient/a_term_position_below_1_or_with_a_fraction_has_no_term.php
HTML
lenient/a_term_position_below_1_or_with_a_fraction_has_no_term.pad
Result
<?php

// The lenient walk under test: with the syntax check off, what cannot run passes the
// value through or yields empty, and the walk carries on.

$padCheckSyntax = FALSE;

?>
[{echo sequence:prime(0)}][{echo sequence:fibonacci(-3)}][{echo sequence:fibonacci(2.7)}][{echo sequence:prime(1)}]

App: regression/framework Page: prefixes/sequence_names_a_sequence_type
PHP
HTML
prefixes/sequence_names_a_sequence_type.pad
Result
{sequence:prime rows=3}
{$sequence},
{/sequence:prime}