« first day (1525 days earlier)      last day (844 days later) » 

2:40 PM
Right so I am a 1000% Noob at Jelly, but it intrigues me and I want to grasp the basics. To do so I wanted to figure out the sum of every number that is a multiple of 3 or 5 under some limit
My first attempt is here Try it online! I later figured i could drop the 3 and 4. Hower, I can not for the life of me seem to input a list (R) as the second argument
 
I'd love to help right now, but Imm busy for the next couple of hours. If no one else checks in before I'm back, I'll walk through it work you :)
 
@cairdcoinheringaahing No hurries =) Just driving me up the walls that I am this close but no bueno. Feel free to leave me a ping ifno one else replies
 
 
5 hours later…
7:58 PM
@N3buchadnezzar Ok, so what should the expected output for that be?
By my understanding, you're calculating the sum of the elements of the second argument that are divisible by either 3 or 5, so the output should be 60?
Or should the second input just be 15, and you want to convert that to a range in the code itself?
 
8:14 PM
Yeah, not sure what the expected output is - this makes sense for the code written so IDK what the desired behavior is :p
 
8:41 PM
Correct me if I'm wrong @N3buchadnezzar, but is this an attempt to solve this CMC: Given a list of integers a and an integer b, calculate the sum of all integers 1 ≤ b that are divisible by at least one integer in a. Answer with MD5 hashes
 
Yes, adding the S at the end gives me my desired output
Except that I manually have to enter the list, instead of being able to use R or something akin to that
So ³ḍ€⁴S>0×S works but ³ḍ€Ḷ⁴S>0× does not. I tried ³ḍⱮḶ⁴S>0× as well without much success
Input would be something like [3,5] and 1000.
@cairdcoinheringaahing Yes, that is precisely it, everything else works.
 
So first of all, with your initial code (that takes the range as the argument), you can remove 2 bytes fairly easily
Giving this 7 byte spoiler
 
I know i can remove the numbers, I just kept them there for learning purposes =)
 
Ok, good :)
Of your two suggested approaches, let's take a look at why they don't work
 
But yeah, I dont know how to write 15 instead of [1,2,...,15]
 
8:49 PM
For ³ḍ€Ḷ⁴S>0×, we want to apply to . In order to tell Jelly to specifically run on , we need to group it into a nilad
There is a quick which specifically groups links into a nilad
 
¢ right?
 
wait, should we not be using R? or am I reading the challenge incorrectly
 
I'm just working on N3's suggested approaches first
 
ah, okay
 
"Find the sum of all the multiples of 3 or 5 below 1000." Is the exact wording. But the problem is not whether to use R or Ḷ :p
 
8:51 PM
@N3buchadnezzar not quite - that calls the previous link as a nilad, but here, we are trying to group a couple of links in-line together into one link
@N3buchadnezzar ah, I was just going off of caird's CMC wording, which has <= :P
 
@cairdcoinheringaahing 6 bytes, D31035E59E6E4D78222790FFD83A0FC5
5 bytes, 4D16FB6E24C1FF34076A9BEE23CAEB41 to do
 
I have (6) 4405f1688f71ba63e558f6fd9edd4fa7 to do with swapped inputs
 
Never mind. So, your current solution works by × multiplying the corresponding elements in the input array. Keeping with this approach with the input changing to an integer will either result in a complicated chaining strategy, or a lot of nilads based on .
 
rot13(v jvfu qbg cebqhpg nhgb-enatrq GOU)
 
Is the problem with my order in the program. Again very new. That my ⁴.
sort of sits in the middle? It would be easier if the logic was reordered?
 
9:00 PM
Restructuring would make this easier
 
Using the superscript nilads to refer to the arguments sort of goes against the whole point in tacitness and often restructuring is both shorter and easier
 
Generally, when you want to do something to each element of a range, it's good to have the range integer as the first argument
Given that auto-ranges (converts an integer to a range), a good start would be this
 
(5) 4d16fb6e24c1ff34076a9bee23caeb41
yep, same as yours
and (6) d5c718eca901409ea1ba4eb26f1a8e66 to get strict less-than - not actually the same as yours, interestingly
 
The top line is a dyadic function that takes an integer x in the range and the list a, and you can work with each integer individually
 
(6) 7c483c424f1ad513f435ea0f3b4abc25 - another one that differs from yours
 
9:03 PM
@hyper-neutrino There are two versions of my 6 byte, that's one
 
a third (6) b9f8446cd26bb355b175be32ce811f23, still different lmao
(6) d31035e59e6e4d78222790ffd83a0fc5 - okay, finally found yours :P
rot13(V jnf chggvat gur cbc nsgre gur svygre :C)
 
@cairdcoinheringaahing What does that other symbol do? Last link as a dyad? And yes this seems like a great start (which is all i need =) )
 
@N3buchadnezzar Yes, ç calls the link above as a dyad
 
I might be tired but I still do not quite understand how ç€ / why this gets interpreted as a list
 
So turns 16 into [1,2,3,4,...,15,16], then runs the previous link as a dyad on each. The left argument to the dyad is the element and the right element is the second argument () passed to the program
For example, that pairs each element with the input list
That then means that you can work with each element, determining if it should be part of the sum or not
 
9:15 PM
Yeye Its just a bit strange using € on what feels one element instead of two.
 
Yeah, the golfing tricks can be a bit weird :P
For an additional byte, you can prepend R so that it's clear that it runs over each element in the array (or )
 
Ok.. So what is the difference between doing something like 16R and 16€ then? Or is it just that number + € is interpreted as a list?
 
Number + is always interpreted as a range
Jelly will cast integers to lists when necessary. Some builtins use range, some cast to digits, others just wrap (e.g. x -> [x])
 
Ok, finally figured out that pesky euro
 
9:33 PM
@cairdcoinheringaahing Try it online! Next attempt
Seems like I still run into the problem of inserting that list again, this is close I think
 
So, in order to convert the input into a link, you'll need R (as I'm sure you know)
 
Yes, already tried that =)
 
However, just replacing the list with R doesn't work
We need to explicitly tell Jelly to run R on the first input. There are two ways we can do that
The beginner way is to create a nilad where we construct the range, from ³ explicitly
 
³R did not work
 
It did not
What we need is to group those together
take a look at the quicks and see if there's anything about grouping nilads together
 
9:38 PM
¢?
 
Not quite, keep looking :)
 
Hmm I tried ¤ too
 
What did you try with ¤?
 
¤R³ and R¤³ and R³¤ <- as in I have no idea where to put it :p
 
Ok, that's no problem - ¤ is one of the more complicated quicks
Essentially, ¤ scans backwards, looking for a nilad followed by monads, dyad-nilad pairs and nilad-dyad pairs. Here, we only care about a nilad followed by a monad
 
9:43 PM
From what I see, I do not follow ¤ by a link
 
Think about how to arrange ¤, R and ³ so that you have a nilad followed by a monad, that will be seen by ¤ when it scans backwards
 
Right I thought it scanned forwards
 
all quicks in Jelly scan backward :P
 
Jelly is destroying my brain with how the control flow does not flow left to right, nor right to left
³R¤ did the trick =) monad (R) followed by nilad ³
 
"followed by" here means moving forward, as in R is followed by ^3
^3 is a nilad :P
 
9:48 PM
@hyper-neutrino Of course! ^3 takes no input, R takes 1
 
So, I believe you have a 9 byte solution that works?
 
I find it a bit strange that it goes over two lines though, most Jelly programs I've seen goes over one.
 
Ok, that approach can be shortened by 2 bytes and onto 1 line :P
 
I tried using the d dot but could not make it work. The division thingy I used in my original attempt
 
The 2 bytes can be golfed from 2 different parts, the "2 lines" and the ³R¤
³R¤ is easier to golf by a byte, so we'll start with that :P
If I say that ⁸R¤ is the same as ³R¤, does that make sense?
 
9:53 PM
Let see ^8 returns the links left argument
But what is the link here?
 
And do you get why that's the same as the first command line argument?
The link here refers to the entire last line
 
And the very first thing we do on that line is input the first command line argument right?
 
When deciding on the terminology for his already confusing language, Dennis (the creator of Jelly) decided to call 2 different things "links" :P
@N3buchadnezzar Implicitly, yes
 
So to the very left of that link is ³
implicitly
 
Kind of. So an important think to know about Jelly is that a dyadic link (what we have here, as it has 2 command line arguments) has a left and a right argument
 
9:56 PM
With you so far
 
By default, the left argument is the first command line argument and the right argument is the second (in a dyadic link)
 
Yeah, I figured that out when I dropped the numbers and it still worked (on my first attempt)
 
Therefore, when just running a dyadic link, ³ is essentially the same as and is the same as
 
Yup, makes sense
 
So ⁸R¤ is the same here as ³R¤
 
10:05 PM
Yup
 
So, there's a quick specifically designed to make ⁸<monad>¤ into 2 bytes (as <monad><quick>), so we can turn ⁸R¤ into R<quick>. You can find it on the quicks page, but the description isn't 100% helpful. Take a look through to see if you can find anything, let me know if not :)
 
wait, there is? or are you talking about spoiler
 
@cairdcoinheringaahing I think i got it with { right?
R{ seems to work
 
@N3buchadnezzar Yes, very nice
 
Now I get why they are called quicks
 
10:10 PM
So, we're down to 8 bytes. Now we just want to get rid of the two lines and make it all into 1
1 message moved from The Nineteenth Byte
 
Should the description really be "Uses the left argument of the previous link" ?
 
Not quite, because it can change the parsing of the link in some cases. Here, it doesn't matter tho
The parsing of Jelly programs is dependent on the arities of each link in the program. { turns a monad (arity 1) into a dyad (arity 2), which can affect the parsing in certain cases
 
have we gone over chaining rules or is it too early to fully introduce those
 
I've mostly skipped over those
Ok, golfing from 8 bytes to 7
If we want to make it into a single line, we need to find someway to remove the newline and ç and replace them with a single byte
 
Do we have to use the Michael Jackson symbol?
 
10:16 PM
Never heard someone call it that before :P
But no :P
 
We're using ç to group the commands on the first line into a single dyad, so that we can run that dyad over each element. But there's a way to group 2 links into a dyad without needing a newline
 
@cairdcoinheringaahing If you got time, could you quickly explain why we need two lines?
In the first place
Oh so ç sort of works on the line above
 
I like to use multiple lines and Ç/ç when I'm running a large link with a quick (e.g. ), then I try to turn it into a single line after getting a program that works
For example, my first version of this was this because I could group everything together on the first line, then call it
After getting a working version, I then golfed it to be a single line
 
Makes sense, it seems what you are hinting at is using ¥
 
10:22 PM
Indeed it is :P
 
And this one scans backwards as well?
 
Yes. Like hyper said, all quicks scan backwards in Jelly
Some have a fixed number of links they capture (e.g. ? always gets the previous 3), some vary
 
@cairdcoinheringaahing %Ȧ¥€ḋR{ works, but I dont really get it :p
 
Ok, so %Ȧ¥€ is exactly the same as %Ȧ¶ç€ (using instead of a newline). ¥ groups the previous 2 commands into a single command (kind of like function composition). then runs this composed command over each integer 1,2,3,...,n (n is the left argument)
 
And the two previous commands are?
 
10:29 PM
% and Ȧ, the 2 commands directly before the ¥
 
And then it does g(f(x)) on the list where g and f are % and À respectively. Makes sense finally!
There might be a bug though, PE 001 says the answer should be 233168 but we output 266332
I know we are overcounting by doing 1..1000 instead of 0...999, but the error is not a difference of 1000
 
¥ groups these two into a function f(k, l) (k is an element in the range, l is the list passed as the second argument). % calculates \$k \bmod l_i\$ for each element \$l_i \in l\$, then Ȧ asserts that all of those are non-zero. This is only true if k is not divisible by any element in \$l\$
I remember you saying you have a masters in Maths (?) so I hope the LaTeX isn't too much
 
It does not render, but yeah I read LaTeX for breakfast :p Seem to be missing some chat pluging or something I recall
 
There are various userscripts you can find on Math.SE for chatjax
Here we can see our error - Ȧ is asserting that \$k\$ is divisible by no elements of \$l\$ instead of at least one element
 
So we sadly have to add one byte to negate the results
In my first attempt I tried solving this by doing S>0, but by Jelly standards this seems a bit woordy
 
10:36 PM
Yes. Now, this will change 2 characters in the code - 1 to add in a negation condition, and 1 because ¥ only groups 2 characters, so we'll need to use a different quick instead of ¥
 
@cairdcoinheringaahing %Ȧ¬ɗ€ḋR{ works =) The difference from the actual answer is exactly 1000 =)
 
Very good :P
 
I'll go to sleep now. But I will hopefully try to solve the first 10 PE problems using Jelly in the following weeks / (months..)
 
o/ Sleep well, dream of Jelly :P
 
No no
No nightmares pls :p
 
10:40 PM
The nightmares are when you start dreaming of ways to golf your Jelly answers :P
6
 

« first day (1525 days earlier)      last day (844 days later) »