Skip to main content
clarification
Source Link
lisa
  • 171
  • 2

OS/2 Classic Rexx, 102... or 14 for "cheater's version"

Take out the linefeeds to "golf" it.

w='%1'
o=center('O',w,'-')
m='center(space("\|/",w),%1)'
do w
  w=w-1
  interpret "o="m"|o|"m
end l
say o

Cheater's version, name the script whatever source code you want under 255 characters (requires HPFS disk):

interpret '%0'

EDIT: Just to be clear, cheater's version isn't intended to count! It's just to be silly and show an old dog can still do tricks. :)

e.g. For real fun and games, an implementation of Java-8/C11 style "lambda" expressions on a list iterator. Not tested, but ought to run on a circa 1979 IBM mainframe. ;)

ForEachInList( 'Months.January.Days', 'Day' -> 'SAY "You have an appointment with" Day.Appointment.Name "on" Day.Appointment.Date' )
EXIT

ForEachInList: 
    SIGNAL ON SYNTAX
    PARSE ARG MyList "," MyVar "->" MyCommand
    INTERPRET ' MyListCount = ' || MyList || '.Count'
    DO ListIndex = 1 TO MyListCount
       INTERPRET MyVar || ' = ' || MyList || '.' || ListIndex
       INTERPRET MyCommand
    END
    RETURN
SYNTAX:
    SAY MyCommand ' is not a valid expression. '
    EXIT

-- Calling code assumes you already made a stem (array), naturally.

OS/2 Classic Rexx, 102... or 14 for "cheater's version"

Take out the linefeeds to "golf" it.

w='%1'
o=center('O',w,'-')
m='center(space("\|/",w),%1)'
do w
  w=w-1
  interpret "o="m"|o|"m
end l
say o

Cheater's version, name the script whatever source code you want under 255 characters (requires HPFS disk):

interpret '%0'

OS/2 Classic Rexx, 102... or 14 for "cheater's version"

Take out the linefeeds to "golf" it.

w='%1'
o=center('O',w,'-')
m='center(space("\|/",w),%1)'
do w
  w=w-1
  interpret "o="m"|o|"m
end l
say o

Cheater's version, name the script whatever source code you want under 255 characters (requires HPFS disk):

interpret '%0'

EDIT: Just to be clear, cheater's version isn't intended to count! It's just to be silly and show an old dog can still do tricks. :)

e.g. For real fun and games, an implementation of Java-8/C11 style "lambda" expressions on a list iterator. Not tested, but ought to run on a circa 1979 IBM mainframe. ;)

ForEachInList( 'Months.January.Days', 'Day' -> 'SAY "You have an appointment with" Day.Appointment.Name "on" Day.Appointment.Date' )
EXIT

ForEachInList: 
    SIGNAL ON SYNTAX
    PARSE ARG MyList "," MyVar "->" MyCommand
    INTERPRET ' MyListCount = ' || MyList || '.Count'
    DO ListIndex = 1 TO MyListCount
       INTERPRET MyVar || ' = ' || MyList || '.' || ListIndex
       INTERPRET MyCommand
    END
    RETURN
SYNTAX:
    SAY MyCommand ' is not a valid expression. '
    EXIT

-- Calling code assumes you already made a stem (array), naturally.

Source Link
lisa
  • 171
  • 2

OS/2 Classic Rexx, 102... or 14 for "cheater's version"

Take out the linefeeds to "golf" it.

w='%1'
o=center('O',w,'-')
m='center(space("\|/",w),%1)'
do w
  w=w-1
  interpret "o="m"|o|"m
end l
say o

Cheater's version, name the script whatever source code you want under 255 characters (requires HPFS disk):

interpret '%0'