On Thu, May 14, 2009 at 12:36 AM, Raul Miller <[email protected]> wrote:
> That's an extreme overgeneralization of my point of view.

More specifically, in one instance -- where it looks like an APL
primitive has been recharacterized somewhat abstractly -- I
have been advocating that APL's original approach has what I
see as significant advantages over the recharacterization.

However, in terms of implementation:
   insertr=: /
   insertl=: ~/(@|.)
   foldr=: insertr (@,)
   foldl=: insertl (@,~)
   mixedr=: (&.>) foldr (&.(<"1))
   mixedl=: (&.>) foldl (&.(<"1))

insertr is the original definition.

foldr deals with the initial value issue

mixedr additionally deals with mixed domain issues
(the initial value should be supplied as a single item
but it may be omitted by providing an empty list for
the right argument (mixedr) or left argument (mixedl)).

The insertl, foldl and mixedl cases provide left associativity
instead of right.

And, yes, J could provide some significant optimizations
for cases where these adverbs derive from trivial verbs.

Has J missed the boat here, in terms of good implementation?
Are the cases for these operations so compelling that they
all deserve primitives?  Or, should the mixedr case be
so significant that it should have gotten the / primitive
instead?  I have seen no compelling arguments of this type.

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

Reply via email to