/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: sicp-cover.jpg (500x492, 95K)

Other urls found in this thread:

github.com/ghc/ghc/blob/master/libraries/base/GHC/List.hs
github.com/idris-lang/Idris-dev/blob/master/libs/prelude/Prelude/List.idr
twitter.com/SFWRedditVideos

Why haven't you learned Haskell yet, Jow Forumsirls?

Attached: monads post.png (1051x184, 60K)

I'm learning Scheme instead.

Posting crossdressing and faggotry related shit in the programming thread and spamming it to no end is a Reddit tactic used to subvert Jow Forums. It's also a tactic used by neo-liberal democrats supporting the Zionist and Wahhabi influence to groom young men into pederasty under the front cover of "letting them to explore their sexuality".
Of course, they also have another cover of fighting for the underprivileged, all while boot-licking the large banks and taking out campaign funds from them, as well as changing the economic accords in their favor.

Attached: pepe_matrix_2.jpg (512x512, 256K)

Because unlike other mainstream languages, Haskell actually has a decent amount of power, and you can keep going far further than in, say, Java. That's why I'm still learning it. That's why I haven't finished yet.

please delete this thread

"No".

then enjoy your dead thread

At least it's not shit like the other one.

There's already a thread here. Delete your thread.
Pederasty has nothing to do with programming.

>There's already a thread here. Delete your thread.
haha get fucked
>Pederasty has nothing to do with programming.
and the post you quoted has nothing to do with pederasty

the Jow Forums oriented dpt has just been deleted !

I need to write a program with c++ which should plot given function and finds its root using scanning method while displaying how it is done.
Don't know even there to start.
Which libraries to use, so what not only I could plot but also make somekind of button and fields to adjust values?

retarded thread is ded
building an android text editor that sends files to my RPie for compilation

Does the program have to display the graph itself, or can it write it to a file like an svg or a csv to be plotted in excel?

Redpill me on LISP

Attached: 1505162071369_1.png (800x311, 145K)

JavaScript rocks!

it has to display graph itself

JavaScript isn't programming.

LISP macro is probably one of the most powerful tool, but also the worst.

scheme is comfy

Why do you need macros when you can just manipulate quoted forms?

it sucks
You'll want a graphics library, or at least a graph drawing library. SFML for example.

Go away, Karlie

C++

>when you can just manipulate quoted forms?
but whomst'd've arst'd've thoust'd've quothingst'd've?

Does the static code that you type end up anywhere in the running program? Or does it just get compiled to object files?

can i plot inside sfml module using something like gnuplot for example?

Posting frogs is the biggest Reddit tactic

So I'm trying to sort the script of a visual novel by going through all elements but only saving japanese characters in a new array of strings.

However if you ignore that western letters still get pick. empty spaces are also picked and count as a box. Is this some sort of encryption tool used by company?

top is the console output

Attached: buck.jpg (1340x456, 136K)

I don't know. It can display images though, so you could probably use both together.

I would try to find out if you're making a stupid mistake or misunderstanding the format. And if you can't find out what's happening then look at the format from the perspective of the bytes to see what what empty spaces are encoded as to see how to filter them out.

It's the best fun language.

Looks like you're in some kind of unicode parsing hell.

late-ass response to some things from the pruned thread:

>should I learn C before C++?
C++ is one hell of a rabbit hole, and learning it to the point of genuine proficiency is a hefty undertaking (if not a never-ending process). so getting comfortable with C first isn't a bad idea. it's not strictly necessary, though. see below for a pitfall to avoid

>I tend to program like I'm using C with a few classes bolted on. Don't be like me. If you want to learn C++ then learn C++
this. if you're going to learn C++, learn modern C++, and learn it right (good C++ code is better than good C code, but bad C++ code is worse than bad C code; half-assing it isn't worth the effort). C++11/14/17 add many invaluable features / STL components which allow for much more concise, robust, expressive, and/or efficient code compared to analogous old-school implementations. you don't have to use all of them (by all means you should pick and choose based on your requirements), but you should make the effort to learn them in order to best inform such decisions, and ensure you aren't missing out on things which could greatly improve your code

>The advice online about how it's 'wrong' to teach C as part of teaching C++ is more about improving how quickly we can teach the essentials of C++ rather than because it will make you stupid
it won't make you stupid, but there is a tangible risk of picking up an irrational aversion to higher-level abstractions than those provided by C (a common affliction in the C community), based on the blind assumption that they must incur some performance cost (despite the fact that this is very often not the case; zero-cost abstractions are a major focus for C++ / the STL). ironically, it's often possible to implement things more efficiently in C++ than in C (where generally an equivalent C implementation is not *impossible*, theoretically speaking, but certainly intractable/unrealistic in practice), while still benefiting from many high-level abstractions

post a screenshot of your code, faggots

Attached: scrot.png (2560x1312, 316K)

Trying to learn C++ templates. Why is this not a constant expression?
>warning: variable length arrays are a C99 feature [-Wvla-extension]

#include

template
constexpr size_t sum_sizes(T elem)
{
return sizeof(T);
}

template
constexpr size_t sum_sizes(T elem, Args ...rest)
{
return sizeof(T) + sum_sizes(rest...);
}

template
void testme(Args ...list)
{
char arr[sum_sizes(list...)];
printf("Array of size: %zu\n", sizeof(arr));
}

int main()
{
int a, b, c;
double d, e;

a = 0;
b = 0;
c = 0;
d = 0.0;
e = 0.0;

testme(a, b, c, d, e);
return 0;
}

>not std::make_unique

I'm trying to execute a external program from Java, it's a console application in which I don't care for the output, nor does it have any parametres. I just execute it and the program should process some files I have. The problem is, I can't seem to run it in the "normal" method like this one:
String cmd = System.getProperty("user.home") + "/Desktop/a.exe";
Process process = new ProcessBuilder(cmd).start();
process.waitFor();


I can see the process a.exe is running, but it never finishes. If the third line (process.waitFor()) is commented, the program won't even execute. And if I do it like this:
String cmd = System.getProperty("user.home") + "/Desktop/a.exe";
Process process = new ProcessBuilder(cmd).start();

InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;

System.out.printf("Output of running %s is:", Arrays.toString(args));

while ((line = br.readLine()) != null) {
System.out.println(line);
}


It runs normally, the output is shown on the NetBeans console correctly. The problem is, I would need to call this program many times and showing the output makes it run extremely slower. What should I do?

Oh, and this a.exe is a C program I compiled that prints on the screen from 0 to 50000, just to test. The program I really want to use does the file processing, but it runs similar otherwise.

why
>faggots
(-__- )

should I buy picrelated and wear it to work

Attached: sicp.jpg (856x820, 57K)

>not wearing a LISP shirt

Attached: ra,fitted_scoop,x1950,101010 01c5ca27c6,front-c,445,420,420,460-bg,f8f8f8.lite-4u1.jpg (420x460, 20K)

My bud says that aspiring graphic programmers should start right from dx12/vulkan

Isn't he a mad lad

It's like saying that aspiring programmers should start right from C instead of Perl. He's not half wrong.

Hell ye buddy

Attached: DANK MEME 2018-09-15 at 22.11.06.png (1536x1024, 117K)

jej

I think games nowadays it's more about assets

Attached: 1537033605017.png (1024x768, 91K)

lol no.
It's like saying you should start with swift instead of anything else because it's newest.

someone post the programming projects image

An invocation of a constexpr function is only a constant expression if all its arguments are also constant expressions or are unused.
a, b, c, d, e are all "used" because they are copied to initialize elem in each invocation of sum_sizes.
If you were to make the arguments to sum_sizes references then that would not count as a "use" of the variable and it would compile happily.

No, it's not. D3D11 and OpenGL are contrived abominations that don't map to current hardware and carry decades of baggage and cruft. Going forward, D3D12 and Vulkan are a hell of a lot more sane, especially once you start seeing higher-level libraries that use them under the hood coming out.

Why you still advertising this book? Really

Thanks man

>trying to find a general and precise method of proving deadlock- and starvation-freedom for programs using locks
>it all comes back to well-founded relations, which are already used heavily to prove termination of straight-line algorithms since they correspond to induction
I should have seen this coming, really.

>C++ has template template parameters
>C++ has had this since C++98
Why am I only now discovering this?

not OP but I don't see the problem with it:
>it's free as in free speech and also free as in free beer
>it's universally acclaimed and accepted as a standard instruction for teaching PCP

He should start by writing a software renderer with nothing but an array of pixels and some means of blitting to that a window.

What am I missing?

Machine Measurement = Identity - Evaluations ÷ Users Priorities

|||

Machine Learning = Identity + Measurements - Recursive path

elixir ?

What YouTube channels do you recommend for learning more deeply about programming languages?

Why is the Haskell prelude so ugly compared to Idris?
github.com/ghc/ghc/blob/master/libraries/base/GHC/List.hs
github.com/idris-lang/Idris-dev/blob/master/libs/prelude/Prelude/List.idr
Take the scanl function for instance.

*tips fedora*

If you mmap the tty does it let you do i/o directly without need for streaming and allow you to do it at any arbitrary buffer position without need for control sequences?

ve you heard of those things called books

stop with blogs, videos and other shit

Compiler optimizations.
>This peculiar arrangement is necessary to prevent scanl being rewritten in its own right-hand side.

c++ weekly with jason turner is a good one for staying on the edge of new STL features

Because Idris is the superior language, obviously.

But why doesn't Idris have it? Do they prefer idiomatic code over performing code? Is it a side effect (no pun intended) of laziness?

It's got nothing to do with idioms or laziness, it's just that Idris doesn't support compiler optimizations like Haskell does.

Edwin puts features and correctness before performance. But has said eventually he does go back and do performance refactors.

Idris is written in Haskell m8.

>underscore prefix

Attached: 1536678902207.png (1280x720, 588K)

>the Idris compiler being optimized means the code it produces is optimized

Attached: 1523386635027.png (645x773, 23K)

>didn't post his code

stop posting frogposter

honestly lose all interest in discussion/argument whenever i see a wojack_brainlet.png posted. I filter most of them anyway because 99% it's just an inane greentext.

>I filter most of them anyway because 99% it's just an inane greentext.

Attached: 1525891708311.png (229x220, 6K)

Both make sense. It just surprised me, because most Haskell learning books don't mention such things.

Technically it's a GHC feature, not a standard Haskell feature. So really the question should be "why is the GHC prelude so ugly?".

Very true, but the only relevant Haskell compiler is GHC.

A cli for my software. In the end there will be a gui, but I want a quick prototype. Also the software will support scripting, so a cli will help with that.

Yes. In practice, if you're using Haskell, you're using the GHC. However, books aren't written with that in mind, so as to be more generally applicable.

Even if most C code on Linux is compiled with GCC, a book about C on Linux is probably not going to talk about GCC extensions.

Attached: unknown.png (991x994, 60K)

There isn't any other good book that teaches the same but with a actual lenguage not lisp¿ really

Does anyone have material on the different types of threading and coroutine systems?

Like what constitutes pthreads vs Lua-style coroutines vs fibers, etc.

lisp is the mother of all functional programming languages

doesn't mean lisp is a good FPL, which it's not.

I need to store a user password in a DB in order to access yet another DB.
I don't want to store it as it is, but I can't do a one-way cryptography either. I need something relatively safe that's also reversible.
Is there something I can read about it?

you can absolutely do good fp in scheme

you must be that haskell anime retard

carry on wayward son

font?

lambda calculus is. haskell or ml have not much in common with lisp.

FP without static types is a lesser-form.
nope an idris intellectual.

your type autism does not define fp

ARM's documentation is truly stinking

thousands and thousands and thousands of pages of shit no one cares about, and then you find that the information you need isn't actually written down anywhere

no, but you can't argue dynamic FP loses a lot of benefits static FP can guarantee.

i'll just continue using procedural programming with first-class functions and closures, thanks

A thread is a unit of execution that is known to the operating system. A thread has an OS-state like runtime, priority, scheduling class, pending signals and so on. The operating system switches between running various threads by swapping out the register states and the os specific thread data. You can also do this yourself in userspace, although you lose out on the per-thread info. Fibers have their own stack, whereas coroutines could be implemented as stackless continuations like clozures. Fibers and coroutines are scheduled by the programmer and run inside the context of a thread, whereas threads are shceduled to CPU cores by the OS.

those benefits are the same benefits present in any paradigm

can't argue dynamic FP doesn't lose*

talk to me when Lisp can do totality and other compile-time checks.