view src/ploki/examples/cat.pk @ 8916:0234daffd946

<oerjan> addquote <int-e> I couldn\'t help thinking that maybe if one considers the ramifications in full detail it will turn out that overthinking is often not helpful and therefore, not something to be proud of.
author HackBot
date Sun, 14 Aug 2016 02:31:47 +0000
parents ac0403686959
children
line wrap: on
line source

#!../ploki
NEXT main-program

FOR cat LET line @LEGS \@
    IF line ; ""
        WUNT line
        NEXT cat
    END IF
KTHX

FOR open
    IF \@ : "-"
        KTHX \EING
    FI
KTHX @LAPERS \@

FOR main-program
LET status 0
IF \ARG < 2
    cat \EING
    END status
FI
LET i 0
FOR arg LET i i+1
IF i < \ARG
    LET fh @open \ARG:i
    IF @NOT fh
        WUNT (\ARG:0_": "_\ARG:i_": "_\!_"\n")
	LET status status+1
	NEXT arg
    FI
    cat fh
    IF fh ! \EING
        CLAUDS fh
		IF \_
            WUNT (\ARG:0_": "_\ARG:i_": "_\!_"\n")
	        LET status status+1
        FI
    FI
    NEXT arg
FI
END status