/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

buildyourownlisp.com/chapter5_languages
strawpoll.me/13845606
pastebin.com/Wrpwaiys
twitter.com/NSFWRedditImage

Dual PC wall mounting. Only thing I need to buy now is the PCIe risers.

What's the most painless way to kill myself, /dpt/?

hows that programming

Divide yourself by 0.

Rewriting my game engine for the third time. Is this normal?

electrical clamps to the nuts

buildyourownlisp.com/chapter5_languages

>So what does code that looks like a grammar...look like? Let us take a look at mpc by trying to write code for a grammar that recognizes the language of Shiba Inu. More colloquially known as Doge. This language we are going to define as follows.

>› An Adjective is either "wow", "many", "so" or "such".

>› A Noun is either "lisp", "language", "c", "book" or "build".

>› A Phrase is an Adjective followed by a Noun.

>› A Doge is zero or more Phrases.

who recommended me this

>the state of lisp

Why would you waste your time on anything involving lisp?

>the language of Shiba Inu.
the grammar is correct

example is just funky and you are too much of a brainlet

It is, the ratio of game engines to actual games should be kept at at least 3:1.

Because writing a lisp compiler/interpreter is dead simple and a good way to get into compiler design.

Not the one you replied to but I've thought about playing with lisp to get a better grasp on map/filter/reduce/zip and all other shit that makes code just a little bit shorter.

Unfortunately, yes

i'm not saying it's incorrect

Decompilation.

How many other HAHA MEMES have you ran into with this?

then what is the problem exactly

Lisp is a dynamically typed language, writing a compiler for it not trivial. Writing an interpreter is tho, since it has no syntax that means it's trivial to parse. Still tho, it's better to learn about actually compiled languages with actual syntax.
>to get a better grasp on map/filter/reduce/zip
You might as well play with Python since it has all these things, and just like lisp has nothing to do with functional programming.

Learn JavaScript

Python's where it's at! You can do almost anything with it!

already did this

How accurate is this? What needs to be changed/added?

it's cringeworthy, it's adolescent, it doesn't take itself seriously so why should i. i could go on, do you want me to?

APL and Prolog.

what a cringeworty adolescent meme

>he doesn't program in shakespeare, the thinking man's language

did you write that website or something? are you really getting butthurt over poeple thinking your 2005 era memes aren't funny and aged like shit? next time don't use memes in a resource you want people to take seriously

if you like the resource and learn things from it, you'll use it regardless of whether 'people take it seriously'
take it ez

add BASIC between C++ and Fortran

Are you using Rust?

>What needs to be changed/added?
Change it so it's no longer on your hard drive, what a fucking awful meme

Why is pattern matching so comfy?

Because it's a great idea. Surprise surprise industry avoided it for as long as possible, too busy being "pragmatic"

racket after lisp

Why do integer types end with _t? Like int8_t and int16_t.

Are you a little Anime girl, Sup Forums?
strawpoll.me/13845606

Traditional naming schemes for types
C89 had wchar_t, off_t, ptrdiff_t

Also POSIX recommends types to be named _t:


B.2.12 Data Types

The requirement that additional types defined in this section end in ‘‘_t’’ was prompted by the problem of name space pollution. It is difficult to define a type (where that type is not one defined by IEEE Std 1003.1-2001) in one header file and use it in another without adding symbols to the name space of the program. To allow implementors to provide their own types, all conforming applications are required to avoid symbols ending in ‘‘_t’’, which permits the implementor to provide additional types. Because a major use of types is in the definition of structure members, which can (and in many cases must) be added to the structures defined in IEEE Std 1003.1-2001, the need for additional types is compelling.

not disappointed

Finally got cmake to build my hobby os. Next step is to get jslinux to load it.

retard here
is there any other, better, way of determining how many digits a number has?
if (num

log base 10
or, convert it to a string and check the length of the string

>there is one little anime girls ITT

Yes.

make it into a string and get length

No, C11.

I just tried log base 10 on my calculator. I assume I just celi() the result?

n = ceil(log10(num))

Divide by ten until zero, count iterations

>Modern C
Meme. ANSI or go home.

...

>convert to string
>use log
why not
size_t digitCount(size_t n) {
size_t count = 0;
while (n > 0) {
n /= 10;
++count;
}
return count;
}


I like my declare-anywhere variables, anonymous structs and unions, fixed-size types and everything else just fine. You can go fuck yourself, mister jobless neet.

Python was literally made for kids who are new to programming.

And turned out to be a good language in its domains. Your point?

>A-and Scientists! Not j-just kids! REALLY.

python would be more decent if not whitespace
>tfw I thought earlier it was a nice idea

It is good. It condenses code. I also think it would be good if you, in general, eliminated all style choice, that way condensing the language even more. Consider the following example:

>THIS_IS_CONSTEXPR
>thisIsAVariableAndFunctionsAreVariablesToo
>ThisIsAType

Also, if you get rid of colon before new indentation level you wouldn't need elif shit and could just write else if.

No, it didn't.

Whitespace is the least of its concerns.

What are some must-reads for software developers?

I nominate the following books:

The Structure and Interpretation of Computer Programs (SICP) - Gerald Jay Sussman and Hal Abelson

Applied Cryptography 2nd Edition - Bruce Schneier

Introduction to Algorithms (CLRS) - Cormen, Leiserson, Rivest, Stein

RFC 7231, HTTP/1.1 - Fielding and Reschke

Any more?

Well, whatever. I'm using it for my game engine resource generator. Already over 500 lines.

I've written a small program that prints every new unique poster of a specific thread, but sometimes it prints the same poster two or three times in a row, I don't know what's going on, can someone take a look and help?

pastebin.com/Wrpwaiys

How are you distinguishing unique posters?

The Pragmatic Programmer - Andrew Hunt and David Thomas
Code Complete: A Practical Handbook of Software Construction - Steve McConnell
Design Patters - The Four Amigos

Graphics Programming:
Computer Graphics: Practices and Principles - Hughes, van Dam, McGuire, Foley, Feiner, Akeley
Real-Time Rendering - Akenine-Moller, Haines, Hoffman
Physically Based Rendering - Pharr, Jackob, Humphreys

in the Sup Forums API there's a unique ips count, all I did is check if this number increases when someone does a new post, if it does, then it's a new guy

and adding to that, I can only know the first post of a new guy, the rest of the posts that anyone makes are impossible to track

log10(1000) = 3

should be log10(n) + 1

Is Haskell fun? I was watching some computerphile vids and stumbled upon some people who really liked it. Is functional programming all that much different from what I've been learning in school (oop)?

that works. go do I in to math?

>ftw I passed calc

Yeah, it's fun. It's not that practical by itself, but it would bend your mind in a beneficial way, making you a better programmer.

Yes! Try it out!

this

I love ADTs!

>not that practical

question mark

>Is functional programming all that much different from what I've been learning in school (oop)?
Functional programming is the light desu. We're just cursed by academia not caring about speed.

don't fall for memes user

haskell is the new gentoo

undefined behavior

> It is good.
It is good if it doesn't make difference betwwen tab and space indentation.
But it fucking does!

>he mixes tabs and spaces
thank lord Guido from protecting me from faggots such as yourself

>he cares about spaces and tabs
lol what a faggot

>you wouldn't need elif shit and could just write else if.
i can't see why that matters. elif is just as readable and it's shorter

>he cares about different byte values

>i can't see why that matters. elif is just as readable and it's shorter
It pollutes _keyword_ namespace (which is equivalent of registers in the CPU memory hierarchy) and shortness is literally nothing when you're talking about projects over 10kloc.

I'm writing a GLFW wrapper. My question: who the fuck has 25 function keys?

Can I get a job with Kotlin or should I focus on Java instead?

>his keyboard has only 12 function keys

>tfw Code::Blocks has regex search and replace

kotlin is a meme, stick with java

You can get a job with anything if you're competent. Seeing as you're asking this, you probably are not and should increase your chances of employability by targeting a larger market, Java.

I've never seen one that has more.

...

What programming languages will be "on demand" in 3-5 years from now? (in your opinion ofc)

JavaScript.

Rust

>what I wish
c++22
racket
r

>what will be
js
js
java

Haskell
Haskel2020
PureScript

They could:
a) forbid spaces or tabs for indentation, making the use of only tabs or only spaces for indentation
b) they could enforce not whitespace indentation
They did neither the first, nor the second.
IIRC there was some PEP on that, though.
>elif is just as readable and it's shorter
Don't greentext what I didn't say, mong, I agree about that.

Just watch, COBOL2020 will take the programming by storm.

SICP
K&R
"31 days of refactoring" (free e-book!)

Also:
A decent book about Databases (i.e. "SQL antipatterns" by Karwin)
A decent book about Data Stuctures (i.e. "Open Data Structures" by Morin)


All in all I would avoid "bulky" books like "The Art of Computer Programming". It's better to read concise, entertaining and well written books. Life is short.

THIS 2020 TIMES