On Thu, Aug 30, 2012 at 5:05 AM, Linda Alvord <lindaalv...@verizon.net> wrote:
> This seems to be the shortest version at the moment.
>
>    |:1j1#(25{.(u:,2#65 97+/i.26)(>:@i.}.[)])"0 's'
>
> If I apply Raul's explanation to the current shortest version, why doesn't
> the following function work?
>
>    f=: 13 :'|:1j1#(25{.x (>:@i.}.x)y)"0'
>    f=: 13 :'|:1j1#(25{.x (>:@i.}.x)y)"0'
>    (u:,2#65 97+/i.26) f 's'
> |domain error: f
> |   |:1j1#(25{.x(    >:@i.}.x)y)"0

One issue here is >:@i.  -- that was the left tine of a fork, but by
replacing the right tine of that fork you no longer have a fork, you
have a noun phrase.

But if you replace that with (x >:@i. y) you will then get a syntax error...

Here's a cleaned up version of f that is syntactically valid:
   f=: 13 :'|:1j1#(25{.((x>:@i.y)}.x))'

> I didn't have much luck with Raul's definition either:
>
>     1j1#"1&|:(25{.]}.~1+i.~)&(u:,2#65 97+/i.26)"0 'L'
> M N O P Q R S T U V W X Y Z A B C D E F G H I J K
>
>    g=: 13 :'1j1#"1&|:(25{.y}.~1+i.~)&x"0'
>    (u:,2#65 97+/i.26) f 'L'
> |syntax error: f

First, you should be using g here, instead of f

But the syntax error is because the result of the sentence you used
for g's definition is a verb.  It's a verb because of the trailing "0
on your (25{.y}.~1+i.~)&x means that (25{.y}.~1+i.~)&x becomes the
definition for a rank 0 verb.  And the rest of the expression to the
left of it is suitable to turn the whole thing into a fork.  So if you
had defined:
   g=: 2 :'1j1#"1&|:(25{.y}.~1+i.~)&x"0'
it would have succeeded without error.

But that's not the only problem.  Another problem is that you have an
expression which reads ()&x and this will also be generating a verb,
So just removing the "0 is not enough to make your 13 : definition
compute a noun result.

And there are other problems... but working with the definition split
out from the arguments seems to me to be tedious -- if everything is
on one line, I can hit control-shift-uparrow to recall my previous
line and then simplify my test until I understand what's going on.
With things on two lines that process becomes much slower.

Anyways, here's what seems to me to be a near minimal set of edits to
your g to make it do what I am expecting you want it to do:

   g=: 2 :'1j1#"1&|:(25{.x}.~1+y i.~x)'

Note that I changed an x to a y and I removed things that made your
result want to be a verb and I gave your i.~ its explicit arguments.

I hope this helps, but I'm thinking that you are making blind changes
to full sentences instead of experimenting with small phrases and
building those into full sentences.  If you make blind changes (for
example, putting y where you meant x, but also things like using a
verb where  you meant to use a noun) the results will tend to be
confusing.  To unravel the confusing stuff, you are going to need a
good set of practices, for isolating the parts of the code which are
behaving differently from what you want.

Take care,

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

Reply via email to