« first day (2005 days earlier)      last day (2833 days later) » 

12:13 AM
Generate a set of N random numbers such that 1. Each number has an absolute difference of at least K from each other number 2. Each possible number has an equal chance of appearing and 3. Each possible set of numbers has a non-zero chance of appearing
@El'endiaStarman @MartinEnder @PhiNotPi ^
the real problem lies with the ends of the range. For example, if my numbers are from [1,10] and K is 3, then the numbers 1,2,9,10 have a greater chance of appearing
also, have any of you used Rhino (the JS engine)?
 
@DrGreenEggsandIronMan Do you ever leave the chatroom and come back hours later to see something like ":31275012 " saved in the message box and wonder what message it was?
 
@NathanMerrill yeah
@HelkaHomba just look at the link form
 
@HelkaHomba Hahaha No, I haven't done that yet.
But it all makes sense now.
 
@MᴀʀsUʟᴛᴏʀ more work
 
12:24 AM
8 hours ago, by Dr Green Eggs and Iron Man
@HelkaHomba I don't understand that message you pinged me with.
Actually, I can make a bookmarklet when I get home
 
@MᴀʀsUʟᴛᴏʀ If I wanted to call a function in JS from Java with parameters and get the return value, is that feasible/fast?
 
Cool, I just got the "incrementalist" badge.
Actually wait a sec, it was downgoat who approved it! Ty @Downgoat!
 
@NathanMerrill feasible? Yes. Fast? Idk, I don't usually check performance
 
@DrGreenEggsandIronMan np
 
@DrGreenEggsandIronMan what does it do?
 
12:27 AM
It's a badge for editing docs
 
@DrGreenEggsandIronMan can u pls approv my edit :3
 
0
A: Sandbox for Proposed Challenges

Dopappcode-golf math string Teach me how to add Everyone knows how to add numbers by hand, right?––Well, I hope so, but for anyone who needs a quick reminder: To add 17282 and 1342, you proceed as follows: 1) place the larger number above the shorter number and match up the digits 17282 1342 2) dr...

 
No, I'm < 1K.
 
;_;
 
What's the edit?
 
12:28 AM
@Downgoat where? I can.
 
@DrGreenEggsandIronMan Hive yet?
 
Vim is probably the only docs I'll end up contributing to. Maybe that and pygame, if I can get one more person.
 
Oh, apparently I can approve.
 
@Downgoat oh. I don't have that much rep :P
 
12:29 AM
@MᴀʀsUʟᴛᴏʀ also, what about async execution/communication?
 
@DrGreenEggsandIronMan :D thx dr green eggs
 
there is no brainfuck tag. I am deeply disapointed.
 
@HelkaHomba Maybe after dinner.
 
oh, I don't think Rhino is what I want.
I didn't realize it can access Java libraries
 
@NathanMerrill what do you want exactly?
 
12:33 AM
@MᴀʀsUʟᴛᴏʀ its not just about the security, its also about speed. The entire reason I'm considering Rhino is that it might be faster than communicating via pipes
@MᴀʀsUʟᴛᴏʀ I'm considering adding custom support for certain languages into my KoTH framework, where those languages would execute faster (and wouldn't have to do a bunch of input/output processing)
 
Well first off Rhino is already built-in to Java (javax.script)
 
oh, I saw javax.script, but didn't realize that was Rhino
 
Secondly Rhino can actually compile JS to Java classes (iirc)
So that's pretty good
@NathanMerrill It's supposed to be a generalized scripting framework so that people can implement other languages but the default language is JS with Rhino
 
ah ok
 
I can show some code snippets by the way if you're looking for sandboxing.
I use a ClassShutter plus a custom object factory to make it so people can't use reflection
 
12:37 AM
JVM languages, Idk how many can be accessed from Javan.script
 
er, before that, a common requirement is to write to files. How would a Rhino script do that?
(or store data somewhere)
 
It would just use the appropriate classes from java.io
 
You can pretty much use any Java class seamlessly. The only time there's a bit of a hassle is when you need a primitive array (not a List)
You can even make anonymous classes and all that cool stuff
 
@NathanMerrill developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/… <- examples, idk how helpful they are since I can't access GH atm
 
12:39 AM
thanks
 
I (unfortunately) have a lot of experience with Rhino, lemme know if you have any questions.
Fair warning: it's still JS. I myself am transitioning to LuaJ as a result
 
what about asynchronous communication?
aka, I call a JS function
it stores some variables
and when I call the JS function again, those variables are still set
 
You can save scopes
 
what does that look like?
nevermind, I found the page on it
 
You can just specify the old Scope object when you run the new piece of code
 
12:44 AM
hmm. So it looks like if users want to write JS to save state between execution, they'll have to learn some stuff, but all in all, it looks promising
oooh, if I pass in an arbitrary object to a JS function, does that object have all of the public variables and methods of the object?
I'm guessing yes, which is way cool
it literally means that there's no serialization
 
Why not read?
 
user214599
Hi
 
@quartata ask downgoat :P
 
@quartata if I pass a List to JS, does it become a JS array?
 
user214599
@CᴏɴᴏʀO'Bʀɪᴇɴ fread looks like a quite awkward name.
 
@MatthewRoh totally :3
 
@quartata readFile will return a buffer/string of a file's contents. read will read bytes from a stream (from open)
 
@NathanMerrill no, you need to convert yourself
 
user214599
Why not make a filestream object?
 
12:54 AM
Either in js or using a wrapfactory
 
@MatthewRoh good idea brb
 
user214599
@Downgoat You can consider a function that redirects all the input to a file
 
user214599
Like in C++: cin.rdbuf (<filestream name here>.rdbuf ())
 
@NathanMerrill wait, are you using Java 8
 
@MᴀʀsUʟᴛᴏʀ yes
@Downgoat neither of those are good
 
@NathanMerrill then wouldn't nashorn be faster
 
@NathanMerrill alternative suggestion pls?
 
they don't tell me what I'm reading
IO.File.read
 
i don't want to become Java
 
12:59 AM
just readFile
 
@NathanMerrill that is kinda gross
 
IO.File.read.async.call.aruments(goat.txt)
 
user214599
@Downgoat Why not IO.async | read
 
@DrGreenEggsandIronMan ;_; where is DJ McGoathem
@MatthewRoh wat
 
1:00 AM
@Downgoat oh, I'd make read the function, and readAsync() a different function
there's no need to namespace them
 
@NathanMerrill why are you even using rhino
 
@MᴀʀsUʟᴛᴏʀ fast/easier execution of JS scripts for KoTH competitions
 
user214599
@Downgoat Can you give me a document about it?
 
(the controller in Java)
 
@MatthewRoh about what?
 
user214599
1:02 AM
@Downgoat the whole IO thing (or at least an explaining about the buffer)
 
user214599
@Down Wait I have an idea
 
@NathanMerrill wouldn't nashorn be faster and equally easy?
 
@MᴀʀsUʟᴛᴏʀ I'm looking into nashorn right now
 
user214599
@Downgoat IO.asyncBuf(buffer) maybe
 
i am having very low views so self-advertising:
 
user214599
1:06 AM
@Downgoat wait what's downgoay (lol typo)
 
user214599
I've come up with a solution for async
 
@Quill pls halp, node is borked
 
what's wrong?
 
@Quill new profile pic?
 
i tri do path.join
but:
TypeError: path.join is not a function
;_; @node y u do dis to gaot
 
1:15 AM
what is path?
 
wait nvm figured it out
 
Did you have a local variable called path
@CᴏɴᴏʀO'Bʀɪᴇɴ yeah
 
@Quill yes >_>
how did u kno
 
I did the same thing yesterday
 
user214599
XD
 
1:19 AM
@Quill ._.
 
user214599
Hey I found the best programming language to check primes!
 
user214599
 
user214599
Saw it and went ._.
 
Lol, who starred my poll?
@MatthewRoh that's not actually a language by PPCG standards. It can't add.
 
Great, a brief power outage caused my computer to reboot
 
1:24 AM
^^
 
@DrGreenEggsandIronMan moi
 
user214599
:O
 
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    Caused by: java.
Gee, thanks Java.
 
user214599
Should I make a golf library for C++
 
@MatthewRoh no
 
user214599
1:27 AM
Y
 
\o/ \o/ \o/ IO.read works!!!!!!
 
user214599
I mean for being boring.
 
"fun"? We hate fun.
 
chat mini-challenge
help me find example output for an upcoming challenge
 
0
A: Sandbox for Proposed Challenges

xnorWrite a program with unknown halting status code-golfcops-and-robbers [This is an attempt to make a workable version of this closed question.] Cops try to write short programs for which it's not clear whether the program eventually halts (terminates) or whether it runs forever. Robbers try to "...

 
1:28 AM
you know that the repeating part for 1/3 is 3 (because 0.3333....)
the repeating part for 1/7 is 142857 (because 0.142857142857...)
what is the repeating part of 987654321/123456789?
 
@orlp 7. It's definitely 7.
 
post answer in a gist
@DrGreenEggsandIronMan I don't believe so :)
 
@orlp are you sure about that? I wrote a programming language that solves your challenge in 0 bytes, and it says the answer is 7.
 
please, serious discussion
I legitimately don't know the answer
 
@orlp is this a joke?
 
1:31 AM
no
my next challenge will use it as an example
 
so you ask us? what are we, your slaves!? starts working on the problem, intrigued
 
but I don't have a working answer
 
How do you know it does repeat? Lots of fractions don't.
 
definitely not
 
1:32 AM
@orlp it's it's irrational. I've done it to 10,000,000 decimals and no repeating part
 
@orlp sorry, floating point error :P
 
@Downgoat are you saying that the ratio of 987654321/123456789 is irrational?
 
   987654321%123456789
8
   x: 987654321%123456789
109739369r13717421
 
user214599
Look at this
 
@Downgoat wat how, it cant
 
user214599
1:34 AM
66
Q: Why is 987654321/123456789 = 8.0000000729?

marty cohenMany years ago, I noticed that $987654321/123456789 = 8.0000000729\ldots$. I sent it in to Martin Gardner at Scientific American and he published it in his column!!! My life has gone downhill since then:) My questions are: Why is this so? What happens beyond the "$729$"? What happens in bases...

 
@MᴀʀsUʟᴛᴏʀ
 
@Downgoat maybe your algorithm is wrong. does it work for something like 5 / 6?
 
yes, that answer has a lot of nice analysis, but no generic algorithm, nor an actual full repeating part
 
I'm writing a function to calculate the decimal expansion of a number
then look for patterns
 
user214599
If it was rational, It would be boring.
 
user214599
1:35 AM
20
Q: Golf to find Boring numbers

Matthew RohIf an integer has a digit/sequence of digits in it which repeats continuously (You will understand why I said "continuously") 5 or more times, we call It "Boring". For example, 11111 is Boring, whereas 12345 is not. Instructions Take an Integer as Input Output a truthy value if the integer is...

 
user214599
^ reference
 
it should have a period of 6855006, according to this one site
 
@CᴏɴᴏʀO'Bʀɪᴇɴ that gives: .8333...3
 
@CᴏɴᴏʀO'Bʀɪᴇɴ that is not a proper algorithm though
1. it's brute force
2. it can give false positives
 
1:36 AM
for example
what about 0.12345123451234512345 + 1/7000000000000000000000000000000000
the repeating part is still the same as 1/7
 
user214599
Everyone uses brute force in project euler. That's no bad.
 
but your algorithm will return 12345
 
@orlp can you give the lowest multiple of 123456789 that is in the form 999....?
or anyone actually
 
@orlp 411/33333
 
@MᴀʀsUʟᴛᴏʀ do you mean in the form 10**i - 10**j?
 
1:38 AM
I tried it in Mathematica and the repeating part is 6855006 digits.
 
2 mins ago, by orlp
it should have a period of 6855006, according to this one site
 
@orlp 10^n-1
 
user214599
That's because of the limit of floating numbers in programming. Can you even 1/700000000000000 in programming? (Without mathematica)
 
@MᴀʀsUʟᴛᴏʀ why would that multiple exist?
for example there is no multiple of 2 and 10^n-1
 
@MatthewRoh yes, use rational class
 
1:39 AM
@MatthewRoh yes.
   x: 0.12345123451234512345 + %7000000000000000000000000000000000
4115r33333
 
@orlp because it terminates
 
@MᴀʀsUʟᴛᴏʀ but 1/14 doesn't
and 14 is coprime with all 10^n-1
 
user214599
Also pi might be rational
 
@feersum could you post the full repeating portion in a gist?
 
@MatthewRoh false
 
1:41 AM
@orlp found repeating part!
 
@orlp I could if I knew how to save a huge output from this terminal...
 
@feersum pipe to a file
 
some_command > output.txt
 
user214599
@DrGreenEggsandIronMan Theres a 10^-100000 possibility that pi is rational
 
1:41 AM
@Downgoat how do I trust this is not a false positive?
 
It's an ssh connection.
 
@orlp ill post in pastebin brb
 
@orlp but not all 10^m-10^n, it's just that 123456789 Does not have 2 as a factor, so no trailing 0s should appear
 
I would still have to get it through the terminal or paste in on the internet somehow.
 
@feersum you can create a gist
git clone it on the SSH machine
 
1:42 AM
@MatthewRoh No. Pi is proven irrational.
 
pipe the output to the gist file
git commit
git push
 
@MatthewRoh Huh?
 
And transcendental too for that matter
 
I want to make this a code-challenge, since this challenge is mostly about finding and implementing an algorithm
 
And food as well
 
1:44 AM
but I can't think of a scoring mechanism other than code golf
 
However, it's not proven that every integer sequence appears in pi.
 
@DrGreenEggsandIronMan such a number would be irrational, right?
 
user214599
Ok
 
@Downgoat please raw gist
don't crash my browser with big syntax-highlighted gists
 
1:46 AM
@CᴏɴᴏʀO'Bʀɪᴇɴ A number that contains every sequence would be irrational, but not all irrational numbers contain every sequence.
 
@orlp ... My ipad can load it
 
@DrGreenEggsandIronMan yes, that makes sense
 
@Downgoat my old laptop probably has less ram than your fancy new ipad
 
@MatthewRoh Next you'll be telling us that e to some constant times pi is rational!
 
1:48 AM
@Downgoat what is the repeating part?
 
385
Q: Does Pi contain all possible number combinations?

WildlingI came across the following image, which states: $\pi$ Pi Pi is an infinite, nonrepeating (sic) decimal - meaning that every possible number combination exists somewhere in pi. Converted into ASCII text, somewhere in that infinite string if digits is the name of every person you w...

 
e ^ (0 pi ) = 1 ???
 
@orlp the entire file (exluding the 8. and some junk at the end) is repeating part
 
@feersum yes, why is that surprising?
 
@feersum Ok. That trivially ruined the joke :(
 
1:49 AM
oh I missed helka's msg
e^sqrt(-pi*pi) = -1
 
@Alex: there's no particular reason for the digits of $\pi$ to have any special pattern to them, so mathematicians expect that the digits of $\pi$ more or less "behave randomly," and a random sequence of digits contains every possible finite string of digits with probability $1$ by Borel's normal number theorem: en.wikipedia.org/wiki/Normal_number#Properties_and_examplesQiaochu Yuan Oct 19 '12 at 16:52
 
e^(-pi*pi)^(1/2) = -1
 
Our pi user is unregistered, whatever that means
 
@HelkaHomba I believe you can post answers without making an account
@DrGreenEggsandIronMan you missed the opportunity for Dr. Mayham
@feersum how long does mathematica take to calculate 987654321/123456789?
 
1:55 AM
@CᴏɴᴏʀO'Bʀɪᴇɴ urls don't like your name chat.stackexchange.com/users/129255/**c-ob**
 
@HelkaHomba yup :3
 
@orlp It took a couple minutes I think
 
@feersum really?
 
on Raspberry pi
 
holy crap
 
1:56 AM
and markdown doesn't like me
 
@orlp ooh, that's a good one.
 
is there really no efficient algorithm for this?
maybe I can make it a fastest-code challenge?
 
@orlp on a Raspberry Pi that sounds about right. It's not a powerful computer
 
@NathanMerrill Rhino's JS arrays are subclasses of List. So you can pass a JS array to a method that takes a List (no generics obviously) but you can't cast a List up to a JS array
 
1:58 AM
@HelkaHomba you take that back! poor pi :(
it has feelings too you know
 
@orlp Mine took up to a minute to draw world maps
 
I found this nice little thing in node:
> c
[]
> c.unshift(c)
1
> c
[ [Circular] ]
 
As for regular Java arrays (Object[]) you have to use reflction to work with them :(
 
@HelkaHomba well, worlds are big
 
There might be a way to cast a List to a JS array though I dunno
 
1:59 AM
and it did an entire world in just 1 minute
 
So you're saying that π is a bit like reddit? — Mark Byers Oct 19 '12 at 11:00
dat comment
 
@HelkaHomba As a kid I thought that theme song was really catchy. Please forgive me
 
@quartata It is. Good game too.
 
Yeah I always thought DK64 was underappreciated. Always really loved it + BK
I think Banjo Tooie is still one of my favorite console games to this day. Good ol Rare
rip
 
2:10 AM
I hate it when people are that wrong.
 
whoa so few trekkies
 
@quartata It looks like nashorn can, so I'll probably be using it
as well as other speed improvements
 
I haven't tried nashorn yet. It looks good though
 
2:16 AM
I haven't tried it either, but I'd expect Nashorn to taste terrible.
 
haha
 
Bah.
So, apparently, if I pass a List into JS
and then have the JS return that list, it is a List
but if JS creates an array, then its a Map
 
Wah? In Rhino it's just a special List
 
yeah, passing a List into JS gives JS the ability to do bracket access
but all of the functions are List's function, not the javascript array functions
 
@CᴏɴᴏʀO'Bʀɪᴇɴ dont know js but cant you make a wrapper class for the generator?
 
2:29 AM
0
Q: Missing Integer Sequence Detection

A.DanischewskiThe challenge is to detect missing integer sequences. You have a directory filled with directories or files that are named as integers. The directories and files are generated from multiple threads yet the job did not complete - there are therefore gaps in the sequence. The input is two intege...

 
sometimes you gotta take an alternative approach
Can I just delete all files and print 1? — orlp 19 secs ago
 
2:46 AM
@HelkaHomba Do you still wanna play? I'm free now.
 
\o/ A new programming language actually compiles! Only one function has been added but it works!
 
Nice! What's the language?
 
-2
Q: run native code in python… Without loading a shared library!

user2284570The aim is simple : crash the Cpython interpreter process in a way that let run native cpu assembly instead of triggering a segmentation fault.  Rules : You can’t use any library outside the python standard library (butimport mmapis disallowed). The code shall be able to run on a computer with...

 
The name is still WIP but I'm calling it LI. It's supposed to be a functional golfing language (as opposed to stack-based or procedural, like most other golfing languages as far as I can see)
 
2:53 AM
I still have to push the code, gimme a few minutes
 
@DrGreenEggsandIronMan Yeah, ok. 3 min
 
Actually, while I'm messing around with getting the code pushed I can post the WIP function list
Please critique as much as you can, since this is my first time trying to actually make a programming language and as such I don't have much experience with language design
 

« first day (2005 days earlier)      last day (2833 days later) »