/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: 1528085923504.png (939x246, 34K)

Other urls found in this thread:

haskellbook.com/
haskellbook.com/progress.html#exceptions
youtu.be/MKog0cd4rJI
pastebin.com/raw/SsduDv9J
twitter.com/AnonBabble

Threadly reminder the official /dpt/ Error Handling ranking is :
Monadic EH (Haskell, Rust) > Exceptions (Java, C++, Python) >>> Return Values (C, Go)

First for TeamFoundationHub 365

I concur

He is correct.

haskell has exceptions

How does that invalidate his reply?

People with power should always be distrusted. And money is power. The respective powers of government and private enterprise need to be balanced so that they cancel out. That's what Stallman means.

I'm so glad this is the first post. Pleb langs please leave

Those functions need to be purged from the standard library. They don't exist. Do not use them.

I turned myself into an S-expression, Morty!
I'm Parenthesis Rick!

Attached: RICK3.png (400x430, 245K)

>Java Exceptions
Fucked up mess (throwable, exception, runtimeexception) and convoluted durr checked exceptions

>C++ Exception
KEK

>python exceptions
The joy of exception(& error) handling in a dynamic lang (SyntaxError lol)

>checked exceptions
trashed

Butthurt Go soibois detected

i programmed java for work tho

why would you not want exception checking if you're convinced static typing is good?

What's the difference between declaring what a function returns in the successful case and declaring what it throws in the unsuccessful case?

>Those functions need to be purged from the standard library. They don't exist. Do not use them.
Yet the most popular Haskell book for novices ("Learn You a Haskell for Great Good!") uses and describes them in detail.

No you

>Monadic EH
It's just return values in disguise.

that book is old, the current popular book is haskellbook.com/

FP is cum consuming in disguise

Yeah and everything else is just electrical signals in disguise.

Quit insulting SICP with your shitty memes.

;_;

That's a disguise worth changing a language for.

>mfw I'm doing cs50 and I get to the dynamic programming lecture

I get the general idea of storing and using solutions to smaller problems to come back to but this particular lecture left me confused

Attached: 1473487284731.png (300x256, 102K)

:(

haskellbook.com/progress.html#exceptions

have you read about the earley parser?

Why the fuck isn't this book finished yet?

yes, it explains to you the exceptions that are in haskell

not encouraging you to define your own

What happens on the receiving end when an exception is returned? Why the fuck does an FPL have exceptions? Divide by zero?

>earley parser
nope

it's basically done actually, in RC stage (i have it)

the final steps are just shit for print, so you are good to get this book. Huge content, 1k pages

so what is a monad?

Doesn't change the fact that exceptions are to stay in Haskell and people will continue to use them.

A seperate nigger monoid of the cotton theory

Use a Maybe monad eg.

read "a" :: Int
read "1" :: Int

vs

readMaybe "a" :: Maybe Int
readMaybe "1" :: Maybe Int

people don't use them, they deal with them

A monad is just a monoid in the category of endofunctors, what's the problem?

God that is ugly

There are also retardo index operators like !! which can lead to out of range exception but that wouldn't happen if you just traversed it eg. with map and foldl like you are supposed to.

it's just a monoid in the category of endofunctors

nothing ugly about it, he just listed the types for people to see

You can't just rephrase "use" and act like it's something different.

Haskell is fucking beautiful. It is literally the most aesthetic programming language ever created. Admitted, that's not the best example of it.

Sorry, I meant, really useful types for the programmer.
Go's typing system is just an indicator for the compiler to read memory layout a certain way. It's sole purpose is performance and optimizations.
Types can do much more than that.

>It is literally the most aesthetic programming language ever created.
No, that is Lisp. Simple is beautiful.

burrito

a burrito.

also, might be relevant :
youtu.be/MKog0cd4rJI

shit wrapper

Haskell is actually very lisp like, except it's an improvement on lisp because it doesn't have shitty imperative functions like iterators and it allows parentheses to be eleminated in sensible places.

I like lisp.

Attached: 1526670143380.gif (262x199, 65K)

It is sepples, Lisp and autism.

>chubby
>beard
>visibly autistic
He probably browses Jow Forums.

he _is_ Jow Forums

also,
>autistic laugh embarrassing everybody around.

>Lisp
>simple
>beautiful
Daily reminder the CL standard from 1994 defines more symbols than the C++14 standard.

I've seen this pic countless times and I still can't tell if that girl is aroused, scared or simply sweating because it's too hot. Am I autistic?

>Haskell is actually very lisp like
Except, you know, it's statically typed.

>CL
I'm not talking about CL, that's an abomination.

Yes

How do I create a ListView on android with two different types of layout in the same list, like pic related? All I want is to have part of the list be simple_list_item_1 and another part be simple_list_item_multiple_choice. I'm seeing things saying custom adapters but that looks like it's still for styling each item the same way.

Attached: Screenshot_20180604-093851.png (1440x2560, 162K)

Oh right, another reason it's better. Is there legitimately anything Lisp has over Haskell? Aside from a mega autistic fanbase

Wowee, chapter 2 of cpp primer is finally done after a whole month

Attached: 1479303728734.png (1328x764, 122K)

Homoiconicity.

>No true Scotsman
Face it, CL is the Lisp, the most successful one, and it being an abomination is a direct result of trying to make Lisp "practical".

CL would be pretty good if it was updated, though. Its main issue is the mountain of historical cruft.

It's arousal. The clue is in the shimmer in the eyes. But then again, autistic people can't read peoples eyes so. You're welcome user.

A structure that you can map over, inject data into, and collapse multiple layers of. That is LITERALLY it.

There are some rules that effectively say the inject and flatten are inverses and that map isn't allowed to change the shape of the structure, and a couple other sensible things, but that's all it is. It confuses people because they expect it to be more.

If you combine map and flatten you get flatMap, which Haskell calls "bind" just to confuse you.

are you confusing the programming language with its standard libraries?

What's good about homoiconicity? How come the rest of the languages go without it perfectly well.
Besides, Haskell has Template Haskell.

Can you implement monads in a dynamically typed language?

Attached: b7d.png (1000x1000, 66K)

If it's this easy to explain, why isn't this explaination everywhere? When someone says it this concisely it feels like it has to be wrong because why hasn't it been said otherwise...

>programming language with its standard libraries
What's the difference in CL? Is `car`, `asoc` and `multiple-value-bind` parts of the language or the standard library?

"No true Scotsman" isn't a fallacy if whether he is a Scotsman actually is debatable.

>Whether Common LISP is a Lisp is actually debatable
Right.

I meant the other way around. Common Lisp is gross, but this is because of the Common part, not the Lisp part. Even then, a major issue for the language is that it hasn't been updated in over twenty years.

>What's good about homoiconicity? How come the rest of the languages go without it perfectly well.
The same could be said about lots of concepts in Haskell like monads or lazy evaluation. You don't really need it, it just makes the language more expressive and life simpler. With homoiconicity you can mold the language to your own needs so that you can be most productive. Of course, the philosophy of enterprise is that a language has to be easily understandable and uniform, even if it sacrifices a lot of its expressive power and makes anything outside of one area that it's good at cumbersome. That's part of the reason why Lisp and homoiconicity in general haven't caught on and people don't realize their power.

>>doesn't steal your data
Youtube videos and online guides on how to turn off spying in Windows 10
making a copy of your data isn't stealing since you still have the original

What are the advantages of one's and two's complement respectively?
Should I have one instruction SHF which takes a register and a signed constant, or RSH and LSH respectively?

... how did this end up in DPT?

Or should I do away with them both, and go with MUL instead? A constant is a constant anyway.

>two's complement
You don't need to implement separate addition and subtraction instructions twice for signed and unsigned numbers.
That's not true for one's complement.

>That's part of the reason why Lisp and homoiconicity in general haven't caught on and people don't realize their power.
So this is the legendary Lisp smugness - people don't use Lips because they don't know it, if only they knew it they would use it all the time. Too bad a lot of people me including know the language and used to program in it only to realize static typing worth more than homoiconicity productivity-wise.

>the most successful one,
do you have any studies backing that claim?

No, I don't, it's just how it feels. Right now Clojure is more widely used, but still not as wide as CL used to be back in the 80s and the 90s.

Arguments like this can be used against FP in general to contend that there is no reason to use anything other than Java or PHP.

>PHP
>static typing

>80s
what about maclisp and franzlisp?
what about emaclisp?

There's lot of symbols for debugger and the reader. Most languages don't include debugger into the language.
C++ has million symbols for doing the same thing in more convoluted way.
CL has lot of symbols because it provides stuff that no other language provides like customizable reader.

Anyone?

React or Angular?
I'm moving to nyc and need a new job. We have to use obsolete tech at my current job, so I'm feeling pretty nervous without being able to confidently talk about a modern language.

Yes, see the gorillean implementations of monads in JavaScript, the meme hipster functional programming former Lispers love to push.

I tried to write a shitty little text game as a Python project. I don't get why my setting of variables isn't working? Its not finished yet but I tried to test it as I thought it would work but when I try to set have_ladder = True it doesn't seem to work?

What am I doing wrong?

pastebin.com/raw/SsduDv9J

typescript

neither

Just a small tip. You could use
\n
to create a new line inside your string instead of calling print lots of times.

I really enjoy watching these faggots try to defend lisp. Its like your trying to argue that your 90 year old grandpa that shits his pants isnt retarded at least.

We dont care your fucking grandpa lang sucks and get it away from me before I puke.

Either

Or you can create multiline strings with triple quotes like this:

""" this is a
long string.
really long"""

Python scope is fucked up sometimes. Insert the line global have_key at the top of a function that uses have_key and see if that helps. I haven't had enough coffee to properly debug this though.

How does alpha-beta pruning work? I tried watching the Wikipedia animation but I don't get it. How does it know the 5th move from the left can be safely discarded? What if it's actually a great move?

Attached: 1503719404342.png (796x423, 55K)