« first day (2616 days earlier)      last day (2228 days later) » 

5:04 AM
deducted -> deduced
 
@ASCII-only okay so we have a problem: gist.github.com/vihanb/c0869fb6baf11ec2c7d8b44ba18af588
this is for this code:
class A<T> {
    init(x: String) {

    }
}

func main() {
    let x = A<Goat>("T")
}
 
@Downgoat what is problem
 
@ASCII-only see the gist, it has ambiguous parsing
doing let x = A<Goat>
works
so seems to be with parens
 
wait are both things the same thing
 
ok problem
 
5:15 AM
:| they're identical
brb looking at grammar
 
it is parsing as A < Goat > ("T") meaning: A lessthan Goat greatherthan Tuple
for this case:
let x = A<Int>()
 
@Downgoat this is parsing as tuple?
 
@ASCII-only yeah
not sure why above is erroring
 
:|||||||||||\\ what
 
hm this shouldn't be a problem
 
5:17 AM
wait. why is () tuple anyway? was it always like that
 
to resolve ambiguous we have made FunctionHead Tuple result in Tuple becomnig the arg list
 
@Downgoat so is it still ambiguous
@Downgoat btw pls include operator symbol in AST ty
 
maybe I should just take out tuple. lemme see what hapepns
 
hang on
we can just disallow chained comparisons
@Downgoat :|
 
@ASCII-only that seems like bad idea
 
5:24 AM
@Downgoat well how can you be sure they don't mean A < Goat > ("T")
 
because single element tuple should be ("T",)
hm, a<f>?.c:d would be ambiguous
even with tuples disabled
because is this if a<f> { .c } else { d }
or is it if a<f> is not null { a<f>.c }
 
@Downgoat :| what is VSL even using : for
@Downgoat why is a<f> even a valid object
 
@ASCII-only ranges i thought?
a[1:4]
 
unless we do ...
which might conflict with rest
 
5:31 AM
i thought we were using .. and ...
 
we'll have to fix the 1. bug though
1. parses as a number rather than [1, '.']
 
@Downgoat ok
@Downgoat change to /[0-9][0-9_]*(\.[0-9_]+)?/
 
ah ok
ok cool:
vsl::asts> 1..5
CodeBlock
 └ statements[]
    └ ExpressionStatement
       └ expression: BinaryExpression
          ├ lhs: Literal; 1
          └ rhs: Literal; 5
 
now to add the backend for generics
 
5:38 AM
this also means things like 1.toString() (or whatever) will work too
 
are there any problems with semantically using type erasure
is that differentiable from templating
I mean they are generated using templating to seperate LLVM functions and all
 
@Downgoat don't think so
java survives fine
 
but like it's much easier for the type deductor to assume typealias T = Object than clone the class's AST 5 times
 
@Downgoat wait what
 
5:44 AM
@Downgoat :| type deductor should know type of generic by time of usage though?
 
Can casting an int to a double result in a double smaller than the int due to floating point imprecision?
 
@ASCII-only no it can't necessarily know that
@Pavel are you asking in general or about VSL
 
@Downgoat In general
Basically, for any given double foo < double.MaxSafeValue, is it guaranteed that (int) foo == foo
 
@Pavel no, because double has 53 bits of mantissa
 
I'm getting the wierdest error rn
 
5:48 AM
@Pavel no
 
@Pavel pseudocode pls
 
there is a little bit of a problem and that is that VSL WASM malloc does not return the ptr to the chunk of memory it reserved
not sure how to work around since it's a direct port of libc malloc
 
@Downgoat :|
 
Basically I'm casting 3 to a double and magically getting 2.9560000000000013
 
@Pavel int -> double?
 
5:50 AM
I think I might have a bug somewhere else
@ASCII-only I have a giant mess of casts between ints and doubles it's pretty confusing
 
@Pavel :|
what are you even trying to do
 
Basically what I'm doing is I'm indexing into a tilemap based on an object's screen position, which is represented as a double from 0 to 100 for horrible reasons.
I need to get where in the tilemap the object is
 
@Pavel screen pos is between 0 and 100?
 
Yes
The screen is 600 pixels wide
 
@Pavel why
 
5:55 AM
I have no idea. It's not my code and I can't modify it.
Oh I know why I'm getting 2.9560000000000013
It's because I'm checking if floats are within .05 of each other instead of actually equal because comparing floats for equality is unsafe.
I am saved
 
@Pavel :|||||||||||||||| why did you make your epsilon so large
make it like 0.00001
@Pavel also... that's not casting at all
 
Yeah I know the problem is in a different spot from where I thought it was
 
6:31 AM
I'm just gonna try to use fixed point from now on
 
6:51 AM
0
A: Sandbox for Proposed Challenges

BubblerThe Double's Base code-golf Background IEEE 754 Double-precision floating-point format is a way to represent real numbers with 64 bits. It looks like the following: A real number n is converted to a double in the following manner: The sign bit s is 0 if the number is positive, 1 otherwise....

 
 
1 hour later…
8:18 AM
Is it possible to search for questions which are not answered in a specific language?
 
@Bubbler it's not even possible to accurately search for questions answered in a specific language
 
Well, a bit expected, thanks.
 
In Wolfram Alpha, I use x = 1 to 100 and I get a list of numbers. How can I return the difference between each of them, so ex, [1,6,16] returns [5,10]?
 
@Soaku :| won't the differences all be 1
 
@ASCII-only No, I said it a bit unclear... just, is there a function to get them?
 
8:25 AM
@Soaku wolfram alpha isn't a programming language though?
 
@ASCII-only It's a wrapper for programming language, right?
 
@Soaku nope
@Soaku it's basically google for math
 
The language is called the "Wolfram Language", I guess
 
@ASCII-only ^
 
8:27 AM
@ASCII-only Mathematica == Wolfram Language
 
@Soaku what i meant is: that isn't wolfram alpha...
 
Both are correct, as I know
uh... it's a changed version
 
nope
 
It generates wolfram alpha code and evaluates it, you can even get a link
 
wolfram alpha isn't mathematica at all?
@Soaku wat.
@Soaku mathematica != alpha
 
8:29 AM
I believe Wolfram Alpha accepts any Mathematica expression, but it also accepts natural-language requests
 
@Bubbler nope, i've tried.
so many times.
 
oh.
 
Wolfram Alpha doesn't have all the features of Mathematica, but they're similar
 
@Soaku *nowhere near all the features
 
8:42 AM
Good thing that it's free on TIO :P
This is weird anyway, it's not free language and they just gave it for free use on TIO.
Unless I'm wrong
 
@Soaku same happened with Dyalog APL though?
 
isn't Dyalog APL free for non-commercial use?
 
 
2 hours later…
10:45 AM
2
Q: Ice Golf Challenge

Manfred RadlwimmerThe goal of this challenge is to write a program or function that returns the least amount of strikes needed to complete a given course. Input The layout of the course can be passed in any suitable way and format you prefer. (read from the console, passed as an input parameter, read from a fi...

 
11:02 AM
J: Would (+/ >. #-+/) compute the sum of the list twice, and is there a way to avoid it?
What about (((#@[ - ]) >. ]) +/)? Is that too hard to read?
 
(>.#&-)@+/ perhaps?
 
@Cowsquack No, in its current form the # applies to the input, not (+/ input).
 
hmm i'm sure someone posted a link to an amazing graphical vim editor a while back but i can't find it :(
 
(#(->.])+/) then
uses a dyadic train in the center, to keep everything simple
 
Good idea. (BTW I was not asking for code golf, I was asking for clean code)
 
11:16 AM
works both ways :)
 
11:30 AM
@AdmBorkBork it works because 1 doesn't have a 0 in it
 
How can I have newlines in a string?
 
yes, LF is the linefeed
 
yes
 
11:38 AM
I'm getting fascinated a bit of the structure of Mathematica. There's builtin for everything, no need for if's or loops... Just like in a golfing language. Alright, is there any language that's a golfed version of Mathematica? (Just like Japt is short version of JavaScript)
 
@Soaku Mthmtca maybe? (although it's not commonly used because Mathematica is closed-source and not-free)
 
@Soaku don't forget ESMin/JS, Pyth/Python, and MATL/MATLAB
 
@ASCII-only I was only wondering if there's one
 
(fact: most golfing language has similar and shorter name then its non-golfing variant/inspiration, except Jelly and J)
 
@user202729 well because Jelly isn't as directly related than the others. also you can't have a name shorter than J >_>
 
11:47 AM
J and Jelly sounds like J is the shorter version :P
 
@ASCII-only Sure you can:
 
XD
 
@Adám that's already taken though
 
@Soaku That's why I suggested to Dennis that he call it ȷ (a "shorter" J).
@ASCII-only By me, you mean?
 
@Adám yes
 
11:49 AM
@ASCII-only But that was long after Jelly was made.
 
well it's taken now :P
 
"" isn't taken though :P
 
@EriktheOutgolfer But that's two characters. What a waste.
Hm, having an interpreter on Windows called "".exe would be… interesting.
 
@Adám it's the empty string, just with a different type of quote
 
@EriktheOutgolfer The quotes are not part of the name. How would you write it in PHP?
 
11:52 AM
@Adám since the quotes are different, we now have a case of two languages having the same name but not being confused with each other :P
 
I'll name my language <<<X
X;
then
 
@Soaku What? Can you spell it out in hex?
 
@Adám It's an empty string too
 
@Adám it's the an empty heredoc :P
 
Just with heredoc
 
12:30 PM
> 0*_ , 0*__ , and 0%0 are all defined to be 0 .
Why...?
 
uh, are you quoting from somewhere?
 
And what is __?
 
0 times x is always 0. 1%1 = 0. 2%2=0... so 0%0 = 0
¯\_(ツ)_/¯
 
% means "remainder", as in division
 
(note that _ is infinity, % is division)
 
12:34 PM
and 0%0 is dividing by zero
oh
 
0
A: Sandbox for Proposed Challenges

Kevin CruijssenInterval Notations code-golfstringkolmogorov-complexity Challenge: Output or return this exact text: (a,b) = ]a,b[ = {a<x<b} = {a<x&&x<b} = a-1..b-1 [a,b) = [a,b[ = {a<=x<b} = {a<=x&&x<b} = a..b-1 (a,b] = ]a,b] = {a<x<=b} = {a<x&&x<=b} = a-1..b [a,b] = [a,b] = {a<=x<=b} = {a<=x&&x<=b}...

 
oh
 
@user202729 because they don't like to leave % partially defined
and that defining 0%0 as either 0 or 1 would have 50% of the people complaining, but having it error would have 100% of the people complaining
 
Yeah. I hate when 0/0 returns NaN (if it doesn't evaluate to 0) or throws an error
 
and 100% of those people can simply make a division function themselves, employing % in every case except division by zero
 
12:36 PM
It might be ok, but it should be a warning, not instant crash.
 
although in languages with infinities it should return positive infinity if the dividend is positive, negative infinity if the divident is negative, and the only thing remaining to define is 0/0
 
@EriktheOutgolfer well there's -0
 
-0 isn't a thing, unless the language is buggy
 
Signed zero is zero with an associated sign. In ordinary arithmetic, the number 0 does not have a sign, so that −0, +0 and 0 are identical. However, in computing, some number representations allow for the existence of two zeros, often denoted by −0 (negative zero) and +0 (positive zero), regarded as equal by the numerical comparison operations but with possible different behaviors in particular operations. This occurs in the sign and magnitude and ones' complement signed number representations for integers, and in most floating-point number representations. The number 0 is usually encoded as +0...
...
JS has -0, and it follows IEEE 754 (IIRC)
 
that's how it may be stored, but, unless we want to make some crazy stuff built-in, let's rather make -0 have the same behavior as +0
and also make their representations equal
 
12:47 PM
@EriktheOutgolfer ...
@EriktheOutgolfer but -0 exists for a reason?
e.g. a number too small to be stored as a float?
 
@user202729 negative infinity
 
But about -0 in JS, it's real. 0 => 0; +0 => 0; -0 => -0
And otherwise, I'm already lost in the discussion...
 
btw if a number has extremely high precision unsupported by the language, the number should simply be rounded, not stored as "-0" instead
 
@EriktheOutgolfer ... infinity and -infinity are very different numbers
 
12:51 PM
those are generally stored as floating-point values, but cannot be rounded
 
@EriktheOutgolfer what i'm saying is that it's useful to keep the data that a number is negative
 
I don't know if that's really possible
 
> Welcome to a world of pain and suffering! Please confirm your membership by <a href="@Model.CallBackUrl">here</a>.
When your placeholder makes it into a production build >.>
 
if you trust JS to do trigonometry then the blame is on you
at least "prepare" the arguments of Math.atan2 before using it
 
12:56 PM
That should work in pretty much all languages with floats.
Signed zero is a standard, not a language quirk.
 
was just going to post this...:(
wow, what an awful standard
 
That doesn't work, because Python (unlike JS) has an integer type.
 
yeah I figured, but I meant that I just went to the TNB tab when you posted that
 
@EriktheOutgolfer how is it awful...
@EriktheOutgolfer would you really prefer your results to be the wrong sign (infinity instead of -infinity, or anything really)
 
I'm talking about signed zero there, not signed infinity
 
1:09 PM
@EriktheOutgolfer -0 and -Infinity are very related - 1/(1/-Infinity) is a good example
 
@EriktheOutgolfer yes? but 1/-0 is infinity?
so basically 1/0 and 1/-0 are very different
 
@EriktheOutgolfer Same deal. If some computation has to round a small negative value to -0 and then divides 1 by it, the result should be -inf, not +inf.
 
tl;dr if you're making a golfing language, please use a bigdecimal, not a bigrational
 
and really that's what you should expect, extrapolating from e.g. 1e-302 and -1e-302
@moonheart08 *gmpy2
@moonheart08 why not rational?
 
@moonheart08 We're talking about floats though.
 
1:10 PM
@ASCII-only you mean -1e-302?
otherwise -1e302 has a zero decimal part
 
@EriktheOutgolfer yes >_> i should really go and sleep now
 
> Considering my code looks like it was written in an esolang to me, I'm guessing I did something wrong at some point. source
 
(wrong tab)
 
@AdmBorkBork ugh why are these people dissing egyptian brackets braces
@AdmBorkBork also :/ that looks more readable than like 99% of my code
 
Yeah, I wonder what real esolangs look like to this person if that's considered an esolang.
 
1:16 PM
> stringilate
ok i change my mind
 
if he compared it to an esolang then real esolangs can't look much worse
 
float
 
Real esolangs are worse.
 
i'm pretty sure bigrationals are less accurate
if not, please correct me
:p
 
//float because I think it's the smallest datatype that can return a non-zero number when divided, correct me if I'm wrong
 
1:17 PM
@moonheart08 Rationals are infinitely accurate.
 
@moonheart08 if anything they're more accurate
@user202729 *bigrationals
 
ok then lol
 
@moonheart08 because rational = fraction
@moonheart08 also big = arbitrary precision
 
But it's kinda annoying at times...
 
1:18 PM
@user202729 hmm?
 
you'd think bigdecimal would be slightly more accurate, because it represents the exact decimal to a precision of your choosing
 
(last time totallyhuman was stuck on HyperNeutrino's Markov chain challenge because bigrationals are too accurate)
 
@ASCII-only i think c#'s standard style guide has braces on their own lines
 
@Poke yes. but that's terrible
 
might be misremembering though
 
1:20 PM
eww braces on their own lines
 
i used to write all my code that way
 
maybe i'm just too used to java/js
 
now i write it the other way
 
> You should let your variables have some space to breathe.
 
i only do it for The Powder Toy because jacob1 requires it.
 
1:20 PM
Solution: Don't use variables at all, use Jelly.
 
i don't really mind as long as people don't switch in their codebase
 
@user202729 any stack/tape-based language would do
 
inconsistent styling is the worst :]
 
or perl
perl is actually really nice if you try it
 
@Poke want inconsistent styling? Go look at the linux kernel. some of the modules are even flat out obfuscated
 
1:21 PM
@ASCII-only perl can be hard to grok for people because it has a lot of hidden things that it does for you
@moonheart08 i believe it. that's a huge project, haha
 
@Poke hidden things?
 
@ASCII-only by hidden i mean "not obvious" to a new user of the language
 
@Poke also because linux started as a bunch of libraries hastily glued together iirc
@Poke solution: use perl the sane way
or use perl6 for your normal C-based language style
 
@ASCII-only not sure what that means. I'm referring to things as "simple" as $_
 
@Poke you don't have to use that at all?
 
1:24 PM
Perl is weird
 
@ASCII-only of course you don't
but many people do
 
for my $foo (@array) {
    do_stuff($foo);
}
 
Perl 6 looks nice. How fast is it?
 
@Poke yes. because they understand it.
@moonheart08 scripting language speed
 
@ASCII-only i'm not trying to argue why people do or don't use it
i'm saying stuff like that makes it hard to grok for a noob
 
1:25 PM
(There are no stupid questions. :D)
 
@Poke yeah which is why i said you could just use whatever you do understand
 
sure
 
to me it looks like perl supports multiple paradigms syntax-wise, there are basically several ways to do the same thing
 
most scripting langs seem to fall into the "multi-paradigm" bucket
 
@Poke but perl is multier-paradigm (especially syntax)
 
1:27 PM
@ASCII-only and because it's a perl, you can do the most inefficient ways possible, like (probably) solve for prime numbers using a grammar or something similar
 
@Poke *most languages
@moonheart08 *regex
 
perl 6 has grammars
I suspect you can do the same concept as the regex prime solver with them
:p
 
i'm using a regex :/
 
blocked at school ):
 
1:59 PM
@ASCII-only I'm just 2 bytes from your solution :)
without using a regex though
 
2:11 PM
Does J have bitwise operators?
 
Why don't you just link this?
 
@user202729 Well, just do "Under binary".
 
&.#:?
 
@user202729 Yes.
 
2:23 PM
(so it doesn't work directly)
 
@user202729 Because the arguments result in different widths of binary representations. Do a reduction on an array instead: Try it online!
 
@user202729 well I didn't know that page existed, for one.
 
CMC: Calculate f.
 
f?
 
@LeakyNun it's a link
 
2:31 PM
busy, bye
 
So conjunctions (in J) are left-associative?
 
@user202729 Yes.
 
@user202729 Whoa, that's a lot of work to avoid counting f=:.
 
2:53 PM
CMC: Find a challenge in which J does better than APL
 
a challenge on ppcg or just any challenge?
 
-4
Q: Python Question using Dictionaries?

ScottWrite Python codes to develop a product recording system. It should allow the user to type product names one by one until he/she enters an empty product name. Display the entered product names and quantities so that each line is formatted as “-­‐-­‐-­‐[product name]: [quantity].” For example, a ...

 
@Pavel Pretty much anything involving primes, or determinants, or any of the other build-ins J has but APL doesn't have.
 
Looking for some Javascript help, but with regards to design. So, background: I'm working on a personal project and as part of the backend, I've developed a model system with fields like name = StringField(min=5). I had to do some Python magic to make it work nicely and conveniently, but it works well.
Now, I need to replicate this model system, specifically the fields, in Javascript for the frontend. For two reasons: 1) so the frontend knows what kind of data a particular field is supposed to be and 2) client-side validation (server-side validation already exists). The problem I'm struggling with is...hard to describe. (That might be my problem.)
class Graph(MongoModel):
  links = ListField(ModelField(Link))
  nodes = ListField(ModelField(Node))
  data = DictField()
(source) I need to be able to do this kind of thing client-side. Each instance of a Graph has those three attributes. links is a list of references to Links (a different model). Those references look like strings, but they're not, hence the need to specify.
I did some research on JS classes yesterday and it's weird to me how class variables that aren't class methods are not a thing.
 
3:20 PM
I would like to be able to generate these JS classes in the backend by defining the model field types (e.g. StringField) by hand and then using Jinja2 to build the model definitions (e.g. Graph), thus rendering model_definitions.js along with a version number so I can take advantage of browser caching.
 
javascript doesn't really have classes
if that helps
it's an object/prototype language
 
Oh I know JS classes are syntactic sugar over regular objects.
I don't think I've really fully grasped the prototype concept.
 
0
Q: Output numbers, more or less

simonalexander2005The Challenge Given an input string (or array) consisting of < and >, output a sequence (array or string) of integers such that: the operators are all correct when applied in order between consecutive numbers in the output all integers are positive (1 or greater) the sum of the integers is as ...

 
I suppose I can insert a this.fields = {'name': new StringField(min=5), ...} statement into the model class' constructor via Jinja, and then go from there.
 
3:49 PM
3
Q: Output your Score!

X1M4LChallenge: The concept is simple enough: write a full program to output its own code golf score! Output should only be the byte count of your program and a trailing bytes BUT WAIT..... there is one restriction: Your source code can not include any of the digits from your byte count So if you...

 
> 18 answers
Of course.
 
@NieDzejkob I edited my comment to golf one more byte
 
4:24 PM
Ooooh, setter/getter syntax exists for objects. I can just work with objects directly. Easier than classes, go figure. This is why I have yet to actually use JS classes.
 
1
Q: Electronic Piggy Bank

DevelopingDeveloperA piggy bank is a container used to collect coins in. For this challenge use the four US coins: quarter, dime, nickel, and penny. Challenge Your challenge is to create an electronic piggy bank. Write a program (or function) that when run (or called), outputs (or returns) the count of each coin ...

 
0
A: Sandbox for Proposed Challenges

DatLet's play the too high too - low game! TL:DR : write a code that plays the too high - too low game Given this Python function for the too high - too low game, write it in your language of choice. This is just to make the challenge work better across all languages. This code won't count in th...

 
@El'endiaStarman does your frontend support es6?
 
@ConorO'Brien It could, I suppose. I have total control.
 

« first day (2616 days earlier)      last day (2228 days later) »