The problem here is that ELSE and WHEN are not verbs, so they must be
defined before they can be used.

FYI,

-- 
Raul

On Thu, Jul 7, 2011 at 9:47 AM, David Ward Lambert
<[email protected]> wrote:
> Likewise, I cut&paste into emacs console session.  Thank you for fixing
> this!
>
> The wacky indenting indicates, to me, top down programming.  I briefly
> considered adopting the style but it doesn't work without extra thought.
> Suppose, as I did, we follow the instructions to speed the code.
> However we write these into a new file and load it all at once into a
> new j session.  This causes domain error, I presume because the
> undefined names ELSE and WHEN that j takes as verbs become other parts
> of speech.  Loading the script that follows twice, or reordering it
> fixes the trouble.  The original script is an exquisite representation
> of the algorithm.
>
> AP =: ;@AllParts ELSE N WHEN (1:e.,)
>   N =: ,:@{.~
>   AllParts =: <@Parts"0 >:@i.
>      ELSE =: `
>      WHEN =: @.
>      Parts =: Add1 ELSE Ones WHEN <:
>         Ones =: < }. ] ,:@# 1:
>         Add1 =: 1: + - AP ]
>
> AP =: AP f. M.  NB. domain error
>
>
> On Thu, 2011-07-07 at 12:00 +0800, [email protected] wrote:
>>
>> Message: 4
>> Date: Wed, 6 Jul 2011 14:01:18 -0400
>> From: Devon McCormick <[email protected]>
>> Subject: Re: [Jchat]
>>         http://www.jsoftware.com/jwiki/Essays/AllPartitions
>> To: Chat forum <[email protected]>
>> Message-ID:
>>         <CAGdEmpEFmk6S6HAtJY7UdGM-R_4GoeYD5nKQibVh
>> [email protected]>
>> Content-Type: text/plain; charset=UTF-8
>>
>> I have no problem cutting and pasting this into a console session -
>> running
>> emacs - for both J6 and J7.
>>
>> BTW - does anyone understand the reason for the wacky indenting of the
>> code
>> at the top of this page?
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to