/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

cplusplus.com/info/description/
learnbchs.org/
learncpp.com/
doc.rust-lang.org/book/second-edition/
twitter.com/NSFWRedditVideo

...

Bow before your new god, /dpt/

>Come back when you stop thinking it's smart to have a language recompile every function for every different argument by default unless you explicitly specify otherwise
Nice strawman retard.

>tfw you realize arrays are literally just pointer offsets in C

Anyone here use go regularly?
What do y'all think of it? I'm pretty comfortable with C and was planning on picking it up, any recommendations?

go away Simon, nobody likes you smug sweenie.

>comic sans

>muh optimizing compile

Rust sucks and so do you
Use C instead

>I mean type functions not other functions! It's not like I should be expected to be consistent or something!
Utter fucking state of you.
Shame on you for being so braindead.

Forgot image

Great argument.

>you realize arrays are literally just pointer offsets in C
You learning C?

...

>gohu

Yeah. Going through "Numerical Recipes in C" and taking a Computer Systems class

...

You can also do much crazier stuff such as stuffing an arbitrary amount of data in a structure by taking the address of a field and writing to it like it was a normal pointer.

i can't think of any anything more cucked than having to manually manage memory

Monomorphization on types is feasible except with existential types. It's better to have monomorphization by default with some restrictions under existential quantifiers than to leave it to the compiler to determine when monomorphization is allowed.

Haskell!

Go is a very easy langauge to learn. It's kind of like C with a GC and relatively convenient concurrency/parallelism. And one of the less painful takes on OOP that I've been stuck using lately. It's not bad for network code. I don't think I'd want to use it for much else.

How do you benchmark compression algorithms well? Every algorithm will be favored in some way based on the data. And a large sample of random data has limited real world application.
How do you guys benchmark your algorithms?

No it isn't you fucking idiot
Once again
>compile all functions for arguments unless told not to!
Utterly stupid.

What you want is a drop in a fucking pond for the sake of optimisations that are trivial for the compiler anyway to be the default.
There is no fucking defense for this.
Sure you could say "maybe there should be a way of saying that this type should be unpacked" like a pragma, but the opposite is completely stupid.

name one thing wrong with python that isn't just you gatekeeping

I guess use a basket of data with various types that you would expect to use in everyday usage.

but ur a better coder because you have to manually manage it! dont you know that the more a pain in the ass to program in and unsafe a language is, the better? le C master race!

dynamic typing

it's not ruby

Dynamic typing
Syntax errors are runtime exceptions
Significant whitespace

You're annoying

FIOC (forced indentation of code)

>cplusplus.com/info/description/
It's about C++, but this part of the site basically addresses your stupid point and applies to C as well:
>..is a strongly-typed unsafe language.
C++ is a language that expects the programmer to know what he or she is doing, but allows for incredible amounts of control as a result.

Just because you readily admit you are an idiot that can't manage his own code doesn't mean everyone else is. Go shill your pointless language somewhere idiots roam freely.

That sounds incredible... Do you know where I can read about stuff like this?

Not a bad thing, keeps your code more organized.

Let me see your nontrivial and completely safe C project

D3D11 is excellent in terms of API design. it's cleaner and easier to learn/use than the comparable OpenGL feature set because its interface was designed from the ground up for the hardware of the time (Vulkan now boasts this benefit too, but i don't really recommend starting out with it if you're not already experienced with graphics pipelines), instead of just piling new functions on top of the old like OpenGL does (which ends up being a clusterfuck, and that's before even getting into extensions/compatibility/etc). D3D11 does the best job of painting a meaningful and well-organized picture of the underlying state machine its API represents (the graphics pipeline) of any of the feature levels of the graphics APIs i've worked with (D3D9-11, OpenGL 2.1-3.X). HLSL is a bit better than GLSL, too. don't bother with DX12; still too young and not as intuitive. a good way to go might be to learn the graphics pipeline through D3D11, and then branch out into OpenGL and/or Vulkan from there, as you'll inevitably want to do if you're serious about low-level dev

Name ONE thing you can do in C++ that you can't do in Rust.

Anzu is a miracle of this universe

Monomorphization on values would be stupid because of how many possibilities there are given user input. Unless you have dependent types, user input doesn't affect the type of something, so there are's a small set of instantiations that actually have to be compiled. Save your words for when a language that doesn't assume monomorphization is as fast as C++ or Rust.

Use a language that's an industry staple and has and actual ISO standard

Dumb microcuck.

>underlying state machine
The state machine is completely fictional. No hardware works that way any more.

>dependent types
Nope, way before dependent types.
Polymorphic recursion, rank n types, gadts, etc etc lists of features that require this

Not him but the ISO standard is totally a placebo. No one really cares about it.

lol, didn't think so. Try again.

Since GL 3.2, all the native graphics functionality was removed.
The only thing GL does now is facilitate uploading shader code into your GPU and stuffing vertex data into vram, everything else must be implemented by you.

Really, a more apt name is OpenGC, for GPU compiler.

>the ISO standard meme

what is wrong with this

...

>zero means zero
>one means one
>two means two

Still waiting on that one thing that C++ can do that Rust can't.

Abstract base classes, virtual functions, compile time loop evaluation etc

...

You clearly haven't seen maths autism before. They try to be ridiculously precise about everything.

Gas yourself

it's not nearly formal enough

:(

I hope we get another public ban, like we did the other day.

Shut up

>Polymorphic recursion
>gadts
Both fall under existential types.

>rank n types
Not necessarily existential. Imagine for a moment that Rust has higher rank type polymorphism (it already has higher rank lifetime polymorphism).
fn foo(f: impl for Fn(T) -> T) {
let x = f(100);
let y = f("Hello");
}

This could be fully monomorphized.

...

just stop, you've got nothing, everyone who knows anything about the cases where monomorph doesn't work understands that monomorph should be an optimisation and not the default

Interpreted. If I wanted to do something quickly I'd just use Nim

I hate Sup Forums

what's going on here

Is kotlin a good language for machine learning?

Actually, even GADTs don't always mean existential types. Polymorphic recursion is nice but rare in practice.

kotlin is not a good language for anything

I want to make a backend in C. Should I write an http server (or: use a framework) or is cgi okay to use?

isn't this a recursive definition?
what is the point of math?
what is the meaning of life?
what is toast?

What is love?

learnbchs.org/
BCHS YOU FOOL

Use nginx and SCGI.

>learnbchs.org/
>C is a straightforward, non-mustachioed language. It has full access to the kernel's system calls and a massive set of development tools.

I like it

literally almost all of those prevent monomorphisation never mind the fucking code bloat that even C++'s weak type system has

C++ is shit.

This doesn't prevent monomorphization:
data Foo a where
FooInt : Int -> Foo Int
FooAdd : Foo Int -> Foo Int -> Foo Int
FooString : String -> Foo String
FooShow : Foo Int -> Foo String

Not really. It defines zero as the additive identity and one as the multiplicative identity, and then it defines some other numbers relative to those. Brainlets won't understand, but it makes sense and is consistent with the first thing you'd learn if you opened a book on number theory.

GIL

do you need a suit for programming jobs?

we tried user

You need one for the interview
this, it's so much more fun compared to imperative

Man why did no one tell me earlier that functional programming is so comfy?

(* Returns the expression in its recursive CNF *)
let rec simplify expr =
let result =
match expr with
| Atom(x) -> expr (* P(x) ---> P(x) *)
| Not(x) ->
(match x with
| Not(a) -> x (* ~~A ---> A *)
| And(a,b) -> (Or( Not(a), Not(b))) (* ~(A | B) ---> ~A & ~B *)
| Or(a,b) -> (And( Not(a), Not(b))) (* ~(A & B) ---> ~A) | ~B *)
| _ -> Not(simplify x)) (* ~A ---> ~A *)
| Or(x,y) ->
(match (x,y) with
| (And(a,b),c) -> And( Or(a,c), Or(b,c)) (* (A & B) | C ---> (A | C) & (B | C) *)
| (a,And(b,c)) -> And( Or(a,b), Or(a,c)) (* A | (B & C) ---> (A | B) & (A | C) *)
| (_,_) -> (Or((simplify x), (simplify y)))) (* A | B ---> A | B *)
| And(x,y) -> (And((simplify x), (simplify y))) (* A & B ---> A & B *)
| Implies(x,y) -> Or( Not(x), y) (* A => B ---> ~A | B *)
| Equivalent(x,y) -> And( Implies(x,y), Implies(y,x)) in (*A B ---> (A => B) & (B => A) *)
if expr = result then (* If the expression hasn't changed after simplification, don't make another recursive call *)
result
else
simplify result;;

(sneakily removed the double recursive calls I forgot in there, you didn't see a thing.)

ewww, the horror

if you'd actually read the post you'd have seen i was recommending *starting with* D3D11 because it's easier to learn than OpenGL or Vulkan, but recommended continuing on to OpenGL and/or Vulkan after that. i'm experienced with both OpenGL and Direct3D and understand they each have strengths and weaknesses. personally, i generally use OpenGL for portability

uh... yeah, i know. i didn't mean like an actual physical state machine. the interface of the graphics pipeline can most naturally and intuitively be represented in software as a the interface of a state machine in the form of an independent graphics context object, regardless of the underlying implementation in hardware, as long as the implementation doesn't behave as though it mutates global state as seen from outside the implementation, and yields deterministic output for a given set of inputs

is it a bad first impression if I dont wear a suit?

see

...

I don't actually know t b h, I'm not actually sure suits are expected from people applying for programming jobs.

hi /dpt/, professional fizzbuzzer here - what would be the best way in c# to sort a list of object with a date (sadly handled as string currently, but is the easiest to sort) and integer property - I have multiple dates with different integer properties and would like to keep only one row per date that has the lowest integer property, I read that should be possible with linq, but couldnt get anything to really work yet, any ideas?

Which will help me get more jobs btw Java, C# and Node?

Java

does Rust still lack variadic generics?
if so, then pack expansions, fold expressions, perfect forwarding

>variadic generics
>not simply taking a list of types as an argument

Want to start learning how to programming. What's a good language to start with, or some resources that will help me out? I want to be able to make applications and software and stuff like that, maybe a couple basic computer games.

what, tuples? not necessarily the same thing. can you write a function which sums the elements of a tuple (of any number of elements) without a loop? and without calling any functions which contain loops, obviously

Learn C++ or Rust.

>C++
learncpp.com/

>Rust
doc.rust-lang.org/book/second-edition/

Since you are new to programming I suggest C++, it's lot more easy in comparison to Rust.

I'm trying to teach myself Haskell by working on a fairly simple project. I just want to read in a .ppm image, modify it using some function, and then write it back. What would be a good way to represent the RGB data from the image that won't slow everything down. The only thing I can think of is to write a bunch of functions that access a ByteString by returning 3 bytes of RGB data while pretending like it's a 2D array

Don't forget what a piece of shit doxygen is

you there? i am actually curious about this. i don't know much about Rust, but i know a lot about C++, and i'm interested in learning how they differ

Rust has a steeper learning curve, but in the long run C++ will cause way more headaches. Man up and learn Rust.
Actually, maybe C would be a decent first language.

I don't really care about Rust I'm just saying if you think C++ you can have template template parameters right?
Imagine if you could make your own form of type parameter and manipulate it like a regular list, but at the type level.