/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?
Previous thread:

Other urls found in this thread:

htdp.org/
twitter.com/SFWRedditVideos

Dynamic "typing" is trash

Reminder that Japanese anime is cute and cool

Monads are only necessary in a language where immutability, statelessness, and purity are concerns.
In other words, a shitlang, because computers fundamentally don't work that way, and any language that insists on working that way cannot go fast.
Correctness, readability, and going fast are the only three things that matter. Imperative languages with mutable state are better for going fast. Hasklel, Lithp, and I[dr]SIS are better for correctness and readability, but anyone who is not a brainlet can write correct and readable code just as well in an imperative language with mutable state. If you're especially not-stupid, you can even write *gasp* type-unsafe code that's correct, readable, and more efficient than its type-safe equivalent.

>tfw you solve a bug in 5 minutes in the morning after sitting on it for several days

Implicit type conversions damage brains.

No. As long as you don't use a shitlang like Python, you have the full power of static dispatch available to you.

# GADT equivalent in Julia using abstract and parametric types.

abstract type expr{T} end

struct In

int i = 5;
long u = i;
writeln(i,u);

Trash

I don't like it

What is the best micro to attatch a camera and a wireless transmitter to? I want to practice with Assembly and video streams.m

>coding to the hardware
You can produce even faster code by using assembly, but nobody does that, and there's a reason for that that you would do well to learn.

>readable code
>imperative language with mutable state
No.

>type-unsafe code
>more efficient
No.

>things which do not exist

I would be interested in your reasoning.

>Monads are only necessary in a language where immutability, statelessness, and purity are concerns.
They are not always necessary in such languages either.

I get to have GADT's so that I can combine parsing and type checking in one operations if I decide to implement a parser for my own domain specific language.

Your language does not have this unless it is Haskell or OCaml, which do not also have Lisp macros that make type-checked DSL's useful.

He's a brainlet who thinks his spaghetti code is just as readable as well-crafted, maintainable code, because he is unable to understand the latter.

>You can produce even faster code by using assembly, but nobody does that, and there's a reason for that that you would do well to learn.
The reason for that is because assembly is not abstracted enough to be usable.
Compiled imperative languages with mutable state are.
Any further abstraction is nothing but a waste, because the threshold was waaay farther back along the road.

>>readable code
>>imperative language with mutable state
>No.
Yes.

>>type-unsafe code
>>more efficient
>No.
Yes.

Completely incorrect.

>well-crafted, maintainable code
>cannot go fast
These contradict each other.
I don't care how maintainable your code is, if it's not fast, it's not """"well-crafted.""""

No, I'm actually right.

If you think fast code cannot also be well-crafted and maintainable, then I think you ought to go back to school.

>>>type-unsafe code
>>>more efficient
>>No.
>Yes.
This does not make any sense.

>>cannot go fast
[citation needed]

>If you think fast code cannot also be well-crafted and maintainable,
I didn't say this though

I like dynamic types because I can't be bothered getting the types right, I just want to get shit done.

>>>>type-unsafe code
>>>>more efficient
>>>No.
>>Yes.
>This does not make any sense.
Word manipulation.

>>>cannot go fast
>[citation needed]
pic related

business idea: a language where mutability can only happen in pure functions

>dynamic types
>things which do not exist
???

>I can't be bothered getting the types right
Meaning?

hax my anus, user. hax my anus ;_;

>pic related
This only compares implementations

>Word manipulation.
Wut?

>This only compares implementations
>i-it's just an implementation
>hurrr

>Wut?
Machine words.
Manipulating them.
Faster than always manipulating the right types.
Types are useful for prototyping, but after that, any mature adult would redo it in terms of words.

>>This only compares implementations
>>i-it's just an implementation
>>hurrr
Are you retarded?

>>Wut?
>Machine words.
>Manipulating them.
>Faster than always manipulating the right types.
>Types are useful for prototyping, but after that, any mature adult would redo it in terms of words.
This makes no sense.

Then use type inference.

>Are you retarded?
>IT'S JUST AN IMPLEMENTATION BRO

>This makes no sense.
It does, you're just dumb.

>>IT'S JUST AN IMPLEMENTATION BRO
Yes? How is that wrong?

>It does, you're just dumb.
Well, you are wrong.

I still get type errors if I do that.

>Yes? How is that wrong?
Your """"""""""""""""""""""pure"""""""""""""""""""""" shitlangs cannot be implemented efficiently without changes to the hardware. This is because the languages themselves are shit from a perspective of realism about how computers work. This will be true until you can show me an implementation of Haskell as fast as GNU C.

>Well, you are wrong.
How is it wrong to say that it's more efficient to manipulate an object of any given type as an array of machine words?

That's good, you're writing code which is objectively wrong.

It's not wrong if it works

>Your """"""""""""""""""""""pure"""""""""""""""""""""" shitlangs cannot be implemented efficiently without changes to the hardware
[citation needed]

>This is because the languages themselves are shit from a perspective of realism about how computers work
Again, [citation needed]

>This will be true until you can show me an implementation of Haskell as fast as GNU C.
This makes no sense though.

>How is it wrong to say that it's more efficient to manipulate an object of any given type as an array of machine words?
I do not think that you understand how type safety works. If you did you would understand that how objects are manipulated in a lower level is irrelevant.

>Your """"""""""""""""""""""pure"""""""""""""""""""""" shitlangs cannot be implemented efficiently without changes to the hardware.
Reminder that Lisp machines did exist, and were disposed of for a good reason.

lmao dude everyone knows passing void* is faster than passing int32_t*

1: This makes absolutely no sense
2: The standard says nothing about that
3: This is irrelevant to our discussion.

>[citation needed]
observation
>Again, [citation needed]
observation
>This makes no sense though.
typical hasklet can't rhetoric
?I do not think that you understand how type safety works. If you did you would understand that how objects are manipulated in a lower level is irrelevant.
This kind of attitude is the reason our technology is slow. How objects are manipulated at a lower level is ALWAYS relevant, because speed is paramount in importance in the general case.

(the ? was supposed to be a >)

I am trying to understand hierarchy.
in Java.
And I am still recalibrating on my antidepressive (zoloft).
I am battling my lack of want and yet am stopped by my empty thoughts.

>observation
No such observation.

>How objects are manipulated at a lower level is ALWAYS relevant
I meant that it is irrelevant in regards to type safety. Nobody stops you from using whatever method you want in the lower level when you use a type safe language.

>Nobody stops you from using whatever method you want in the lower level when you use a type safe language.
Wrong, the language does. And that's what's wrong with your "functional" languages.

you mean class hierarchies?

>Wrong, the language does
How so?

yes.
keywords like super, this, implements, interface.

My head is sluggish though and I have difficulties grasping the concepts.

Type safety is about being able to declare what operations are valid or invalid. Type safety does not imply slow execution.

>How so?
By way of the implementation being slow.

Like all things, it makes more sense when you see it in practice.

You are really not making any sense. You claim that type safe languages magically stop you from using any underlying mechanism you want because their implementations are slow, W A T?
You don't seem very bright.

are there a lot of you in this thread that use haskell or is it one guy against the world? Seems like every day I come in here and some guy is giving it his all defending haskell but I've seen like 1-2 industry use-cases total and they're for DSL's.

I use Idris mostly but sometimes when I feel like slumming it I'll use Haskell

haskell is a social construct made by math grads whose worldviews resonate well with it
nobody actually uses haskell

Could you explain monads to me?

what sort of work do you do if you don't mind me asking? I work in data science so most of the languages I work with are ones that have implementations that accommodate scale. Usually I have to deal with Java/Scala/Python folks or people writing C/Rust for CUDA gpu clusters. I've setup frameworks for Haskell but my understanding was Idris is still relatively formative implementation-wise

hasklelfags can't write a compiler in 3 days

Hey Haskell and Lisp fags, how is the job hunting going? Picking the right offer? :DDDDDDDD

>2017
>Still worries about minute differences in efficiency

Fast as possible doesn't matter. All that matters is that it's fast enough. A faster computer/server is cheaper than paying programmers.

When it comes to consumer software, there's only one point that speed absolutely matters: UI. As long as everything else processes unperceptively quickly, it doesn't matter if it takes two times or 100 times as long, 1ms and 10ms doesn't make a difference, 100ms is fine as long as your UI is responsive.

When it comes to server software, as long as your server meets demanded capacity, all's fine.

Go ahead, write in a slow language. If you need efficiency, like a loop takes up a significant portion of time, then write that part in C or whatever.

Back in the 80s, C was a slow as fuck language unless you had a fancy processor like the 68k. 6502 ran C like shit.

And really, until the *implementation* of C was improved like mad with GCC and its optimizations, along with good cross-platform library support, C ran well on only a handful of the most expensive computers. If you wrote your program in C, you still typically optimized performance-critical parts with hand written assembly.

The reason C is such a fast language today is because modern processors are designed around C's computing model.

Fuck you! Haskell is NOT a social construct! It's a real programming language, and it's fast, and it's pure and stateless and it's fucking better and more efficient than any retarded imperative shitlang! Computers are pure and stateless and so is Haskell! State is a fucking lie! They made it all up! Kill yourself!

monoids in the category of endofunctors

Sometimes it's just convenient to write in assembly on an embedded computer. You don't have to guess how long something will take to run. You can get the exact behavior that the datasheet is talking about.

and it isn't that hard

It's funny, most companies I go to want people who know Python and other OOP stuff just because that's the easiest thing for most teams to adopt. The interviews are usually pretty boring but every now and then some old lead dev will see that i write Lisp and his eyes will light up then get a really sad look in them.

I'm employed ATM, deffo not for my Lisp.

Haskell is more efficient than assembly

>comparing lisp with haskek
I'll have you know Common Lisp is a robust, industry-grade imperative multi-purpose language that is hardly comparable to the purposeless autism that is Hascuck. A shame people only know it through the two kikes that wrote SICP.

>Haskell is more efficient than assembly

Idris compilers

I sometimes worry I've cornered myself into a very niche sector

>>Haskell is more efficient than assembly

>build a state machine
>pretend it's stateless
lmao functionaltards are funny

...

CL is crap compared to Scheme.

>languages are difficult to learn
???

Yes, let me just spout a meme from my asshole as well:

Go is better than C because C stands for Cuck

It's absolutely fucking tragic

Sure, it might be 10x harder to find developers proficient in Lisp, but they'll generally be 11x as productive. Businesses don't want that though, they want easily-replaceable cogs, because perish the thought that an individual lowly worker (y'know, someone who actually produces stuff) might be essential to the business

Common Lisp is for the common man. The refined aristocrat prefers a better Scheme.

A COMPUTER IS NOT A STATE MACHINE!
IT IS FUCKING STATELESS!
"RAM" AND "PROCESSORS" ARE A FUCKING LIBFAG COMMUNIST LIE, OPEN UP A COMPUTER AND SEE FOR YOURSELF IT'S TYPED LAMBDAS ALL THE WAY DOWN YOU FUCKING NECKBEARDED FAGGOT!! (but when you get that far down the industry just calls these lambdas "circuit components")
HASKELL IS EFFICIENT!!!!!

>works with Idris
>Idris compilers
>worried if it's too nich

>woman bursts in to room
>covered in blood
>holding young man
>he seems unresponsive
>she screams
>"I NEED SOMEBODY WHO CAN WRITE ME AN IDRIS COMPILER"

Nobody pretends that.

Nice falseflagging. (not really, it's shitty and you are shitposting)

it's really true. I know that if I do my job the right way when it comes to writing code in Python, it's so that when I leave it's easy for somebody else to work on the code. The language certainly has that benefit for enterprise.

I genuinely enjoy writing Lisp. If I get to write some tooling in it I will (where appropriate). The most enjoyable thing about it is somewhere in it's approach to solving problems. I feel like it turns on a different part of my brain that other languages simply due to the interesting outward-reaching nested list structure

>have to mimic iteration using tail recursion
>no do, loop or format
>no vectors, streams, packages, OOPOO
>no regular macros, has to handhold you with "safe" ones like a baby
sure thing body

The refined aristocrat is a fat lazy bastard who lives off the backs of the poor.
The poor are pure, clean skinned, clean blooded, innocent, and hard working. The dirt a poor man wears on his skin takes from him like the rich do, but the man himself is still clean, whereas the rich ARE the filth that sullies their own selves.
The poor -- the pure -- the victims -- the real human beings, with real souls and real lives -- prefer C.

>write lisp interpreter in python
>write the rest of your code in lisp and include it as resource files
>later your entire codebase is in lisp and it would be too expensive and time-consuming to change it
>switch from the python interpreter to sbcl
>management can get fucked

I want to get into programming, but it seems very intimidating. Is there something easy for a novice to work with?

SICP then HoTT

It's true though, if you think about it, circuit components are lambdas. They're function objects: they accept parameters, they return a result, and you can compose them, curry them, map them, etc. In this sense, lambdas, functional programming, and statelessness are the reality, and a """"computer"""" is just an imperative lie built on these truths.

>>have to mimic iteration using tail recursion
And this is good
Or you can make a macro if you want (loop is a macro in CL, same for the rest of the things that you mentioned)

>no vectors, streams, packages
False

>OOPOO
??

>no regular macros, has to handhold you with "safe" ones like a baby
Why are you lying?

>The poor are pure, clean skinned, clean blooded, innocent, and hard working
Lmao, no
The poor are dirty, stupid and with pitchforks.

>prefer C.
C is the anvil, Lisp is the sword.

>The poor are dirty, stupid and with pitchforks.
The poor are pure and clean. The dirt is not a part of them. It's the rich who are truly dirty, because there's dirt in their souls.
They aren't stupid, they're smarter than the people who take advantage of them.

If they were smart they would not be taken advantage.

t. commie

>Science: "Rats are closely related to primates, which are much smarter than birds."
>(You): "If the rat were smarter than the owl then owls would not be able to eat rats."
This is how retarded you're being.

htdp.org/

>build an out of order machine
>pretend it's in order

>fart on the toilet
>accidentally take a shit
Oh look it's functional programming.
In theory yes, but in practice the category of types for the language won't be closed compact monoidal unless you make it so rigid that it's basically a proof checker like Coq.

Perelman isn't a neet. He is secretly working as a software consultant in Sweden, I met him a while ago.

>Ted Kaczynski, activist

Some birds are pretty smart, like parrots

(and parrots are vegetarian, maybe we could learn something from them)

why is his/her (you can never tell with anime) hand green?

Pretty sure that's a Pepe hand.