/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Previous thread:

Other urls found in this thread:

pastebin.com/g5GQ5pPA
twitter.com/AnonBabble

Rewriting Haskell in LaTeX.

Re-writing Idris in MaD.

sugoi hasukeru

Sup Forums is making a web browser

Rewriting trash in garbage.

I'm gonna FUCK Haskell

Haskell is garbage lol.
Have fun Iterating though a list twnty times just to get anything done.

Detroit has 228% more people in it, yet the vehico call only only gets called 1 more time per minute than cincinnati.
Wew.

I believe Detroit doesn't have a lot of "people" in it.

A-user you program your own µc libraries r-right?

Official statistics say 680k, and dividing numbers is easy.
I am wondering why there's a billboard near Detroit, though.

thank you user, i ALWAYS wanted a slower latex

>Official statistics say 680k
Most of them aren't actually people though.

>Official statistics
Yes. And remember that Oswald acted alone.

How do I write this in a non retarded way in C?

pastebin.com/g5GQ5pPA

Dios mio

>pastebin
hahahha i'm not clicking that you think i'm stupid or something????

C programmers are incredibly "simple minded"

>system("pause");

kys

...

l = x+'0'
if(x > 57)
x += 39;

should be correct.
3/5 compromise :^)

Well, here's a rewrite of your convert function:
char convert(int x)
{
if (x >= 0 && x = 10 && x = 18 && x

Lookup table would be faster.

Use pattern matching

You forgot the bug where l is undefined if it's not between 0 and 36

Replacing TeX with mylisp.

This assumes ascii, something that the standard does not guarantee.

char convert(int x) {
return (x >= 0 && x

Thank you!

What does your function do?

give me algorithm problems

Most C programs would be fundamentally broken if ASCII wasn't available everywhere.

Assumes ascii, don't do it.

This is false, I am aware of no program for which this holds true.

implement a self balanced binary search tree

...

Possibly.

This is C, not Rust.

Hrm... I thought there was an implicit return 0 as part of the standard, but it seems that's only the case for main. Fair enough, last return statement should be removed.

user used a system("pause"), implying that the platform will be restricted to Microsoft Windows.

This
Rust was made by people who just wanted to be hipster and had no idea on how to properly design a language on top of mathematical foundations.

Stop samefagging. It's embarrassing.

Can someone help me out with this? In the following code block:
for z in x, y:
print(z)

What exactly is z? Is it a tuple, a list, what? type(z) just gives the type for each component x and y. But what is z's type?

Forgot to specify that this is Python 3.6

S-sorry, if you're a beginner.

>Doesn't have pattern matching
As I said. C programmers are really "simple minded".

like what language

>Reactive Functional Programming
What is an ``Reactive Functional Programming"?

If you know your choice of string only contains ASCII characters, you can trivially convert to Vec and access characters in constant time. If you need more than ASCII characters, you will have to use UTF-8. The only encoding that allows for constant time access of unicode characters is UTF-32, which is quite simply not practical.

>h-h-he made me feel bad for the time I wasted learning rust! he must be a samefag!

Who said this?

>t. MIT professor

Or just storing the unicode codes directly (21 bits)
And if you remove useless scripts it becomes even less. The \alpha things from (la)tex should have been the standard.

some sort of events? i don't get it im too retarded

It is not that C programmers are simple minded, it is that C is a simple language.

>21 bits
And then you will have values spanning word boundaries, which is time inefficient in the general case.

UTF-8 is considered one of the best encoding formats for good reason. Rust isn't being revolutionary in choosing it for the default encoding of strings, plenty of other languages do the same damn thing. If you need constant time access to unicode characters, you convert to UTF-32. If you need constant time access to ASCII characters, you convert to a vector of bytes. If you don't need arbitrary access to characters, you use iterators over UTF-8 which is the best for space utilization.

i'm doing this btw

I added some simple surface displacement and bumpmapping to my raymarcher.

I wish, that being said, in my uni we had to implement heap trees, hash tables and other similar fun stuff.

Good luck! Are you going with AVL, RBtrees or something else?

>it is that C is a simple language.
Designed for "simple minded people"

>Or just storing the unicode codes directly (21 bits)
Which would still work out to 32 bits per code unit, under normal padding and alignment rules. You could theoretically pack it down to 24 bits (or 21, if packing across byte boundaries), but you'd have to unpack it again to do indexing, so it's pointless.

>byte
my byte size is 21 bits, fight me

Wrong. Making complex things out of simple parts takes much more effort and skill than making complex things out of complex parts. A "simple minded person" would think the following code is perfectly reasonable:
char *s1 = "foo";
char *s2 = "bar";
printf(s1 + s2);

Let me guess, you're middle-endian as well?

Since I've basically cheated my way through Haskell without learning monads by solving project Euler problems instead of real world situations, I decided to take the dude's challenge from a few days ago and actually list a directory's files with sizes.

fileSizes :: FilePath -> IO [(FilePath,FileOffset)]
fileSizes path = do
ls = return . fileSize

Learned a lot in the process.

That's not how it works...

>A "simple minded person" would think the following code is perfectly reasonable:
Of course they will, however a normal human being with active brain would find that disgusting.

let (a, b) = ("abc", "def");
print!("{}{}", a, b);

AVL. so far i've got heights updating correctly and adding functional. gotta go to bed bc i have to lift tomorrow morning. nite

>let (a, b) = ("abc", "def");
This is pretty nice actually.

/dpt/ what to program to distract myself from misery and self loathing?
pic related: me, except unlike this man i'm agonizingly aware this is what i am and the only reason i make no effort to improve my life is because i'm sick and tired of making an effort at things in general
can software help something like me /dpt/? or should i go for the suicide

Get into programming real-time computer graphics!

is MATLAB difficult to learn if you know Python?

Starve yourself and become a trap

the horror

Matlab is for people that can't program that still want to program.

So is Python.

>whine whine whine
>"durrr i'm such a fat piece of shit"
You do realize the harder you think this about yourself, the longer it will stay true, right?
Believing you're a disgusting slob is an unspeakable kind of pain. You probably are one, but even disgusting slobs don't deserve to believe they're disgusting slobs. That's too much grief to saddle anyone with, it's suffocating, and it keeps you stagnant.
You have two options as far as I can tell:
1) Write another fizzbuzz and drown your sorrows in another cheeseburger, you fat fuck. Then remember them tomorrow and start over again.
2) Practice pretending you're not what you are. If you practice hard enough, maybe one day you'll feel enough like something worth exercising for to actually get up and exercise.
You sicken me.

ebin

oh fugggg :---DDD

don't respond to heretics

I agree but Matlab is even easier than python

76th for go

Looking to further my career in embedded systems, any programming languages you guys would recommend picking up to do so?

Haskell is a pretty good one.

C O B O L

You can't be fucking serious, there's literally zero probability this isn't another Rust versus C++ troll

is there embedded work outside of C/Python?

Golang is probably your best choice

>Embedded
>Python
Nani?!

>embedded
>python

kek

Python is fine for embedded stuff.

>wanting to work at google

I have 'kind of' learned a bit of java, c# and python, but very superficial. I want to actually learn programming this time, I have gone through those "programming logic" and was wondering, is it even worth going through SICP anymore or should I just go with Programming Principles and Practice Using C++?

>Python is fine for embedded stuff.
In what fucking world?

The Python runtime is like 2 MB. Embedded environments don't always have that kind of space to spare. A particularly bloated C runtime is like a quarter of that.

make tools for mobile/pc games

x, y is treated as a list of lists, so z is a list within that list.

/dpt/ on a scale of 1-10 how gay is it to want to make an action adventure vidya whose artistic message is "dear player, please don't kill yourself, i know i'm just a video game but i love you"?

Sounds like Nier.

Pretty gay

has been done/10

You mean automata right?
Cause the original nier's message is pretty fucking depressing.

Yeah

Automata's message is more like a lonely existence is suffering but with the help of others we can give meaning to our lives.