« first day (2181 days earlier)      last day (2663 days later) » 

4:00 AM
I think that (i int) is rather bad syntax, as it looks like a parameter
 
The implicit return that is.
 
what? the return is explicit in the example
 
Why does the return value need a name?
 
The point of it is that if you have that then all you do is return and it returns i
 
@Pavel so you can reference it in your deferred function
 
4:01 AM
@NathanMerill It's reusing the syntax which puts it on my warpath
 
Lisp questions for you guys: Do you know of a good introduction to Lisp? Should I just read John McCarthy's paper and work from there?
 
uhhhhhhhhh it probably would have helped to know the rest of this conversation.
 
@quartata oh, so you override the return?
 
@Sherlock9 Try Racket it has good tutorials and a better stdlib than other Scheme flavors
 
so, a better syntax would be defer func() { return i + 1}?
 
4:02 AM
@Sherlock9 I know Clojure just from doing random stuff
If that helps
 
@Pavel look up at my code I just posted
 
@quartata I'm reading How to Design Programs now, but I'm also trying to learn the original flavor of Lisp as well
 
But what does defer do
 
You mean Common Lisp?
 
I may look at Clojure later
@quartata Yeah, probably. I'm very new to Lisp
 
4:03 AM
@Pavel oh, it makes the function execute after the function returns
 
I just heard that McCarthy's paper starts with 25 functions and everything else is built on that. Wanted to see it for myself
 
func c() (i int) {
    defer fmt.Print(2)
    fmt.Print(1)
}
this prints 1, then 2
 
Does it happen synchronously after the return?
Reminds me of this:
 
yes, in reverse order
(of order of defers)
 
void c() {
  scope(success) { writeln(2); }
  writeln(1);
}
That's D. They're called scope guards.
 
4:08 AM
Why not just move the function to the end?
 
Or rather, to quote TV Tropes (this page)
> The Common Lisp language, although its syntax can be rather daunting, has the unique property that any feature of any programming language can be added to it - yet the compiler/interpreter is tiny and supports only 25 commands.
Why? Because one of those commands lets you create a new language construct, and provide a Common Lisp program that expands that construct into a simpler one. This can then be expanded again, and so on until the program contains only those 25 commands. Essentially, it implements the compilation process itself as a language feature, meaning that the compiler is infi
 
func c() (i int) {
defer fmt.Print("done");
return 1;
}
 
And I wanted to see that for myself
 
I probably botched the code since I don't know go
 
@Pavel a good example is opening a file. Your function may have multiple exit points, but you always want to make sure the file is closed
 
4:10 AM
Ah, makes sense,
 
another is that you may have a condition to call defer, or put defer in a loop
 
There's also scope(failure) which occurs only on error or scope(exit) which is either way.
 
and you don't want to call that condition at the end
 
So do you guys know of a Common Lisp tutorial or guide or some such that I can look at?
 
@quartata failure is defined by an exception?
 
4:10 AM
codegolf.stackexchange.com/a/107205/60042 I've been refreshing this Dennis answer for a while, waiting for it to reach up-arrow notation levels of golf.
 
@NathanMerrill Yes.
 
I like that much more than the common try{} finally{}
 
Me too. Pytek is stealing them.
 
I have never used finally. Does this make me a bad coder?
 
or you've never dealt with file handling :)
 
4:14 AM
Hm, seems better than Python's try, except, finally keywords
 
@quartata I'm struggling to find a use case for success
like, when would you want to execute something only if the function was successful
 
No, I've dealt with file handling. Read, copy contents to a String, close.
 
finally is a crutch for languages lacking RAII
 
Done.
RAII?
 
@NathanMerrill I have one somewhat amusingly: unit tests here you eant to fail if it doesn't throw an error
resource acquisition is initialization
 
4:16 AM
Best to look it up; it's actually misleading to say what it stands for :)
 
I usually do this: try { ...; Assert.fail(); } catch (Exception e) {}
Ugly as all hell though.
 
@quartata what is "failing"? like, do you return false, or do you throw another exception?
 
That's horrible, yet strangely resembles something I wrote once.
 
I think Python sort of put that in. You have with keyword now, which (for files anyway), closes a file at the end
Let me find the notation
 
@NathanMerrill As in fail the test. Depends on your test harness
 
4:18 AM
right, I was curious in your case
or, better put, whether you can throw an exception inside of a scope
 
with open("x.txt") as f:
    data = f.read()
    # do something with data
 
and if you can does that get caught inside of a error scope?
 
@Sherlock9 I hate this syntax.
 
for (int i=0;;i++) {
    try {
        System.out.println(list[i]);
    } catch (IndexOutOfBoundsException e) {
        break;
    }
}
 
Yet another level of indentation
 
4:20 AM
Actual thing I did when I was learning programming for the first time.
 
I don't like with either. It's not just about the extra whitespace, it forces me to stay in the block while I keep the file open
 
Oh wow, the nostalgia is strong with this one. imgur.com/gallery/pRcG0
 
Actually, I don't think I knew what the exception was called. Probable just said Exception e.
 
which is an awesome thing about RAII: when the object dies (no matter the scope), the file is closed
 
@quartata What's wrong with the syntax?
 
4:21 AM
@Sherlock9 As Nathan said you have to stay inside the block
 
Oh, I see. I usually just do file read and get out of the with block immediately
Or readlines
 
That's fair.
Pytek's \slurp will make that one step
 
right, and that's what I do as well, but that's not always optimal (when dealing with large files, or wanting to incrementally read it)
@quartata I'm always amazed at how tough it is to read an entire file into a string in most languages
 
I know right?
 
like, seriously, that's 90% of all use cases
 
4:24 AM
Really? 90% of your use cases?
 
One of the few things Perl 6 did right. slurp "file". Done.
 
no, 100% of mine. 90% of the world's :P
 
I'm not complaining, or challenging... just kind of surprised
 
I rarely want to read part of a file
 
Ah, you're weighting the average... quite often I'm parsing the file while reading it, or reading chunks
 
4:25 AM
@HWalters Yeah. What else are you gonna do with a file? Read it one line at a time? It's very common to read the whole file in at once and then do string processing on the contents.
 
@VoteToClose What have you done ?!
 
@El'endiaStarman I don't doubt it's common; it's just the 90% use case that's high for me personally
 
Often times I just want to parse JSON or something. Python thankfully lets you pass in a filehandle and closes it for you but in most languages I just want to slurp and jsonify
 
(How I picture VTC when they see that message.)
 
@El'endiaStarman What what?
What did VTC do?
 
4:28 AM
@Pavel Yeah, basically.
 
@El'endiaStarman But no... usually it's not "line at a time" for me either... it's more "logical data piece at a time", but I don't tend to work with webby stuff a lot
 
I'm confused
 
Make an addictive challenge it seems
 
I just know I won't be able to get any rest before the denominator hits 256!.
 
xaxaxaxaxaxaxaxaxa
 
4:33 AM
Don't think that's possible sadly
 
Surely there's an obscure bash extension someone made to throw moar error codes
 
Man now I wish I made that languagr that outputs only via exit code
Speaking of which @VoteToClose did you ban signals?
 
yes
 
OK cool. We talked about that earlier in chat
 
I think
 
4:37 AM
I had a score of 7 * 10^-19 otherwise :P
 
That would cause you to be beating Dennis
What makes you think you're allowed to do that
 
What it says no sdk
 
@Qwerp-Derp file->project structure
(will give more instructions when intellij boots)
 
it says no project sdk
i don't understand why
i have java installed
 
Doesn't detect it automatically
 
4:39 AM
I see @DigitalTrauma kind of salvaged the idea though
 
File->Project Structure->SDKs->'+' icon->locate JDK
Should be in Program Files on windows
@Qwerp-Derp does that work?
 
what where is locate jdk
i have java runtime environment but not anything else, does that help?
also its 64 bit not 32 bit if that helps
 
Oh
@Qwerp-Derp You have to install the JDK
The java runtime environment and the sdk are not the same thing
 
what
kk
Well that's inconvenient
 
JRE is just the interpreter. JDK has the compiler.
 
4:44 AM
32 bit or 64 bit?
 
32 bit or 64 bit system?
 
Oh OK
 
Gosh we're active right now.
 
It's not like end users need the compiler and it stops source code viruses (although Java is portable anywas)
 
Wait, @Qwerp-Derp, you can also get the java 9 pre-release if you want
It comes with a REPL and other neat features
 
4:46 AM
Wait link pls
I have Java 8 runtime already
 
Looking for it, one sec
 
I'm installing jdk 8
 
The JDK includes the required JRE
 
wait what
so i can uninstall the jre?
 
Yes
Actually, I'm not sure
You probably shouldn't unless you're low on disk space
 
4:48 AM
nah i should just use jdk8 for now
it includes lambdas right?
 
Yeah
 
Yey then I can use runnables as lambdas
Woot
 
Sorta. After boilerplate, lambdas are actually longer than normal functions.
 
And lua still doesn't have a good syntax for anonymous functions.
 
REPL tho
 
4:50 AM
We have load"print(...)" which is equivalent to function(...) print(...) end
 
So... eval?
 
Almost.
IIRC eval simply does it, where as load returns an anonymous function.
 
Lua has anonymous functions
local x = function()
  ..
end
 
Yeah, but they're bytey
the load method is the same, but smaller.
what I would like is an x:=expression option
 
Oh, kind of like Pytek's <:
 
5:24 AM
How do I import stuff in IntelliJ?
 
@Qwerp-Derp What do you need to import?
 
Processing's main library
 
Ok. file->project structure->global libraries
 
How do I start a project from scratch with the default things
What does the base class thing mean also
I don't understand
 
Base package you mean
 
5:35 AM
@Pavel Halp pls
Yeah
 
First of all, File->new
 
Mmhmm done that
Wait hang on
What is com.company
Can I change that? If so what should I change it to
 
You can change it to anything, but standard is com.<YourName>.<ProjectName>
If anyone wants to import files from the project, they'll do it with import com.<YourName>.<ProjectName>
This will create a line reading package com.<bla>; at the start of every class. Everything with the same package name can access all package-private variables.
(package-private is when you exclude public/private/protected)
 
@xnor I tested my 'crack' in my usual Python calculator environment
 
@Qwerp-Derp I forgot the most important thing
 
5:43 AM
which contains sqrt
that's why I got confused
 
You can leave it blank for small projects and not worry about it
 
Ah OK
Uhh I want to separate some files from my main "sketch"
How do I do that?
 
Oh. Then you do need packages.
Let's assume your package is called com.sketch.
 
Uhhuh
 
Create new class you want separate, and set it's package declaration to com.sketch.foobar
This will show up as an error. Put your cursor there and click alt+enter, this should give you the option to move it to it's own package
 
5:48 AM
What's foobar?
 
Anything
 
From then on, you have to import it to reference it, however it doesn't have to import whatever is in the base package.
You probably don't need to do that.
 
Likewise, it can access package-private variables in main but not the other way around
What are you making?
 
5:49 AM
Making Trees
Using stuff from Processing
 
Ok. That's probably simple enough you don't need to worry about separating your classes anyway.
The namespaces are separate anyway
And it's not like anyone will ever need to import Trees.
 
Yeah, but I have a couple of classes like buttons and progress bars
I want to put them in a separate folder
 
Yeah, then you have to put them in seperate packages.
 
How do I do that
 
Do you have a project created with a base package?
 
5:53 AM
Yeah
Called com.qwerpderp.trees
 
In the right panel, right click the folder com.qwerpderp.trees and select new->package
Packages are folders
 
I got it don't worry
I already did it
 
Oh, k. Create a new java class in that package and just set the package declaration to the new package instead of the base one.
IntelliJ might have done that automatically
 
Ah
What variables should be public and what should be private?
@Pavel?
 
public variables can be accessed by anything, including anyone trying to modify the execution of Trees externally.
Use them as little as possible
 
5:59 AM
??? So should I make everything private?
What's protected?
 
If you don't include a scope declaration (package-private), it can be accessed by everything in the same package
Protected means only accessible by subclasses
In general, select the most restricitve one you can.
Private when possible, protected if there are subclasses that need it, package-private if everything in your program needs to access and modify it frequently.
 
@wat huh
 
wat
@orlp ?
 
why did you link that
 
wat
6:08 AM
Earlier I was talking about how i listed it on Amazon, I just now input it into my website
 
@Qwerp-Derp Public is for when you have something in a subpackage you need accessible outside of that package.
 
wat
@Pavel ?
I know what public does
 
Just making sure you didn't get the idea to make everything private.
 
wat
I think you have confused the chicken and the duck
 
Oh, yeah
 
6:20 AM
@Pavel Ah OK
 
7:08 AM
@Dennis I am not apologizing. :3
@quartata Yes, I banned signals.
 
7:44 AM
@VoteToClose that piques my interest
in what context
 
7:58 AM
@ais523 In which language would you write the parser?
 
...
my wizard has the spell light
                   ----------
                  /          \
                 /    REST    \
                /      IN      \
               /     PEACE      \
              /                  \
              | ***************  |
              |      59 Au       |
              |    killed by     |
              |  kicking a wall  |
              |                  |
              |                  |
              |       2017       |
             *|     *  *  *      | *
    _________)/\\_//(\/(/\)/\//\/|_)_______
when you're a wizard who starts with light, and accidentally wields a cursed axe
 
8:24 AM
0
Q: "Apple activity tracker" clock, In Ascii

Matthew RohOnce, I've seen an activity tracker of the Apple watch. It looked very well-designed. And it seems, there is already a watchface of its theme! This challenge is about it too. The Challenge Your code should read time in any format, and output an ascii art like this. For example, if the time...

 
9:41 AM
I clicked this starred message... only to find a considerable amount of noise around.
 
 
1 hour later…
10:48 AM
We had the alphabet, now it's clocks...
 
0
A: Sandbox for Proposed Challenges

Stewie GriffinThis might be an "impossible" challenge, but I want to see if anyone thinks it can be done. I'm ready to change almost everything, for instance: Let the functions do something other than arithmetic, only have one function ... Note: Please vote on this based on the idea, feasibility and whether ...

 
11:16 AM
0
Q: Batch - Addition logic puzzle

NitrateTake two random inputs and output the factorial of those two numbers added together in the least amount of bytes. (In batch.)

 
Hai
 
11:43 AM
0
Q: Hello World! generator

raznagulOften I need a simple Hello World! program to show some basic concepts of a programming language on my travels. As I usually travel only with light luggage I can't to carry a Hello World! program for each language. So a program that generates Hello World! programs in as many languages as possible...

0
Q: java i need a program that finds out the usage duration of a machine from a given array and then select one user who uses it the most

Nishant singhusage duration date name start end 05:55 05:59 30.12.16 Mr.Rk Nair 06:9 06:55 30.12.16 ms.AAsha Jha 07:00 08:56 30.12.16 Ms.Rani Kaur

 
12:40 PM
I would like to add "cute animal videos/pictures" to the list of things that are noise
5
 
12:58 PM
But what is the pont of posting pictures of animals that are not cute???
 
I think the idea is to not post pictures of animals without reason at all.
 
You could argue that cuter animals constitute more noise, since they are more difficult to ignore...
 
1:24 PM
The Error code challenge is another good one with unobservable requirements.
 
@flawr What the heck was Mego doing in 1820?!?
5
 
According to Google translate, it means "My" in Polish
 
And to
(archaic) gentle, mild, peaceable
in Spanish
 
Same query, case insensitive
 
1:33 PM
:(, both are not words so I don't see why I'm last
 
@NathanMerrill Awww yeah, that's more like it! :P
 
Reality check for me: This is a code snippet: +₁ᵐ Can you guess what it does based on the symbols?
 
I can't really tell what the third one is.
 
Add two boxes
 
it's a superscript m
 
1:37 PM
(The second and third character don't load on mobile)
 
@NathanMerrill Oh… I was about to be sad. the second is a subscript 1 and the third is a superscript m
 
My first guess from knowing Jelly is "add whatever subscript 1 means and exponent by the right argument". My second guess is "subscript 1 is a modifier on + and then exponent by the right argument". My third guess is "add then a modified exponent".
 
Some ideas are there, that's pretty reassuring
The answer is "Map increment"
So you were right that subscript 1 is a modifier on + (+ by itself is sum) / add whatever subscript 1 means
 
Anonymous
@El'endiaStarman Yep, it's really funny
 
Anonymous
@El'endiaStarman Shh, don't give away my secret
 
Anonymous
1:51 PM
@Fatalize That's definitely not accurate :P
 
OK, I'm reading up on async/await, and if I understand correctly, "await" immediately returns with a promise that resolves when the await resolves and resolves with the value that you return
@quartata how does NodeJS force it down your throat? Do they simply have promises everywhere?
That said: it seems weird that the "async" keyword is needed. If I use the word "yield", I dont need to put "generator" in my function definition
 
2:12 PM
@Qwerp-Derp btw there is no longer an active bounty on golf you a quine for great good
 
What's more useful for a range function in a golfing language; 0 to n exclusive, or 1 to n inclusive?
 
Do you have a symbol spare so you can have both?
 
Anonymous
@BusinessCat Actually uses both. They both have their merits.
 
Anonymous
Though if you can only choose one, and you have vectorized increment, go for [0,n)
 
Anonymous
So that [1,n] is two bytes
 
2:16 PM
Hmm, I'll probably have both
Planning to use a code page so I'm sure there'll be a spare symbol
 
Alternatively, 0 to n and m to n would be a useful pair
 
Yeah there will definitely be m to n
So maybe it could be one for [0, n) and one for [m, n], so you can just use 1 as m
 
Using a variable makes it inclusive? That seems like a bad idea
 
Probably, tbh
 
If possible, just override your 1 symbol so that if it is followed by a m to n, it makes the m to n inclusive
 
2:21 PM
how do people continually say "yes, I think a community called Code Golf is the best place to put my programming questions"
 
That sounds weird
@GabrielBenamy "Because I can't figure it out so it's a programming puzzle"
 
To be fair the site's first word is "Programming"
 
and my DVR instruction manual has a section on "programming your dvr" let's call up verizon and see if they can help me with this batch script to calculate factorials
 
Anonymous
@GabrielBenamy Do you want your DVR to catch on fire?
 
In computer engineering, Halt and Catch Fire, known by the assembly mnemonic HCF, is an idiom referring to a computer machine code instruction that causes the computer's central processing unit (CPU) to cease meaningful operation, typically requiring a restart of the computer. It originally referred to a fictitious instruction in IBM System/360 computers, but later computer developers who saw the joke created real versions of this instruction for some machines. In the case of real instructions the implication of this expression is that, whereas in most cases in which a CPU executes an unintended...
 
Anonymous
2:24 PM
So that's a yes. I can help you out with that.
 
2:46 PM
@GabrielBenamy Maybe we could ask them
"How did you find this site?"
 
Anonymous
2:56 PM
@trichoplax People have asked before. It's always the same outcome: no response, deleted question, never see the user again
 
Oh well
 
@NathanMerrill Even something as simple as reading a line from stdin involves registering a callback. They're not even considerate enough to provide promises
 
@wat what's the ping for?
I wasn't even in this chat then
 
I suppose that's inevitable. "Thanks for not reading any of the information or even the title of the site. Would you mind taking some time to fill in a survey?"
 
@quartata so, to read input, you pass in a function that is passed the input?
 
2:59 PM
Yes. process.stdin.on(..)
 
Anonymous
@trichoplax Pretty much :P
 

« first day (2181 days earlier)      last day (2663 days later) »