« first day (1919 days earlier)      last day (2093 days later) » 

5:07 AM
@MarsUltor there should definitely be a "batch replace" function. e.g. batchReplace("abc", "a1b2c3") -> "123"
That's generally referred to as tr (transliterate)
I've been thinking to myself recently, I should create a golfing language in Racket, or a more compact form of Racket
D: someone downvoted my TeaScript post:
A: Make a search engine

DowngoatTeaScript, 4 bytes F@Iσ Output is cast to string. Try it online Explanation F@ // Filter input 1 Iσ // Includes input 2

@Doorknob Oh, I thought transliterate was just things like a -> b not a -> b, c -> d
lol they removed it after i commented @Downgoat
5:10 AM
llama@llama:~$ echo ac | perl -pe 'y/ac/bd/'
@Winny O_o huh
@Winny no they didn't
user image
@Quill they probably saw downgoat and decided to click downgoat
it's like one of those match the word to the picture games
@Quill they are match the word to the picture games O_o
5:22 AM
@Quill well played :)
5:34 AM
Q: Map a list of indefinite size to a number!

Kenny LauIt is well known, in the field of Mathematics studying infinity, that the Cartesian product of any finite amount of countable sets is also countable. Your task is to write two programs to implement this, one to map from list to integer, one to map from integer to list. Your function must be bij...

ಠ_ಠ GitBooks is taking 10 minutes to import an empty repository...
Thanks @NewMainPosts
@KennyLau I don't think I get your thing, but what power are we raising Z to?
any finite number
is that an input though?
5:36 AM
an input would be [0 1 5 3]
and i would map it to, let's say, 314159
then when I feed 314159 to the second function
it would give me back [0 1 5 3]
but would then [1 2 3 4 5] be an input?
it would be mapped to 1618033989
and wouldn't that then be the product of an infinite amount of sets?
for example
there's a difference between indefinite and infinite
Z^Z is uncountable
but Z^k where k is finite is countable
@NewMainPosts test cases are cool
5:39 AM
@KennyLau I don't really get it, but you're saying that an bijection exists, so I'll think about it
@Winny there really can't be any test cases
it depends on your program
@Maltysen It exists. This problem is not original.
I even remember the algorithm.
@Maltysen gotcha
@KennyLau well I don't really know set theory, so... :P
I'll see if I can come up with it
have fun
@KennyLau is the function prime factorizations?
5:42 AM
not bijective
why not? all numbers give a unique list
and all numbers can be returned by some list
how would you encode [1,3,0,0,0]?
oh I have to do 0?
5:44 AM
@Maltysen yes then
@Maltysen my algorithm isn't prime factorization but it's cool
you're getting there
prime factorization and then decrement each?
the state "empty" is represented by 0
@KennyLau isn't empty 1?
what would 3 map to?
5:46 AM
I don't get it
what would 9 map to?
[2, 2]
here I'm posting it, I'll delete it if its wrong
what are you guys discussing
5:48 AM
A: Map a list of indefinite size to a number!

MaltysenPyth - 4 + 3 = 7 bytes number → list: tMP list → number: *FhM

a bijection between N and Z^k?
N and N^k
@Maltysen both [1,1,1,1] and [3,3] map to 16
ah damn, incrementing messed up the uniquenes of prime factorization.
wait, its N → N^k?
then I don't need to worry about 0
it includes 0
isn't N the natural numbers?
1, 2, 3, …
5:52 AM
with zero
@KennyLau that's Z mate
Z is with negative
N can be with or without zero
depending on who you are talking to
isn't natural numbers without 0 and whole numbers with 0?
5:52 AM
natural numbers is without 0
well, to be fair, your question did specify "nonnegative"
deleting my answer for now
> Some authors begin the natural numbers with 0, corresponding to the non-negative integers 0, 1, 2, 3, …, whereas others start with 1, corresponding to the positive integers 1, 2, 3, ….[1][2][3][4] Texts that exclude zero from the natural numbers sometimes refer to the natural numbers together with zero as the whole numbers, but in other writings, that term is used instead for the integers (including negative integers).
by the way
it's trivial to show a bijection exists
let's ignore single-digit single-element lists for now
@Maltysen I thought it would be the exponents of the prime factorization
5:54 AM
then you can encode every single possibe list
as a base 11 number
of 0123456789,
@orlp please stop spoiling
@KennyLau there's no such thing as spoiling here
15 mins ago, by Maltysen
@KennyLau well I don't really know set theory, so... :P
if you're not the challenge author
@orlp no, I'm trying to figure it out for myself
5:56 AM
@Maltysen you know how you can combine N^2 into N?
@orlp not really
that's been part of multiple challenges
@Maltysen try making a bijection between N and N^2
oh is it base conversion?
that's one possible approach
then N and N^k for some fixed k should be obvious
you can simply fold the bijection
but k isn't fixed
5:57 AM
k becomes k-1 becomes k-2, etc
@Maltysen well, we're almost there
now you just encode k and your number
into one
that's N and N (e.g. N^2) into N
I don't get it
what do you mean by ^^^^^^
N^2 = N x N
N x N = the cartesian product of N
e.g. all combinations of integers
or pairs
I meant when you said "k becomes k-1 becomes k-2, etc"
if you know how to combine two numbers into one
you should know how to combine three into one
6:00 AM
you first combine the first two into one
and then the result of that with the last one
you're 'folding' the bijection
@orlp By the way, your approach needs modification
@orlp but will that still be a bijection?
@Maltysen you can reverse every step, so yes
actually wait how is base-conversion a bijection
that makes no sense
@Maltysen no, it could be used for it
6:03 AM
[1, 0] and [0, base] give the same number
it isn't directly
@KennyLau please clarify your scoring
is it the sum of the two programs?
can you only write one program that contains two functions (thus potentially share code?)
how can sharing code benefit?
Hmm... So Cantor's pairing function works for len(L) >= 2, but I'm not sure what to do about 1 and 0
@KennyLau imports, helper functions, etc
Yay 1K hours of TF2! I am officially no longer a noob!
6:10 AM
@orlp Clarified.
my algorithm in Retina is 17(N^k -> N) + 23 (N -> N^k)
maybe "in Retina" is a hint lol
@Mego if you encode the initial length as one of the elements in your tuple for Cantor's pairing, when you decouple them, you can operate on that length to resize
@KennyLau are we allowed to use floating point operations?
that eventually break down because of precision
e.g. cantor's pairing function requires sqrt
@orlp As long as it maps from N^k <-> N
I don't care what operation you use.
well the problem is that at some point for big N it breaks down
because floating point has only 64 bits of precision (well, 52, but yadda yadda)
Go ahead.
>| testing
>! testing
> wtf?
btw, my solution: from N^k to N, from N to N^k
6:23 AM
@zyabin101 Try my challenge using UGL, it should be easy if you're using my algorithm
@KennyLau Which challenge? :3
Q: Map a list of indefinite size to a number!

Kenny LauIt is well known, in the field of Mathematics studying infinity, that the Cartesian product of any finite amount of countable sets is also countable. Your task is to write two programs to implement this, one to map from list to integer, one to map from integer to list. Your function must be bij...

It's hard.
@Dennis Your solution is brilliant
6:45 AM
@Mego Should I post my solution?
@KennyLau I'd wait some time for other people to post answers
@Mego Are you planning to attempt it?
@KennyLau I'm working on a solution, but too tired right now to finish it
I'll probably post it tomorrow
care to share your approach?
6:48 AM
@Mego :)
@KennyLau Once I get it working, I will post it with an explanation
Sage also has powerful polynomial builtins, but it was shorter to just do prod(...).expand()
7:42 AM
hi, let's say I have a directed graph like this: 1->3, 2->3, 3->4, 3->5; what do you call 1 and 2 relative to 3? and also 4 and 5 relative to 3?
Or parents
predecessors and successors?
In mathematics, and more specifically in graph theory, a directed graph (or digraph) is a graph, or set of vertices connected by edges, where the edges have a direction associated with them. In formal terms, a directed graph is an ordered pair G = (V, A) (sometimes G = (V, E)) where V is a set whose elements are called vertices, nodes, or points; A is a set of ordered pairs of vertices, called arrows, directed edges (sometimes simply edges with the corresponding set named E instead of A), directed arcs, or directed lines. It differs from an ordinary or undirected graph, in that the latter is defined...
7:44 AM
cool, thanks
Welcome :)
@KennyLau posted my answer
Link for the lazy?
A: Map a list of indefinite size to a number!

orlpPython 2, 204 bytes p=lambda x,y:(2*y+1<<x)-1 u=lambda n,x=0:-~n%2<1and u(-~n//2-1,x+1)or[x,n//2] e=lambda l:l and-~reduce(p,l+[len(l)-1])or 0 def d(n): if n<1:return[] r=[];n,l=u(n-1);exec"n,e=u(n);r=[e]+r;"*l;return[n]+r Works by repeatedly applying a Z+ x Z+ <-> Z+ bijection, prepended by...

@Maltysen the pairing function in my answer is really easy to understand
That's the same mapping I was going for :)
7:51 AM
2**x * (2*y+1)
the left hand side is a power of two (so even)
the right hand side will always be odd
so you can separate the two
> certian
@zyabin101 blagodarya
Time for me to sleep :)
Q: A Mapping of Primes

LegionMammal978Recently, I have found a bijective mapping f from positive integers to finite, nested sequences. The purpose of this challenge is to implement it in the language of your choice. The Mapping Consider a number n with the factors where . Then: For example: Rules You may write a full progr...

Something similar to Dennis' solution xd
It is Orthodox Easter today. :)
8:03 AM
ooh, yes it is
I should call my family
@KennyLau I just thought of an interesting mapping
0 = []
1 = [0]
2 = [1]
10 = [9]
and then?
that's the base case
now let's say I have a list in text form
we strip off the first digit
and now we encode this as a base 20 number
digit by digit
0123456789 map to themselves
",0" ",1" ",2" .. ",9" map to 10, 11, 12..., 19
8:15 AM
poke: VVV
mon: AAA
@orlp and then?
@KennyLau then you're done
bot is lazy
what about the first digit?
8:17 AM
done for.
@KennyLau that was the base case
so "1,2,0" would map to 400+12*20+10?
well, [1] maps to 2 as a base case
so 2*400+12*20+10?
then ,2, so 2*20 + 12
then ,0
so (2*10 + 12)*20 + 10
8:18 AM
/me kicks the bot, work out ur bobbins u piece of unworthy sensless iron
the first digits gets multiplied by 10
since the first digit is in base 10
make it back to 20
or else it will fail
no it won't
although you probably want to do it in reverse
8:21 AM
A: Sandbox for Proposed Challenges

Agawa001Reverse the Gijswijt's sequence As the Gijswijt's sequence is already known no need to redefine it, but the aim of my challenge is to do the vise versa. Given a number N as arbitrary from STDIN or function's dimention, output the first index from that sequence. I'm not really big fan of code-g...

for easier decoding
what does "0,1,2" map to?
well, ignoring what I just said about reversing the order
(0*10 + 11) * 20 + 12
what does "0,0,2" map to?
(0*10 + 10) * 20 + 12
8:23 AM
Q: Find the positive factors!

Kenny LauDefinition A number is positive if it is greater than zero. A number (A) is the factor of another number (B) if A can divide B with no remainder. For example, 2 is a factor of 6 because 2 can divide 6 with no remainder. Goal Your task is to write a program/function that takes a positive numb...

what does "1,2" map to?
1*10 + 12
what does "10,2" map to?
(1*10 + 0) * 20 + 12
8:25 AM
and "0,0,2" =?
ah collides
I need some sort of prefix detection
I thought "10,2" maps to (2 * 10+0) * 20+12
oh it does
I derped
I approve of your mapping
go ahead and implement it
8:29 AM
it still has some issues with leading zeroes
in particular
,0 shouldn't be possible
and 0 for the first digit is a special case as well
as that can only happen with [0] or [0,...
what do you mean?
what issue does it have
right now 01,5 has a unique code
but that should be the same as 1,5
what would "01,5" map to?
and what would "1,01" map to?
let them map to "0,1,5" and "1,0,1" instead
actually, there are two states
new number:
    0 - stay in new number
    1 2 3 4 5 6 7 8 9 - go to existing number

existing number:
    0 1 2 3 4 5 6 7 8 9 - stay in existing number
    0 - go to new number
    1 2 3 4 5 6 7 8 9 - stay in existing number, starting new number
in the start we are in new number
if we then find a 0, we stay in new number
otherwise we are inside an existing number
generally, let the base case 0 map to "0," and the normal case 10 map to ",0," instead.
but it should create another problem
i've no idea how to make this work
well i don't get your states
8:56 AM
@KennyLau oh I just think I massively simplified everything
encode the list as a list of binary numbers
e.g. [1, 5, 2] becomes [1,101,10]
damn, java 8 functions can only count to 2 >_<
@orlp and then?
@aditsu What are you referring to?
there's Function and BiFunction, Consumer and BiConsumer, Predicate and BiPredicate etc
what if I need (gasp) THREE arguments?
@KennyLau sorry, I forgot to mention one step
first encode the list as a list of binary numbers after adding one
so 0 becomes 1, and5 becomes 6
8:59 AM
then [1,5,2] becomes [10, 110, 11]
note that zeroes can not occur in the list
now every number in the list starts with an 1
so we can simply encode the list as a ternary number
possible values are "1" , "0" and ",1"
@aditsu I don't understand everything here, but read it if you want to
Q: Java 8: Where is TriFunction (and kin) in java.util.function? Or what is the alternative?

Richard FineganI see java.util.function.BiFunction, so I can do this: BiFunction<Integer, Integer, Integer> f = (x, y) -> { return 0; }; What if that is not good enough and I need TriFunction? It doesn't exist! TriFunction<Integer, Integer, Integer, Integer> f = (x, y, z) -> { return 0; }; I guess I shou...

yeah… I'm complaining that it doesn't already exist; everybody who needs it will roll their own different interface
Today's Infographic: 'Tis the season imgur.com/gallery/T4OUolk
the accepted answer there is kinda idiotic, the highest voted one is better
9:17 AM
@NewMainPosts Thanks in advance.
Q: Find the n-th perfect power!

Kenny LauA perfect power is a number of the form a**b, where a>0 and b>1. For example, 125 is a perfect power because it can be expressed as 5**3. Goal Your task is to write a program/function that finds the n-th perfect power, given a positive integer 1. Specs The first perfect power is 1 (which i...

@NewMainPosts Thanks.
9:53 AM
Just woke up, 6 in the morning here
@LegionMammal978 ohai
@LegionMammal978 HAI
It's weird, if I get woken from a dream then I feel a physical jolt
@KennyLau Your Decompose a number! is hot!
Q: Bijective mapping from integers to a variable number of trits

orlpThis challenge is a harder version of this one. A variable number of trits is an array of 0 or more trits (a trit is a ternary digit). So [0, 2, 2, 1] is a variable number of trits, but so is []. Write a function or program that, given an non-negative integer returns a variable number of trits ...

10:03 AM
The amount of attention a challenge receives is often inversely proportional to its difficulty.
10:17 AM
@KennyLau It's also inversely proportional to the number of challenges posted in short succession. ;)
@MartinBüttner :p
10:29 AM
Yeah! If you only posted one question it would have had tons of answers by now. But by posting so many, people are so excited they can't pick where to start.
@KennyLau could you explain your algorithm?
@orlp Done
Q: Updating the [popularity-contest] tag info: suggestions

flawrThe current tag info of the popularity-contest is outdated and needs to be replaced/improved as we now have much clearer notions of what a pop-con is compared to the time of creation. From the recent discussions (links below) we can conclude that a pop-con needs an objective validity criterion ...

@KennyLau kinda brute force :P
@orlp added links to other bases
but works xd
10:49 AM
Why doesn't anyone like my Keep Calm and Juic Avocad poster? ;(
Either no one really does like it, or the Keep Calm-o-Matic shows no likes.
1 hour later…
@flawr :-(
flawr is back
@Optimizer Ikr.
@flawr :-(
11:58 AM
This one is also interesting from a sociological point of view.

« first day (1919 days earlier)      last day (2093 days later) »