/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

wiki.haskell.org/Type_arithmetic#A_Really_Advanced_Example_:_Type-Level_Lambda_Calculus
softwarepreservation.org/projects/LISP/book/LISP 1.5 Programmers Manual.pdf
github.com/yegor256/eo
yegor256.com/2014/05/13/why-null-is-bad.html
twitter.com/SFWRedditVideos

Lisp is the most powerful programming language.

Still game dev. The whole dictionary bitflag thing Im hoping will stop my spaghetti code tendency

*groan*

no more fuck opengl posts? guess i'll say it then
fuck opengl

Software Renderer is much nicer

clearly you've never met haskell

Clearly I have, and Haskell is far inferior.

why is programming so fun?

cuz you get bonus powers if you dress like picrel

Vulkan!

Because it is taking the abstract and with it effecting concrete change.

Haskell: "lisp macros" are just libraries (free, operational, etc); but nobody wants to use it. Syntactic abstraction is a code smell inside a modern abstract programming language.

*syntactic

Haskell libraries are just half-baked summer school projects. Why would I want to use those?
Besides, if it's such a "code smell" as you put it, why do many of the popular libraries (lens for instance) rely on Template Haskell?

lens is just a library

You need to address this: syntactic abstration is a code smell, particularly in stringly-typed languages like lisp

LISP could be Haskell, but Haskell could never be LISP

cuz you get to make something your bitch

as of 2010, you can literally implement lisp in the haskell type system, compile-time

There is nothing to address, because that implies syntactic abstraction is a code smell, which it is not.

WTF is code smell? How can code even have olfactory properties?

It doesn't imply it, it outright states it

Prove it.

And that is a questionable assertion until proven.

wiki.haskell.org/Type_arithmetic#A_Really_Advanced_Example_:_Type-Level_Lambda_Calculus

I didn't question it when I read it
You're not one of them sceptics are you?

/dpt/ made me hate all languages I know

Lambda calculus != lisp. Lambda calculus is a pure functional language, it's like a superset of lisp.

programmers are a bunch of faggots

Let me know when you get around to implementing
softwarepreservation.org/projects/LISP/book/LISP 1.5 Programmers Manual.pdf
in Haskell.

Got this question in my Databases Exam:

>optimize the following SQL command:

(4chin doesn't let me post the code)

why would I implement abandoware?

The link shows that GHC Haskell's type system is Turing complete, hence you can implement anything.

traps aint gay brug

>taking seriously the opinion of anybody on 4chins
ishiggydiggy

can you normalize the table?

Why C accept lots weird way to assign function pointer?
int fun(int);

int main()
{
int (*bar)(int);
bar = fun; //OK
bar = &fun; //OK and clearer since & giving the pointer
bar = *fun; //OK
bar = **fun; //OK!?
bar = ***fun; //WTF it's still OK
bar = ********************fun; //WTF is this. This is still OK
return 0;
}

you can do whatever you want i guess

>haha you can't do it unless you complete this entire book
nani

this would be better asked on IRC ##[email protected]
but to clarify, do you pass any warning flags to the compiler?
does it still compile/not raise any warnings with `-Wall -Wextra -Wconversion`?

yup with gcc -Wall -g
There is no warning at all.

...

interesting... i have no idea... if you really want an answer you should go on IRC but what about -Wextra?

When doing function pointer syntax, they wanted it to be callable as either
void (*fn)(void) = whatever;
(*fn)(); // Reflects the fact it's a function pointer
fn(); // Looks like a normal function call
(depending on whatever style the programmer prefers).

However, this has an odd implication: dereferencing a function pointer will return the same function pointer.
So fn == ******fn regardless of how many *s there are.

pointers to functions get a lot of syntactical sugar because they're mostly an exception in the type system and don't function like all the other types

it's actually kind of ugly once you think about it, because it doesn't fit into the rest of the C syntax.
if a function identifier "fun" is the pointer itself and can be assigned to an int (*fp)(), then assigning &fun should be a syntax error because why would this be accessible to the user?

>Teach myself basics
>Getting burnt out because I have no idea really where to go from here combined with my quasi-understanding of various aspects of methods
meh

>basics
of what, OOP? it's trash

Yes and ok

said the type system fetishist

>everything that isn't OOP is type systems
>OOP langs don't frequently use type systems

fuck off huskel nigger

...

...

c++ is the greatest language of all time

...

...

Why is functional programming so comfy but every functional language is dogshit?

I think computer scientists are generally more interested in researching even more theory as opposed to actually applying current theory to make a language.

because its hard to put math notation in ASCII
CAPTCHA: CALLE CALLE

...

...

>operators

is this satire?

too much R
not enough D
>in the sausagefest that is CS?!?

I REALLY wanna click on those (why?)s rn

found it
github.com/yegor256/eo

>mutability
>constants
>operators
>DSL

...

why is there no why after operators
I really don't understand

Threadly reminder that class-based OO is the master paradigm

Marx would disagree

why are many companies obsesed with "le web devilopment"?
after a job search, there are 27 out of 36 companies looking for web developers in my city

yegor256.com/2014/05/13/why-null-is-bad.html

>Every time you get an object as an input you must check whether it is NULL or a valid object reference
public Employee getByName(String name) {
int id = database.find(name);
if (id == 0) {
return Employee.NOBODY;
}
return Employee(id);
}

how is checking whether it = Employee.NOBODY better than checking whether it's NULL I don't understand

>obviuosly your tuo damb to undastund
at least make that a fucking function

No, LabVIEW is the most powerful programming language.

public Maybe getByName(String name);

thats factually wrong, considering everything is made on top of ASM

What was the first assembler written in?

and then you still have to check whether you got a valid return value
there's no getting around that when you have a function that can fail to return

C# also supports structs, with encapsulation.
What's your point? Java is shit?

It's not, at all.

The difference is that you cannot use the result directly as an employee. Using a null object instead of something like Maybe doesn't prevent this.

It's not, people cite the "billion dollar null" all the fucking time but the reality is that cost came from a bad fucking implementation of everything, not from using null.
There's nothing wrong with checking null.

so basically using maybe is just retard proofing?
fair enough, seems like a reasonably effective way to mandate error checking

>so basically using maybe is just retard proofing?
Like the entirity of OOP, yes.

That's not the only function, it also abstracts away the notion of null object so that you don't need to keep writing null object boilerplate and so that you can write code that works for any nullable class.

println!("Hello World");

it's separated and abstracted
obviously your lookup might fail, but you don't need to make every type have a "null" value
What if it can fail in multiple ways?
What if you had a database OF optional values? Then looking up a key would return an option OF an option, in which case you can't use null anyway

...

>not AbstractLineTerminatingPrinterFactory.BridgedAdapter

>fuck opengl
Why?

...

Threadly reminder that type theory is a cult.

public Maybe getEmployeeSalary(String name) {
return Maybe.chain(getByName(name), Category.compose(Maybe.pure, Employee.getSalary));
}

...

public Maybe getEmployeeSalary(String name) {
return Maybe.chain(
getByName(name),
Category.compose(
Maybe.pure, Employee.getSalary
)
);
}

>GoF
>brainlets

stop taking memes seriously

mostly for the meme of it. honestly it's an a bad api but not unmanageable, in that it has a grotesquely stateful design which makes things terribly hard to trace what happens, in infuriating ways sometimes.

(fmap getSalary .) . getByName

Reading the (why?) of casting is so funny
It's basically function overload 101

What would these rust types be in C?

(&'a Arc, &mut *mut i16)

(*const Result, &'a mut Result)

*const Option>>::Output>

&'a mut RefCell

([*mut Rc; 19], *mut *const ::Output)

*mut Rc

*const &Result