/dpt/ - Daily Programming Thread

Old thread: What are you programming in C, Sup Forums?

Other urls found in this thread:

en.wikipedia.org/wiki/Offsetof
gnu-pascal.de/gpc/Succ.html
youtube.com/watch?v=LXvP1A97oAM
twitter.com/NSFWRedditVideo

C is the most productive and practical programming language today.

C is for brainlet toddlers. See pic, a toddler rhyme book on the left and a book for mature and adult person on the right

C++ is the most productive and practical programming language today.

I'm pretending to be retarded.

>no anime picture
Shit thread.

Your image is akin to this.

Unity is not real programming.

>he needs 650 kb of library code in his fizzbuzz apps

Pointers are useless in real-world programming

>he uses library to print hello world

>he uses I/O in his program

Why do c toddlers think it's all about library?

lol

Trips of tres. Javascript is best programming language, but we didn't need trips of truth to know that.

Bjarne, hvorfor skapte du et så forferdelig programmeringsspråk som C++?

Unless you are using 'c'. The shitlang doesn't even have resizable arrays, so c tards are bound to use pointers

Learn English before posting here, you E*ropean monkey.

Learn English before posting here, you A***tralian nigger.

Knep dig selv i roven, smatsæk! Flæk dig til helvede man.

>resizable arrays
They're implemented in terms of fixed-size arrays, I hope you realize.

I am a CSS programmer.

So you are saying you have to implement them by yourself before doing anything useful. What a piece of fucking trash.

Already did. And where did I claim to be "Australian"?

>Already did. And where did I claim to be "E*ropean"?

Learn English before posting here, you A***tralian nigger.

But, as a C fag, I'm perfectly fine with all the extra features added by C++. They really don't have a downside for me, as a programmer, since I'm not forced to use them - they're there for me to use if I want to, but I don't have to. The problem is that the C++ standard library is openly advocated as the "right" way to do things, when it's often over-complicated for the use case.

C was a mistake.
ML was robbed.

>i have to rely on the data structures and routines provided by my language and its standard library instead of creating them myself
*clap clap clap*
Statist, stop giving language makers power, take power BACK and craft your world, take a language which gives YOU the power to develop first class syntax for it seamlessly. Lisp and Forth respect YOU and YOUR power. Honourable mention to Haskell too. FUCK GOLANG! AND FUCK _______________________

STOP REPLYING TO RETARDS REEEEEEEEEE

Idris > ML > C > C++

>his languages isn't memory safe

Did you try Cyclone?

>using a low IQ language
typical of a lolipedo

True.

Developing a multi threaded chess AI using higher kinded types in OCam. With no I/O.

woah there hacker master I see you also like to live dangerously

/dpt/ challenge #543: Write a program that prints the string "Hello World!" to the terminal, without using I/O.

peabrained dinosaur tier intellect

putStrLn "Hello World!"

A memory safe language is an inherently better-documented and better-optimized language.

>He actually replied

>she actually replied

>she

you make me laugh, you must have the smallest brain on Sup Forums

>she doesn't know

Please provide arguments, I'm intrigued.

Whales have larger brains than a human, the only being more idiot than a whale is you

You asked for a program that prints "Hello World!" to the terminal without using I/O, and I gave you one.

>implying implications

Assuming it's memory safe because it uses a stronger type system and not because it prevents you playing with memory outright.

How many C programmers use restrict? With linear types, the optimization can automatically be applied to every pointer. Types alert the programmer to errors, they guide implementation, they're documentation that is never out of date, and they're optimization flags that can never be wrong.

school project involving a linked list inside a linked list.

the typical low intelligence argument i'd expect from you

>prints "Hello World!" to the terminal
>not I/O

>I got owned: the post
lmao 50 bucks say you are a dumb c tard

>a linked list.
Don't you have vectors?

>this much damage control

meant for

Your arguments are getting worse and worse my friend, your IQ is lower than even my lowest expectations!

you didn't tell him to run it

Oh? Are you actually suggesting IQ is proportional to brain size? hahaha

Stop lying, r*ddit trash.

59409658
Okay

Between my human brain and your arguably human brain, yes it does, brainlet

Posting in a bait thread.

Programming really is a language if you think about it

> my human brain
ape* brain

Oh look you've reverted to the very argument you stated was flawed. Your brain is like a wet cashew nut, only less delicious!

you seem very upset

>no sizeof
>no offsetof
It's almost as if you don't actually know C.

S/ML influenced Rust, OCaml, and even Swift, numerous other languages. ML has become Lisp, where all new imperative languages are just becoming closer to Lisp. All new functional languages are just becoming closer to SML.

Best part is it is dead easy to understand SML. Theorems are types (specifications), and proofs are the programs. Type theory has its origins in proof theory (the theory of human reasoning) and is closely related to category theory (the general theory of mathematical structures). If you learn type theory, proofs by induction, and category theory you essentially fully understand every single language that has yet to be invented. Also because SML has a formal definition you can write formal verifications for it without being a mathematician.

It's the main reason why How to Design Programs book (and edx course) is so successful at teaching people how to actually program because all they are doing is reasoning about types for the most part which in turn helps the student totally understand the specification of their program. When you grok the specification everything else is easy.

Very low IQ

Agreed

offsetof isn't standard. And if it was, it would be offset_of, not offsetof.

>offsetof
see

en.wikipedia.org/wiki/Offsetof

>C's offsetof() macro is an ANSI C library feature found in stddef.h.

Except SML doesn't have dependent types so its ability to specify is pretty limited.

I made something simple and put it on github a while ago, basically a python script that acts as a password manager.

Do you guys think its a good idea to link my github here and let people comment on what I did?

After people make bigboy git projects are you supposed to shill it everywhere?

Explain dependent types to someone who's briefly used and loved Haskell, and who doesn't afraid of maths.

Go ahead and post'em

f : Bool -> Type
f True = Int
f False = String

g : (b : Bool) -> f b
g True = 3
g False = "hello"

Apparently they're types which require their values to satisfy certain constraints.

>t. 'c' fag

Promise you won't be mean?

Hmm I sort of see, a little.

Thanks for an attempt

C noob here. For char arrays, can I specify a subscript with an expression?

For example, is char[i -1] acceptable?

I thought c tards are not lazy

Yes.

h : Nat -> Type -> Type
h Z t = ()
h (S n) t = (t, h n t)

>80% of the thread is language wars
>20% is random morons asking for help with their kiddie assignments
I know one of you must know a good place to discuss programming

Yes (assuming you mean for array access and not declaration), the thing inside the brackets is an expression, so it doesn't have to be constant. The same is true in most programming languages.

try reddit

Freenode

/prog/ was good until the admin fucked up the servers

Dependent types are types that depend on a value. Some languages have something like this, but only for constant values that are known at compile time. Dependent types, on the other hand, can depend on variables or expressions containing variables. This allows you to interpret them as predicates, and you can construct types corresponding to "for all" or "there exists, s.t.".

For example, if you have two variables x and y of type A, you can have a dependent type family P : A -> Type. Then you can construct two types P x and P y. If you have a proof that x = y, you can then determine that P x = P y, and when types are equal, you can coerce values of one to the other. You can also do safe array indexing with no run time bounds checking required:
// natural numbers
data Nat : Type where
zero : Nat
succ : Nat -> Nat

_ Nat -> Type
_ < zero = Void // false as a type
zero < succ _ = Unit // true as a type
succ m < succ n = m < n

// is allowed because you can never have a value of Void
// lets you utilize the fact that predicates may prevent certain cases from being possible
absurd : Void -> A

Array : Type -> Nat -> Type
Array _ zero = Unit
Array A (succ n) = A * Array A n

index : (n : Nat) -> Array A n -> (i : Nat) -> (i < n) -> A
index zero _ _ p = absurd p // if n = zero, i < n can never be true, so we use absurdity to fill in this case
index (succ n) (a, _) zero _ = a
index (succ n) (_, as) (succ i) p = index n as i p // we use the recursive definition of _

gnu-pascal.de/gpc/Succ.html

good to know. thanks

So it's basically the increment operator?

youtube.com/watch?v=LXvP1A97oAM

Dependent Types are mainly used in shit like AST (Dependent ML), Twelf, Idris ect to prove language type safety and other verification.

Thanks, I'll thinking about this over coffee.

Thanks also this. Can't words today but thank @u.