« first day (4575 days earlier)      last day (565 days later) » 

05:21
My mission statement for ARBLE is to have someone complain that my answer is a snippet.
05:57
0
A: Sandbox for Proposed Challenges

mousetailRepeat your program to print Fibonacci numbers code-challengesource-layout Write a program fragment so that, when repeated N times it prints the Nth Fibonacci number. For example, if your program is print(x) then: print(x) should print 1 print(x)print(x) should print 1 print(x)print(x)print(x) s...

06:10
CMC Given a list of positive floats, evenly spread the floats that occur between consecutive integers.
Example?
0.1 0.2 1.4 goes to 0.333.. 0.6666 1.5
:)
i assume inputs are always given in ascending order?
06:21
yes
and never integers
right
I need a group construct in ARBLE...
:)
Extra gratitude points for a python answer
can probably be shorter but ḞJ÷L‘$+ƲƙF` for 11 in jelly
er
`` ḞJ÷L‘$+Ʋƙ`F ``
fuck it
ḞJ÷L‘$+Ʋƙ`F
06:28
@UnrelatedString which language is that in?
see what line I replied to :)
is it suitable for main?
I am tempted to post it there
although I would be very grateful for a Python answer :)
floor, map over groups {divide [1 .. len] by len+1 and add the floors back}, flatten
06:30
:)
@Simd APL, 18: ∊⌊(⊂+∘(⍳÷1∘+)∘≢)⌸⊢ Try it online! doing exactly that ↑↑
@Adám nice!
@Simd Well, Py'n'APL exists…
@Adám it's a great name too!
0
Q: Evenly spread values

SimdGiven a sorted list of positive floats (none of which are integers) such as: [0.1, 0.2, 1.4, 2.3, 2.4, 2.5, 3.2] Evenly spread out the values that fall between two consecutive integers. So in this case you would get: [0.333, 0.666, 1.5, 2.25, 2.5, 2.75, 3.5] (I have truncated the values 1/3 and...

06:33
because your answers were so great :)
Answered 59 secs after posting :-)
:)
@Adám that's what I am talking about!
my code would work with repeats too
@Adám interesting
@UnrelatedString thanks for the answer!
does anyone here code in Python?
not that I am begging :)
@Simd I've added a full explanation. Should e possible to translate to Python. Maybe ChatGPT can even do it…
06:48
groupby(x,int) is new to me!
@Adám thank you
oh I see what it is doing (the python code that is)
everyone has gone for grouping
@Simd There is a ton of useful stuff in itertoos: docs.python.org/3/library/itertools.html#itertools.groupby
Highly recommend looking at it
@mousetail I know it is there but have never spent enough time going through it
thank you
thanks for the python answer too
@Simd you'll probably get a Python answer from xnor soon
@TheThonnu I look forward to it
although mousetail got there first :)
what is k+-~j for? I mean why +-
I wouldn't be suprised if an answer with half my length is possible
@Simd ~ is equivolent to -x-1
So -~x is x+1
06:56
and k-~j doesn't work?
It's k-(~j/-~len(i))
Order of operations is different
I think you mean -~ trick (in your answer)
@mousetail thanks
@Simd Actually I can sort of do something like that
cool
Since both operands of / are negative I can invert them both and save 2 bytes
06:59
for k,[*i] in ... is tricksy too!
@mousetail nice
I am never 100% confident when I see * in python
Honestly same, there are a lot of odd edge cases
Be happy python doesn't have object desctructuring like in Javascript though, ton more edge cases for ... in JS than for * in py
If I have a function def foo(*x) I understand that if I call foo(2,3,4,5) then x becomes (2,3,4,5) but I am not really sure how to explain that
All the remaining arguments get put into a list then assigned to x
@mousetail apparently a tuple
Also ** does the same for keyword arguments
07:03
I have had bugs where I assumed it would be a list
It used to be a list
ah... until python 3?
Probably
Tuples are generally superior to lists
because they are hashable?
And immutable
07:04
why does immutable make them superior?
You can't accidentally modify them, which would modify all copies across your code
btw this is an excellent python resource: github.com/satwikkansal/wtfpython that explains these types of things well
ah ok. I am starting to get annoying by python (or maybe emacs). I really want to know if my indentation is broken or I have misspelled a variable before I run the code
@mousetail thanks!
inspired by wtfjs :)
07:18
@Simd Can't you get a flake8 plugin for emacs?
@mousetail maybe :) I am trying to install eglot currently. It's not easy
 
3 hours later…
10:46
0
Q: Find separating sets

bsoelchTwo points pand q in a topological space can be separated if there are open sets U and V such that: p is an element of U and q is an element of V U and V do not have any elements in common Your task is given a topology (a set of open sets) and two points p and q to output sets U and V satisfyin...

 
1 hour later…
12:12
@TheEmptyStringPhotographer Great to see someone trying CellTail
Hope you try some non-trivial challenges as well
 
1 hour later…
13:12
@mousetail I have a suggestion: remove integer overflow
14:01
Remove?
Like just crash?
@mousetail it's annoying because if i have a number more than 9 digits i have to split it up.
That's just how numbers on a computer work
It has 64 bit numbers
@mousetail signed or unsigned?
Signed
Actually the wasm version might be less than the offline version...
wasm is 32-bit
@mousetail 64-bit can handle 10-digit numbers easily
So "if i have a number more than 9 digits i have to split it up" and "It has 64 bit numbers" can't both be true
But wasm is 32-bit, because 64-bit integers cannot losslessly be converted to JS numbers. You either have to use the "i53abi" (in which long long is actually 53 bits) or use bigints instead of numbers at the JS/wasm border.
14:43
It's probably 32 bits then
Still more than enough for any non-trivial program
15:41
@Adám If you are concerned with efficiency, swift-algorithms has randomSample(count:). swift-algorithms is one of a few packages that are in a weird spot: they're first-party packages, but they aren't available by default, so you need to list them in your package manifest.
Being external packages is annoying since environments like Godbolt typically don't have them
Other such packages include swift-collections, swift-async-algorithms, and swift-numerics
 
1 hour later…
17:08
CMC Given a string, output the index of every : and , that is not surrounded by parenthesis
@Bbrk24 that's how I plan to distribute most of Rabbit's pseudo-stdlib
as separate modules with their own release cycles, installed independently by the module manager
the few modules that don't follow this pattern will be for things like low-level networking and OS interfaces, and will be directly built into the interpreter and updated in lockstep with it
@mousetail You mean immediately adjacent, or even further out? E.g. does (a:b) give an empty result or not?
Further out, with any level of nesting. So :((ab:cd):) should return only 0
17:28
@mousetail QuadR , 25 23: Try it online! (1-indexed)
⍸⍵∊':,'
\([^()]*\)
⊣\⍵M
Very nice
@Ginger Here's the thing: without a package manifest, you can't have any external dependencies besides the stdlib and anything else built into the compiler, so simple scripts can't use them. By doing this, you massively increase the amount of boilerplate needed for some simple tasks.
Not that Swift is exactly a scripting language, but
Rabbit (normal Rabbit, that is) isn't usable as a scripting language at all
all code has to be formatted as a module with a manifest
Swift is trying to make Swift scripts a thing and this is the biggest obstacle
it will be possible to use the Rabbit Script Host and schema modules to make "scripts", but I'm not sure how that'll work just yet
of course, all of this does assume I resume working on Rabbit
which I probably will, I like the concept too much to just abandon it
17:39
0
A: Sandbox for Proposed Challenges

spooky_simon2D Percolation Model Per Wolfram MathWorld: "Percolation theory deals with fluid flow (or any other similar process) in random media." The model is a 2 dimensional lattice whose edges are either "open" or "closed" with probability p in [0,1]. At a percolation probability P, each edge will be eval...

18:30
My CellTail sorting algorithm finally actually works: github.com/mousetail/CellTail/blob/main/examples/sort.ct
19:09
TIL that you can't really use a tuple of tuples of floats as a key in a python dict
You can?
hmm... must be my mistake
I though I had tried it and it didn't find the key but I think I got that wrong
Probably the floats are not actually equal
floats can be off by a tiny bit and have a different hash
ah yes
Even if, when you print them, they look the same
19:13
good point
19:24
How can I make a hash of a tuple of tuples in python?
Md5 or anything similar will do
There's the __hash__() method
>>> (1, 2, 3).__hash__()
529344067295497451
>>> (1, 2, 4).__hash__()
-4363729961677198915
Or just hash((1,2,4)) will do the same thing
It works on any python type
For strings hash will randomize when you restart python though
@Bbrk24 what is the range it hashes to?
I am only doing it save space
@mousetail thanks
let me google that for you
> hash() truncates the return value based on the bit width of the host machine.
@Bbrk24 I did try to look out up :)
@Bbrk24 ah!
Thanks
So it seems it is 64 bit signed

« first day (4575 days earlier)      last day (565 days later) »