« first day (2649 days earlier)      last day (2180 days later) » 

1:14 AM
@WhatWizard just realized your avatar looks like a hamster
 
It's a cat though
 
@WhatWizard yeah i know
 
 
1 hour later…
2:40 AM
CMP: Have you ever abused syntax highlighting?
This is a random question; I only ask because I have
 
3:11 AM
1
Q: Drag Race Countdown

LordColusDescription: In a hypothetical scenario, the countdown timer for a race has random intervals between the counts, to prevent premature starting, i.e. 3 (0.8 seconds pass), 2 (0.6 seconds pass), 1 Task: Create a program that uses this method, with an interval of 0.5 seconds to 1 second between...

 
3:23 AM
@EsolangingFruit wow... creative i suppose
 
There were other things I should have been doing
 
@EsolangingFruit 0/10 that's the worst use of your time ever
you should at least be working on an esolang
or even better, VSL/Attache/Röda/[language name redacted]
 
@ASCII-only CMC: Make an esolang where programs look like the above image
 
I wonder when PyTek/Elegance will continue being developed
@EsolangingFruit that... would be a ridiculous waste of possible commands >_>
 
Actually, I think I'll work on [language name redacted]. Thanks for reminding me
@ASCII-only If it's a golflang, sure
BIIA might look a bit like that
well... not really
 
3:26 AM
BIIA?
@EsolangingFruit i mean Woefully-level waste...
 
@ASCII-only But is it art?
Oh whoops, I can't acronym
nvm I misunderstood BIIA's syntax
 
@EsolangingFruit O_o this actually has an interpreter
 
probably very slow though
 
@EsolangingFruit almost certaily
 
The most impressive language I've seen that was actually implemented is Dependently Typed Binary Lambda Calculus
0110010011001010010010110111011100111001001100101001001011011100010110011100100110010100100101101110001000101100100111001001110011100100111001001110010011001010010010110111000000011111011100000001111011101101010010011001010010110011001001100101001011001001011100110010001011100011011100100110010100000000111111101101010010011001010010010110011001000101101000000001111111001110000001111110011110011110011111000000111111110011100111110
^ above is a proof that 1+1=2 in DTBLC
 
3:50 AM
So is that 433 bytes or 55?
 
4:15 AM
@EsolangingFruit proof?
@DJMcMayhem Looks like it doesn't support binary, so 433
 
anyone here familiar with Clang API? (cc: @quartata). I am using .get_display_name() to of a Clang Type but I'd like to get that type with the context of an identifier. e.g. right now I get void (^)() completion but I'd want void (^completion)())
 
@Downgoat quartata :P
 
i swear quartata has like used every single tool, language, SDK, framework, and API that exists
 
@Downgoat Other than esolangs?
Also: I wouldn't be surprised if quartata is an AI :P
 
@ASCII-only Perhaps (operator+) = alternate((operator+), (user defined operator+))...
 
4:27 AM
@user202729 yes. but the signature looks... slightly off
 
@ASCII-only How?
If you want a function to take either a or b, it should take Either a b
 
@user202729 like what happens if it's passed an a and a b though? i.e. f insance_of_a instance_of_b
 
@ASCII-only I don't know.
 
5:27 AM
@ASCII-only It has to be on either the left or right side, if f is an instance of both you have to choose.
data Either a b = Left a | Right b
I believe the given type signature is fine.
 
Is that like a union type
I honestly have no goddamn clue how to work with user-defined types in Haskell
 
It is very similar to a union type
 
It's called a tagged union
because if you want to say that a union has one type, you have to name the variant it is associated with
which means that you can't just cast a random union to one of its variants
@ASCII-only Yes. In dependently typed languages, types can be parameterized by values, which means type checking a program may involve verifying that a term will have a given value at compile time. Of course, there's no way to do this in general, so type declarations in dependently typed languages essentially have to specify proofs of correctness. DTPLs are so closely related to proof checkers that it's often possible to use them as such.
 
data Bool = True | False would be union type
 
I'm thinking of C++ unions here
 
5:35 AM
@WhatWizard so you can only do f a a or f b b?
 
@Pavel Haskell unions are like C++ unions, except that they always have an extra field that specifies which type of union it is, and they require you to check that field if you ever want to access any of the others
that way you don't just arbitrarily reinterpret types
 
data Bool = True | False looks like an enum
 
@Pavel Right, because it has no normal fields, leaving only the extra "variant" field
 
@ASCII-only I think I misunderstood what you were trying to say, I thought you were talking about passing a value that was ambiguously a case of a and b. I now see what you meant and I agree that would be a problem.
 
How do I define a type that implements, say, Show?
 
5:37 AM
@ASCII-only f g h (Left a) (Left b) = Left (g a b); f g h (Right a) (Right b) = Right (h a b); f _ _ _ _ = error "Please don't do that"
 
@Pavel add deriving (Show) at the end
 
You would use a type class.
 
@Angs Couldn't you just use Either (a, a) (b, b)?
 
@EsolangingFruit I got that, but how do I specify the implementation of show <myclass>
 
@EsolangingFruit :| -1 tuple
 
5:38 AM
@Pavel instance Show Foo where {show x = ...}
 
@ASCII-only +2 type safety
 
deriving show will just do what the compiler thinks you want to do
 
haskell oop is weird.
 
That's cause haskell isn't oop
 
I'll stick to predefined types
I'll just use tuples whenever I need a complex struct
 
5:40 AM
It has no oop features. class and instance don't mean what they mean in OO
 
Haskell's type system is really good.
 
Right
 
class means interface; instance means implements
 
Until you're defining your own types
Then it's super annoying
or I'm really bad
 
No even after you are defining your own types it is good, in fact that is where it shines.
 
5:42 AM
After you've defined your type it's good, it's the part where you actually define the type where I always get lost
 
What's losing you?
 
I get how defining a simple union type like data Bool = True | False works, but when there are fields that can hold other kinds of values I get confused
 
Rust's enums are pretty much the same thing
enum Token {
    StringLiteral(String),
    IntLiteral(i32),
    OpenBrace,
    CloseBrace,
    // ...
}
 
Say I want a type that holds two Ints
I have no idea how to do that
 
You define a data with only one constructor
 
5:45 AM
@Pavel You might be more comfortable with record syntax which ends up looking a lot like a C++ union type data TwoInts = TwoInts {int1 :: Int, int2 :: int}
 
data Point = Point Int Int
 
Ok
And then I can use pattern matching to retrieve the values, right?
 
Yes: case px of { Point x y -> ... }
 
Yes or in the case of the record int1 and int2 are functions that retreive the values.
(The record also allows for pattern matching)
 
yay
Why do I remember this being so much more complicated
 
5:47 AM
As an aside, I don't like how Haskell just dumps everything into the namespace
Constructors; record getter functions; imports (by default)
it's kinda annoying
 
I try to divide everything up into as many modules as reasonable to avoid the problem.
 
And then you have the C programers who don't get to use namespaces
 
I still don't use namespaces when I program in C++.
 
It's at least nice when the libraries you're using are in their own namespace
 
Combine that with the fact that C compilers only have to look at the first six characters of an identifier, and you have a recipe for... something
 
5:51 AM
Oh I think I misinterpreted what you meant by "using" a namespace.
 
Oh yeah I don't do using namespace Foo either
But in C there just aren't namespaces at all
 
@EsolangingFruit record getter functions polluting the namespace is kinda annoying. I wonder if there's a solution to that yet.
 
There are some GHC extensions for handling the ambiguity caused by Duplicate Record Fields
but my favorite approach is probably Rust's, where everything is just in the namespace of its type
 
That's how it works in like, everything
 
You'd have to do like Either::Left(4) (which would be Result::Err(4) in Rust)
 
6:03 AM
If you define a static function for a class in any language the even remotely supports OOP, you have to qualify it with the class name when you access it from outside
 
except that some really basic stuff (like Option, which is Rust's Maybe, and Result, which Rust's Either) is imported by default
 
Maybe in Haskell makes sense, since sometimes you do need a kind of Null value. What I don't get is Optional types in e.g. Java, where all it does is convert your NullPointerExceptions to NoSuchElementExceptions.
 
@Pavel Well C# has Nullable too :P
 
@ASCII-only Right. It has Nullable for types that otherwise can't be null.
 
@Pavel so basically structs
 
6:08 AM
Yes
 
IIRC Java has no structs. why, Java
 
That is correct
I have no idea what one could possibly use Optional<T> for in Java
 
(Since in both languages primitives have boxed forms)
 
@Pavel To confuse people trying to explain monads to Java programmers who already have preconceptions of how Maybe should work based on Optional
so as to prevent them from switching over to Haskell
 
@ASCII-only int? isn't really a boxed int in the same way Integer in Java is.
 
6:10 AM
@Pavel Is that not syntactic sugar for Nullable<int>...
Also, huh, TIL. C#'s e.g. Int32 is a primitive
I suppose no sane person would need non-primitive primitives though :P
 
@ASCII-only Yeah but Nullable<int> is still a primitive sorta.
 
@Pavel hmm. wut
 
It's a struct
@EsolangingFruit I don't know what "Monad" means, I just know how to access stuff from a Maybe with pattern matching.
 
@Pavel A monad is... well there's a lot of ways to explain it, but from a type-theory perspective it means you have a generic type m a where repeating the m n times is structurally equivalent to just m a
So for example you can turn Maybe (Maybe (Maybe Integer)) into a Maybe Integer
 
I see
 
6:16 AM
you can turn [[[[[a]]]]] into [a]
You can turn r -> (r -> (r -> a))) into (r -> a) by just reusing the argument
 
@ASCII-only From a marshalling perspective, int and int? are the same type. Nullable<T> is just generally a kinda weird special case.
 
But n can also be zero, so you have to be able to turn a into Maybe a
which can be done with Just
with lists, you make a singleton
with functions, it's const
 
Ok, so why is this significant?
 
IO a is a monad
 
Right
 
6:19 AM
because you can turn a normal value into an I/O computation that does no actual I/O and just returns it
and you can turn an IO (IO a) into an IO a
by just sequencing the I/O actions
 
Right
 
So it's a common pattern between all of these, and Haskell has a typeclass for it
 
Ah
 
so you can write code generic over every monad
 
6:31 AM
@EsolangingFruit wait. what
 
@ASCII-only stuff like sequence :: Monad m => [m a] -> m [a]
 
 
2 hours later…
8:22 AM
0
Q: prime or highest factor

I'm no one Challenge : Given an array of numbers in the range of 0 to Infinity , Check whether all of them are primes or not. (You can take input as a string too if you want) Input : Input :An array of numbers Output : The array with every element replaced by one of these : -1 -----> if...

 
@mbomb007 In the last sed command, the buffer is evaluated as bash code, as seen by the e option to the substitution, and the bash code contains the call to dc which is eval'ed
 
9:07 AM
who-named-this-style-of-word-separation-Kebab-Case?
wtf
 
@Soaku it's slug case isn't it
well at least for node devs
for others apparently it can also be lisp-case, spinal-case or Train-Case
 
idk. I found a kebab-case tag on github, googled it and got a Wikipedia result about snake_case. Down there was written that it's also used in different forms, like lisp-case also called kebab-case
 
 
1 hour later…
10:25 AM
@DJMcMayhem It looks like MATL will be language of the month for May. Should I wait for @DLSoc to write a post announcing it as in previous months, or should we do it ourselves?
 
10:40 AM
@ASCII-only To your previous message: I would prefer to not store the results, so the language can be Turing complete, allowing for repeated execution.
 
@Soaku ah. so loops. then of course it would be slow?
 
It might be. Unless we add a new operator, which I'd prefer to avoid
 
@Soaku yeah. but if it's for looping it being "slow" is unavoidable?
 
probably
we could add constant expressions with a new operator.
 
@Soaku well constants can just be detected
 
10:46 AM
hmm, you're right
in case of the language, a simple regex would be able to detect it
 
plus if you're optimizing and/or compiling it there won't be any slowdown anyway
@Soaku :|||||||||||||||||||||||
 
If /^[^<>]+$/ is matched, then it's a constant expression.
Called per statement
but, it could be more optimized, so <> pointing to a constant would still make it a constant
also, a mute operator would be useful too. So you can prevent evaluation of a root statement which is a constant
 
11:02 AM
@Soaku wait... what? how do you make a different thing happen every loop then...
 
@ASCII-only wait, i'm stupid
it would detect everything as constant
I think some sort of variables/stack might be necessary
Maybe if a statement follows an array and is not inside one, ex. [x-x, x-(x--)](...) could push using [...] and pop using []
 
0
Q: Quines and newlines

NathanielA simple question really: how strict is this community (or how strict does it want to be) about newlines when it comes to quines? For example, is the Python quine _='_=%r;print _%%_';print _%_ 29 bytes, or is it 30 (including the trailing newline, since that's printed in its output)?

 
@Soaku there already is a room
 
oh
 
11:43 AM
hi
 
hey
 
12:23 PM
Does anyone know how to change Ñ€¨â‚¬à in 05AB1E so the items '' become -1?.. (It's for the Prime or highest factor challenge.)
 
12:35 PM
Hey, I want to post my first puzzle, I fear it is too easy. What should I do?
 
@RaisingAgent Is there a duplicate?
391
Q: Sandbox for Proposed Challenges

SandboxWhat is the Sandbox? This "Sandbox" is a place where Programming Puzzles & Code Golf (PPCG) users can get feedback on prospective challenges they wish to post to the main page. This is useful because writing a clear and fully specified challenge on the first try can be difficult. There is a much...

 
Don't think so, I searched around a bit with different terms
I should post it as an answer in the Sandbox thread?
 
Yes, definitely
 
Okay, thanks :)
0
A: Sandbox for Proposed Challenges

RaisingAgentGiven these truths, write a program that determines the weight of each variable. Truths: a < b 2a < b + c 2a + 2b + c < 2a + b + c You may use 1, 2 and 3 or any other values as weights.

 
@RaisingAgent Our NewSandboxedPosts will do that for you...
@RaisingAgent Well, not as trivial as I expected. But I can't understand what is that about at all. (what is the weight of a variable?)
 
12:50 PM
b is heavier than a = has greater numeric value for example
 
@RaisingAgent 0/10 constant-input
@user202729 value
 
BMO
Any feedback for this? It's my first meta-answer..
 
@RaisingAgent I still don't understand. What is given as input?
 
I guess I need to be more specific on the puzzle :0, I'm glad I came here first
For example: 2 * a is smaller than b + c
so if a = 1 then b + c >== 2
 
> Write your challenge just as you would when actually posting it.
Many users miss that (including me).
 
12:56 PM
Should I add an example to the question?
 
@RaisingAgent yes, definitely. also, i think you need an equals for at least one of the variables otherwise there's no solution
 
0
A: Sandbox for Proposed Challenges

RaisingAgentGiven these truths, write a program that determines the weight of each variable. Truths: a < b 2a < b + c 2a + 2b + c < 2a + b + c You may use 1, 2 and 3 or any other values as weights.

 
@ASCII-only But you could put in anything a = 99 and then b + c have to be greater than that
Programatically it's a trial and error problem
 
@RaisingAgent 1. but what if there are multiple solutions 2. not in prolog it isn't :P (well, Prolog is 100% trial and error so technically yes)
 
There is only one solution.
I just googled 'prolog'. :0 I am going to learn that now
 
1:04 PM
@RaisingAgent what do you mean? don't you need an equals for that
otherwise you can multiply the variables by any number and still get a correct solution
 
1:16 PM
File "<string>", line None - Thank you, Python
 
@Soaku are you using eval
 
Well, no. That's a simple mistake in my code. The error looks funny tho
 
I revised my question in sandbox, how specific do I need to be with rules?
@ASCII-only I am not sure what you mean
 
@RaisingAgent if you *2 to a, b and c, won't the answer still be correct
 
yes
One does not need to use specific integers, a can be 300 if b is still greater than a
 
1:31 PM
0
Q: Find the EARLIEST valid time that can be displayed on a digital clock

TlinkGiven six digits, find the earliest valid time that can be displayed on a digital clock (in 24-hour format) using those digits. For example, given digits 1, 8, 3, 2, 6, 4 the earliest valid time is "12:36:48". Note that "12 : 34 : 68" is not a valid time. Write a java method: class Solution...

 
Yay another homework question.
 
@NewMainPosts Oh, good point. What are winning criteria for puzzles?
 
CMP: Would you rather have a = 3 return its value to allow for (a = 3) + 4, or would you rather have keyword arguments for functions?
CMQ: How do we distinguish a, b = 3, 4 as a single expression for assignment and a, b = 3, 4 as three arguments for a function call?
 
@HyperNeutrino both
@HyperNeutrino because parameter list should be parsed differently from expression...
 
@ASCII-only so basically if it's in a function it doesn't assign to a but if it's outside of one it does?
 
1:38 PM
@HyperNeutrino no. use a: 3 for named arg
 
good idea will do
 
1:52 PM
@LuisMendo I don't really know. There aren't really any standards for this yet since it's such a new thing. I'd lean towards letting DLosc do it since he set up everything, but if it seems like he isn't around for a day or two, someone else should do it.
 
0
A: Sandbox for Proposed Challenges

TlinkBuilding a Structured Outline In a fictional document management system, input documents are structured with weighted headings. Lowest weighted headings are the most important. This is a sample document: H1 All About Birds H2 Kinds of Birds H3 The Finch H3 The Swan H2 Habitats H3 ...

 
2:17 PM
-1
Q: Which variable weighs the most?

RaisingAgentGiven these truths, write a program that determines which variable is the heaviest, second heaviest, and lightest. Truths: x < y 2x < y + z 2x + 2y + z < 2x + y + z Weight refers to the value of a variable, greater (positive) numbers weigh more. Example: If ...

 
2:29 PM
What is it with people and making us do their homework lol
Well, trying anyways
also java sucks
 
Wait a minute.
(1) I told you that "Write your challenge just as you would when actually posting it." You didn't. Making it a popcon is a thing that need serious consideration.
(2) As ASCII-only said,
2 hours ago, by ASCII-only
@RaisingAgent 0/10 constant-input
Often, this vulnerability is an indicator of a dumb question... — boothby Mar 7 '14 at 19:37
What's wrong with making the inequalities the input?
(3) Yes, 1 hour is waaay too short. (as KevinCruijssen said)
why my browser crashes so often
Anyway, better luck next time.
CMQ: (C++) If you have something that you want it to have global access, but it can only be initialized after some input is given, what should be done?
 
2:57 PM
Any ideas why a function in a background script for a chrome extension would be invoked multiple times? I believe I'm only calling it once.
 
@user202729 Huh?
 
@Pavel Sorry, my keyboard...
 
I still don't get it
@Poke Chrome Extensions are powered by black magic and obscure security policies
Ok
 
Or am I doing it the wrong way?
 

« first day (2649 days earlier)      last day (2180 days later) »