This sentence gives me an error even without parens.
Looking closer, I see six left parentheses and seven right parentheses here:
({:`([:$:0 1&+)@.(9&<@{.)@(([:*/"."0@":@{.),{:))"1(|:@,:1:))50 25 33 22 293
Getting rid of the far right parenthesis gives me the result which you
displayed.
Meanwhile, you're using $:
And, incorporating (|:@,:1:) into the $: phrase changes the context of
$: which means that it also changes the definition used for evaluating
$: -- so you'll need to do something about that. There's several
possibilities, and using a name for the $: phrase is one of those.
I hope this helps,
--
Raul
On Tue, Oct 17, 2023 at 6:26 PM 'Viktor Grigorov' via Programming
<[email protected]> wrote:
>
> Hey,
>
> I have a bit of code I want to include into something large, but I'm hitting
> a wall.
>
> ({:`([:$:0 1&+)@.(9&<@{.)@(([:*/"."0@":@{.),{:))"1(|:@,:1:))50 25 33 22 293
> 1 2 1 1 3
>
> Okay. Slap on some parens, and it fails? Valence error for {:..? Both resolve
> to 3, a verb, according to 4!:0. Because both verbs are monadic, I tried
> capping either and both, all composing conjunctions, parenthesizing. Adding
> in ]. or [., I don't see what the problem is, or how tail's valence fits into
> it? Some configurations increase the dimensions and don't give out the
> desired thing:
>
> (({:`([:$:0 1&+)@.(9&<@{.)@(([:*/"."0@":@{.),{:))"1 @ (|:@,:1:))50 25 33
> 22 293
> 1 0
> 0 0
>
> 1 1
> 0 0
>
> 1 0
> 0 0
>
> 1 0
> 0 0
>
> 1 1
> 1 0
>
> However, assigning both to names and composing does work
>
> q=:|:@,:1:
> w=:({:`([:$:0 1&+)@.(9&<@{.)@(([:*/"."0@":@{.),{:))"1
> w q 50 25 33 22 293
> 1 2 1 1 3
> (w@q)50 25 33 22 293
> 1 2 1 1 3
>
> What am I missing? This to me is unexpected behavior. I expect
> parethesization and variable substitution to be identical, but it's not. I'm
> sure there's a single, explanatory/exculpatory line somewhere about
> assignments, variables and or parentheses on the wiki, but it's not easily
> discoverable..
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm