App: manual - Page: fragments/expressions_32
App: regression/framework - Page: expressions/a_chain_of_real_pipe_functions_is_fine
PHP
|
HTML
expressions/a_chain_of_real_pipe_functions_is_fine.pad
|
Result
|
|
{echo 'HELLO' | lower | ucfirst}
|
|
App: regression/framework - Page: expressions/a_pipe_in_brackets_after_a_call_with_arguments_runs_every_part
PHP
|
HTML
expressions/a_pipe_in_brackets_after_a_call_with_arguments_runs_every_part.pad
|
Result
|
|
{echo (mid('hello', 1, 2) | ucfirst)} {echo (php:max(1, 2, 3) | + 1)} {echo upper(('ab' | replace('a', 'x')))} {echo ('x' | left(2) | . '!')}
|
|
App: regression/framework - Page: functions/a_listed_function_takes_a_callable_the_list_allows
PHP
functions/a_listed_function_takes_a_callable_the_list_allows.php
|
HTML
functions/a_listed_function_takes_a_callable_the_list_allows.pad
|
Result
|
<?php
// A callable the list allows is handed on as before, and a function name as an argument // that is no callable is only text.
$padPhpFunctions = [ 'implode', 'array_map', 'strtoupper', 'ucfirst' ];
?>
|
[{echo php:implode(',', php:array_map('strtoupper', ['x', 'y']))}][{echo php:ucfirst('system')}][{echo php:implode(',', php:array_map(NULL, ['a']))}]
|
|
App: regression/framework - Page: functions/a_php_function_piped_an_empty_value_is_still_handed_it
PHP
functions/a_php_function_piped_an_empty_value_is_still_handed_it.php
|
HTML
functions/a_php_function_piped_an_empty_value_is_still_handed_it.pad
|
Result
|
<?php
$title = '';
?>
|
[{$title | ucfirst}] [{echo $title | php:strtoupper}] [{echo php:time() | gt 5 ? 'set' : 'unset'}]
|
|
App: sequence - Page: index
PHP
index.php
|
HTML
index.pad
|
Result
|
<?php
// Front page: names the five ideas the subsystem is built from, and describes the one the // concept= parameter asks for. // // concept arrives from the query string, so it is only used when it names one of them - // reading $concepts with an unknown key ended the request with a 500 instead of a page, // and so did concept[]=, which arrives as an array.
$concepts ['sequences'] = 'Something that defines a Sequence list'; $concepts ['stores'] = 'A stored sequence list'; $concepts ['actions'] = 'An action executed on a Sequence list'; $concepts ['plays'] = 'Execute a Sequence on a Sequence'; $concepts ['resume'] = 'Resume on a stored Sequence';
if ( ! isset ( $concept ) or ! is_string ( $concept ) or ! isset ( $concepts [$concept] ) ) $concept = 'sequences';
$title = 'Sequences';
$conceptTitle = ucfirst ($concept ) . ' - ' . $concepts [$concept];
?>
|
{lines} {concepts} {if &concepts:key NE $concept} <a href="?index&go=index&concept={&concepts:key}">{&concepts:key | ucfirst}</a> @else@ <b> {&concepts:key | ucfirst} </b> {/if} {notLast} | {/notLast} {/concepts} {/lines}
<h2>{$conceptTitle}</h2>
{block} {page 'concepts/{$concept}', include} {/block}
|
|
App: sequence - Page: listen
PHP
listen.php
|
HTML
listen.pad
|
Result
|
<?php
// Listen: a sequence played as notes. Each of the first 32 terms becomes a note - the // term modulo 60, five octaves up from C2, the way the OEIS 'listen' button folds a term // into the keyboard - and the notes are written as a WAV file into the page itself // (seqFunWav in _lib/fun.php), so an <audio> element plays them without JavaScript. // Recamán's sequence, which jumps back and forth, is the famous one to listen to. // // type arrives from the query string and is used only when it names a type the gallery // draws.
$choices = seqFunTypes ();
if ( ! isset ( $type ) or ! is_string ( $type ) or ! in_array ( $type, $choices ) ) $type = 'recaman';
$terms = seqFunTerms ( $type, 32 ); $oeis = seqFunOeis ( $terms, $type ); $oeis = $oeis ? sprintf ( 'A%06d', $oeis ) : ''; $list = implode ( ', ', $terms ); $notes = implode ( ' ', array_map ( 'seqFunNoteName', seqFunNotes ( $terms ) ) ); $audio = seqFunWav ( $terms );
?>
|
<p>{choices}{notFirst} | {/notFirst}{if $choices eq $type}<b>{$choices}</b>@else@<a href="?listen&type={$choices}">{$choices}</a>{/if}{/choices}</p>
<h3>{$type | ucfirst}{if $oeis ne ''} - <a href="https://oeis.org/{$oeis}">{$oeis}</a>{/if}</h3>
{chart 'line', data='terms', title='{$type | ucfirst}, the first 32 terms', width=640, height=220}
<p><audio controls preload="none" src="{$audio}"></audio></p>
<p>Each term is a note: the term modulo 60, counted in semitones up from C2.</p>
<p><small>{$list}</small></p>
<p><small>{$notes}</small></p>
|
|
|