[CSCI2322] I was brain dead

John Howland jhowland at ariel.cs.trinity.edu
Wed Apr 26 15:05:43 CDT 2006


We had the definition of the adverb correct (almost)

Since adverbs have their args on the left (ex., insert /

+/ sum
*/ product

we must write it as:

tag =: adverb define
, & ('<', m. ,'>')
)

m. rather than n.

and

br =: 'br' tag

Here is sample from a J session

    tag =: adverb define
, & ('<', m. ,'>')
)
    tag
1 : ', & (''<'', m. ,''>'')'
    'br' tag
,&'<br>'
    br =: 'br' tag
    br 'hi'
hi<br>

See http://www.cs.trinity.edu/~jhowland/test-html-tools.cgi
for this working to generate an html page.

Notice how this works if we do it as I initially tried:

tag =: adverb define
, & ('<', n. ,'>')
)


    tag 'br'
|syntax error
|       tag'br'
    'br'tag
|value error: n.
|   ,&('<',    n.,'>')

so the args to an adverb are written on the left and when the
argument is referred to in an explicit definition of an adverb,
m. rather than n. must be used.

_______________________________________________________________
John E. Howland       url: http://www.cs.trinity.edu/~jhowland/
Computer Science    email: jhowland at ariel.cs.trinity.edu
Trinity University  voice: (210) 999-7364
One Trinity Place     fax: (210) 999-7477
San Antonio, Texas  78212-7200


More information about the CSCI2322 mailing list