/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1544980724523.jpg (800x800, 91K)

Other urls found in this thread:

docs.haskellstack.org/en/stable/README/
unidef.net/quantum.source/lib/types.h
youtube.com/watch?v=CX13jZtV-xs
cs.york.ac.uk/fp/reduceron/
youtube.com/watch?v=E4RarTAZ2AY
docs.idris-lang.org/en/latest/st/state.html
github.com/edwinb/Blodwen
twitter.com/NSFWRedditVideo

:hearts: :hearts: :hearts: :hearts: I love you all

Still trying to figure out how the fuck I'm supposed to use Haskell

let me know

best OP from the decade
great job

Attached: 1554177326734.png (1920x1080, 930K)

docs.haskellstack.org/en/stable/README/

>tfw finals this week

Studying for finals this week, so nothing.

t. Superior Quarter system user

Attached: yes.jpg (533x399, 30K)

Don't. It's not worth the brain pain.
And have you ever met people who use Haskell? Sheesh.

I love you too

Attached: friends.png (657x527, 44K)

start by a reading a book

Attached: get-off-your-fucking-phone.png (600x700, 656K)

:hugging: :hugging: :hugging:

Why do you guys hate Apu?

Attached: 1558852943488.jpg (701x1024, 89K)

let rec computed_fixed_point eq f x = if eq (f x) x then x else computed_fixed_point eq f (f x);;

They're from reddit and they don't know that Apu and Pepe are the basic Jow Forums memes.

In C++ if I have abstract class A with a subclass B which has a subclass C, and I want to instantiate C with 3 parameters but these parameters belong to A, what do?

who is apu?

I think it is helper pepe anons are referring to

Attached: 1478479922848.png (657x527, 44K)

why is ocaml so comfy?

let set_diff a b = List.filter (fun x -> not_present x b) a;;

I just lost my virginity, do I have any hope left of becoming a programmer?

What is the Big O complexity of that?

Owner of the Kwiki-mart

Pepe is the original "feels bad man" frog, Apu is his little retarded brother.

Attached: 1488648942632.png (1465x1209, 245K)

class A
{
protected:
A(Foo, Bar, Baz);
};

class B : public A
{
using A::A;
};

class C : public B
{
using B::B;
};
this is a specialised solution. For the general solution use initialisation lists.

>fun not_present

thank you, wise one

class Base {
int m_x;
explicit Base(int x): m_x(x) {}
}

class Derived : Base {
double m_d;
Derived(int x, double d): Base(x), m_d(d) {}
}
[/code]

user, why aren't you creating your own language and compiler for making translation romhacks?

Attached: hqdefault (1).jpg (480x360, 9K)

>fun x -> not_present x b
What's wrong?
Also, working with grammars in ocaml is gods work.
let rec verify_existence rhs terminal_rhs = match rhs with
[] -> true
| symbol::t -> if (sym_exist symbol terminal_rhs) then true && (verify_existence t terminal_rhs) else false in

only if your girlfriend doesn't mind hearing you ramble on about code

What is the best free university course teaching the basics of programming using Java? I know of SICP one and the Stanford one on YouTube but they don't use Java and I'd like to refresh my knowledge of both programming and Java with a course made by people who know what they are doing.

>inb4 why specifically a university course

Believe it or not, I greatly enjoy this way of learning.

Read a chapter on partially applied functions and lambdas in Haskell in the morning
Now finishing up OpenGl 1st Chapter
About to continue reading Clean Code

I wish I could be this productive during workdays

Attached: 1437105359763.png (682x383, 345K)

Basically you just write functions and you pass the functions around to other functions and then it just works.

>Still trying to figure out how the fuck I'm supposed to use Haskell
So are the people who initially developed it.

Attached: enters thread.jpg (848x865, 131K)

How do you modify variables?

Silly user modifications are side effects which is impure.

angry_functional_programmer.png

You need to understand functional programming to understand the answer to your question

user, with this kind of motivation on a Sunday, one day you'll have your own business and you WILL be this productive during workdays.

you don't and you also don't need to

unironically true

>lmao how do i do X paradigm in Y paradigm
>wtf things are different????

Quantum parallelization using multidirectional multidimensional binary trees (sample @ unidef.net/quantum.source/lib/types.h ) to place into the FreeBSD kernel. I want to setup a brain type for an internal neural database since Finnish people have no sense of humor

Attached: E45D7C22-F180-4506-930E-6756221CB6BC.jpg (256x166, 20K)

You need to read a book to understand Haskell. If you don't want to read a book, just stop.

It's not nearly as comfy as Haskell.
setDiff = flip $ filter . ((.).(.)) not (flip elem)


O(n * m)

How can I do dependency injection in Haskell?

th-thanks user but I really need to start working on my personal project that has a meaning
Started writing my own library in C but gave that up in favor of Haskell.

I've got too many toy projects and nothing to show for it.

Attached: 1446733192520.jpg (759x508, 225K)

>dependency injection
absolutely disgusting

>((.).(.))
never worked with Haskell.. uh what is this?

You're going to make the kernel funny in Finnish?

You never worked with a woman either :D

you uh just pass a function as an argument

>being able to write to variables is a paradigm
but that's how computers work

Attached: 1558911550466.jpg (492x382, 43K)

import Data.Thing

>too many toy projects and nothing to show for it
This is why you need one of your projects to make you money.

you don't

variables are an abstraction
there's no difference between data and code

Attached: 85e.jpg (764x551, 263K)

computers write to registers not variables.

(.) :: (b -> c) -> (a -> b) -> a -> c
(.) f g x = g (f x)

Well, "." is infix function composition and "(.)" makes it a regular prefix function. So "(.) . (.)" is also "(.) (.) (.)" which is a composition of compositions... Well, the type looks better:
comp2 :: (b -> c) -> (a1 -> a2 -> b) -> (a1 -> a2 -> c)
comp2 = (.) . (.)

It's essentially composition for a function of two variables.

based and lisppilled

>Haskell is safe & modern, bro!
>the lib I need is full of IfThingIsNull

I have a question. Why don't computers exist that sole purpose is to evaluate lambda calculus? Then Haskell would really be similar to how the computer actually works.

>posting on Jow Forums instead of studying for my AI final tomorrow
just kill me now

Attached: 1528501071726.jpg (400x533, 99K)

registers are variables

A variable is just a label for an address in memory.

dont know about haskell specifically but generally in functional languages you dont. You run a function by passing some arguments to it, and you get a result, which you may store in some database or forward to another function as argument. You then can run the same function again with different argument and get another result.

Registers hold the values of variables.

Lambda calculus is a very high-level abstraction.
Nobody in their right mind would even attempt to try and implement this in pure hardware.

What people do in functional languages is they have a reference to the current state of the world, but that state is immutable. When the program gets input, it creates a slightly different version of the prior state of the world and sticks it in the reference, replacing the prior state.
If you want more info, watch this or read a book.
youtube.com/watch?v=CX13jZtV-xs

cs.york.ac.uk/fp/reduceron/

Here's a better version of that video, with slides:
youtube.com/watch?v=E4RarTAZ2AY

It's been done in the early 80s, though. I know because our 1st semester uni script had a picture of a LISP chip in it.

>but generally in functional languages you dont
maybe in shitlangs
Mutation can be handled in a pure manner if you define the mutation so the compiler can evaluate it.
docs.idris-lang.org/en/latest/st/state.html

LISP =/= Lambda Calculus

Another fun way to write that in Haskell:
setDiff = flip $ filter . fmap not . flip elem

>Lambda calculus is a very high-level abstraction.
>Turing machine isn't
>C machine isn't

variables hold the values of variables

Not without Linus’ fucking permission I’ll tell you that much

Lisp machines were just conventional computers with certain Lisp-specific instructions. The Lisp code still had to be compiled to an imperative machine language.

that address in memory contains data
that data can be either be an instruction or data
address doesn't exist, it's just an output of a decoder that links to RAM, that's been fed a combination which is "the address"

Attached: 16.jpg (4030x4096, 1.15M)

>>Turing machine isn't
>>C machine isn't
They aren't, because they more closely describe, by a long shot at that, how actual processors are implemented.

what a nice way to flip burgers

Actually a register is just a monad that may or may not have a variable inside it.

idris is a shit language

>since Finnish people have no sense of humor
Big if true

>They aren't, because they more closely describe, by a long shot at that, how actual processors are implemented.
I bet you actually believe this

>dependent types
>totality checking
>built in proofs
>soon to have linear types
If you can't check totality, you're using a shitlang.

They don't. Most autistic country to exist

I'm not seeing any arguments

would claiming i'm right by a long shot constitute an argument?

At the end of the day computers are just electrified sand.

I can tell you for certain, that strawmanning is not an argument.

>soon to have linear types
so its a work in progress, I wonder what will happen to the old code when new update comes out and adds new feature and break everything before it, I guess that isnt really a problem because no one really uses it and there isnt any code/projects to maintain (at least important ones)

and brain is just electrified fat

I’m also working on injecting a Windows 10 iso into qemu so I don’t have to use that not so nice dicker, there’s no stack guards so it gets hacked pretty bad. I call it win10emu.

You can compile it right now.
github.com/edwinb/Blodwen
Planned to be mostly backwards compatible, and the exceptions so far are cleanly listed on the github.
And actually comes with advantages, especially now that it's escaping haskell.
>The Prelude is much smaller (and easier to replace with an alternative).

Maybe you should tell yourself that

you may only continue to post in this thread if you can understand the following
[code[
struct termios config_terminal_state;
tcgetattr(STDIN_FILENO, &saved_terminal_state);
atexit(reset_input_mode);
tcgetattr(STDIN_FILENO, &config_terminal_state);
config_terminal_state.c_iflag = ISTRIP;
config_terminal_state.c_oflag = 0;
config_terminal_state.c_lflag = 0;
config_terminal_state.c_cc[VMIN] = 1;
config_terminal_state.c_cc[VTIME] = 0;
tcsetattr(STDIN_FILENO, TCSANOW, &config_terminal_state);
[/code]

Is the SICP actually that good or is it a giant meme? Should I be downloading racket or clojure posthaste