/dpt/ - Daily Programming Thread

Old thread: Lisp is the most powerful programming language.
I don't care about what you're working on.

Attached: LISP.jpg (430x299, 44K)

Other urls found in this thread:

youtube.com/watch?v=u_ij0YNkFUs
nerdparadise.com/math/lineintersectsaplane
en.cppreference.com/w/cpp/filesystem/recursive_directory_iterator
pastebin.com/77xt5GtZ
twitter.com/SFWRedditVideos

I'm working on a winforms app and also learning Oracle SQL.

What books should I add to my Lisp collection?

FUCK LISP

>when you get to live out your sexual fantasies while also landing a nice jr. dev job as a self-taught C++ developer

youtube.com/watch?v=u_ij0YNkFUs

Attached: this is nice post.gif (299x374, 852K)

An obituary

land of lisp and sicp are all you need

What are you working on, Jow Forums?

Attached: 1567977076132.jpg (1280x720, 329K)

As a C fag, I've tried learning C++ multiple times in the last 5 years but it is just so tedious. Every nook and cranny of the language seems to be packed full of technical idiosyncrasies which wouldn't be that bad if the language wasn't comprised of 33% nooks and 33% crannies. I feel like there's only 1/3 of an actual language there and 2/3 of a brainstorm on amphetamines.

Are there any good books that introduce a sane subset of C++ without diabetic levels of syntactic sugar.

describe your fantasies

Forgive me father for I have Java'd.

Attached: Screen Shot 2019-09-18 at 10.35.40 PM.png (597x572, 16K)

Looks nice, desu

I'm trying to learn Idris and Emacs at the same time. oof.

How do I calculate whether a point is in front or behind an infinite plane (with a Vector3 position and a Vector3 normal)?

Attached: big anime tits.jpg (1051x1360, 184K)

I don't know what Idris is, but I will guess it's a meme parens lang. I've never used emacs. Once I figured out how to exit from vim I never tried emacs.

cross product

What do I need to take the cross product of?

The vec3 position and the ligma

>How do I calculate whether a point is in front or behind an infinite plane
with respect to the origin?

Yes, the origin/position of the plane is not always zero

What situations would C# be better than C++ to develop in? What about vice versa?

You shouldn't use C++ for any purpose, so C# wins by default. It's still pretty shit, though.

maybe use the triangle equality extended to 3 dimensions?

FUCK the origin. It doesn't deserve my respect.

The sane subset is called rust.

C++ is better for small high-performance algorithms because it is more predictable and has better codegen
For anything else (other than hacking 3rd party applications or targeting non-desktop environments) C# is better

I don't think triangles can represent infinitely large planes

>ligma
what's this?

nerdparadise.com/math/lineintersectsaplane

C# is useful when you need to interact with COM or the CLR.
C++ can do it, but not as easily.
For everything else C++ is better, much better.
None of that icky forced OOP crap.
I went back to C# recently for the first time in like three years since I started using C++ full time, I cannot believe I enjoyed writing it.

I already have a line plane intersection algorithm, but I need filter out rays that never hit the plane

C# doesn't force you to write object-oriented code

ligma balls GOTEM

Attached: 1568411877945.jpg (510x614, 89K)

Wouldn't that make the line parallel to a line within plane... Or, it would have to be perpendicular to the normal! Can you take the dot product of ray and normal?

*If the intersection was behind viewer then intersection distance would be negative.

is learning ruby for weebs?

What does your video have to do with your post?

Not at all.

Attached: Kanzaki_Ranko_Holding_Ruby_Programming_Lang.png (659x990, 480K)

>Wouldn't that make the line parallel to a line within plane... Or, it would have to be perpendicular to the normal!
???????????

>Can you take the dot product of ray and normal?
I do take 2 dot products to calculate a mysterious numerator and a mysterious denominator

>*If the intersection was behind viewer then intersection distance would be negative.
If I'm not mistaken then a distance between 2 points is always positive though?

...I guess I'll post the algorithm when I get around refactoring and analyzing how it works exactly

Isn't ruby dead at this point? I thought only webshitters were using it, and they moved on to the next meme language/frameworks years ago.

Attached: 1561544563636.png (850x1200, 646K)

He should probably be learning Common Lisp instead.

Nobody asked, you stupid lispshitter.
How much autism do you need to have in order to spam these threads like you do?

Man, I'm just sayin', Common Lisp can be wonderful to learn given the right books. It's great fun.

I just started programming today, i learned a lot! rate me

#include
// this progams checks if NumberToTest is pair
using namespace std;

int main() {
string IsPair = "Pair";

int NumberToTest = 20;
if(NumberToTest == 0)
IsPair = "Not pair";
for(int i = 0; i < NumberToTest; i++) {
string TempString = IsPair;
if(IsPair == "Pair") {
IsPair = "Not pair";
}
if(IsPair == "Not pair") {
IsPair = "Pair";
}
if(TempString == IsPair) {
IsPair = "Not pair";
}
}
cout

>C++
0/10

>comparing strings with ==
Is this how sepples does?

but user, Jow Forums told me to start with C++

Whoever said that was a literal shit-eater.
Jow Forums is not one person.

Is that guy who wrote his own ncurses music player using libmpv around? I'd like to see some code if possible

Probably don't wanna have capitalized variables, camelCase is best practice.

Should I learn Ada?

Attached: Shiomiya_Shiori_Holding_Shy_Ada_95_From_The_Beginning.jpg (1052x1342, 402K)

Not in C languages, they use Pascal case, except for C itself I guess

>music player using libmpv
Jesus, that seems like an extremely excessive dependency.

>camelCase is best practice
Disgusting.

It was this guy, found his post in the archive, but no code

Attached: 1568054185980.png (1918x1080, 2.06M)

I always thought that camel case was standard across most programming languages.

Many "modern" languages actually use a Frankenstein mix of them.
C doesn't have an "official style", but it heavily leans towards snake_case.

using namespace std;
is generally considered a bad practice; std::string is preferred

Isn't Ada a deadlang?

No, I use it every single day

Only for Java and it’s descendants.

So this is what happens when people start with c++

Yes you can overload the equality operator to be whatever you want. You don’t need some abomination like compareTo methods to make up for deficiencies in the language.

truly the highest IQ board.

Jow Forums also told you to delete system32.

So bros, i want to use Rust for a site backend, its not a problem cause Rust is actually pretty good at that but the problem is, i dont have an idea on what website would need the Rust speed under the hood, is there anything that you can generally do in the browser that would benefit from talking to a fast as fuck backend? Maybe some video/image processing?

Attached: 346634.png (1200x897, 34K)

You'll appreciate the low performance overheads when you exceed 10,000 concurrent users without getting your VPN account suspended.

Do you have anything else to do that isn't shilling lisp without even making relevant posts about it?

>You can literally write Lisp inside of Rust by using macros
How will Lispfags ever recover

// based on post #include
using namespace std;

int main() {
string msg;

int N = 20;
if(N < 1) { cout

the very first invited speaker is a tranny in high school

>Try to use std::filesystem::recursive_directory_iterator
>It always throws an exception at the end

Attached: 1565423654083.jpg (537x810, 63K)

Zoom-to-fit seems to work now. Need to bind something to toggle between zoom-to-fit and normal and then get panning/scrolling working.

Attached: Screenshot from 2019-09-19 13-46-13.png (640x523, 241K)

Based overlords Google and Facebook doing whats right

Attached: 53232523525.jpg (1889x923, 268K)

C does not have this problem.
#include
#include
#include
#include
#include

static void walk_dir(int cwd_fd, const char *path, int level)
{
int fd = openat(cwd_fd, path, O_RDONLY | O_DIRECTORY | O_CLOEXEC);
if (fd < 0)
return;

DIR *dir = fdopendir(fd);
if (!dir) {
close(fd);
return;
}

struct dirent *dirent;
while ((dirent = readdir(dir)) != NULL) {
const char *name = dirent->d_name;

if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0)
continue;

for (int i = 0; i < level; ++i)
printf(" ");

printf("%s\n", dirent->d_name);

if (dirent->d_type == DT_DIR) {
walk_dir(fd, dirent->d_name, level + 1);
}
}

closedir(dir);
}

int main()
{
walk_dir(AT_FDCWD, ".", 0);
}

Does AWS use Rust now?

neat!

based

I unironically dont see for new companies that are yet to decide their backend stack, when to use C++ instead of Rust for heavy stuff. Like there is just no point

>Ticketmaster
So they went from VAX assembly schizos to rust trannies?

got a job doing GTM

what am i in for (i already know gtm)

How is this a problem? Just stop iterating when you reach the end iterator, since that's what you're supposed to do.

My team lead pays for premium azure tech support or something and they gave him a C# class that bootstraps connections to CosmosDB. The way they implementing deserializing json documents into POCOs was return (T)(dynamic)document. Can some C# wizard tell me how the fuck the dynamic cast causes the json document to deserialize?

for(const auto &e : rdi)
{
//code
}

How should the code be?

en.cppreference.com/w/cpp/filesystem/recursive_directory_iterator
sounds about right, must be a compiler bug
what compiler are you using?

gcc 9.1.0 from the Arch Linux repos.

Lets see them dee pee tee

Attached: 4gd7f7.png (719x45, 53K)

Are there any resources that can redpill me on string comparisons? As in, if I had these:
5 == 5
"five" == "six"
"reallylongstring" == "evenlongerersting"
How to they all stack up in terms of speed? I know that a lot of languages hash everything, but then how fast is that compared to an int? And what's the "cost" of that? Memory? Sorry for newbie questions.

Attached: 1424722099192.png (700x700, 362K)

apparently permission issues will cause an exception
does directory_options::skip_permission_denied change anything for you?
#include
#include
#include

namespace fs = std::filesystem;

int main() {
for(auto& p: fs::recursive_directory_iterator("/tmp", fs::directory_options::skip_permission_denied))
std::cout

depends on the language you're using

but any way, string comparison in general requires you to iterate over both strings until you find a difference.

how do I start debugging why aws lambda isn't sending a request.post?

Integer comparison is always the fastest. Strings are, after all, just lists of integers. With regards to hashing the cost is just the cost of the algorithm to hash the bytes, then it's just an integer comparison after that.

most languages don't pre-hash strings; you need to do that manually unless you're using a storage type that already does that internally (e.g. map/Dictionary/etc.)

That seems to be helping, though this was the exception I was getting. I had tried directory_options::skip_permission_denied earlier and it didn't help. Perhaps I had two bugs at the time.
terminate called after throwing an instance of 'std::filesystem::__cxx11::filesystem_error'
what(): filesystem error: cannot increment recursive directory iterator
Aborted (core dumped)

String comparison is O(1) in the best case and O(n) in the worst case.

Some languages such as lisp/scheme and ruby have the notion of symbols which are "interned" strings. By interned string I mean the virtual mschine converts the string to a number internally, and that string stands in for the number from that point on. So you have strings that are about as efficient to compare as numbers. They work like C enums but with real strings.

Attached: Untitled.png (413x771, 33K)

>>> sorted([9,4,7,3,1,6,5,2,0,10])
[0, 1, 2, 3, 4, 5, 6, 7, 9, 10]

>I don't care about what you're working on.
I finished my first book

Attached: Screenshot_2019-09-19.png (795x177, 20K)

>implement
i banish you back to english 101, Ranjeesh

Are macros in Rust as good as people say? It looks kinda complicated

So I been struggling with this program for a while, the exercise requires me to use a recursive function and I've gone through so many iterations that I've forgotten how the program was supposed to go but I feel I'm getting close
pastebin.com/77xt5GtZ
All honest I don't know what else to do.

Attached: FILE633.jpg (493x348, 21K)

This is probably a stupid question but is it possible for code that's not even being run to crash a program in c++? I'm going crazy over this right now and there's this line of code where when I comment it out the program doesn't crash and when I don't comment out the line I can get the program to crash fairly consistently. It could be pure randomness that it's just by chance only crashing when I have this line of code but I've tested it so many times I feel like it can't just be randomness unless God is fucking with me. But the thing is, this code shouldn't be getting run. It's behind an if statement where one of the conditions I made && false for testing purposes, and I added a line to print a test string just in case and that test string isn't getting printed. I'm basically certain this code isn't being run. But I don't know what else could be crashing my program and when I comment this out everything seems fine.

That's the same error message I get when there's a filesystem permissions error.
In contrast, when I try to increment past the end iterator, I get a segfault with no message.