« first day (4008 days earlier)      last day (1132 days later) » 

02:00
@Nitrodon One, taking implicit input of n miraculously gets rid of a bunch of bytes:
!!/run (n-nd‹×*꘍,) - 5
[@emanresuA: 60189126]
    *
   ***
  *****
 *******
*********
Two, Vyxal loops autocomplete so the final ) is unnecessary
I didn't know how to do input with !!/run
I still don't really.
@hyper-neutrino !!/run `code` `flags (- to exclude)` `input line` `input line` ...
02:01
Vyxal takes implicit input
but after I've consumed the first input (5), what about the second one?
It loops
For example,
!!/run `+` `-` `1` `2`
will take 1 and 2 as input, and take their sum
It'll take the first input, then the second, then the third, and so on until it runs out, then it loops back to the start.
I assumed that further input would be 0 (and the 5 in my code was just a placeholder because I didn't know the bot accepted input)
02:04
Nope, Vyxal's cool like that
VyMC: Given a single integer n, return the number of times its digits need to be summed until the result is of length 1. E.g. 453 -> 2 (453 -> 12 -> 3), 999999999999999999999999999999999999999999999999999 -> 3 (999999999999999999999999999999999999999999999999999 -> 459 -> 18 -> 9)
How does the condition in {} work?
Think of | as if not pop(stack): break
@Nitrodon so it executes the condition on the stack and if it returns a value considered truthy, it continues
Also, good job y'all on the teaching. Y'all did great!
Just to be sure, is it a "while" or a "do while"?
pre-test
like python's while
02:16
What's truthy?
non-zero for numbers, non-empty for strings and lists
@emanresuA this can be taken a bit further - the for loop can be replaced with just range ɾ, vectorisation then takes effect and finish off with øĊ and join on newlines
This is probably completely wrong, because I'm still getting the hang of everything.
wait, I can probably golf that anyway
that's okay if it's wrong - you're here to learn and mistakes are what help you learn
!!/run 12∑
@Nitrodon 3
02:20
yeah, that command will probably help
That happens because numbers are treated as lists of digits in that context
Is the same true of L?
yes
numbers are converted to whatever makes more sense or is more helpful in 90% of use cases
things like mapping functions convert to range, because more often than not, you want to map over a range if given a number
other things convert to list of digits because that's what you would want to do more often than not
!!/run {:L‹|∑←›→}← - 12345
@Nitrodon 2
02:23
@lyxal An often used example of this is flatten
!!/run 12345f
@AaroneousMiller ⟨ 1 | 2 | 3 | 4 | 5 ⟩
@Nitrodon that's a good while loop submission
and the condition there is roughly what I used in my intended solution
but let me blow your mind with another way to do the task
!!/run ‡L‹⁽∑ŀL - 12345
@lyxal 2
while it seems more complex, it's essentially just another way to express a while loop
As far as I know, you just doodled on that line.
02:26
lol
I'll break it down for you
ŀ is what does most of the work
it's an element that takes 3 arguments
and when given two functions and a non-function, it calls the second function on that non-function while calling the first function returns true
that sounds complicated, but it'll be clearer in a second
but I don't see any λ or @
that's what ⁽‡≬ are for
they group a certain number of elements into a single function without needing λ or @
I'm trying to search that elements.md for ŀ, but it's showing every l, which is useless.
num a, num b, num c: a <= c <= b
num a, num b, str c: a by b grid of c
num a, str b, num c: a by c grid of b
num a, str b, str c: b.ljust(a,filler=c)
str a, num b, num c: b by c grid of a
str a, num b, str c: a.ljust(c,filler=b)
str a, str b, num c: a.ljust(b,filler=c)
str a, str b, str c: a.infinite_replace(b, c)
fun a, fun b, any c: collect_until_false(predicate=a, modifying_function=b, inital=c)
Those are the overloads
look for "Left Justify"
Left justify is ↲
02:30
groups a single element into a function, groups two elements into a function and groups three into a function
@Nitrodon that's left justify with spaces. ŀ allows for a custom character
and it's showing collect_until_false under .
@Nitrodon I'm not seeing that in the documentation
well, I guess this is "old"
I see that now
@hyper-neutrino !!!!!!!!!
The bot links to the old docs
not the new ones
Is there a similarly updated abrudz.github.io/lb/vyxal ?
02:33
not yet
i only implemented two commands and somehow they were both broken and we didn't notice during testing?
just pr the new link or smth
@Nitrodon we never got around to asking Adam to update it
okay, so I see the new doc now.
@hyper-neutrino is the source code for today's bot open source?
Codepage is correct and most of it works tho
02:35
should be
and ⁽‡≬?
@Nitrodon those are function groupers
they group a certain number of elements into a single function without needing λ or @
groups a single element into a function, groups two elements into a function and groups three into a function
I can't find them in the codepage.
they're near the end
ah, there they are
This just goes to show that I'll always be outgolfed by someone who knows more commands.
Don't let that discourage you
learning vyxal is a journey
even I find myself being outgolfed because someone knows a better set of commands
Knowing commands isn't much, you can just look them up on the online interpreter
it's more about having a general idea of what exists
is this right?
For me, it pretty much comes down to doing a lot of random garbage, and then later having a problem where I go, "oh yeah, I've done some random garbage that will solve this" and then doing that
@hyper-neutrino yep that's right
I fixed the weird dimming issue with my laptop!
Turns out it was caused by a conflict between the built-in Intel graphics and NVIDIA card
@Nitrodon I think what you should take away from that example is that there exist elements that deal with function overloads
Just looking through commands and such now. Weird that k≥ and k≤ don't match.
So while I had the dynamic whateveryacallit disabled in the NVIDIA card, the Intel one (which apparently still does stuff despite the NVIDIA one existing) was trying to dim stuff
VyMC: Given a non-empty list, return a list of the first item, last item, and the length of the list.
hint: and are helpful here
and are the parallel apply modifiers
they take two elements and apply them to the same stack. They then push the results to the stack in the order they appear
e.g.
!!/run 3 4 ₌+-W
@lyxal ⟨ 7 | -1 ⟩
02:46
Here, applies + to the 3 and 4 first
then it applies - to the 3 and 4
is the same as but it wraps the two results into a list
@emanresuA I have a 4-byter that only works in the 2.4.2 interpreter, and a 3-byter that should work in the current interpreter but doesn't because of one of the open issues on github
What happens if the two elements have different numbers of arguments?
@Nitrodon they take as much as they need
!!/run 5 8 ₍d+
@lyxal ⟨ 16 | 13 ⟩
d only takes one argument
so it only took the 8
+ takes two arguments
so it took the 5 and the 8
02:49
What exactly is an element?
one of three things:
a) a built-in
b) a structure
c) a combination of modifiers
Can you elaborate?
the first one there (point a) means just a single command like + or Þ∞
@lyxal can the list be in a different order?
the second one (point b) means that things like if-statements, for-loops, etc, are all considered one element
@AaroneousMiller I'll say yes
back to point b, ‡1[<body>] sees the 1 and [<body>] as two elements
<body> can contain as many elements as you want
it'll always be considered one "unit" so to speak
02:52
Is an element, or is ₍-+ an element instead?
the third one (point c) means that modifiers and their elements are considered single elements
@Nitrodon ₍-+ is an element
is a modifier
modifiers group elements to create elements
How do you input a list?
Python syntax [a,b,c] or Vyxal syntax
(vyxal syntax doesn't currently work though)
(because that's something I haven't gotten around to yet)
@lyxal Then I've got 4 bytes with a flag
02:54
so how badly will the universe explode if I try this?
@Nitrodon it won't
everything will still be in one piece
!!/run ₍h₌tL - [3, 1, 4, 1, 5, 9]
@Nitrodon ⟨ 3 | 6 ⟩
you're almost there
consider placing the head and tail into its own list and appending the length to that
02:57
!!/run ₌₍htLJ - [1, 2, 3, 4, 5, 4, 3]
@Nitrodon ⟨ 1 | 3 | 7 ⟩
Excellent
that's what I had
as in, exactly byte-for-byte
but that's clearly the stack instead of a list
@emanresuA Oh nice, I forgot that the unwrap diagraph was added. I had this, which flagless would also be 5 bytes
@Nitrodon no, that's a list
implicit printing only prints the top of the stack
J only merges the top two items
so it appends the length to the list you create with ₍ht
Here's another challenge that should be easy:
VyMC: Find the only element in an list that doesn't appear twice.
03:00
⁽‡≬ take 1/2/3 bytes instead of elements though?
@Nitrodon the documentation needs to be updated there
originally, it was only bytes
but the parser was rewritten to make it elements
@lyxal just an aside, it's guaranteed that there will be only one item that appears once. Every other element will appear twice.
twice, or twice or more?
so something like [1, 2, 2, 2, 2, 3, 3, 4, 5, 5, 5] won't be given as an input
@Nitrodon just twice
I won't get anything 3 or 4 times?
@lyxal I have 3 bytes
03:03
correct
@Nitrodon only once or twice
(for those questioning the wording, it was AI generated)
I have two bytes
wh.... how?
!!/run d⊍h - [1, 2, 3, 1, 4, 3, 4]
@Nitrodon 1
@lyxal two words: xor reduce
03:04
oops
forgot the deduplicate command
@Nitrodon now you're the one outgolfing me because you know more commands
!!/run Ud⊍h - [1, 2, 3, 1, 4, 3, 4]
@Nitrodon 1
putting my 7 byter to shame
@emanresuA dang, that's clever
03:06
oh wait, that's set difference, not multiset difference, never mind
I got nothing.
9
A: What's missing (aka the vanilla multiset difference challenge)

tshJavaScript (ES2019), 25 bytes a=>eval(a.flat().join`^`) Try it online! Take input as f([array1, array2]). Calculate xor of all input numbers.

Inspiration
vyxal probably does need a multiset difference built-in
@emanresuA oic
still pretty clever tho
Ċ↓h works for 3 bytes
@lyxal that's what I had
03:08
Another one:
VyMC: Given two strings, return whether one is a rotation of another (i.e. there exists a positive integer n where one string rotated n times equals the other).
so abcde and deabc would return true
hint: and Ǔ might help
What does Ǔ/ǔ do with the first input?
My input box won't accept the actual character, so I guess I can't do that at all.
@Nitrodon depends on the types
if the first type is a number, the second item is just left on the stack
!!/run `i'm a string, not a number lol` `r o t a t e` ǓW
@lyxal ⟨ `i'm a string, not a number lol` | ` o t a t er` ⟩
03:13
5 bytes, outputs by terminating/not terminating
!!/run `r o t a t e` 4 ǓW
@lyxal ⟨ `t a t er o ` ⟩
!!/run kHǓ
@Nitrodon ello, World!H
@VyxalBot i am sad because it says "otater" instead of "potater"
03:14
@emanresuA see if you can find a 5 byter that always terminates
!!/run ⁽ǓǏc - abcde cdeab
[@Nitrodon: 60189476]
STDERR:
Traceback (most recent call last):
  File "/home/Vyxal/mysite/vyxal/main.py", line 147, in execute_vyxal
    exec(code, locals() | globals())
  File "<string>", line 27, in <module>
  File "/home/Vyxal/mysite/vyxal/elements.py", line 2790, in prime_factorisation
    return {
  File "/home/Vyxal/mysite/vyxal/elements.py", line 2793, in <lambda>
    }.get(ts, lambda: vectorise(prime_factorisation, lhs, ctx=ctx))()
  File "/home/Vyxal/mysite/vyxal/elements.py", line 3868, in vectorise
._.
that's not your fault, that's ours
!!/run ⁽Ǔİc - abcde cdeab
@Nitrodon 1
03:16
I had the wrong modified I anyway.
oh
oh wow
you're good
I wouldn't have thought of that
that's clever
I like that a lot
Very nice
very elegant
looks like you're ready for something a little harder:
VyMC: Given a non-empty array containing only integers, return the number of triplets (groups of 3 without replacement) where the sum is 0.
hint: might help
03:18
[1, 1, 1, -2] should output 3?
@Nitrodon oh yeah i forgot about that overload for İ. I tried to do the same thing except with where it would terminate or not, but it appears to be bugged, because it doesn't ever terminate.
@Nitrodon yes
In the docs, b (where listed and c isn't) is the top of the stack?
yes
assume the stack is a b c or a b
!!/run 3 2 6rḋ
03:22
@Nitrodon ⟨ ⟨ 2 | 3 | 4 ⟩ | ⟨ 2 | 3 | 5 ⟩ | ⟨ 2 | 4 | 5 ⟩ | ⟨ 3 | 4 | 5 ⟩ ⟩
!!/run 3 2 6rḋ∑
@Nitrodon ⟨ 9 | 14 | 19 ⟩
(just seeing what those do exactly)
is probably what you mean
because doesn't vectorise
!!/run 3 2 6rḋṠ
03:24
@Nitrodon ⟨ 9 | 10 | 11 | 12 ⟩
It says "Reduce stack by addition" though.
that's another relic from before the rewrite we did
What does it do now?
v∑
vectorised sums
!!/run 2 6r3=
03:27
@Nitrodon ⟨ 0 | 1 | 0 | 0 ⟩
!!/run 3ḋṠ0=∑ - [1, 1, 1, -2]
@Nitrodon 3
And you're sure you've never used vyxal before?
because you've just beaten my solution again
I'm sure.
I had 3ḋ'∑¬;L
which is a byte longer than your answer
03:29
@Nitrodon 0= can be ¬
@emanresuA actually
because ¬ doesn't vectorise
on a list is vectorised ¬
@lyxal I did the same, except I replaced ;L with the l flag, which currently only works in the old version
Oh true, forgot about that
When did change?
rewrite
03:31
@AaroneousMiller 2.6.something
so for sum of stack we just do W∑ now?
pretty much
What is '?
filter lambda
03:32
now's a good change to explain the different lambda types
so you know how λ... push a lambda to a stack?
well there's 3 lambda types that immediately call the lambda
ƛ...; is the same as if you wrote λ...;M
which maps the lambda over the top of the stack
'...; is the same as if you wrote λ...;F
which filters the top of the stack according to the function
µ...; is the same as if you wrote λ...;ṡ
which sorts the top of the stack according to the function
@lyxal that should say chance instead of change
next challenge:
VyMC: Write a triadic lambda that sums its arguments and multiplies that by the average of the three items.
This is basically just to check if you understand lambda syntax
uh... λ++²3/; ?
Append a T to make it triadic
(T is for triple)
λ3|W₌∑ṁ*;
@emanresuA what is this, brachylog
@UnrelatedString no, this is patrick.
03:45
I wasn't really sure whether the arity was required.
@Nitrodon the triadic requirement was to make sure you understood how lambda syntax works
What happens in a lambda if you include arity?
in this case isn't W wrap the stack also
so explicit arity probably helps
@Nitrodon When it gets called, it's given <arity> arguments popped from the stack
@Nitrodon it changes the arity of the lambda, meaning it doesn't take just 1 argument
03:47
although i guess since you can calculate the mean directly from the sum it actually doesn't make that big a difference
!!/run 4 5 6 λW∑;
@lyxal 6
!!/run 4 5 6 λ3|W∑;
@lyxal 15
wait is default arity always 1
that
would explain why so much of what i've tried to write didn't work
03:47
@UnrelatedString correct
the default arity is 1
unless of course you use the 2 or 3 flag
!!/run 4 5 6 λW∑; 2
@lyxal 11
because the 2 and 3 flags are a thing
wait, what?
03:49
where's the 4 flag
the most useful flag
@UnrelatedString we don't do that here
That looks like it should push 2 over the 6.
@Nitrodon is that a question about flags in general or the 2 and 3 flags?
@Nitrodon the 2 here is a flag, not an input
it takes the place of - you've been using
@Nitrodon The 2 isn't part of the program, it's a flag
!!/help
03:49
@lyxal !!/run `code` `flags (- to exclude)` `input line` `input line` ...
I guess I just can't tell the difference between code spaces and non-code spaces at a glance.
!!/run 4 5 6 λW∑; -2
@lyxal 11
that should make it a little clearer
!!/run 4 5 6 λW∑;W
03:50
@Nitrodon ⟨ 4 | 5 | 6 | 9 ⟩
lambdas in lists start to get a little funny when you start printing them
because when you print a lambda, it calls it
i think i remember a conversation about this but wait what
!!/run 4 5 6 λ2|W∑;†W
@Nitrodon ⟨ 4 | 11 ⟩
@UnrelatedString it's mainly so that implicit output of lambdas calls that lambda
03:53
so even though the stack at the end of the lambda is (5 | 11), it only pushes 11?
does it call it on the rest of the stack
so you can do things like <whatever> λ<body> and not need ;† on the end
@Nitrodon yes. It only returns the top of the stack
@UnrelatedString correct
@Nitrodon a named function would return the entire stack
in the case of a list of, say, two lambdas
does printing the first one consume the top of the stack, leaving a different top of stack for the second
@UnrelatedString theoretically it shouldn't matter because each list item gets its own stack iirc
How do you use a named function?
03:55
ah
good
so it forks the stack for each print
@Nitrodon @name:arguments|body; to define, @name; to call
like a scuffed parallel apply
@UnrelatedString maybe - I honestly don't remember
@Nitrodon so for the example above, it'd be something like
!!/run @f:2|W∑; 4 5 6 @f; W
@lyxal ⟨ 4 | 6 | 11 ⟩
You can edit !!/run commands?
03:57
and it edits the response
!!/run `very helpful feature`
@lyxal very helpful feature
!!/run `truly`
Where did the 6 in the output come from?
i guess it doesn't track edits of messages that didn't asctually !!/run the first time
03:58
@Nitrodon named functions take their arguments in reverse
so 5 was the top of the stack?
yes
Why does W pop exactly one item instead of either none or all?
oh vyxals in the lyal today
03:59
@Nitrodon as I said earlier, there's probably some issues with W because of the rewrite that recently happened

« first day (4008 days earlier)      last day (1132 days later) »