[CSCI2322] Re: Class Examples

John Howland cs2322 at ariel.cs.trinity.edu
Wed Sep 13 17:37:20 CDT 2006


On Wed, 13 Sep 2006, Alcantar, Ricardo wrote:

> Dr. Howland,
>
> Is there any way for us to see the examples that we do in class?

Ricardo,

Good question.  I have answered this verbally, but here are the
nitty gritty details (I'm copying this reply to our class mailing list
so all can see).

If you copy /users/jhowland/.jhistory to some file in your home directory , i.e.,

cp /users/jhowland/.jhistory ./howland-jhistory

and then call that file up in an editor (such as vi) to select,
by deleting the lines before and after what were used for a
given lecture, say the lecture of 20060912 (I found I had to
delete the last 13 lines because I used J in my graphics class
after functional programming on 20060912), I had the following
file named

howland-jhistory :


verb
dyad
foo =: verb define
- y.
:
x. - y.
)
3*foo 4
3*4foo 5
3*4 foo 5
names
4!:1 ''
a =: i. 10
4!:1 ''
noun
4!:1 0
(4!:1) 0
(4!:1) 3
1 2 3 , 4 5
1 2 3 ,'abc'
< 1 2 3
(<1 2 3) , <'abc'
b =:(<1 2 3) , <'abc'
1 { b
2 0 from b
1 0 from b
b
0 { b
> 0 { b
1 { > 0 { b
b
<b
link
 1 2 3 ; 'abc'
i. 10
;/i.10
;/'abcdef'
bar =: 222222222222222222222222222222222222222x * 555555555555555555555555555555555555555555555555x
bar
foo
bar1 =: bar ; 1 2 3 ; 'now is the time'
bar1
bar
names noun
names verb
names
(4!:1) noun
> (4!:1) noun
$ > (4!:1) noun
' ' = 0{ > (4!:1) noun
 0{ > (4!:1) noun
$ 0{ > (4!:1) noun
names noun
('de';'foo1') =: 3 4
name noun
names noun
de
foo1
names noun
#names noun
'n1 n2 n3 n4 n5 n6
'n1 n2 n3 n4 n5 n6' =: names noun
n1
n3
'x y z' =: 1 2
'x y z' =: 1
x
y
z
names verb
names noun
foo2 =: monad define
'a b c' =. y.
%a*b-c
)
a
foo2 3 4 5
a
b
c
foo2 =: monad define
'a b c' =. x: y.
%a*b-c
)
foo2 3 4 5
%3x
x: .333333
x: .33333333333333333333333333333333
x: .333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333
ls =: 10000$ 0.01
+/ls
print_precision
print_precision''
set_print_precision 17
print_precision''
+/ls

These are the expressions which I typed into J during the 20060912 lecture.
I had to delete a lot of lines at the beginning of the file because this history
is quite large.  It is probably best to work backwards when deleting lines.
Before exiting the editing session, add a last line of

exit 0

All of this work should be done in your cs2322j directory.

To re-create both input an output for the session, enter the following
unix command:

echo "lecture'howland-jhistory'" | j > 20060912-lecture

This tells J to run the J program called lecture on the file

howland-jhistory

and send the output to

20060912-lecture

You then have a copy of the complete lecture session.  Isn't J neat!

I have done this for the 20060912 lecture and left the above named files
in ~jhowland/cs2322j .

John


>
> thanks,
>
> _____________________
> Ricardo Alcantar
> Trinity University
> One Trinity Place #1005
> San Antonio, TX. 78212
> (210)843-8033
> Ricardo.Alcantar at trinity.edu
>

_______________________________________________________________
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