8:52 AM
⎕←{|⍵*÷2} ¯3 ¯4

```@RosLuP
1.732050808 2```

so the left function| as precedence to the right *?

1 hour later…
10:16 AM
f←{⍵<3:1⋄9}
g←{⍺ ⍵}
f g 4
VALENCE ERROR

Is it possible define one function that has as argument one function?Thank you

10:33 AM
@RosLuP `g←{⍺⍺ ⍵}` should work in place of your `g` if I understand what you want to happen. Then `g` becomes an operator, in which `⍺⍺` is the left operand and `⍵⍵` is the right.
Note that once `⍺⍺` is added, it will need a left operand (and once `⍵⍵` is added, it will need both operands). After that operator has gotten the operand of `⍺⍺` (and `⍵⍵` if used) it acts like a function. You should review Lesson 2 for more info

3 hours later…
1:11 PM
@dzaima Unfortunately there isn't. There are various ways to work around it: you could use a nested `⍺{condition:then⋄else}⍵` or if you're working on numeric data you can do `(condition×then)+(~condition)×else`, or if you're applying a function conditionally: `f⍣condition⊢argument`
@EriktheOutgolfer I hadn't seen this discussion but I think I've solved this or a similar problem before.
@J.Sallé I find APL's scan (\) counter-intuitive too: `f\a b c` is `a(a f b)(a f (b f c))` in order to be consistent with the right-associativity of APL grammar. This means that if `f` is a user-defined function, intermediate results can't be reused, so `f` is applied O(n×n) times. The alternative would be to follow the order of array indices and "go from left to right": `a(a f b)((a f b)f c)` but it's too late to change the language.

Than this has to run ok: h←{a←⍺⋄{a ⍵}⍵} h functor ...

1:27 PM
@RosLuP what is "functor"?

Funtor I mean " function that has at last one argument one function"

@RosLuP in APL they use slightly different terminology than in mainstream functional programming - they call higher order functions "operators" and their arguments "operands"
@RosLuP the left and right operands are denoted with ⍺⍺ and ⍵⍵ (which are different from ⍺ and ⍵)
A function in APL is always ambiguous - it can be applied monadically or dyadically.
However an operator is known in advance to be either monadic or dyadic (with respect to its operands).
@RosLuP I don't understand the purpose of this expression, but if "a" is meant to be a function, it should probably be something like `h←{a←⍺⍺⋄{a ⍵}⍵}` and then the operand must be to the left of `h`.

@ngn never said you're particularly bad at outgolfing Adám in APL ;-P

@EriktheOutgolfer well, he designed the problem, so he might be aware of the short solution but keeping quiet about it :)

@ngn huh? sure, maybe, nobody is a perfect golfer ;) I guess we'll see, you can even ask if you're in doubt
just don't ask too much, or you might surprisingly find yourself with some kind of answer in your hands :p
and if you do, then you'll be sad, since the chance to think of it yourself will be gone...

4 hours later…
5:58 PM
CXO is here!
@RosLuP No, there is no precedence among APL functions, the are "right-associative" which means that the rightmost will be calculated first (except for any parentheses).

1 hour later…
7:23 PM
Can anyone explain the specifics of how trains/forks/etc. work/are parsed? I've always been confused by their specifics.

@Zacharý there are 2 kinds of trains, atops and forks
@Zacharý there are 2 kinds of forks, fgh and Xgh

is `X` a scalar?

@Zacharý yes

So, it just parses right to left?

no
trains are ambivalent
`(gh)Y ≡ ghY`
`X(gh)Y ≡ gXhY`
monadic fgh forks work like this:
`(fgh)Y ≡ (fY)ghY`
dyadic fgh forks work like this:
`X(fgh)Y ≡ (XfY)gXhY`
monadic Xgh forks work like this:
`(Zgh)Y ≡ ZghY`
dyadic Xgh forks work like this:
`X(Zgh)Y ≡ ZgXhY`
@Zacharý
uppercase letters are literals, lowercase are functions
note that monadic atop `gh` is the same as monadic `g∘h`

7:42 PM
Okay, I'll take a snapshot of that.
One last question, how does precedence work between these forks and atops?

well
@Zacharý trains can have more than 3 functions in them
@Zacharý if there is an odd number of items, then it's a fork, if there's an even number of items, it's an atop
precedence is right-to-left

Oh, I think I got it now, so if its a fork, the leftmost character is interpreted as the left argument?

another way to understand how it works is the following
@Zacharý if there are more than 3 functions, wrap the last 3 functions in parentheses and repeat
if there are 3 or less functions, you're done

Okay, that makes sense.

for example, parsing train `abcde`
```abcde
ab(cde)```
you can see that 3 functions remain, so it's an fgh fork
another example, with `abcdefghij`
```abcdefghij
abcdefg(hij)
abcde(fg(hij))
abc(de(fg(hij)))
a(bc(de(fg(hij))))```
here you have 2 final functions, so it's an atop

7:52 PM
So `2++/×` would parse as `2(+ (+/) ×)`, because of operators, thus causing a syntax error?

@Zacharý that's not valid syntax
`(Zg)` is always a syntax error
@Zacharý however, `2++{⍺/⍵}×` isn't a syntax error

Because it forces `/` into an function, right?

yes, `/` is one of the 4 hybrids `/\⌿⍀`
@Zacharý duh, yes that's the `/` function

I get it now, thanks!
Dyalog doesn't want to install on this computer ... ugh.

@Zacharý um, have you requested a license?

8:01 PM
Yes.

@Zacharý you should wait until it's approved
then you get the credentials to MyDyalog where you have access for 14 days

I've already gone through those steps, the license was approved on December 4th.

signed in to MyDyalog?

@Zacharý Check out the chat bots' profile, it has four links about trains.

8:06 PM
Erik summarized it well enough.

@Zacharý maybe you requested for the wrong OS?

Nvm, it works! I just forgot that on my old computer (and this one) I used command line tools to install it once I have the package.
Now, to get a keyboard, since I used GNU APL's keyboard.

@Zacharý download RIDE, and you can insert chars with ``` + key or ``` + shift + key

Okay, I will do that later.

@Zacharý remember to select appropriate architecture too, you can see it in the URL while hovering
and use .DEB if using Ubuntu or some other Debian-based linux

8:17 PM
Okay

2 hours later…
10:26 PM
@Adám how can I catch all errors in dfns? (Like `{0::'catched' diamond nasty stuff}`)

@Uriel Yup. Error 0 means all errors in range 1-999. (Error 1000 means all above 1000, but those are special exception errors you probably don't need to worry about).

@Adám o me dumb. gute voch anyway

@Uriel np. Shavua tov.

1 hour later…
11:39 PM

Nice name.