/dpt/: Daily Programming Thread

Previous Thread: A thread by Sup Forumselligents for Sup Forumselligents.

Other urls found in this thread:

groups.google.com/forum/#!topic/vim_dev/CmiGxtJ7fn4
pastebin.com/yBEnQ8Bq
en.wikipedia.org/wiki/Modulo_operation
twitter.com/SFWRedditVideos

>Sup Forums
Fuck off
------------------------------------------------
/dpt/ - Daily Programming Thread
What are you working on, Sup Forums?
Maki edition

Previous Thread:

Probably an ausfag poster.

>2 posters
>le shitty aus meme
Fuck off OP

>got a perfect score on the structure of programming languages quiz everyone else got F's on
feel free to ask me any csci questions, brainlets. i may deign to respond

r8 my Europe, Sup Forums. :-)

Reposting important question.
How the fuck do I improve my productivity? Reading some tech book, pretty easy, but 1-2 hours tops, then my brain feels like a goo. Is it normal? How do wizards do wizardry then?
What do you do to get more work done?

Learn Haskell

What features should a type system have?

I told you to fuck off OP, we're going to derail your fucking off topic derail thread into a proper on-topic dpt thread

I don't know how to feel right now. My brain hurts.

>What are you working on, Sup Forums?
Converting my ETL package into a service with various schedules depending on the required frequency of a data refresh.

I started this thread because old thread is dead and I actually want to build an app today.

I'm building a GUI calculator. If I need help, I'll ask you pussies.

I usually only post on Sup Forums and /his/, but I'll be here today.

...

>I'm building a GUI calculator
>If I need help, I'll ask you pussies

>GUI calculator
>need help

That's some basic bitch shit, nigga.

I might not, but if I do, I know where to go to ask and be condescended to.
You're fucking basic, nigga. I bet you didn't even go to the gym today.

>be condescended to
You mean "be condescended"?

>What features should a type system have?
how the fuck should i know

... How did you pass your test?

idk it was pretty easy lol

>I'm building a GUI calculator
No you aren't. Fuck off, manlet.

Implementing bidirectional realization in bicoloured Calculus of Constructions in Haskell.

Why?

I'm tired of writing out all arguments explicitly.

sounds like homework, but here's a little tip

(1

Been playing with rust this afternoon and im not liking it so far. Documentation is poor beyond basic syntax. Syntax is on level with c++ templates and fucking compiler is annoying. I have C,C++ background and rust is pain in the ass. One evening of playing with it and im tired of fucking unwrap. So much code duplication.... and since rust is special you have to do it all tust way... Haskell is joy to uze in comparison
/rant

Rust is not ready to be used in production.

>waah, this technology forces me think in new ways

I figured as much. Im moving to haskell as hobby language...

>haskell as hobby language
jesus christ, how horrifying

No it doesnt, concepts are simple enough. Fucking syntax is problem

Ive been using every main stream language for too long, need a change for home projects. Rust seemed interesting in theory but alas syntax and compiler are too annoying

I don't know. Haskel is not a language I'd like to work with, but seems a nice pick to fuck around. It gives off Pearl's write-only language wibe.

That's even more embarrassing.

I'm kind of new to C++, and currently testing out Magick++ and was wondering, how can I create a window displaying an image?

What are you working on?

fp people, do you prefer haskell, ocaml or f#?
why?

Reminder that Vim 8.0, the first major update in a decade, has just been released.

groups.google.com/forum/#!topic/vim_dev/CmiGxtJ7fn4

if:
(1

vim's too hard to learn

Haskell or OCaml, because they're the most mature among the bunch. I don't hate on any others tho, F* especially looks really intriguing.

now a way that doesn't include a giant list of ifs for every bit position

Come on show me rust code withou 50000 unwraps or match statements.

why f*?

Dependent types, multi-monadic effects and handlers, familiar syntax, it also attempts to fill the gap between theorem proves like Coq and general-purpose languages like Idris.

function switchit(bit_position)
{
switch(bit_position)
{
case 1:
return (1

If I have a very simple python module designed to solve complex math expressions given as a python string, how should I handle invalid input to the module's solve() function? Should I just return math.nan (Not a number), or should I create custom exceptions that users of the module will have to catch?

What have a function when you could just make the entire function ambiguous to 1 line:
((1

...

What is that ugly language? Holy shit, so many obj.do().then().do().this().run().after().this()

whats pow

It's not that difficult. What do you use?

power, exponent, 2^bit_position
Even if u still want to use a function, delete the switch and add my line.

but thats cheating

>It gives off Perl's write-only language vibe
There's a lot of really cryptic Haskell online, but people don't post their Java-like imperative style Haskell.

Throw an exception. Fail fast is better than magic sentinel values.

user, this is C where people know what

pastebin.com/yBEnQ8Bq
somebody from finland helb
how can i make the black circle change colors between red and blue if the number is odd or even

Custom exception, reserve NaN for undefined solutions to valid expressions.

Finland mentioned :-DDDDD

God damn it user, program in English. Even the japs program in English.

no fucking help really its my friends homework i dont know shit about javascript

Haskell, it's a lot more powerful and practical type-wise
The code's a lot nicer too

That's fucking disgusting.

Rate my binary converter!

of and fuck you guys sideways
#include
#include

int
main(int argc, char **argv)
{
if (argc < 2){
printf("Usage %s \n", argv[0]);
return EXIT_SUCCESS;
}

long num = atol(argv[1]);
char temp[64] = {0};
char *c = &temp[63];

*c = '\0';

while (num != 0)
{
--c;
*c = (num & 1) + '0';
num = num >> 1;
}

puts(c);
}

i wrote you a simple function
function evenorodd(x)
{
var i = x;
while(i >= 0)
{
i = i-2;
}
if(i == 0)
laskuri.style.color = "green";
else
laskuri.style.color = "red";
}

gedit. feels bad man, but i went through a vim tutorial and then today i'm in class trying to use it to take notes and none of it stuck so i had to go back to gedit

I'm familiar with several languages already, what's a good python resource?

if you can have negative numbers...

function evenorodd(x)
{
var i = abs(x);
while(i >= 0)
{
i = i-2;
}
if(i == 0)
laskuri.style.color = "green";
else
laskuri.style.color = "red";
}

do temp[65] and remove the *c = '\0'
a lot better than the one from the other thread though

If you want to learn Python then you probably aren't very familiar with other languages

x%2 ???

if you're shitposting on Sup Forums then you're probably very familiar with Sup Forums

what if x isn't 2 percent though

% gets the remainder of x / 2
en.wikipedia.org/wiki/Modulo_operation
ak

I need to learn it so I can work with the existing codebase at my job

its for his homework

you dont want it to look like he copied the answer from the internet

or maybe we do

Muh preflight requests. What a pain in the ass.

Damn, didn't notice that. ty

In Python, is there a more succinct way to get a list of filepaths of files with a certain extension?
fdir = 'prawns'
impaths = [os.path.join(fdir, fname) for fname in os.listdir(fdir) if fname.endswith('.png')]

depends on the platform and what libraries you're using.

also &temp[64] since you decrement c before the first use

i use joe's own editor because text editors are supposed to be fucking simple and wysiwyg, not this weird ass extensible bullshit. i don't want my text editor to also be my file manager, terminal, and irc client.

Using XCode on a Macbook

try cocoa lol

glob.glob

>i don't want my text editor to also be my file manager, terminal, and irc client.
What? I think you're confusing vim with emacs.

they're both highly extensible text editors, what's your point?

Cocoa for the Graphics windows, you mean?

yes, you fucking idiot.

C# of course

God Emperor Racket

Yeah I considered
glob.glob(os.path.join(fdir, '*.png'))

This is more succinct if I only want .png files, but becomes more complex if I want to match more than one file extension.

Vim is >simple and wysiwyg
Nobody forces you to use the extensions.

Thanks!

gedit is shit, try kate.

Then you probably won't get around to writing a function.

- os.listdir
- os.path.join
- os.path.splitext
- os.path.abspath/os.path.realpath

might all be useful to you.

Use it for coding instead of taking notes, so that you can learn at your leisure.

I don't think you saw my first post

>Building a GUI Calculator
>Needing help

How's baby's first program coming along? I'm going to guess that you've just finished all you can with Scratch and want to learn the big bad Python.

no it fucking isn't. i have to press i to type, and instead of a simple ctrl-c exit command, you have to type q! it's fucking ridiculous.