developing in J with simple tools and simple minds 
Author Message
 developing in J with simple tools and simple minds

There are a number of people who believe that is
difficult to develop systems in J. That J is just a number
of mathematical notations.

Similar to misconceptions about APL in general but more
so because even APLers believe that it is hard to
make programs in J.

If this ever was true then it certainly is not so any more.

For many months now I have concentrated on the new
Visual J  (J2 personal edition) and I have to say that in the
beginning I was a bit reluctant to replace my "old" J/Dos
programs as well as my Visual Basic stuff. After all they
were working and why fix something that is not broke.

Because of helping out with testing the new J as well as
reading the doc that comes with it looking for typos I have
began to find a lot of interesting little interesting things.

There are a lot of control words in Visual J that I did not have
in J/Dos. If. do. while. and so on.

The debug facilities are there too.

An interesting thing to do is set a verb to tell you about
contents of vars.

out=. 1!:2&2

By doing this you can place the verb "out" little bit here
and there in your verbs and it will print out the contents of
nouns.

If you load the profile.js you get a number of utils.
One is the verb "require". It is good to place that at the
beginning of your script. Say:

require 'files misc'

Brings in a set of tools to assist you reading files and
splitting up text.

Say you want to read in some files and look in them
quickly.

In your script you say:

require 'files misc'
out=.1!:2&2
PATH=.'i:\roameo\postur\skeyti\'

test=. 3 : 0
DIR=: 0 dir PATH
SPLIT=:chop DIR
FIRST=:{.SPLIT
out FIRST
out ' '
FILE=:fread PATH,,>FIRST
SPLIT_FILE=:chop FILE
out 'Number of lines ',":#SPLIT_FILE
)

test ''

You can of course from the open script run individual
lines as you test things out but when you have added
a number of lines in the script it is convenient to put the
lines in a verb. Put the "out" verb in there and then you can
investigate what is happening in the verb as it executes.

Also use =: instead of =. during development so you
can look at the contents of nouns outside the verb.
It is easy to use the editors to replace one with the other
as you need to change from dev to prod. Use your editor
of choice. The J session manager is good for that also.

Place the windows side by side so you can watch both
the script and the execute window at the same time.

I think it is basically learning new techniques instead of
the "old" APL ways. I have been discovering that J contains
a lot of undocumented features. And sometimes they are
documented but in such a way that it is difficult to
understand how you do things.

Like this little verb "out". It is so useful but it is not among
the utilities. Probably because for Jers it is so obvious and
easy to write 1!:2&2 . I have discovered a lot of those kind of
little things which in the beginning seemed to be impossible
but turned out to be "obvious" and easy.

Everything is easy obvious and simple once you know it.
When you do not it seems very complicated.

The learning curve for J needs not be steep in the beginning
but I am afraid for quite a lot of people it is. It was for me
in the beginning. I was more or less forced into J because
I could not use APL. I am very happy that I took the time.
/Gosi

http://www.*-*-*.com/
http://www.*-*-*.com/



Fri, 01 May 1998 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Losing my mind over simple syntax (non)error

2. Simple-minded Windows programming (DVF)

3. Two simple-minded capitalization functions for string.py

4. how to develop simple time based ramp driver for lab view VI

5. developing simple sprite module

6. Very simple awk for a simple user

7. Simple courses in J for simple (ordinary) people

8. Simple courses in J for simple (ordinary) people

9. Simple courses in J for simple (ordinary) people

10. Simple task-not simple for Dummy, Help

11. Simple Hardware, Simpler FORTH

12. Simple forth question - maybe simple ?

 

 
Powered by phpBB® Forum Software