/dpt/ - Daily Programming Thread

What are you working on, and why haven't you written an emulator for Rem best girl?

Attached: 1475546193270.jpg (641x870, 383K)

Other urls found in this thread:

en.wikipedia.org/wiki/SECD_machine
prism.ucalgary.ca/handle/1880/46590
en.wikipedia.org/wiki/Graph_reduction_machine
duktape.org/
binji.github.io/binjgb/
en.wikipedia.org/wiki/Typestate_analysis
github.com/RFEtree/sauce
pastebin.com/yG59esaC
twitter.com/NSFWRedditVideo

First for not getting anything done

researchers at university of Calgary tried to implement the secd machine in hardware

en.wikipedia.org/wiki/SECD_machine
prism.ucalgary.ca/handle/1880/46590

also,
en.wikipedia.org/wiki/Graph_reduction_machine

Attached: hiragana-chart.jpg (2550x3300, 1.45M)

JavaScript rocks and is the sole reason lambdas are even mainstream.

How do I stay motivated to program every day?

I really enjoy programming when I start and get into it, but getting started is always really difficult, I usually just end up pissing away time on vidya or shitposting on Jow Forums instead.

How do you get motivated to start a programming session?

Attached: 1535985355548.png (553x569, 101K)

This

Either find a really motivating project, something maybe that uses new tech. Or split it up correctly in chunks, the tried and tested organisational way

thank you for posting a programming related picture, OP.

Somehow, playing vidya (or even passively watching animu) requires more motivation than programming. So I guess I'm just lazy in the right way.

Attached: 1516559095691.jpg (600x600, 205K)

Operator tier list

God tier:
>

Shit tier:

>anime loli op
Good, keep the fucking java developers out

λ is the only operator a programmer need.

Attached: doyouevenlambda.png (811x805, 29K)

Supreme God tier:

What scripting language to use for my C program?

duktape.org/

C

>he thinks java programmers are deterred by anime
first day here kiddo?

Attached: Nagato_Design_Patterns.png (934x1000, 554K)

Typestate is great, but fuck me, trying to find syntax for it is hard.

lol

>can't answer with the usual oopsie plebbit response
>"lol" last thread
>"lol" this thread
You don't have very compelling reasons to make anyone believe you have anything intelligent to say

I'm trying to learn Rust by watching an IRC bot and when parsing incoming messages I had to write this gross line. Is there a better way to write this?
impl Message{
fn new(line: String) -> Message{
let mut parts = line.as_str()
.splitn(4," ")
.map(|x| x.to_string());
let (hostname,command,channel,message) = (parts.next().unwrap(),parts.next().unwrap(),parts.next().unwrap(),parts.next().unwrap());
Message{hostname:hostname,command:command,channel:channel,message:message[1..].to_string()}
}
}

What do you mean type state?

c++ saucenao user, are you here? I made [an initial version] of what you asked for. (You) me if see this

>tfw GB emulator in WebAssembly already
binji.github.io/binjgb/
>saves your state
bretty exciting imo

en.wikipedia.org/wiki/Typestate_analysis

Yeah I'm here

github.com/RFEtree/sauce

match line.as_str().splitn(4, " ").collect::().as_slice() {
[a, b, c, d] => {
let hostname = a.to_string();
let command = b.to_string();
let channel = c.to_string();
let message = d.to_string();
Message { hostname, command, channel, message }
},

_ => panic!("OH GOD HOW DO I HANDLE ERRORS? HOW DO I USE RUST????"),
}

Why not
Message {
hostname: a.to_string(),
command: b.to_string(),
channel: c.to_string(),
message: d.to_string()
}

Why not use an IRC crate instead of rolling your own protocol implementation?

My goal is to learn Rust and using a crate wouldn't have taught me anything. Plus IRC is simple enough that rolling my own isn't too difficult

Ohh this is like indexed monads

>Have been trying to code selection sort for two days now

Attached: 1484567654.jpg (800x680, 330K)

>implementing any sort when sleepsort exists

Yes, but indexed monads only really correspond to type state for a single distinguished object. You can use linear types for multiple distinguished objects, but you have to thread the object references around by hand.

A good solution would somehow do both, but that's the tricky part.

Can't you do a product of the indices?

how do you guys deal with caffeine crashes? I can't keep going like this, I can't drink more during this time of the day because then I can't fall asleep.

>tfw your programming socks just arrived in the mail

Whats a good Python library that can read the Buttcoin blockchain on your local machine?

Sleeping pills

Making something to output a base 60 multiplication table in my custom characters.


public String A(int prime){

if(prime > 59){
int lastdigit = (prime%60);
int seconddigit = (((prime-lastdigit)/60))%60;
int thirddigit = (((prime-seconddigit)/3600))%60;
int fourthdigit = (((prime-thirddigit)/216000))%60;
int fifthdigit = (((prime-fourthdigit)/12960000))%60;

if (prime < 3600){
return (String.format(A(seconddigit) + A(lastdigit)));

}else if (prime < 216000){

return (String.format(A(thirddigit) + A(seconddigit) + A(lastdigit)));

}else if (prime < 12960000){

return (String.format(A(fourthdigit) + A(thirddigit) + A(seconddigit) + A(lastdigit)));

}else if (prime > 12959999){

return (String.format(A(fifthdigit) + A(fourthdigit) + A(thirddigit) + A(seconddigit) + A(lastdigit)));

}
}else{

switch (prime){

case 0:
return "0";
case 1:
return "1";
case 2:
return "";
case 3:
return "";
.
.
.
case 59:
return "ƒ";
}
}
return "";
}

if cuts off after 5 base 60 digits, but that is 59,59,59,59,59 which is 46655999999. This method takes a number and converts it into the characters that my font set uses to denote the value from 0 to 59 for each numerical position.

Attached: 9.png (1700x1700, 28K)

Bleh, it won't display the unicode in the code block but is basically goes alt + # gives the character up to 31, then its alt +1+# from 32 to 59.

If you used records of indices, where each field corresponds to an object reference and order doesn't matter, it would work, although I think there would still be some issues with trying to link up the indexed monad semantics with calling methods on or passing around object references. Actually, you've given me an idea.

How hard is it to break into the software development industry?

I graduated with a CS/Math degree 5 years ago (near 4.0 GPA) but I've never worked a development job and I have no references or connections.

Not sure what I should do aside from trying to become the next Terry Davis (I have Bipolar Type 1)

Attached: sweating.png (190x173, 21K)

dumb frogposter

Degree will likely not matter, considering a lot of people like me got in easy without one. You need a good portfolio though. The better the portfolio, the better your chances. If it's good enough, you'll easily outdo anyone with a degree or a few years experience

>conferences on emulator programming
>the internals of shit like Gameboy, and how others have been doing it

There are conferences on this stuff? Post links.

what the fuck have you been doing this whole time?

Surely my degree will help right?

I've been working on a portfolio, but I have this secret worry that I might actually just be retarded and my projects are just actual shit.

Like I have this paranoia that despite getting an Honors degree with very high grades that maybe all I did was learn how to be smart in a school context (my main focus was pure mathematics) and that maybe I'm just not qualified to be a programmer.

I'm having trouble coding more than a couple hours a day, and I need to take drugs to even manage that.

My best project is an AI for a board game (a modern abstract game vaguely like Chess) that uses alpha-beta pruning, complete with a GUI to play against it.

I've been working an office job that I got purely through nepotism, and I don't even do all that much. It's not even a real office environment, just some bullshit, not a real job.

So I guess I'm basically a NEET to scared to venture into the real world, with bipolar disorder.
Yeah, I dunno. Kinda fucked, not sure how to climb out.

>Surely my degree will help right?
Considering it was years ago, and that technology moves fast, and that software capability is more about applicability rather than basic CS knowledge (also knowing that the broad nature of software means CS degree classes will always be way too basic), it might help but not as much as a portfolio

>Like I have this paranoia that despite getting an Honors degree with very high grades that maybe all I did was learn how to be smart in a school context
Yeah, when I was doing a year in a uni though, they were explicit in that work ethic > learning. Having a degree shows that, but with a portfolio as well, it'll give you a bigger edge

>I'm having trouble coding more than a couple hours a day
Find something that really interests you

post portfolio

stupid frogposter

fuck, I don't want to dox myself.
the stuff is incomplete, and I haven't actually prepared it as a portfolio yet, no readme and general overview, documentation etc

You have ADD take prescription amphetamines

I want to start making GUI applications for Linux, where do I start? I know C and C++, but I'm willing to learn Java or Python.

Attached: 2212829521.jpg (466x614, 227K)

do it anyway
or dump it in a user pastebin

hey guys how do you like my C++ metaprogramming?
I wrote a map function for a list of types!
#include

template
struct List;

template
struct List
{
constexpr static
unsigned size = 1 + List::size;

using Head = T;
using Tail = List;
};

template
struct List
{
constexpr static
unsigned size = 0;
};

template
auto consHelper(List)
{
return List{};
}

template
using Cons = decltype(consHelper(L{}));

template
auto mapHelper(List)
{
return Cons<
typename Fn::template Template,
decltype(mapHelper(List{}))
>{};
}

template
auto mapHelper(List)
{
return List{};
}

template
using Map = decltype(mapHelper(L{}));

struct AddPointer
{
template
using Template = T*;
};

using PointerList = Map;

// demangle to check types in the list
void foo(PointerList)
{

}

>sleeping

Attached: 1ewdzs.jpg (399x385, 37K)

GTK

Attached: raccoon.jpg (512x512, 100K)

>gtk
Install Qt Creator and stop worrying

>You need a good portfolio though.
What would constitute a "good portfolio"?

Is GTK less bloated than Qt?
Qt looks nice, but jesus fucking c. the bloat is strong with that one.

Attached: 1535779743415.jpg (1024x1004, 211K)

hi
newbie here, any begginer-friendly books on algorithms?

>Is GTK less bloated than Qt?
they aren't super far off of each other. If you have time to burn, try both and see which one you like more. If you want to make cross-platform stuff, use Qt.

Creative, complete projects. When I got my first job, no degree, I had an esoteric language interpreter, programming challenge solutions, and a virtual machine implementation

libgen the grokking algorithms books that have illustrations.

#include
#include

class nameClass {
public:
void setName(std::string x) {
name = x;
}
std::string getName() {
return name;
}
private:
std::string name;
};

int main()
{
nameClass n;
n.setName("John Doe");
std::cout

Attached: 1534125506988.jpg (961x816, 239K)

Encapsulation

Not sure the exact details, but in higher level programming, they always make strings immutable. I guess operations other than set are typically too slow. Could also just be encapsulation

private just means people can't fuck with your string name without rewriting your class. Like a quasi-read only.

> encapuslation
I think I understand it a bit more now. Thank you guys.

>but in higher level programming, they always make strings immutable
Because you don't need mutable strings.

>work ethic > learning

I did have tremendous work ethic when I was in school. I'm definitely a high IQ person, but I still had to study a ton to perform well in the advanced courses (in particular the math courses).

>Find something that really interests you

The projects I have been working on are all along the line of AI for playing board/card games. What this amounts to is first implementing the board game with a simple GUI (fairly trivial and boring, and always takes me way longer than I should because I second guess myself frequently about OO designs and shit, when having an ideal design really doesn't matter (but I literally can't help obsessing over this bullshit)) and then researching AI techniques and coding them up using the game library I wrote.

I pick games that aren't the usual suspects (ie I avoid Chess and Checkers) because I'm hoping that this will be more assuring that it is actually my own work (own original code, not that anything I'm doing is novel, but I am at least writing the code myself). Anyone looking to make a basic Chess AI could very easily find some tutorial blogpost that walks them through it step by step. Not that what I'm doing is terribly complicated, but it should at least show that I'm not following some tutorial that any random pajeet can copy paste and pass off as his own.

But I don't know if I'm just wasting my time with this stuff. Perhaps it is entirely unimpressive.

Come on I put effort into this bait

Forget the emulator, I want that whale plushie!

If you find it, pls link.I need it

You wrote idiomatic C++, nobody laughs here.

What exactly is the purpose of goroutines in Go if all the async IO is achieved with epoll?

Hey you, OOPsie! I just put some
>monad transformers
and
>profunctors
and
>hylomorphisms
and
>right Kan extensions
in your OOP codebase.

What are you going to do? Shit yourself?

>definitely a high IQ person

Yeah, you aren't.

he is very smart

using a pure oo programming language here, good luck.

arigato senpai

I am but a humble contractor, brought in to quickly make things work. Maintaining it is your problem! Also, pure as in no side effects (excellent!) or pure as in OO-only (boo!)?

profunctors in base when?

Two days four hours thirty one minutes fifteen seconds

You can't really know that without knowing me.
Earning a degree in mathematics (from a top canadian university), scoring As in all my courses is definitely enough to be considered at least 1 sigma above average, probably 2 sigma.

Mathematics definitely requires a certain amount of intelligence that sheer effort can't really make up for.

pure oo as absolutely everything is an object.

Well at least it's consistent unlike *certain* languages which shall remain unnamed.

You aren't.

I either learn japanese of masturbate to keep myself out of programming.

Any high iq anons feeling helpful? I'm trying to get a value in an equation to be changed at the push of a button. One of the values I sort information by is "PAR". That is calculated differently depending on "league size". I set up a function that changes a variable when called by the button then set up another function to run the equation after the new variable was set. This code looks right but its not quite working. Anyone care to take a look? Using python and tkinter btw

pastebin.com/yG59esaC

>inb4 they leave out Choice and Strong
i hope it's this soon

Why aren't you making use of category homomorphisms in your code, /dpt/?

you wont find any high iq anons here. look elsewhere

what like functors?

Yes. But I expect most anons here aren't making use of them in their code, at least not knowingly

its not really that hard of a problem. Im just new

>give pandas a try
>nothing works
Whelp...

Attached: 1521905113870.gif (429x592, 2.4M)

Think I'm turning into a skeleton, lads. Will I still be able to program?

You may have something called "Impostor Syndrome".

You have to understand that you can enter into a programming context as a entry-level programmer, and you would be learning the iterations of what is required to be a modern day software engineer.

You are afraid because you probably witness all of these programmers who seem much smarter than you showcasing their code and projects on github or articles or such, but you have to remember these are the top 1% or less of the industry with years of experience.

If you want to be employed, then just know how to implement basic algorithms in your programming language of choice. You only need to demonstrate you have the capacity to solve problems, and of course the capacity to learn, which your degree has already proven to some extent. A portfolio is more for freelancing work, it would do you no good in a interview where you have to prove competence in verbal communicate while demonstrating you can write a solution to a common problem..

Work environments are less scary than you think, you'll have co-workers and project managers, the burden is never on one sole programmer, so as long as you commit to learn the workflow, you'll be fine.