# New Cat Tutorial

## Christopher Diggins — 2006-10-31 06:56:43

    I just posted a tutorial on the Cat programming language to

    http://www.cat-language.com/tutorial.html . There is also some new

    enhancement to the Cat interpreter (bug fixes, more commands, and more

    tests). Test coverage is now up to 175 tests.

    Christopher Diggins

    http://www.cat-language.com

## Manfred Von Thun — 2006-10-31 08:12:30

    On 31/10/06 5:56 PM, "Christopher Diggins" <cdiggins@...> wrote:

     > I just posted a tutorial on the Cat programming language to

    > http://www.cat-language.com/tutorial.html . There is also some new

    > enhancement to the Cat interpreter (bug fixes, more commands, and more

    > tests). Test coverage is now up to 175 tests.

     [..]

    Looks very interesting, well done.

    Just one quibble, and I think it is an important one:

    You obviously want to avoid having a terminator (such

    as "." in Joy), and instead take end-of-line to mean

    "end of input, run interpreter". Many systems (languages,

    utilities,..) do exactly the same, and often it is the

    most sensible thing to do. In the rare case where it is

    necessary to have something extend over several lines

    one then needs a continuation character "\" or so

    at the end of line to mean "this is not the real end

    of the line, continue on the next. That is OK if such

    cases are indeed rare, and the total number of lines

    continued that way is small. But quite often those

    cases are not rare at all - in command languages, in

    C macros and so on. When I wrote a lot of lengthy C

    macros for the Joy implementation I got furious about

    the fact that any macro end at the end of line, and I

    had to have oodles of ugly continuation characters.

    I have seen similar cases in other languages.

    I would urge you to reconsider you decision. You

    will find that for any but the simplest tests a program

    or a definition does look better when spread generously

    over several lines with nice indentation and appropriate

    white space.

    In other respects, continue the way you have,

    and best wishes.

      - Manfred

## Christopher Diggins — 2006-11-01 02:55:16

    On 10/31/06, Manfred Von Thun <m.vonthun@...> wrote:

     >

    > On 31/10/06 5:56 PM, "Christopher Diggins" <cdiggins@...> wrote:

    >

    > > I just posted a tutorial on the Cat programming language to

    > > http://www.cat-language.com/tutorial.html . There is also some new

    > > enhancement to the Cat interpreter (bug fixes, more commands, and more

    > > tests). Test coverage is now up to 175 tests.

    >

    > [..]

    >

    > Looks very interesting, well done.

     Thank you very much! I think you did an excellent thing with the

    design of Joy as well. It is one of my all time favourite languages.

     > Just one quibble, and I think it is an important one:

    > You obviously want to avoid having a terminator (such

    > as "." in Joy), and instead take end-of-line to mean

    > "end of input, run interpreter".

     Except in the case of function definitions. In such case as "define x

    { ... }" the closing curly brace indicate the end of the input in the

    case of working with the interpreter. This is not working though in

    the current version.

    In the light of this, do you still feel that a termination character

    is neccessary?

    I can't imagine any scenario where this wouldn't be adequate, so any

    counter-examples would be helpful.

     > In other respects, continue the way you have,

    > and best wishes.

     Thank you very much for the encouragement Manfred.

    - Christopher

## Manfred Von Thun — 2006-11-03 02:22:37

    On 1/11/06 1:55 PM, "Christopher Diggins" <cdiggins@...> wrote:

     >

    > On 10/31/06, Manfred Von Thun <m.vonthun@...

    > <mailto:m.vonthun%40latrobe.edu.au> > wrote:

    >

    > [..]

    >> > Just one quibble, and I think it is an important one:

    >> > You obviously want to avoid having a terminator (such

    >> > as "." in Joy), and instead take end-of-line to mean

    >> > "end of input, run interpreter".

    >

    > Except in the case of function definitions. In such case as "define x

    > { ... }" the closing curly brace indicate the end of the input in the

    > case of working with the interpreter. This is not working though in

    > the current version.

    >

    > In the light of this, do you still feel that a termination character

    > is neccessary?

    >

    > I can't imagine any scenario where this wouldn't be adequate, so any

    > counter-examples would be helpful.

     counterexample: suppose that I have defined all sorts of functions, and

    I now want to use them to do something to a list of lists. Pretend that

    Joy needs a continuation character ³\².

     >> [ [1 2 3]                     \

    >>   [5 6 7]                     \

    >>   [4 9 8] ]                   \

    >> [ [ f ] map ] map         \

    >> [ g ]  filter

     Would you prefer this over NOT needing ³\², instead having a single

    ³.² after ³filter²?

    Best wishes

     - Manfred

    [Non-text portions of this message have been removed]

## Christopher Diggins — 2006-11-03 04:19:01

    Hi Manfred,

    Thanks for the example. First, even if the "\" were neccessary for the case

    of unterminated lists or quotations, the placement of it after map is

    artificial.

     >> [ [ f ] map ] map

    >> [ g ] filter

     should have precisely the same meaning as:

     >> [ [ f ] map ] map [ g ] filter

     At least this is how Cat works, and is my understanding of how the Joy

    interpreter should work as well.

    In theory the Cat interpreter can infer that the current expression is not

    complete, i.e. when a square bracket, paranthesis or curly brace remain

    unclosed. In which case the session might look like:

     >> [ [1 2 3]

     \ [5 6 7]

    \ [4 9 8] ]

     >> [ [ f ] map ] map

    >> [ g ] filter

     The "\" character would be a prompt generated by the interpreter which means

    "finish your expression". As I mentioned earlier the other line breaks

    wouldn't change the meaning of the code.

    So there technically is no need for a line terminator character or

    continuation character in Cat. It just requires a bit of tricky code logic

    to achieve. Though I did implement in an earlier version of Cat, the current

    version doesn't support such smart line breaking in the interpreter. I will

    try to add it soon, and I appreciate you bringing the concern to my

    attention.

    Cheers,

    Christopher

     On 11/2/06, Manfred Von Thun <m.vonthun@...> wrote:

    >

    >

    >

    > On 1/11/06 1:55 PM, "Christopher Diggins" <cdiggins@...<cdiggins%40gmail.com>>

    > wrote:

    > >

    > > On 10/31/06, Manfred Von Thun <m.vonthun@...<m.vonthun%40latrobe.edu.au>

    > > <mailto: m.vonthun% <m.vonthun%25>40latrobe.edu.au> > wrote:

    > >

    > > [..]

    > >> > Just one quibble, and I think it is an important one:

    > >> > You obviously want to avoid having a terminator (such

    > >> > as "." in Joy), and instead take end-of-line to mean

    > >> > "end of input, run interpreter".

    > >

    > > Except in the case of function definitions. In such case as "define x

    > > { ... }" the closing curly brace indicate the end of the input in the

    > > case of working with the interpreter. This is not working though in

    > > the current version.

    > >

    > > In the light of this, do you still feel that a termination character

    > > is neccessary?

    > >

    > > I can't imagine any scenario where this wouldn't be adequate, so any

    > > counter-examples would be helpful.

    >

    > counterexample: suppose that I have defined all sorts of functions, and

    > I now want to use them to do something to a list of lists. Pretend that

    > Joy needs a continuation character ³\².

    > >> [ [1 2 3] \

    > >> [5 6 7] \

    > >> [4 9 8] ] \

    > >> [ [ f ] map ] map \

    > >> [ g ] filter

    > Would you prefer this over NOT needing ³\², instead having a single

    > ³.² after ³filter²?

    >

    > Best wishes

    >

    > - Manfred

    >

    > [Non-text portions of this message have been removed]

    >

    >

    >

    [Non-text portions of this message have been removed]

## Christopher Diggins — 2006-11-04 04:38:08

    In response to Manfred's concerns , I updated the Cat interpreter with line

    continuations as described in the previous post. The new release is numbered

    0.9.5.1 and be downloaded at http://www.cat-language.com/download.html . I

    have also made some updates to the manual at

    http://www.cat-language.com/manual.html .

    What would be particularly helpful at this point would be a critique of the

    manual. However, any feedback would be appreciated.

    Thanks,

    Christopher

     On 11/2/06, Christopher Diggins <cdiggins@...> wrote:

    >

    > Hi Manfred,

    >

    > Thanks for the example. First, even if the "\" were neccessary for the

    > case of unterminated lists or quotations, the placement of it after map is

    > artificial.

    >

    > >> [ [ f ] map ] map

    > >> [ g ] filter

    >

    > should have precisely the same meaning as:

    >

    > >> [ [ f ] map ] map [ g ] filter

    >

    > At least this is how Cat works, and is my understanding of how the Joy

    > interpreter should work as well.

    >

    > In theory the Cat interpreter can infer that the current expression is not

    > complete, i.e. when a square bracket, paranthesis or curly brace remain

    > unclosed. In which case the session might look like:

    >

    > >> [ [1 2 3]

    > \ [5 6 7]

    > \ [4 9 8] ]

    > >> [ [ f ] map ] map

    > >> [ g ] filter

    >

    > The "\" character would be a prompt generated by the interpreter which

    > means "finish your expression". As I mentioned earlier the other line breaks

    > wouldn't change the meaning of the code.

    >

    > So there technically is no need for a line terminator character or

    > continuation character in Cat. It just requires a bit of tricky code logic

    > to achieve. Though I did implement in an earlier version of Cat, the current

    > version doesn't support such smart line breaking in the interpreter. I will

    > try to add it soon, and I appreciate you bringing the concern to my

    > attention.

    >

    > Cheers,

    > Christopher

    >

    >

    >

    > On 11/2/06, Manfred Von Thun <m.vonthun@... > wrote:

    > >

    > >

    > >

    > > On 1/11/06 1:55 PM, "Christopher Diggins" <cdiggins@...<cdiggins%40gmail.com>>

    > > wrote:

    > > >

    > > > On 10/31/06, Manfred Von Thun <m.vonthun@...<m.vonthun%40latrobe.edu.au>

    > > > <mailto: m.vonthun% <m.vonthun%25>40latrobe.edu.au> > wrote:

    > > >

    > > > [..]

    > > >> > Just one quibble, and I think it is an important one:

    > > >> > You obviously want to avoid having a terminator (such

    > > >> > as "." in Joy), and instead take end-of-line to mean

    > > >> > "end of input, run interpreter".

    > > >

    > > > Except in the case of function definitions. In such case as "define x

    > > > { ... }" the closing curly brace indicate the end of the input in the

    > > > case of working with the interpreter. This is not working though in

    > > > the current version.

    > > >

    > > > In the light of this, do you still feel that a termination character

    > > > is neccessary?

    > > >

    > > > I can't imagine any scenario where this wouldn't be adequate, so any

    > > > counter-examples would be helpful.

    > >

    > > counterexample: suppose that I have defined all sorts of functions, and

    > > I now want to use them to do something to a list of lists. Pretend that

    > > Joy needs a continuation character ³\².

    > > >> [ [1 2 3] \

    > > >> [5 6 7] \

    > > >> [4 9 8] ] \

    > > >> [ [ f ] map ] map \

    > > >> [ g ] filter

    > > Would you prefer this over NOT needing ³\², instead having a single

    > > ³.² after ³filter²?

    > >

    > > Best wishes

    > >

    > > - Manfred

    > >

    > > [Non-text portions of this message have been removed]

    > >

    > >

    > >

    >

    >

    [Non-text portions of this message have been removed]