/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

swi-prolog.org/packages/xpce/examples.html
en.wikipedia.org/wiki/Record_(computer_science)
twitter.com/NSFWRedditGif

"The most powerful programming language is Lisp. If you don't know Lisp (or its variant, Scheme), you don't know what it means for a programming language to be powerful and elegant. Once you learn Lisp, you will see what is lacking in most other languages." -Richard Stallman

>Richard Stallman
Stopped reading there.

...

>stopped reading at end of post

Fact: Haskellers are the most powerful programmers.

>Richard Stallman
That's where I stopped reading.

mit cia nigger

Where did he say that?

Working through HtDP. It's pretty good tbqf.

How are templates stupider than void * generics?

See "Richard Stallman" is the last thing in the post. Nothing comes after it.

Because they're templates

So? How did you determine his reading order just based on that?

Because they require additional code to be generated, and create wonky situations where you have to include the template method implementations in the header file.

I'm assuming it goes left-to-right, one line at a time, then beginning at the left of the next line down.

>Because they require additional code to be generated
Executable size vs. speed tradeoff.

>and create wonky situations where you have to include the template method implementations in the header file.
Okay well that's a C++ specific problem. Rust for example has generics that are monomorphized (i.e templates) and it doesn't require that.

Templates produce specialized code, which can be much more performant than code that uses void* pointers.

Fact: OCaml programmers are the most powerful race in the world

What makes you think this assumption is correct?

I'd rather have a slow binary than a big one. Computers these days are fast enough that performance is a non-issue, but storage capacity hasn't kept up with improvements in processor speed.

enjoy your only one existing implementation and GIL

>storage capacity hasn't kept up with improvements in processor speed
Is this a joke?

Because it's the only way posts can be read in a coherent way.

No. Forcing many more instruction cache misses is more costly than making a few more data cache misses.

My Windows 7 computer has only twice the hard drive capacity as my old XP machine.

What does that have to do with what he said?

In any case, with templates you can choose when to use pointers instead. Without templates you have no choice.

Fact: Facts can be made up.

That's wrong though. You can do multiple passes and still have the same level of coherence.

Also, it's not as simple as "templates mean more i-cache misses". What if you call the same instantation over a large collection of values (this seems pretty common)? Templates will destroy void * generics.

I agree. This one is indeed made up.

swi-prolog.org/packages/xpce/examples.html
oop x logic programming best combination

>poo
stopped reading right there.

>opo sucks in my java therefore it sucks everywhere else

>EOF
Stopped reading there.

The hatred to OOP is a meme.

I want someone to tell me why OOP is good without resorting to fallacies like "industry standard so it must be good" and whatnot.

Hatred is a meme.

where did I mention j*va? and why did you say "my java"? I obviously despise it since it's one of the worst examples of POO in practice.

So? How does that make it invalid? Or does your plebbit mind simply not know the definition of "meme"?

>I want someone to tell me why OOP is good
Are you retarded? Serious question here.

I'm thinking of porting oss for gahnoo+hurd but there is some serious spaghetti in that code.

>gahnoo
stopped reading right there.

Are you saying that OOP is so obviously good that I'm a retard for not getting it? If so, surely you could throw me a bone here.

No, you are retarded for demanding an answer to self-evidently unanswerable questions.

Yes but that's inefficient, there's no reason why you would do it that way?

Member functions.

wtf is oss

>waste time on obscure languages
>fail basic job interview in main stream ones

Ever heard of a rhetorical question?

x.f() is just syntax for f(x).

>programming as a profession

>wtf is oss
Open Sound System, it's a cross platform sound system for unix-like systems. It is used by BSDs and available for Linux as an alternate to ALSA.

Yes, that's why I can tell that your post wasn't one.

>x.f() is just syntax for f(x).
or f x if you aren't using a shit language.

>even pajeets are switching to Rust
What are you waiting for?

yet another reason not to use bust

who said this???

They did

Suppose I were to make a game (like pacman), I'd want pacman and each ghost to have x,y properties and I'd end up with something that is either oop or "close enough" to oop (doing the same thing but with structs instead of objects).

>I'd end up with something that is either oop or "close enough" to oop
only if you were mentally challenged. which you seem to be.

No you wouldn't, not unless you were deliberately trying to use OOP.

Anyone have that massive chart of programming projects to post numbers? I need a way to relearn some syntax

There are a million other things that can be modified to eliminate cache misses before templates start becoming a problem. Besides if you don't even know what object you're using in a performance critical portion of code than you have bigger problems than what type of parameter to use

>make something with x,y properties that represents an entity
>"hmm no way this could be an object, I'm to smart for oop"

It's called a record.

en.wikipedia.org/wiki/Record_(computer_science)

>product types are now OOP
>structs are OOP
>tuples are OOP
>defining multiple pieces of data? obviously OOP
>folders are OOP

wake me up

In ASM, is it normal that I can't far call a function that I can near call?

When you went to a Java school, everything looks like an object.

>use record to represent entity
>suddenly you realize you are doing prototype-based oop
>your life is now a lie
checkmate

why this doesn't work?

Nope. That's not OOP.

In simple games translating everything to OOP can work. When it gets more complex it's a hell of a lot better to separate the data from the code that works on it. Then you can use composition to increase reuse far more than you can accomplish with inheritance.

that explains how indians react to women

Dynamic typing.

what?

This doesn't work because of dynamic typing. With static typing you wouldn't be able to construct heterogenus list in the first place.

You're not using list-ref correctly.

>intentionally limiting your lists

how do I get the value of a position in a list?

I'm tired of this racket BS.

>With static typing you wouldn't be able to construct heterogenus list in the first place.
data HList ts where
Null :: HList '[]
(:>) :: t -> HList ts -> HList (t ': ts)

You're trying to index a list with a string.
You know what I mean.

d = {1:'abc', 2:'def', 3:'ghi'}

for key in d:
for letter in d[key]:
print letter


How can I partially iterate trough items in value part?
I.E. I want to print only first and second letter in each key, but not the third.

That's not a list, though, that's a record.

Heterogeneous lists work fine with static typing.

sealed trait HList

final case object HNil extends HList
final case class HCons[H, T

I'm trying to return the value of the iterator of the loop.

should I invert the two values?

(list-ref i a)?

then why the documentation lie?

What ugly language is that?

The documentation isn't lying.
>be a language designer
>intentionally lie to your language's users through the documentation

Racket.

my intro to programming class uses this piece of shit.

No, you're using the elements of the list as indices yet the list itself contains strings in it, so eventually you end up with indexing a list by a string, which is meaningless.

Oh man..

...

I'm trying to return the content of the list.

I gave the function the list (a) and the iterator position (i)

what else I'm supposed to do?

More like a tuple, I guess.
HList [Int, String, IO ()]

(Int, String, IO ())

What's the difference?

Are you quoting someone? Please stop typing in such a retarded manner if you aren't.

Nothing. An HList is a tuple that's easier to write library functions for.

>decide to get some GitHub contributions
>start proposing some Licenses to random projects I find
>either get ignored or flamed
Should I do COC pull requests instead so they stop being mean?

Nope, and you can't make me stop!
>he thinks he can stop someone from typing on the internet

So you admit it's not a heterogeneous list.

who said that?

What is a list other than a tuple in which all the elements have the same type?

Just fucking kill yourself already, you're not half as smart and witty as you think. Even forum banners use green text.

Why would I force you to stop? I just asked nicely.
Well then, continue being retarded.

Variable length.