« first day (1836 days earlier)      last day (811 days later) » 
01:00 - 15:0015:00 - 22:00

ovs
3:00 PM
There is reversed(list) if you want a copy
 
>>> l=[1,2,3,4,5,6]
>>> for i in reversed(l):
...     print(i)
...
6
5
4
3
2
1
 
@Adám @Richard suggested APL Quest, but I think others here should decide and it doesn't matter if the name changes
 
Agreed. And it is time!
 
:)
 
Welcome to this very first APL Quest (or whatever we'll call it.
 
3:01 PM
@xpqz huh why? i mean is it slow?
 
Does anyone have a solution they'd like to present?
 
@Adám I do
 
Go ahead. (We'll discuss alternatives afterwards.)
 
yes, you first
 
For ⎕IO←0:
{1+2×⍳⍵}
 
3:02 PM
(Aha!)
Yeah, that's a very obvious solution.
Anyone else?
 
{1-⍨2×⍳⍵}
 
That's for ⎕IO←1. Nice.
 
A more fun one: (⍸1⌽(2↑1)⍴⍨2×⊢)
 
@xpqz why?
 
That's ⎕IO agnostic.
 
3:03 PM
{⍸2|⍳2×⍳⍵}
 
Whoa.
 
@PyGamer0 (later)
 
I tried to get silly with it, but in some sense it's "where odd numbers"
 
@RikedyP Are you sure you want both s?
 
3:04 PM
@Adám oh yeah
I won't edit
⋄{⍸2|⍳2×⍵}10
 
Don't put spaces immediately inside the backticks.
 
@RikedyP 1 3 5 7 9 11 13 15 17 19
 
@Adám ty
 
That solution is (non-obviously) ⎕IO agnostic.
 
@RikedyP nice one
 
3:06 PM
But probably quite wasteful.
 
@FawnLocke this idea is fun: ⍸1 0⍴⍨2×10
 
Quite fast too, I imagine
 
How about {+\2-10↑1}
 
@Adám +←1
very cool
 
Totally
hmm
 
3:08 PM
{(2|⍳+⍨⍵)/⍳+⍨⍵}
 
@Adám trying to understand it
 
{⍸2|⍳2×⍵}t   → 1.6E¯5 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
(⍸1 0⍴⍨2×⊢)t → 5.0E¯6 | -69% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
{+\2-⍵↑1}t   → 6.5E¯6 | -60% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
i mean. i'm new but i can still be funny
{x←⎕io⋄⎕io←0⋄1+2×⍳⍵⋄⎕io←x}
 
@Richard Let me explain…
 
@Richard I like to either build up pieces from the right, or take away pieces from the left, until I get it
 
3:10 PM
10↑1 should really be ⍵↑1 which generates a one followed by n-1 zeros.
2- gives us a one followed by a bunch of twos.
Then a cumulative sum gives us odd numbers. ⎕IO isn't involved.
 
ah ,ok! :)
 
@BrianBED No need to save and restore ⎕IO as the assignment localises it.
 
@BrianBED By the way, setting ⎕IO inside a dfn will localise it within that dfn, so ⎕IO in the session will not be affected - perhaps that was the joke, but just so you know
 
OK, who's up for using the 2×⍳⍵ method but adjusting for ⎕IO?
 
ill use BQN, no IO worries :P
 
3:13 PM
@Adám oh huh... so even {⎕io←0⋄1+2×⍳⍵} works?
cool
 
ovs
{(¯1*⎕IO)+2×⍳⍵} is what I had
 
You mean * not
That's what I had too.
 
ovs
Yes ...
 
Press UpArrow to edit.
 
Nice
 
3:13 PM
@Adám {~⎕IO:1+2×⍳⍵⋄○'ouch'}10
 
⍳+⍳-≢ for a tacit
 
@Wezl-yizl What?
 
is changing io inside a function ever useful in practice? i can imagine it might simplify some functions?? :o
 
@rak1507 Wow, that is cool.
 
@rak1507 nice
 
3:14 PM
@Wezl-yizl Haha.
@BrianBED Yes. Generally people use a global ⎕IO and flip it locally when neater.
 
ah cool. i'll keep a look out for when that could be useful
 
@rak1507 very nice
 
Anything more we need to say about answering the core quest?
 
ok i think I got the best one
 
@rak1507 ditto
 
3:16 PM
∇ArrayResultListVector ← GenerateDyalogAPLOddNumberFactory EndingNumberInteger
    ArrayResultListVector ← ⍬
    :For IterationValueIntegerCandidate :In ⍳ 2 × EndingNumberInteger
    	:If (2 | IterationValueIntegerCandidate) = 1
    		ArrayResultListVector ← ArrayResultListVector , IterationValueIntegerCandidate
        :EndIf
    :EndFor
∇
 
Hahhhhahah
 
Should I kick-mute him?
 
{⍺←1 ⋄ ⎕←¯1+2×⍺ ⋄ ⍺<⍵:(1+⍺)∇⍵}10
 
how can you dynamically do ]load foo?
 
@Razetime this is better
 
3:17 PM
@Razetime has written too much java lately
 
@rak1507 ⎕SE.SALT.Load or just ⎕FIX
 
thanks
 
@Razetime But you're using instead of an iterator!
 
@Adám is ⎕SE.Link.Import also ok? I feel like might be nice to push for one way moving forward
 
oh there are iterators
 
3:18 PM
and in case SALT is ever deprecated
 
@RikedyP Not sure that works in 18.0
 
@Adám Don't think so, we got quite a lot out of this I think!
 
Can you do this with encode/decode?
 
@Adám Ah fair enough
 
is there some :To label i can use
 
3:18 PM
@xpqz I wondered for a second, let me think again
 
@Adám looll
 
@Razetime No, you'll have to implement it using i+←1 yourself.
 
oh that
 
Let's extend this to a general stride as left argument.
 
{2⊥⍉1,⍨⍉2(⊥⍣¯1)⍳⍵} it seemed like a good idea...
 
3:20 PM
wow dude it also works with io 0 if you switch the plus with minus:
y←⍳+⍳+≢
awesome
 
ovs
@Adám What did you use for t there. For me the last function is 3-4 times faster than the second
 
@Garklein {2⊥1⍪⍨2⊥⍣¯1⍳⍵} or 2⊥1⍪⍨2⊥⍣¯1⍳
 
@Adám and starting value perhaps?
 
1 1⍉1↓∘.+⍨⍳10 ⎕IO ← 0
 
@ovs 10000
 
3:20 PM
@Adám ah I knew there had to be a better way
 
@FawnLocke Yay, O(n²)
 
@Adám what was O for the other ones?
 
O(n)
 
has {⊣/⍵2⍴⍳2×⍵}already been done
 
3:22 PM
@Adám oh... i thought he optimized it lol ¯_(ツ)_/¯
 
Another goofy ⎕IO ← 0 O(n^2), +⌿0 0 1⍉↑⍤,⍥⊂⍨∘.+⍨⍳10
 
Look ma, no additions: 2⍟2÷⍨4*⍳
 
oef...
 
fun
 
isodd←'false'≡∘⊃'iseven'⍎⍨'Data'⍎⍨∘HttpCommand.GetJSON 'Get',⍥⊆'https://api.isevenapi.xyz/api/iseven/',⍕
{n←⍵ ⋄ odds←⍬ ⋄ odds⊣{isodd ⍵: 1+odds,←⍵ ⋄ 1+⍵}⍣{n≡≢odds}0}
 
3:23 PM
lol
 
Outsourcing the problem, eh? I guess that's a good strategy for hard or computationally expensive things like generating odd numbers.
 
@rak1507 I would contend that'd be the slowest solution presented.
 
of course, shame there's no is-even library in APL
 
@Razetime very neat
 
@Adám that is just magic dude
 
3:24 PM
@xpqz challenge accepted
 
loooll
 
Oh slowest huh
 
@rak1507 implement it with tradfns and gotos for extra points
 
@Adám what is a general stride?
 
@rak1507 I'm surprised APLcart doesn't have it.
 
3:25 PM
@Garklein tbh i went for a more enterprise style
 
@Richard Every nth number.
Question is where to start from. We have to take that as an additional parameter.
@Razetime Well, yes, otherwise a stride of 2 doesn't give odds.
 
@Adám {1+⍺×⍳⍵} is the classic (starting at 1)
 
4{1-⍨⍺×⍳⍵}2
starts with 3
 
Yeah, that's a problem.
With ⎕IO←0 and starting always at 0 you can write just ×∘⍳
 
theoretically. what's preventing ⎕io being -1 or 2? :)
 
3:28 PM
Sanity.
 
loolll
 
@BrianBED ⎕io←3.1415 incoming
 
:D
 
How about an operator that takes the stride as left operand, the count as right argument, and an optional starting point (default is 0) as left argument.
⎕IO←0.5 should make both camps equally unhappy.
 
oo another chance to write enterprise code
 
3:30 PM
@Adám you mean, equally happy
 
I've got ⋄ _Stride←{⍺←0 ⋄ ⍺+⍺⍺×⎕IO-⍨⍳⍵} ⋄ 10_Stride 4 ⋄ 8(10_Stride)4
 
@Adám this is the reason why APLers use idioms instead of abstractions 🤦
 
{2⊥1⍪⍨↑1↓⌽⍵∘⍴¨(-2×i)↑¨1⍴⍨¨i←2*¯1+⍳1+⌈⍵÷2⍟⍵}
 
@Adám
0 10 20 30
8 18 28 38
 
tried to construct the argument to base manually
 
3:32 PM
@RikedyP I don't even…
 
yeah I think it's time for me to stop now...
 
that was fun
 
@Adám what is ⍺⍺ doing?
 
That's the left operand, like , in
 
@xpqz I haven't looked at Manacher yet but I will do at some point
 
3:34 PM
@RikedyP I am approaching something reasonable I think
 
Yeah, this was super fun. I'll try making a video about it in the beginning of next week. See you all on Friday for Making The Grade!
@user18120371 Hi Đoàn Thành. If you want to participate here, please email access@apl.chat
 
So what is ⍺⍺ then in your example 8(10_Stride)4
 
Is someone gathering the snippets in a gist or repo?
 
@Richard 10
 
i wonder, has anyone ever made an AI that tries to simplify/optimize APL code? if not i'm not gonna be the one to do it, but it would be cool if it was a thing
 
3:35 PM
@xpqz I can do so in connection with publishing the videos.
 
@Adám what videos?
 
_stride←{⍺←0 ⋄ +\⍺,(⍵-1)⍴⍺⍺} ⋄ 8(10 _stride)4
 
I'll try to make a short video for each event (what are calling them?)
 
Which of the solutions still work with right argument a negative number?
 
@Razetime Nice!
 
3:36 PM
ah, cool
 
@Richard You want a negative count of numbers?
Let the stride be negative if you want descending numbers.
 
well, starting with a negative number
 
The start is the left argument.
 
yes ,ok
 
in my array language, the generalized version is (:stride :start .(* .stride + .start) take: /) used like .(...).:numbers 4 numbers 10 8
 
3:38 PM
hm i don't understand the language but thats cool :o
 
@PyGamer0 @BrianBED on the Python thing (briefly) -- for larger lists doing the slice is ~20k times slower than iterating over reversed().
 
@xpqz wahaaat!!!
 
there are a lot of differences. the main thing is that the anonymous function .(* .stride + .start) is used as a lazy array and taken from
 
@AlexShroyer you seem familiar, but are you new here? Ah, I know you from the APL Farm!
Welcome to the Orchard.
 
Heh yeah. I didn't see anyone post exactly my solution. Are we sharing them here?
 
3:41 PM
The event has ended, I think, but yes, go ahead. I might use it in my video.
 
wait adam do you have a channel?
 
@xpqz So how do you write m2←⌽m1 in Python?
 
@Adám oh i can only imagine
 
{⎕IO←0⋄((1+⍳)+⍳)⍵}
 
Materialise the iterator: m2 = list(reversed(m1))
 
3:42 PM
@BrianBED I've not yet understood what the difference is between a channel and a normal user, but there's youtube.com/user/abrudz/videos
@xpqz Thanks. I'll stay with
 
I prototyped it in J first: ((1+i.)+i.)10
 
@AlexShroyer You can reverse the arguments of the right-most + for a nice palindromic solution.
 
@Adám every user has a channel they can post on. theoretcially you're guarenteed to have a channel if you have a google account but usually when someone asks if you have a channel, it usually means if you post vids on your channel
 
@Wezl-yizl in APL: {stride start ← ⍺ ⋄ ({start+stride×⍵}↑⊢)⍵}. (doesn't work because you can't take from functions in APL)
 
Why the difference in URL formats?
https://www.youtube.com/user/abrudz/videos
https://www.youtube.com/c/RikedyP/videos
 
3:46 PM
oh that is cute (⍳+1+⍳)
 
But of course, this is the same as 1+2×⍳
 
Shame I couldn't make +⌺(⍪2 2)⊢⍳10 useful
This was fun ;)
 
@phantomics made that bot from the lispcord template gist.github.com/LdBeth/b59448896a8aff20be5292914e631308
 
@Adám I think my "user" is Richard Park
 
@Adám You need 100 subscribers for a /c/ URL
Thank you all for participaing. I have to go, but by all means, feel free to continue the discussion.
 
3:51 PM
Till next week :)
 
/e waves
 
4:07 PM
when you have 2 elements and you want the second one, is doing ⊃⌽ better than 1⊃? i saw adam use it in his vid so i'm curious
 
I think 1⊃ is nicer, but it doesn't matter much if you know there's only two elements.
 
ok cool
 
ovs
4:45 PM
A bit late but I haven't seen this one:
¯2-/2*⍨0,⍳
 
 
1 hour later…
6:03 PM
@RikedyP I am reasonably pleased with how this turned out: gist.github.com/xpqz/c19ca3ef97b5437761cad3925ba5388c
I mean, it's still scalar and traddy, but still nice.
 
6:32 PM
code_report said APL doesn't have first class functions while bqn does, and i didn't know what first class functions so i googled: https://en.wikipedia.org/wiki/First-class_function
and from what i understand, doesn't every language with eval satisfy the requirements? actually the wikipedia article has an example of map, which is basically / in APL so i wonder... why isn't APL said to have first class functions like BQN?
 
eval is a workaround. Sure, you can always evaluate a string, but a string isn't a function
 
It's a hack not a way to implement first class functions within the language
A "kludge" is a more accurate term
 
hmmm but again about the map example. wikipedia says if a langauge can do map then it has first class functions. so like does APL's / not do the same as map?
or is wikipedia just wrong :p
 
APLs operators are a single level of higher order functions. Not the same as a first-class function
you can't pass an operator as an argument to an operator for example
 
It's more vague with APL since it has restricted higher order functions, but having first class functions mean functions are treated no different than any other value, so APL's operators aren't first class
 
6:36 PM
ah hm ok that makes more sense
 
"For a language to support map, it must support passing a function as an argument." that second part of the sentence doesn't imply that it has first-class functions
 
oh my bad
thanks for explaining :D
 
is "traditional" a bad word when it comes to APL :P
 
 
1 hour later…
7:55 PM
⋄ create_adder←{⍎(⍕⍵),'←{',(⍕⍺),'+⍵}'} ⍝ ⍵←name, ⍺←int ⋄ 100 create_adder 'test' ⋄ test 20
i was able to make a like... wierd first class function replica. fun problem.
the python version is https://imgur.com/93Pks9n
)about
 
@BrianBED To run APL code, write code blocks starting with ⎕← or or write a multi-line code block and prepend ⎕← or to lines you wish to run. All matching groups / lines will be joined by and run via TryAPL, and the output will be posted here. To format a codeblock, write `code`, or for a multi-line code block, use Shift+Enter to type multiple lines and press Ctrl-K, press the 'fixed font' button, or prepend four spaces to each line.
 
`⋄ create_adder←{⍎(⍕⍵),'←{',(⍕⍺),'+⍵}'} ⍝ ⍵←name, ⍺←int ⋄ 100 create_adder 'test' ⋄ test 20`
 
@BrianBED
NOT PERMITTED: Illegal token
      `create_adder←{⍎(⍕⍵),'←{',(⍕⍺),'+⍵}'}
     ^
 
`⋄ create_adder←{⍎(⍕⍵),'←{',(⍕⍺),'+⍵}'} ⍝ ⍵←name, ⍺←int ⋄ 100 create_adder 'test' ⋄ test 20`
:| i give up
 
 
1 hour later…
9:09 PM
⋄ dice ←{(+/((⊣,' = ',⊢)⍥⍕)⊢)?⍺⍴⍵}
 
@LdBeth Response looks like a 0-by-0 matrix.
 
01:00 - 15:0015:00 - 22:00

« first day (1836 days earlier)      last day (811 days later) »