@diogotito I love it. That's what I was about to ask you to do next. If you define a function in terms of such mathematical functions (we call them scalar functions) then your function will work that way too.
Can you write a function that takes two lists of equal length and computes the fraction of elements in the left argument that are greater than the corresponding element from the right argument?
@diogotito Most (all?) people here like to do code golf, and more often than not, the number of characters of a solution is the only thing that cares to them when solving a problem.
@rak1507 Right :P But that is only for the first implementation. I bet the next iterations of the code will be getting shorter and shorter, and not necessarily faster :P
OK, I think this is enough teaching for now. Should you want more, then I'd be delighted to continue tomorrow. If you can't sleep, then you can look at apl.wiki/Learning_resources
you can have (f g h) where f g and h are functions, and if you apply it with one argument you get (f ⍵) g (h ⍵), and with two arguments you get (⍺ f ⍵) g (⍺ h ⍵)
0∘| doesn't really make much sense mathematically, does it? x∘| is supposed to be the remainder of the argument when divided by x, but you can't really divide by 0.
Another way to look at it is by looking at the list of possible values, e.g. 3∘| could give 0 1 2, 2∘| could give 0 1 and 1∘| always gives 0, so 0∘| gives... ⍬? :P
Wrote an answer for https://codegolf.stackexchange.com/questions/127765/interlaced-rotations : [Try it online!](https://tio.run/##SyzI0U2pTMzJT///v7r0UVeztn71o5690YbaRjWPerfGPuqY8ai3s/zwdEMHjUr9R70rHnWs0D@0QgMop1OhCZLt6Dq0ovJR2wQdIEdPB6gCJKdrqPmobfKj3s0VQBlDbZBRuo86F5VrPupaZHB4enntoRVAyUc9HQZ6poeng2SA6oCKaktBdN/UUOfg/2lgoT6gmx71rnnUu@XQeuNHbROBksFBzkAyxMMz@H86UE01kAOk1NUfdbdo6IAM3qoJotNAjFqudAVjBWOgdnVDI2MTUzNzC0t1oJiZghlCzNHJ2cXVzd3D08vbx9fPPyAwKDgkNCw8IjJK0UFZBaTcUsESpDwkI1WhsDQzOVshqSi/PE8hLb9CIas0t6BYIb8stUihBCidk1hVqZCSn64OAA "APL (Dyalog Unicode) – Try It Online")
@Adám were discussing it in Optima, and decided to recreate the problem for this year. (optima-systems.co.uk/programming-challenge-the-year-game) I had a solution for 29 using 2 0 2 1, but I wasn't sure the rules permitted: |20J21
Original rules state 'In addition to the four digits 2 0 1 6, only primitive functions/operators, parentheses/braces, spaces, high minus signs and decimal points can be used. The resultant expressions must be deterministic (that is, give the same result on repeated evaluations).' Does this mean that solution is illegal?
> The original challenge was intended for users of APL, so the official Dyalog rules are specifically tailored to APL solutions, but do not let this put you off trying it in different languages.
I created a spec that works for non-APL solutions:
If you think this could be fun, but too much work, consider participating in this much smaller challenge.
A bit of fun (and possibly frustration!) for 2016... Dyalog's "puzzle of the year". Enjoy!
The Objective
Find Dyalog APL (download) expressions (other languages are allowed, see Eligibility ...
> Is J (e.g. 37=⌈⍟!20J16) allowed? > No: In addition to the four digits 2 0 1 6, only only built-in symbols and names, parentheses/braces, spaces, high minus signs and decimal points can be used.