« first day (359 days earlier)      last day (905 days later) » 

12:43 PM
Hello there
I am having trouble trying to write a chain
I'm aware that the link DS⁸%o⁸DP⁸%¬ doesn't actually compute NOT(OR(larg % sum(decimal(larg)), larg % prod(decimal(larg)))) and something more like NOT(larg % prod(OR(larg % sum(decimal(larg), decimal(larg)))
I'm just not sure how in the world to fix this
 
1:09 PM
Never mind. Jonathan Allan beat me to the answer
 
2:06 PM
@Sherlock9 - Ah. Yes you want to use the tacit side of Jelly here. I calculated the D first and used chain separation to then concatenate the product and the sum into a list and then checked the division (there is for divides, which like many atoms vectorises).
 
2:28 PM
@JonathanAllan I have had my head in a stack-based language for too long it seems. Thanks for the explanation
I should probably look further into chain separation, but I'm not sure where to start
Usually having another problem to try that requires chain separation and working that out do it, but I seem to have run out of recently posted interesting problems
 
 
1 hour later…
ven
3:39 PM
@Dennis I can look into it (it's "my" bug after all)
I'm not sure what you want though :)
 
3:59 PM
Wouldn't call it a bug. I think all quicks behave like this right now.
 
4:54 PM
Quick question. How would you do a loop like while q<n:q+=1;#something_else_that_uses_q in Jelly, where both q and n were originally arguments? A for loop from 0 to n-q? A map over range [q...n]?
 
5:52 PM
@Sherlock9 It depends. There is a quick for a while loop, ¿ - you'd probably want to collect up results of your "something" with п. Often it will be golfier to do something else. For example finding primes between q and n inclusive could be achieved using a filter like rÆPÐf (where r is inclusive range, ÆP is "isPrime" and Ðfis "filterTrue").
 
Interesting
Still not sure how to go about it, though, as the whole snippet in Python is while q<n:q+=1;r=(r+k)%q
With r initialized before the loop so probably in the main link somehow. It seems like this would be a mess to write
 
k is a constant?
 
Yes, it is and so is n.
 
so if you have r, say [7,8,9,10] you can do r+k to get [7+k,8+k,9+k,10+k]. Then you may be able to % with [q,q+1,q+2,q+3] using a zipwith quick "...
um...
 
I could have q be, say [7,8,9,10], but still have to do mod(last_result + k, q) somehow
 
5:59 PM
actually no need for the ", the vectorisation list%list works
e.g. [7,8,9,10]+5%[4,5,6,7] = [0,3,2,1]
 
Ok start with r=2, k=3 and have q=1 at the start to n=5
>>> r=2;k=3
>>> for q in range(1,6):
	a = r+k
	r = a%q
	print(a,r)
3 0
3 1
4 1
4 0
3 3
Perhaps I should start learning Jelly with an easier problem
Like, Fibonacci or Lucas or binomial coefficients
 
what would be the actual problem that you are trying to solve up there ^?
 
The first question I ever posted on PPCG: Josephus problem with three inputs
 
maybe a usage of # could be made here
"nFind"
 
Oh o_o Now there's an idea :D
 
6:34 PM
Hm, I'll have to try this again in the morning. Thanks for the help
 
7:21 PM
@Sherlock9 well I submitted a solution using a while loop, but there could well be a shorter way.
 

« first day (359 days earlier)      last day (905 days later) »