From jhowland at ariel.cs.trinity.edu  Wed Apr 26 15:05:43 2006
From: jhowland at ariel.cs.trinity.edu (John Howland)
Date: Wed Apr 26 15:05:45 2006
Subject: [CSCI2322] I was brain dead
Message-ID: <Pine.LNX.4.63.0604261446350.12586@Ariel.CS.Trinity.Edu>

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@ariel.cs.trinity.edu
Trinity University  voice: (210) 999-7364
One Trinity Place     fax: (210) 999-7477
San Antonio, Texas  78212-7200
From jhowland at ariel.cs.trinity.edu  Wed Apr 26 15:56:49 2006
From: jhowland at ariel.cs.trinity.edu (John Howland)
Date: Wed Apr 26 15:56:51 2006
Subject: [CSCI2322] Extra credit problem,
 Send to cs2322@ariel.cs.trinity.edu by Final Exam time
Message-ID: <Pine.LNX.4.63.0604261534310.13151@Ariel.CS.Trinity.Edu>

To my great little Functional Programming class,

As mentioned in class today.  There will be no final and no final
project.  I will use what work we have done so far plus extra
credit work to compute your grade.  I will be returning the exams
and other work on Friday.

Extra Credit problem:

Use the latest version of /users/jhowland/cs2322j/html-tools.ijs and
make any additions necessary to those tools to generate a page which
looks like

http://www.cs.trinity.edu

Your page should be tested by:

http://www.cs.trinity.edu/~your-user-id/cs.cgi

This means that you will create a file

/users/your-user-id/Local/HTML-Documents/cs.cgi

which contains the first two lines

#!/usr/local/bin/jconsole
require'html-tools.ijs'
...


This means that you will have your version of

/users/your-user-id/Local/HTML-Documents/html-tools.ijs

where you have added what ever necessary definitions to

/users/jhowland/cs2322j/html-tools.ijs

to generate the CS home page.  For example, the CS page uses
tables, so you will probably have some table definition functions.

You should use the images and backgrounds which the real CS page
uses (look in the page source for those).  I did a couple of those
in

/users/jhowland/cs2322j/test-html-tools.cgi

Finally, I changed the ht definition in

/users/jhowland/cs2322j/html-tools.ijs

to produce more readable html code by appending a newline character
at the end of a tag ( , 10 { a.  at the end of each result).
This gets rid of the long lines (which we didn't see when viewing
the generated web page with a browser) making the page source
a little more human readable.

John

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