Pep and Nom

home | documentation | examples | translators | download | blog | all blog posts

the ℕ𝕠𝕞 "zero" command

Set the ℙ𝕖𝕡 accumulator register to zero

The “zero” command sets the pep machine accumulator or counter to zero. The accumulator register may be used for any purpose as seen fit by the intrepid linguist, for example for counting the number of words per line. For counting characters or lines it may be easier to use the lines command or the chars command.

count words per line and display


    while [\r\t\f ]; clear; 
    whilenot [:space:]; a+; add " "; print; clear;
    # print the line count after every line or at end of file
    while [\n]; 
    [\n],(eof) { 
      clear; add "(# words: "; count; add ")\n"; print;
      zero; clear;
    } 
    clear;
    (eof) { quit; }
  

see also