/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: 1539852316035.jpg (1000x787, 142K)

Other urls found in this thread:

godbolt.org/z/QHRs3o
godbolt.org/z/WzqRMg
github.com/drewt/scmus/tree/master/tui
twitter.com/NSFWRedditVideo

nth for nim!

I'm writing a tiny Virtual Machine in C

anime is gay

What's a comfier software development field to get in to, enterprise or consumer facing? Also which backend stack will I get more mileage out of, java/spring or c#/.net?

kill yourself.

Cute anime girls are way more feminine than 3D girls, therefore liking cute anime girls is straighter than liking 3D.

You have to actually touch a vagina to be straight, user, otherwise it's just ambiguous.

I touch cute anime girl vaginas all the time.

Anime is for virgins

My school is shit and isn't offering compilers again before I graduate.
Any recommended courses for learning it on my own?

I concur. Weebs are desperate filthy creatures always ready to defend their chinese cartoons.

I'd love atleast a semi-up to date book as well, and preferably not in fucking java. Dragon book seems 2old now.

What if I spend most of my time fapping to anime boobies and vaginas?

The fundamentals of compilation hasn't changed. Older textbooks still are relevant.

big gay

And why is that?

Well techniques obviously have. And I'd love a book that goes into JIT vs AOT among other things as well. I feel like the dragon book could have me implementing my own shitty C subset, but then i'd be lost beyond that.

because I said so ayy

Attached: baste.jpg (511x671, 37K)

My favourite dnd book

Attached: dangan book.jpg (386x499, 45K)

Well. they're not going to teach that in a bachelors computer science course. That's extremely specialised and advanced.
You need to deal with lexical analysis, parsing, syntax trees, semantic analysis, and all that sort of related garbage before you'd actually start spitting out code, JIT or AOT.

Taking a functional programming course in Scala.

Dependency injection.

I'm thinking we need to prepare topics to bomb the new OP with so people don't just start shitposting.

redpill me on haskell

Post what you're working on, as is asked in the OP.

Learning it makes programming in other languages feel bad.

You know. a strange part of me missed C++ header files because it provided this nice concise little table of contents high-level overview of what the file/class is about.

That part of me is glad that the Test-driven interface meme is a thing.

Or we could each try to draw a yuno to pass the time.

Attached: 1544307595689.jpg (2287x3254, 1.46M)

I'm continuing to work on changing a bunch of renderering-related shit with my wayland compositor, slowly working towards Vulkan support and software rendering support (it's currently OpenGL only).

Attached: yuno.png (1024x1024, 32K)

bump for this

Attached: 1544487560278.jpg (2048x1057, 246K)

Impossible. I don't do work.

Fuck I hate drawing.

Attached: yuno.png (640x480, 34K)

whats more better/more efficient
for(a = 0; a < 32; a++)
memset(scrn[a], 0, sizeof scrn[a]);
or
memset(scrn[4], 0, (sizeof(uint8_t) * 32 * 64));

im zeroing a 2d array and want to know which statement is better.

btw i fucked up it should be scrn[0] in the second code and now scrn[4].

not scrn[4]

Try both and look at the outputted assembly (with optimisations on).
I wouldn't be surprised if the compiler optimised them both to the same thing.

Front end: you get more flack from customers and from higher-ups who hear about customers bitching because you're what you're doing is directly seen by the customer. But at the same time most of it you can mentally brush off as being the back-end's fault.
Back end: there's more actual pressure on you because what you do makes or breaks the business's business logic, but you're fairly isolated from it unless something REALLY fucks up.

Generally I'd recommend back-end for anyone who has a traditional background because front-end programming is just SO fucking minutia and framework vocational-driven rather than abstract algorithm driven.

As for Spring vs Asp.Net, that's a tough one. I think Asp.Net is growing right now whereas Spring is declining right now, but Spring still has a slightly larger market share. .Net has the boost of netcore, but hopefully Spring will have the boost of modern partner-languages like Kotlin to soon enough. Basically I think both are fine choices. Spring is probably stronger, but C# is overall more pleasant to work with (so long as you're OK with Microsoft products).

Thanks for the in-depth answer! I'll probably go with Spring just because I have more experience with java but I'll likely dip my toes in C#/.Net eventually.

I also like the idea of the backend, I wouldn't mind the heavy lifting and building apis.

I'm working on my mpd client, written in scheme. I've just added the ability to define commands from user-loaded scheme code. So I can write
(define-command (w name)
(playlist-save! name))

in my rc.scm, and then type ":w " in the client to save the current playlist.

so for the former i get this
zero:
mov eax, OFFSET FLAT:scrn
mov edx, OFFSET FLAT:scrn+2048
.L2:
pxor xmm0, xmm0
add rax, 64
movaps XMMWORD PTR [rax-64], xmm0
movaps XMMWORD PTR [rax-48], xmm0
movaps XMMWORD PTR [rax-32], xmm0
movaps XMMWORD PTR [rax-16], xmm0
cmp rdx, rax
jne .L2
ret

for the latter i get this
zero:
mov edx, OFFSET FLAT:scrn
xor eax, eax
mov ecx, 256
mov rdi, rdx
rep stosq
ret

and this is with -O3 optimizations on. seems like the latter is much more efficient.

memset(scrn[a], 0, sizeof scrn[a]);

memset(scrn[0], 0, (sizeof(uint8_t) * 32 * 64));
You shouldn't do it like this. scrn[0] must be a pointer type (or contain a pointer value at least) for the first line to make sense. The second line implies you've got a 32*64 bytes to set.

I can't be sure about what you're actually trying to do here.

But if we're just talking about calling memset in a loop vs making one call compilers can deal with it. Though in this
godbolt.org/z/QHRs3o
Clang and GCC differ at O2.
I would consider it poor style to call memset in a loop like that if it could be done without.

godbolt.org/z/WzqRMg
Just to be clear. With the loop gcc actually loops, even to just set a single byte. With the straight call gcc and clang are equivalent.

Attached: snibbitysnab.png (960x532, 27K)

Lisp is the most powerful programming language.

+--------------------+
| Yuno is the cutest |
+-----------------\ |
\|
---____ ______
\/ \ /\ \
// || v || \/\
/_| || ||\/\ \
|| -- U --< -
/^/\----------v^v-/
I would have just posted the code here directly, but I was getting that connection error bullshit.

Attached: prog.png (646x683, 10K)

why not
memset(scrn, 0, sizeof scrn);

printf("%.*s", printlen, "---------------------------------------------------------");

That has a maximum length, though.

no

but you wouldn't want to print a broken yuno, putting a max len is necessary

Data mining sucks.

I said no because it looks retarded, you might as well just use memset. I think the putchar loop is best.

tell me more pls

Which do you prefer?
(define (tuply function)
(lambda (args) (apply function args)))

or
(define tuply (curry curry apply))

you do it like
const char* line = "----...
printf("%.*s", printlen, line);

Sure. What would you like to know?

Top is more portable I guess
I assume you're using racket

Yuno is cute all right but isn't she an artist not a programmer?

You still have that big ugly "---..." string literal.

everything about it, I'm always interested in anything Lisp

Learn Common Lisp so you can experience CLOS.

No, I'm using guile.
I just defined these in my own custom module.
(define-public (curry function . args)
(lambda rest (apply function (append args rest))))

(define-public (curryr function . args)
(lambda rest (apply function (append rest args))))

Next to make it r7rs comptabile.

programming is an art

Yeah I have to.
I started using guile but the oop module is hard to use because I've never worked with meta object protocols.

Common Lisp is niggerlicious. Use Scheme/Guile.

>what is portability
do you fags even have #+

what are some useful meta functions to have in my lisp environment?

Why would you use java?
At my work place, (we're very up to date and you consume our products, but I dont want to say who).
We only use 3 tech stacks;
Javascript/nodejs/react-saga for mostly front end consumer facing software because of its performance and that you could write it out of typescript/f#,modularity and other features.

Php for old back end driven software (finance/ERP)

.Net Core 2.1 C# for every else, mostly web APIs/micro services, even front end with proper SoC.

Why would you willingly care about java?

The guile manual doesn't really give a good intro. Look into the CLOS stuff and apply it to scheme.

Can someone explain currying to me? I vaguely understand it from a math perspective but I'm brainletting out on how it's used in CS

Nigger you can write Chicken Scheme which compiles to C, giving you essentialy infinite portability.

Read The Art of the Metaobject Protocol

you can write ECL which compiles to C on top of using #+ to make your lisp portable across implementations
checkmate faggot

Say we have a function F, which takes two parameters, x and y
Say F is defined by
F(x,y) = x^2 + y^2

but now we desire the function that is like F, but x is set 3
So we want this function
G(y) = 9 + y^2

we can thus curry F with 3 to recieve the function G
curry(F, 3) = 9 + y^2 = G(y)

So it's kind of like how in calc 3 you sometimes create slices of the surface to solve problems? Or am I being autistic about it?

I guess? Since x and y must be constrained for it to be a slice?
But don't try to make parallels, understand it on it's own terms.
Maybe examples of how it's used in practice might help.

When you outsource your IT department

Is it going to be hard?

Is functional programming even real, it looks like a weird interface on top of an iterative system

Nope, as long as you can read Lisp.

trash, only used in academic circlejerk community

>it looks like a weird interface on top of an iterative system
Elaborate. Also I presume you mean imperative.

Well, it's written in chicken scheme. The UI is a ripoff of cmus. Configuration is done either in scheme, or a shell-like command language. You can bind keys to scheme code which gets evaluated when the key(s) are pressed. The UI can be customized via format strings. Pic related

Attached: scmus.png (529x340, 8K)

i'd rather map anyday over a for loop

It implies it calculates values without changing states, but that's not how computers work

Nice.
Can keybindings be compound? e.g. C-k or C-Alt-k

how does it imply that
everybody knows languages like Haskell or Lisp are built on top of C, which is state overlord.
The API and enviroment are different, sure, but rest assured everyone knows that consing is done under the hood

Lisp doesn't try to pretend it's pure though

Reminds me of when user said Haskell-chan can only be a pure virgin, but Lisp-chan can be a slut when it needs to be.

Yeah, you can bind alt/ctrl/shift+key combos, as well as sequences of keys. This is my list of bindings, for reference. Mostly default.

Attached: scmus.png (544x876, 29K)

So your program handles the curses TUI itself?

First time I try to use a popular library (SDL). C is so comfy.

When I do this in C, does the stack grow?
return func(arg1, arg2, ...) ;

What about in Python?

Well, I recently rewrote most of the UI code to use a widget toolkit that I cooked up. It's kind of shit but it's better than writing ncurses code directly.

Yeah i'd be great if there was a way to write curses TUI seamlessly in Scheme
Also, share toolkit.

Yes, func needs a new stack frame.

I haven't packaged it as a separate library yet, since it's pretty unfinished. Here's the code though,
github.com/drewt/scmus/tree/master/tui

Quick, let's laugh at tards at /v/

It's not that different from /dpt/.