Newsgroups: comp.lang.apl
Path: watmath!watserv2.uwaterloo.ca!torn!howland.reston.ans.net!zaphod.mps.ohio-state.edu!wupost!CSM560.smsu.edu!umn.edu!csus.edu!sfsuvax1.sfsu.edu!vpcsc4
From: vpcsc4@sfsuvax1.sfsu.edu (Emmett McLean)
Subject: Re: efficient J programs (shellsort)
Message-ID: <1993Apr27.061401.27676@csus.edu>
Sender: news@csus.edu
Organization: San Francisco State University
References: <abalje47.735520194@ursa> <1993Apr23.203153.822@csus.edu> <abalje47.735855110@ursa>
Date: Tue, 27 Apr 1993 06:14:01 GMT
Lines: 54


>
>Why is boxing so expensive?
>I would have guessed boxing would be implemented by creating an array of
>pointers to the original object.  Indirection is not a very costly operation,
>really.  It sounds like entire arrays are being copied over.
>
> I still don't see why boxing is so difficult.  Please enlighten me.
>
 Your question goes beyond my current knowledge of the
 implementation. When I suggested that the execution time of boxing
 in J compared favorably to other APL's I was repeating what I 
 remember Roger Hui as saying to the APL User's Group here in the
 Bay Area. 

 You may find it of interest to look at the memory 
 usage in the following session :

   7!:2 'a =. i. 300 300'
720420
   7!:2 '<a'
360184
   7!:2 'b=. <a'
360272

  I don't know what one can conclude from this. At least the entire
  array is not recopied but this doesn't look like simple indirection
  either.
   
  The specifics of how nouns, verbs, conjunctions ... are represented
  are discussed in "An Implementation of J".  If you are hacking the
  source or using LinkJ you should purchase a copy. If not perhaps
  you can borrow a copy.
  

> (before the debugger, how about just improving error messages.  When a verb
> that has been created on a high level of nesting, (shellsort is a relatively
> small example) it is rather difficult to determine the source of 
> "domain error".  I've seen APL systems that point out exactly what they were
> trying to evaluate at the time of error.  Instead of "range error", how about
> "expected this range:       for this verb:     "?
>
  Yes, this would be nice.


  If efficiency is _really_ important , you can write a 10!:k verb.
  As you can see in my recent post, I implemented a verb
  using tacit defintion in J and then implemented its' 10!:0 
  counterpart, and the 10!:k verb was 25 times faster.

  I'll look at your other questions in the next few days.
  See what I can come up with.

  Emmett
