/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: yet another yuno.jpg (800x450, 158K)

Other urls found in this thread:

i.imgur.com/c01maNc.jpg
gcc.godbolt.org/z/5eKZPG
github.com/hanickadot/compile-time-regular-expressions
twitter.com/SFWRedditImages

>Now we're just going to do this
>Pastes code
Why do authors keep doing this? Exercises or don't bother, I say.

1st for C++

BASED manime picture

JavaScript rocks!

Attached: js_rocks.png (1433x779, 473K)

/dpt/ yuno drawings still welcome, drawing helps improve creativity and programming skills.

Last attempt:

Attached: how to draw yuno.jpg (2287x3254, 1.46M)

nth for nim!

please stop posting yuno and post cute anime girls instead
thank you

will do this

Your code is shit. I just tried to compile the following:

println("{} {} {} {} {}"fs, "hi", 8, 5, 32, 4);


And the executable was 200K. I tried eight format specifiers and it hasn't even fucking completed yet. Try again, lad.

Explain to me how """pure""" the functions inside Debug.Trace are

>w

Attached: ayy.png (1392x855, 14K)

Pretty neat huh?

#include

template
auto pipe(const T &t, const F &f)
{
return f(t);
}

template
auto pipe(const T &t, const F &f, const Rest &...rest)
{
return pipe(f(t), rest...);
}

static int twicify(int arg)
{
return 2 * arg;
}

static int addfive(int arg)
{
return arg + 5;
}

int main()
{
printf("%d\n",
pipe(3, twicify, addfive, addfive, twicify)
);
return 0;
}

no, post braphogs

gatsbyjs multilingual website
currently creating markdown content...

With 6 format specifiers: 780K and takes 4s to compile
With 7 format specifiers: 3.2 MEGABYTES and takes FORTY THREE SECONDS to compile

You just wrote a printf that chokes AT COMPILE TIME if there are more than 5 format specifiers. Nice job C++, those abstractions are really looking zero-costly!

Be careful, look at what happened to the user that I'm replying to.

There's only so much you can do with current C++. Perhaps you can do better?
C++ doesn't have much support for arbitrary codegen, you have to use tricks like I did which doesn't always result in good codegen because it's too complicated for the optimizer to see through.

not really my dude
auto compose()
{
return [](auto x){ return x; };
}

auto compose(auto f, auto ...fs)
{
return [](auto x){ return f(compose(fs...)(x)); };
}

nvm im shit
i.imgur.com/c01maNc.jpg

Yeah, don't use C++ for this kind of stuff. It's a shit language for metaprogramming. If you want cool type safe compile-time features, try Rust or Nim or your nearest lisp.

Hey Question,
I've been working in python for a while, I wanted to create a script that scrapes images from a convo in fcbk messenger.

What libraries would I use?
Is there a way to automate keys in python to make more images show, so that I can scrape them?

selenium

It looks fine, thicken up the eyes and fix the mouth with just a simple 'v' and post it here.

Attached: (Hi10)_Hidamari_Sketch_x_Honeycomb_-_02_(BD_720p)_(mudabone) [00:05:40.632].jpg (1280x720, 810K)

>Rust
Rust doesn't have cool metaprogramming.
It parses format strings as a fucking compiler builtin.
I think you meant only Nim.

Lisp is the most powerful programming language, and it is a really long format string.

>It parses format strings as a fucking compiler builtin.
Is this for real? fucking lmao

Rust isn't efficient and thus doesn't exist as an option.

Last I heard, rust has macros with full AST access which would enable a sane implementation of this. Nim has this (module strformat).

I also forgot D, which does this too, including regexp compilation at compile time. Now I'd like to see C++ do THAT.

Attached: slightly less shit yuno.png (678x426, 16K)

Perfect, it looks like a yuno and is cute. Just like in programming, self criticism in the form of "this is shit" will only demotivate you.

Uhh actually user-kun, I think you forgot to enable optimizations.
Here: gcc.godbolt.org/z/5eKZPG
Compiles quickly and codegen is as good as the equivalent sequence of stream statements (because it's built on top of it).
In other words it's zero overhead, the formatting layer I added on top of C++ streams was completely and utterly removed by the optimizer.
But of course, with optimizations disabled the codegen would be stomach churningly bad. Oh well.

drawing is hard

Attached: tiny yuno.png (400x200, 235K)

lmfao dont act like your shitty implementation is c++'s fault

Can you anime drawing faggots fuck off? This isn't the thread for your horseshit.

you just suck at metaprogramming dude

>regexp compilation at compile time. Now I'd like to see C++ do THAT.
I think it does.

No, it was actually that retards fault for forgetting to enable optimizations. See , it adds no additional overhead on top of C++ streams and compiles quickly.

compile time regex is still experimental but it IS coming. why do you think it is somehow beyond c++ to have compile time regex compilation

I'm the user who's writing his own assembly-style-thing, I've managed to implement basic loops and I wrote a little program that prints out 9 to 0

Attached: program.png (1006x1388, 144K)

You're right. Ignore my code size complaint, but the compile time is still abysmal. Sorry, I'm not waiting for 7 hours because the compiler has to generate 30 megabytes of code that it's just going to optimize away.
Show me C++ regexps at compile time.

fuck you we're in this thread like 80% of the days in the year discussing programming

It's just a bit of fun, relax.

> No, it was actually that retards fault for forgetting to enable optimizations.
i was responding to the guy who said 'you can only do so much with c++ metaprogramming', which is bullshit

>but the compile time is still abysmal. Sorry, I'm not waiting for 7 hours because the compiler has to generate 30 megabytes of code that it's just going to optimize away.
Compiled quickly in compiler explorer for me, though.

I don't give a fuck, don't post your shit here.

thats a fun project

I'll comment and pastebin the header for you guys and post it

> Show me C++ regexps at compile time.
github.com/hanickadot/compile-time-regular-expressions
wow, that was so hard.

god damnit I'm such a brainlet I can't even figure out how to parse a text file anymore
this is what being a corporate slave does to you anons

Attached: 1514151905804.jpg (577x575, 59K)

What are you trying to parse? A csv file?

>animeposter can't even parse a text file
/wdg/ might be more your speed

Sure, because you had 5. Bump that up to 8 or 9 (Surely you want to support that, right) and see how long it takes.
The absolute state!

Attached: 2018-12-18-155435_601x438_scrot.png (601x438, 21K)

sokoban levels
########
#####@.#
####.$$#
#### $ #
### .# #
### #
### ###
########
; Level 1

########
### .###
### @###
#. $.###
# # ###
# $$ ###
### ###
########
; Level 2

I'm just too tired to think rn, time for bed
fuck you

>doing aoc
kek, that's suppose to be fun and challenging. What language are you using?

You're right, it's inefficient at compile time, but I was more focusing on just getting a proof of concept up rather than worrying about an efficient implementation. Compile time performance is one my least concerns.
I plan to make a proper, faster implementation when C++20 arrives.

Why not just do pure asm? You're losing optimization by hand typing asm, if you don't know what you're doing.

is that actually an aoc challenge? I'm not doing it this year, this is for a personal project
lang is Lua, trying to learn that as well while doing all this

I'm pretty sure it's so slow at compile time because of your inline recursion. Will C++20 give you a better way of doing that?

It's more an exercise in understanding assembly than something I'd actually use.

you probably missed my post in the last thread but you should check out boost::metaparse. compile time parser generator framework that executes on string literals

>is that actually an aoc challenge?
I believe so, there's a very similar challenge.

>lang is Lua
>Lua
Oh, good luck with that.

Ah, gotcha. Look up radare2 if you need a good dissembler.

>Ah, gotcha. Look up radare2 if you need a good dissembler.
That would actually be pretty fun to try and port other programs to my shitlang

I tried my best

looks pretty neat, user, but you called the C standard library the "STL" but that's the C++ Standard Template Library and that's not the same thing and you triggered my autism reeeee

Attached: i tried.png (640x400, 23K)

Fug, I thought STL was STandard Library, I'm retarded

Does this look anything like yuno? never tried ASCII art before.

+------- ------------+
- / \ / \ \
/ / || \ / || x x \
_ / || || \/\ x \
/ / || || \ x x \
| / ,,, v ,,, \ /\--->
| +-------------------- \/
\/ \ /
\/

not wide enough.

cute

how's my yuno?

Attached: 1461916400967.jpg (1024x768, 121K)

Maybe, idk. I'm just waiting on the convenience features like struct instance template parameters so I can have a cleaner implementation without reliance on any non standard extension.
The likely reason the unoptimized codegen is so horrible is probably because of the branch in print_tokens. I'm pretty much relying on the optimizer to eliminate the branch, which the inlining helps greatly with.
If I can find a way to do that branching at compile time it should improves things a lot. That way it shouldn't recurse any more than 2x the number of format specifiers
That's probably where C++20 will come in. C++20 will allow me to pass those token structs as template parameters and use constexpr if on them instead of praying the optimizer does the right thing.
Yes, I'm aware that I can just pass the individual fields as template parameters and use them at compile time but that's really ugly and cumbersome, that's why I want to wait for C++20.

>boost
No thanks.
No, I didn't miss it. You missed my response.

holy shit

oh sorry. how come you dont like boost?

I wish there was snow here.

Big, ugly, bloated as fuck.

???? most boost libraries are header only libraries... also i dont see how its ugly... its some of the best C++ code in the world...

>what are you working on user?
1. MMO browser game (webgl + node.js)
2. Adobe video plugin (c++)
3. Learning some lisps for fun

>Adobe
delet this

the fuck is a monad?

>using anything but Premiere Pro

>Adobe video plugin
>working for free for a big ass corporation
they'll probably charge for that plugin in the future

>doing exercism.io exercises
>bored already

do people still unironically use java?

install davinci resolve

>they'll probably charge for that plugin in the future
Wrong my dude. The sdk is open source and people have been selling plugins and suites since cs3.

sadly yes

Ocaml is the best functional programming language.

>unironically
what do you mean "unironically" you brain dead retard?

Boost is actually really nice.
ironically I'm doing a short project in Lua today, mostly just so I can move onto something longer in C++ tomorrow.

do you seriously not understand what I meant?

You do you.

doesn't a plugin like that exist already?

No thanks, my shitty youtube videos don't need industry grade colour grading.

No. Java is used everywhere and it always be.

Lua rocks!

Nope, otherwise I wouldn't make it. Reinvent wheel etc.

It does, I'm really pleasantly surprised by how fun it is/

a monad is a monoid in the realm of endofunctors

Indeed, Lua is the language of choice for cute and lovely 2D girls (female).

Attached: aHR0cDovL3d3dy5zcGFjZS5jb20vaW1hZ2VzL2kvMDAwLzAxMy83NDgvb3JpZ2luYWwvbW9vbi1yb2NrLWFwb2xsby0xNC5qcGc= (660x495, 61K)

the fuck is a monoid?
the fuck is an endofunctor?

>unironically
no, Java's just a joke that went too far

a monad is just a lax 2-functor in the terminal bicategory