>I use J504 on a PowerBook with OS V 10.4.7 in German language.

I recommend upgrading to J6.01a, if you can.  The primary incentive is that the 
rest of the community already has, and mostly we "talk in J6".  A lot of the 
examples you'll see flying around this Forum, on the Wiki, and elsewhere, will 
be in J6, and many of them will not work in J5.  Furthermore, it'll be easier 
for us to give you support if you're on the same platform we are.


> Can I do something that allows German "Umlaute" like ä and ü in J code?

I'm not quite sure what you're asking here, but

  (A)  Yes, you can embed diacritical characters in J literals, like:
        
                 ]txt=.'aäuü'
              aäuü

  (B)  No, you can not use these characters in J names:

                 ]aäuü=.'txt'
              |spelling error
              |      ]aäuü=.'txt'
              |        ^

Regarding (A), J6 is different from J5 with respect to non-ASCII characters. 
The release highlights mention this change:  
http://www.jsoftware.com/help/user/relhigh.htm#feats  .  I only use ASCII, so I 
can't elaborate further, but maybe other members of this Forum can.


>Does a key combination exist which interrupt an endless loop without  
>closing J?

I believe CTRL+C will interrupt execution in all versions of Jconsole (both J5 
and J6), but for Jwd (the "normal", windowed interface to J), the answer is 
more complicated.

In J5 on a PC, I know you can use CTRL+Break.  I believe the equivalent on the 
Mac is Command+Break.  I don't know where the break key is on a Powerbook, but 
I know certain PC laptops require you to press Fn+<some other key> to get 
break.  So you might end up having to press Command+Fn+<some other key> to get 
a break for J5 on a Mac Powerbook.

In J6, break is different.  There is a shell command you must issue to break J 
sessions (i.e. independent/outside of the J session).  This is covered in  
http://www.jsoftware.com/help/user/interrupt.htm  .  So in J6, there is no 
interrupt key by default.   

I know in Windows, I can create a shortcut that executes this command, and 
assign a global keybinding to it.  You can make a similar shortcut on your Mac, 
but I don't know if Mac supports the notion of a global keybinding.  You may 
have to use your mouse to press a button.  

Perhaps a Mac savvy J'er can give more specific advice?



> I would appreciate examples for "Adverse" to handle  
> error situations which are easy to understand.

Others have answered you, but a quick example follows.

           NB.  A function to lookup first name from last name.
           nm  =.  (;:'Dan Roger Henry')  {~ (;:'Bron Hui Rich')  i. ]


           NB.  Example of normal use -- no error.
           nm ;: 'Bron'
        +---+
        |Dan|
        +---+

           NB.  But it doesn't know your last name, so   {  throws an index 
error.
           nm ;: 'Schild'
        |index error: nm
        |       nm;:'Schild'

           NB.  To avoid the error, we can use  { :: 0:  in place of plain  {
           nm2 =.  (;:'Dan Roger Henry')"_  { :: 0: ~ (;:'Bron Hui Rich')"_  i. 
]

           NB.  Now, when  nm2  sees a name it doesn't know, it returns  0  .
           nm2 ;: 'Schild'
        0

However, you'll find writing J leads to more imaginative ways of handling 
errors. Often, you won't want to use   try. or  ::  .  For example, the code 
above is not very robust:

           nm2 ;: 'Bron Rich'
        +---+-----+
        |Dan|Henry|
        +---+-----+
           nm2 ;: 'Bron Rich Schild'
        0
           
   
Note that if ANY of the names fed to   nm2   are unknown, the entire call fails 
-- none of the known names are returned.  Of course, we could try to work 
around this problem:

           nm2"0 ;: 'Bron Rich'
        +---+-----+
        |Dan|Henry|
        +---+-----+
           nm2"0 ;: 'Bron Rich Schild'
        |domain error
        |       nm2"0;:'Bron Rich Schild'

But we still have problems.  You can't mix types in J -- an array can't contain 
both boxes (like  ;:'Dan' ) AND numbers (like  0  ).  So, another work around; 
don't return numbers in the error case, return a box.

           nm3 =.  (;:'Dan Roger Henry')"_  { :: (  ({.;:'UNKNOWN')"_ )  ~ 
(;:'Bron Hui Rich')"_  i. ]
           nm3"0 ;: 'Bron Rich Schild'
        +---+-----+-------+
        |Dan|Henry|UNKNOWN|
        +---+-----+-------+
           
But this leads directly to a new insight.  If you're going to return a default 
first name when the last name isn't known, and the error in  {  is resulting 
from the fact that it's trying to select the item that's after the end of the 
list of first names, then we can just append the default name to the list of 
known names.  Thus, we can avoid  ::  (and  "0  ) altogether:

           NB.  Note the list of first names is one longer than the list of 
last names.
           nm4 =.  (;:'Dan Roger Henry UNKNOWN')"_  {~ (;:'Bron Hui Rich')"_  
i. ]
           nm4 ;: 'Bron Rich Schild'
        +---+-----+-------+
        |Dan|Henry|UNKNOWN|
        +---+-----+-------+

This is both more elegant and significantly faster.  Granted, this is only a 
single example, but I can tell you this kind of thinking becomes pervasive.  I 
have very few instances of  try.  or  ::  in my code.


>Are there J packages or labs which include  more comprehensive  
>collections of statistical functions?

There's a statistics script in the standard library.  You can access it by:

           load 'stats'
           
Then, to see what functions it defines, type:

           mean

Then position your cursor (carat) over the word 'mean' and press CTRL+F1 (or 
Command+F1 ?).  Actually, that list is incomplete; it doesn't tell you about 
the rand functions defined by  ~system\packages\stats\random.ijs  .

J also provides the standard LAPACK and FFTW as addons.  You can read about and 
download them at  http://www.jsoftware.com/jwiki/Packages  ,


>Can you recommend a handheld without a phone module, on which the  
>Pocket PC-version of J is operational?

J runs on any handheld whose OS is PocketPC 2003 or later, whether or not it's 
also a phone.  I've had some personal experience with J  on various iPaq 
models.  Like every other application on a small device, I found the interface 
(input/output) too restrictive.  I don't feel that J on a small device is good 
for anything other than a "neato!" or perhaps deploying a packaged application 
for field personnel.  Certainly I don't expect anyone to do "serious" 
programming in that environment.

There's growing J-on-a-PocketPC related information and observations at  
http://www.jsoftware.com/jwiki/PocketPC  , and you might find some tidbits by 
searching the Forums, at  http://www.jsoftware.com/forumsearch  , e.g. 
http://www.jsoftware.com/cgi-bin/forumsearch.cgi?all=&exa=&one=pocket+pocketpc+handheld&exc=&add=&sub=&fid=&tim=0&rng=0&dbgn=1&mbgn=1&ybgn=1998&dend=31&mend=12&yend=2006
  .

I hope this helps.  Good luck with J!

-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to