[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 313
Thread images: 30

What was you working on before you dropped it, /g/?

Old thread: >>59383468
>>
C#
>>
>>59397998
watched some c# tutorial on youtube and got to like video 10 and i dropped it lol programming is hella confusing
>>
A game in unity (C#)
>>
>>59397998
Lisp.
>>
ur mom
>>
>>59397998
My ambition.
>>
https://nntpchan.info/

may start adding country flags to the frontend repo but eh
>>
>>59398180
Sounds like a legal nightmare.
>>
chilling at codewars
>solve a problem using c
>same solution in js times out
>>
Do you give your classes cool -non-cringy- names?
>>
File: 1488546340454.jpg (84KB, 1280x720px) Image search: [Google]
1488546340454.jpg
84KB, 1280x720px
>>59398246
>classes
You mean typeclasses, right anon?
>>
>>59398246
Anything that isn't easy to understand and descriptive without being too long is cringy.

A cool name is cringy.
>>
are there any good programming games?
>>
>>59398265
Yes, otherwise we would have to deport him right away.
>>
>>59398279
SHENZHEN I/O
tis-100
>>
>>59397998
Working with MFC in C++ atm, not sure what to make of it. This doesn't get used at all anymore, does it?
>>
>>59398414
>C++
>This doesn't get used at all anymore, does it?
only by subhumans.
>>
>>59398414
> MFC
Isn't it dead and buried?
>>
>>59398436
it gets resurrected here where I am studying for everyone done with classes/inheritance in c++

general module plan is

c
sql
c++ (+MFC)
c#
java

everything over 2-8 weeks respectively
>>
>>59398414
there is a ton of legacy mfc code that needs maintenance I believe
companies shat out a lot while waiting for c#

as for new stuff, no, nobody uses it anymore
>>
is there any option or way without base64 or rot13 to encrypt a password in a python source code? any tip or help guys?

#    create a interactive shell
chan = ssh.invoke_shell()

# enable!
chan.send('en\n')
time.sleep(1)
resp = chan.recv(9999)
# print resp

# enablepassword!
chan.send('enablepassword\n')
time.sleep(1)
resp = chan.recv(9999)
# print resp
>>
File: 1482389545048.jpg (121KB, 599x880px) Image search: [Google]
1482389545048.jpg
121KB, 599x880px
>>59398672
>base64
>encryption
>>
Anons

I met this guy the other night while I was drinking. He called himself an "automation engineer", and said that he programmed factories.

He told me that there were two languages he used for it. He showed me an example of a program in one of them and it basically looked like he was drawing a state diagram. Obviously very high level languages. I don't remember the names because I was drunk.

Anyone know what languages these might be? I studied computer science but never heard of anything like this.
>>
>>59398783
nevermind I found it.. one of them is called "Ladder logic". have any anons used this ?
>>
>>59398783
https://en.wikipedia.org/wiki/IEC_61131-3
>>
>>59398689
>base64
>encryption

yes, that was stupid written from my side, shame on me. it's not kinda encryption I know that, too
>>
>>59398828
yep that was it. looks pretty low level actually.
>>
>>59398823
It's just a way for CS-illiterate electrical engineers to program simply logic in PLC, there is not reason to use if you aren't one.
>>
What was the last tool you built to assist you with programming in some manner?
>I haven't built any
Well we all have to start somewhere obviously.
>I'm 18+
Oh.. Well, maybe you should get on that now?
>>
>>59398823
I've come in contact with it. Management told me to translate that junk to C because they don't have people who program in that anymore. And there's so many different flavors of tools for this it really doesn't make sense to try to find people who know how to program it. But this was for PLC. I'm not exactly what automation entails.
>>
>>59399023
He told me that he used it to program PLCs. I think he called himself an automation engineer because he programmed the "automation" of the factories.
>>
>>59398672
Not really, any encrypted form of that password would require there also being a key in your script which would make it pointless.

Either prompt the user for the password, or if it needs to be automated, keep it in your script(or an external file) with the proper permissions so that only your user can read it.
>>
Been working on embedding Guile as scripting language for a game engine. Managed to create an ingame repl as well.
>>
Why sticking certain functions to certain types of data is not considered to be a good thing?
>>
File: Capture.jpg (25KB, 838x70px) Image search: [Google]
Capture.jpg
25KB, 838x70px
Is it possible to do this in one loop instead of making all possible subset of initial set, thus wasting 2^n steps?

Solution says yes, but they didn't write the program

I know how to do it with all subsets, but i'm interested in more optimized solution
>>
-> 59399177
Please do not use the following when promoting your reddit garbage here:
1) A Karen image.
2) An anime image.
>>
>>59399177
If you're thinking about OOP, that's not all OOP is.
Practically nobody is complaining about member functions. Though if you make use of implicit this pointers and whatnot it reduces code reuse unless you do inheritance and suddenly you're inside the event horizon of OOP.
>>
>>59399181
To be clear, they didn't say it's possible to do it in 1 loop, maybe they meant 2 loops, which is still faster than 2^n
>>
File: itscool.jpg (229KB, 365x587px) Image search: [Google]
itscool.jpg
229KB, 365x587px
Isn't C just a scripting language for low level stuff at this point?

Feel free to reply with your opinion.
>>
>>59399206
Yeah, pretty much.
>>
>>59399170
>not making your own language
pleb identified.
>>
>>59398015
Why? It seems to be better than Java.
>>
>>59399256
Trash language.
>>
>>59399206
>scripting
I don't think you know what it means.
>>
>>59399256
It is.

Problem is that you get made fun of here because /g/ hates Microsoft, so I had to stop using it.
>>
>using C* of J*va
>>>/r/ibbit
>>
File: pizza.jpg (71KB, 550x550px) Image search: [Google]
pizza.jpg
71KB, 550x550px
I intend on taking over the OP, can someone please post their best OP image(s)? Give me your absolute best.
>>
>>59399291
Is this image real?
>>
>>59399291
>american education
>>
>>59399306
Probably.
I had a physics teacher who didn't believe atoms could be split. We had multiple discussions about it to ensure that she was in fact retarded and not just wrong.
>>
>>59399291
Remember that only anime image makes /dpt/ OP image.
>>
>>59399200
if you're doing two loops you're basically only checking pairs aren't you

see if sorting the list helps
>>
File: zooey.gif (817KB, 200x233px) Image search: [Google]
zooey.gif
817KB, 200x233px
>>59399291
>>
I may have procrastinated in my Operating Systems homework. How difficult should it be to improve an OS I wrote in C/ASM that simply prints the value of the EAX register to the screen, to instead capture keystrokes and write them to the screen?
>>
>>59399181
The subset sum problem is NP-complete, so there's no known algorithm which time complexity in the worst case is O(2^N), despite it being a decision problem.

However, there are some ways to make it somehow faster in practical cases, beneath them:
- dynamic programming: using results computed on subsets of the input to compute a result on the input itself
- integer linear programming: turning the problem into a system of linear equations and pass it to a solver. If there is a solution, it may find it quickly thanks to some heuristics and optimized backtracking techniques.
- approximation: under some conditions (for example how near the numbers are from each other), the polynomial time complexity approximation algorithms can give the same results as a brute-force algorithm.
>>
>>59399268
You know English is considered as a really bad language too, so your your argument is insufficient.
>>
>>59399379
But it's not. You not being able to speak it doesn't somehow make it "bad".
>>
>>59399181
>yet another knapsack's np-complete cousin
damn, I remember fucking up this problem in highschool

there is a "neat" dynamic programming trick, explained here https://en.wikipedia.org/wiki/Subset_sum_problem

basically, fill up the 2d array of partial solutions starting with n = 1
>>
>>59398031
https://scratch.mit.edu

>>59398279
HackNet on Steam seems kinda cool.
>>
>>59399376
>so there's no known algorithm which time complexity in the worst case is O(2^N), despite it being a decision problem.
wew I meant "time complexity in the worst case is LESS THAN O(2^N)"
>>
>>59399181
btw, what's that book called?
>>
Does anyone know algorithm to find all available paths in a graph from one point to another? I can easily find the longest one, the shortest one, but not all paths...
>>
>>59398015
So why are the giant enterprises still recruiting c#/asp/xamarin engineers?
>>
>>59399436
>>59399256
I was just firstposting.

I haven't dropped C#. It's my main language. Easy as fuck to get pretty much anything done in C#.
>>
>>59399420
depth first search with backtracking
>>
File: programming considered harmful.png (87KB, 853x621px) Image search: [Google]
programming considered harmful.png
87KB, 853x621px
>>59399291
>children are more imaginative than their teachers
Not surprising, but also terribly self-reflecting.

>pic related
is my proposition for OP.
>>
>>59399420
Isn't the simplest solution just a Flood?
>>
>>59399413
http://www.introprogramming.info/english-intro-csharp-book/read-online/

Pretty hardcore for a total noob like me, ut i like it because it's a mix of basic c# and actual programming logic (that logic is way harder than learning the language itself)
>>
File: c-1.png (357KB, 454x603px) Image search: [Google]
c-1.png
357KB, 454x603px
>>59397998
I tried picking up C++ a while ago, attempting to write a web framework with it just to try it out and see what it went for.

Ended up dropping it because, while C++ has features that seems nice over C on paper, like RAII or symbolic initializer lists, it seems that for whatever reason it's just impractical in practice. I'm not entirely sure why, but it just feels like nothing comes out convenient in the end. I guess one reason is that you have to write a whole class with three different constructors and two assignment operators for whatever little thing you want to manage.

It feels like I'm just getting the worst of both worlds whatever I do: The inconvenient parts of C, along with the inflexibility of Java. I'd rather just use one of those instead, and get some of the good stuff also.
>>
>>59399465
plan9 people are the worst, it's hard to say whether I'd rather spend time with plan9 people or furries
>>
>>59399503
>plan9 people
Do they still exist? Or aren't they an endangered species?
>>
>>59399502
You can just treat it like C with better namespace management if you really like C.

C++ is really good if you just treat it as procedural for most things and OO for really complicated Self contained objects.

In games for example; a good way to do it is to make most everything Procedural with the exception of Components, Blueprints and the Engine System blocks.
>>
>>59399360
You'll need to write and IRQ manager. If you really only want to capture your keystrokes then it's a matter of an hour max. If you want to make an actual system of it eg a shell then it will take several days or weeks as it requires setting up all descriptors, memory management, etc. Since you mention eax I assume you are doing protected mode then youre in luck because many tutorials exist.
>>
>>59399531
Nice first time I see someone post sensible about Cpp and not just the usual memes.
>>
>>59399528
they exist on Rizen and Freenode, thank god they keep to themselves but sometimes they leak out >>59399465
>>
How do you find in C# the count of all elements in array that are NOT 0?

arr.Count() returns all elements, but i need only those that are not 0
>>
>>59399570
Found it

arr..Where(x => x>0).Count()
>>
>>59399561
its what I grew up on; C, C++, ASM(pic32/x86/x64)
Also, it turns out that C# isn't amazing for speed
and C isn't great when you have extremely complicated objects
so C++ is great for games (which need both)
>>
>>59399570
Iterate on your own
>>
File: lang-matrix-2.png (463KB, 785x678px) Image search: [Google]
lang-matrix-2.png
463KB, 785x678px
>>59399531
>You can just treat it like C with better namespace management if you really like C.
You *can*, but then you could just as well write C and not get mangled symbols.

>C++ is really good if you just treat it as procedural for most things and OO for really complicated Self contained objects.
What I found is that the OO-influenced parts of C++ end up "contaminating" the C inheritance, though. Since everything kinda "wants" (not "requires", but wants it heavily enough to make you feel dirty otherwise) stuff like const-correctness everywhere, references, RAII-handled resources, proper classes for using any library, and whatnot, it limits the ability, or at least willingness, to write more C-like code. And even if you try to regardless, it ends up looking kinda ugly and weird.

Not to mention that you end up having to put everything in header files, so every time you change some little implementation detail, you end up having to recompile the entire project since everything depends on those headers, at which time you also start noticing that the C++ compiler takes an order of magnitude more CPU time and RAM to do its job than the C compiler.

C++ seems like an attempt to mix two very different programming styles which, while they *can* mix, don't mix very well, and the result ends up grainy and unappetizing.
>>
>>59399570
Not doing C#, but knowing a little LINQ, you could either iterate on the whole array or filtering it and applying Count() on the filtered array.

>>59399607
Ah.
>>
>>59399538
Thanks. Yes it is protected mode, not a shell. Just captures keystrokes and writes the data to VGA memory 0xB8000.

I'll probably just have to set up an IRQ manager like you said, then fault handlers and a service routine for the keyboard inputs
>>
>>59399607
I think it would be more efficient with Aggregate, something like
arr.Aggregate((acc, value) => value == 0 ? acc : acc + 1)

because this is just a single loop without allocations, while Where creates a temporary IEnumerable.
>>
>>59399677
What is acc here, next elements in array?
>>
>>59398672
Use private/public keys you fucking dingus
>>
>>59399616
I personally disagree, but then I don't tend to mix libraries and tend to avoid building things that rely on the aspects that require const correctness.
I can see where you are coming from though.

Like I said, I tend to use it because it lends itself to things like game programming well, but allowing both a higher level management of data, as well as allowing you to write large amounts of code with a little bit better namespace management than C but otherwise almost just straight C.

Also, about the Header files; you can mitigate this through some amount of templating (though i don't suggest it for most things) and pre-processor shenanigans. It does come up more often if you are treating it very like a procedural programming language though.
>>
>C# on Windows
Should I use SharpDevelop or VisualStudioCode?
>>
>>59399656
Translating the keystrokes to something human readable takes a bit more work. I'm sure you'll manage. Good luck!
>>
>>59399677
It's all a question whether you prefer style over efficiency. Of course, it the array would have millions of elements, I would recommand efficiency.

>>59399706
acc is the ACCumulated number of values which are equal to zero. You start with acc=0, and it increments each time the current value is equal to zero.
>>
Is there even a sorting algorithm that could beat quicksort. And I'm not talking about randomized quicksort, hell I'm not even talking about randomized quicksort with a cutoff. I'm talking about randomized quicksort with a cutoff using a median of three to chose pivot as well as employing 3-way partitioning.
>>
>>59399743
Bogosort
>>
>>59399731
Are you retarded, use Visual studio

If you meant linux, you can also check jetbrains rider
>>
>>59399756
Nah, sleep sort (© /prog/)
>>
File: lamb-05.jpg (263KB, 800x534px) Image search: [Google]
lamb-05.jpg
263KB, 800x534px
>>59399607
>>59399677
>>59399570

Count takes a lambie, actually.

arr.Count(x => x > 0);
>>
>>59399762
>2017
>US scandals
>not using self-built, free and open source software
Sorry but you are retarded.
>>
File: sadtruth.png (134KB, 603x502px) Image search: [Google]
sadtruth.png
134KB, 603x502px
>>59399787
>self-built
>free and opensource
gl with cia injections in your opensource
>>
>>59399831
care to share muxExtension?
>>
>>59399831
Disregard this, need bigger sample sets and more iterations.
>>
>>59399270
We value your opinion.
>>
>>59399616
For me compile times are the most frustrating thing about Cpp. Throw in a few templates and it quickly becomes hell as long as you have it a bit too close to the base of your program. I'm sure you waste less time hand writing the different cases in the long run.
>>
File: emacsvimicons.png (106KB, 471x381px) Image search: [Google]
emacsvimicons.png
106KB, 471x381px
>>59399833
>claiming they are just two types of foss
Typical for a 4chan shitposter.
>>
File: Capture.jpg (22KB, 841x71px) Image search: [Google]
Capture.jpg
22KB, 841x71px
>>
>>59399833
You have a fundamental misunderstandment what Open Source or Free Software is. Please educate yourself.
>>
>>59399927
You're deluded if you believe every open source projected can be realistically audited.
>>
>>59399833
>last sentence
And some fuckers believed in .NET Core bullshit.
>>
File: lang-matrix.jpg (192KB, 1216x816px) Image search: [Google]
lang-matrix.jpg
192KB, 1216x816px
>>59399728
>I don't tend to mix libraries and tend to avoid building things that rely on the aspects that require const correctness
Me too; I was really only talking about the STL, which I found to be enough of a pain.

>allowing both a higher level management of data, as well as allowing you to write large amounts of code with a little bit better namespace management than C but otherwise almost just straight C.
In theory, I'd agree, and that's why I started trying out C++. I just found that it didn't seem worth it, especially when it's just so easy to implement some very simple vtable-like polymorphism manually. As for namespacing, I also agree in theory, but then again I have a couple of fairly large C projects (one being 150k+ LOC), and in practice I've just never had problems with namespacing. It also really sucks how you can't "import" namespaces in header files, especially when so large a portion of the code of the project ends up being in them.

It's, like, I was hoping for C++ to alleviate some of the more "unnecessary" inconveniences of C that just result from insufficient metaprogramming capabilities, but it seems to add so much overhead to not be worth it.

In the end, I respect people who choose to write their code in C++, and I can see why one might choose to do so, but I hope they can also see why one might opt against it.
>>
>>59399910
No joke. I did some measurements at one time, and the "order of magnitude" figure was not an exaggeration, but actually what I arrived to. If my larged C projects were written in C++, they'd take like half an hour to compile, which is not particularly fun.
>>
>>59399999
kek has spoken
>>
File: anal beads.png (15KB, 1521x73px) Image search: [Google]
anal beads.png
15KB, 1521x73px
>>59399677
Better results in pic related.
Aggregate appears to be the slowest.

var muhRandomNumberGenerator = new Random();
var arrayOfTenMillionPseudoRandomNumbers = Enumerable.Range(0, 10000000).Select(x => muhRandomNumberGenerator.Next(0, 250)).ToArray();
var iterations = 1000;

MuhExtensions.Benchmark(() => arrayOfTenMillionPseudoRandomNumbers.Where(x => x == 0).Count(), iterations);
MuhExtensions.Benchmark(() => arrayOfTenMillionPseudoRandomNumbers.Aggregate((acc, value) => value == 0 ? acc : acc + 1), iterations);
MuhExtensions.Benchmark(() => arrayOfTenMillionPseudoRandomNumbers.Count(x => x == 0), iterations);
>>
Solving some Sphere Online Judge problems.
Do you have any other website with task generator?
>>
>>59399910
I wonder how enginedevs workflow looks like in large gamedev companies. It's clearly not sane to recompile the whole thing, right?
>>
>>59400023
Could you also compare with simply iterating over the array in a for loop?
>>
>>59399964
Oh ya, throw the STL out as soon as you can.
in game programming it is terrible in the long run, the short run it can be used.

I can definitely see where you are coming from, it is likely just a small preference difference that separates us. I tend to use C++ just because I can either Use it like C (and I can ignore the "Dirty" feeling for using it that way) or My project is so complicated that i actually use the more advanced parts of C++

we built a 3D engine and a full game from scratch in C++, tat integrated with C# tools that created content via Macro shenanigans (think " enum Actions { #define <>\n #include "ACTIONSgeneratedByCSharp", #undef numofactions }" bullshit) that exceeded 300K lines (admittedly the 3D renderer was mostly ASM so had like 40K right there) and really needed the object design C++ gave to quickly get new people in on the project. But that is a rather extreme case.
>>
First for C
>>
>>59400047
>It's clearly not sane to recompile the whole thing, right?
isn't that what header files are for?
>>
>>59400058
>Oh ya, throw the STL out as soon as you can.
Having some built-in capabilities for symbolic manipulation seems like half the point of even using C++, though.
>>
>>59399531
>You can just treat it like C with better namespace management if you really like C.
If you're completely alone yeah.
>>
>>59400023
Who would have thought Where is the fastest, what the fuc
>>
>>59400058
>admittedly the 3D renderer was mostly ASM so had like 40K right there
why?
>>
>>59400047
Some engines allow for "hot reload" or use custom build systems. But if your are touching the core systems you'll be in for hours depending on how many cores you had. On my Haswell it took a whole afternoon to fully build Unreal Engine 4 from scratch. I haven't tried doing changes to it yet. During my last internship I worked on the sofa framework which is heavily templated and even for plugins (out of engine components) it took almost a minute for a basic simulation (3-4 Cpp classes, around 30 methods).
>>
>>59400058
>3D renderer was mostly ASM
Did you do rendering on the CPU? Why would you do that?
>>
There are no good or perfect programming language.

PHP is massively used in BMW cars doesn't mean it's the perfect language.
https://mobile.twitter.com/irfaanshakeel/status/841678158961229824
>>
>>59400047
we typically break it down into seperate projects and DLLS, then only recompile pieces at a time, with a weekly (usually weekend) Inline full compile, to make sure nothing fails.

>>59400085
its built in to the language, but STL is technically not the best use. It is great for getting started, but it would be like including a giant math library just to use addition. It also is optimized for symbolic manipulation, when most of the time you are doing Pointer and Math Manipulation.
It works, but making your own is both faster and better for your project

>>59400103
it was entirely scratch, it was made to work with DX 9-12, OPENGL and Vulken, it was a monster, and it was extremely fast. We wanted to keep it above 60FPS for basically everything
>>
>>59400144
I'm really not sure what kind of performance boosts you can get from using ASM over standard C code for your 3D engine seeing most of the work is done on the GPU anyway so it really sounds like you're talking out your ass
>>
>>59400047
Game companies do a lot of build acceleration.

I recently watched an ubisoft talk and that Rainbow six game takes ~6 minutes for a full recompile.
>>
>>59400126
Well of course. Everyone knows PHP is shit.
>>
File: anal beads.png (10KB, 1107x143px) Image search: [Google]
anal beads.png
10KB, 1107x143px
>>59400051
Faster, as expected
>>
>>59400144
Interesting, if it's a big company do you mind giving the name so I can have an idea of how much effort is put on something as basic as rendering (if it's small don't bother I don't want you to dox yourself).
>>
File: 1464359007921.jpg (19KB, 500x327px) Image search: [Google]
1464359007921.jpg
19KB, 500x327px
Is setting font size to 0 the ultimate compression method?
>>
>>59400191
Well, Microsoft needs to unfuck its shit up and make Aggregate faster, the fact that a for loop is the fastest makes it unjustifiable.
>>
>>59400186
Maybe in 1999. . .
Just learn a good framework: https://codereviewvideos.com/courses
>>
>>59400260
The ultimate compression is making the concept of nothing represent everything.
>>
>>59400144
engine name and company producing it?
>>
>>59400260
⊥ is the ultimate compression, you can deduce anything from it.
>>
>>59400330
In what way?
>>
>>59400358
∀A ⊥⇒A
>>
>>59400358
A wrong property implies any property. A -> B translates to B or not A.
>>
>>59400358
*cue a song on the topic of suicide, played upbeat, from a pretentious Japanese animation movie*
>>
File: 1489499813799.jpg (90KB, 957x621px) Image search: [Google]
1489499813799.jpg
90KB, 957x621px
I'm making a I'm making a i'm Making a I'm making a I'm making a i'm Making a
>>
What's the best way to do dfs?
class Tree(object):
def __init__(self, adj_list):
self.n = len(adj_list)
self.adj_list = adj_list
self.V = list(range(self.n))
self.E = [[u,v] for u in range(self.n) for v in adj_list[u]]
self.children = self.adj_list

def dfs(T, root):
T.preorder = [None for _ in range(T.n)]
T.inorder = list(T.preorder)
T.postorder = list(T.preorder)
dfs_recurse(T, root, 0, 0, 0)

def dfs_recurse(T, v, t1, t2, t3):
T.preorder[v] = t1
t1 += 1
flag = True
for c in T.children[v]:
t1, t2, t3 = dfs_recurse(T, c, t1, t2, t3)
if flag:
T.inorder[v] = t2
t2 += 1
flag = False
if flag:
T.inorder[v] = t2
t2 += 1
T.postorder[v] = t3
t3 += 1
return t1, t2, t3
>>
>>59399847
Here's the benchmark methods:
public static void Benchmark(this Action act)
{
GC.Collect();
act.Invoke(); // run once to avoid initialization costs

Stopwatch sw = Stopwatch.StartNew();
act.Invoke();
sw.Stop();

WriteLine($"{act.Method.Name} took {sw.ElapsedMilliseconds} milliseconds to run.");
}

public static void Benchmark(this Action act, int iterations)
{
GC.Collect();
act.Invoke(); // run once to avoid initialization costs

var iterationTimes = new List<long>();
Stopwatch sw = new Stopwatch();
for (int i = 0; i < iterations; i++)
{
sw.Start();
act.Invoke();
sw.Stop();
iterationTimes.Add(sw.ElapsedMilliseconds);
sw.Reset();
}
WriteLine($"{act.Method.Name} was ran {iterations} times, averaging {iterationTimes.Average()} milliseconds per run.");
}
>>
File: nig.png (1MB, 643x641px) Image search: [Google]
nig.png
1MB, 643x641px
anybody wanna bet whether this will compile or not?

(also help, I'm pretty new to C)
>>
>>59400709
Are you one of those retarded rust shills trying to write the most retarded C code so you bash it later because that's the most ugly code anybody has ever written.
>>
>>59400709
>malloc(sizeof(front) + sizeof(back));
>>
What's the best for Visual Studio 2017?
- Windows 10 Enterprise x64
- Windows 8.1 Enterprise x64

I read that Windows 10 was particularly slow with constant malware scanning, shitty OneDrive popups and invasive Cortana panel. Is it a true nuisance or is it overestimated?
>>
>>59400775
Cortana and OneDrive are easily disabled. I had an issue with hard-drive performance on a 5400RPM drive, and that was a preview build. No issues these days with any of that.

However, Windows 10 isn't absolutely necessary unless you want to be able to do UWP. Everything else works fine.
>>
>>59400709
>That use of sizeof
Son I...
>>
>>59400709
Apart from the huge leaks and platform dependency on sizeof(int) I don't see anything obviously broken. That being said you should spend a bit more time planning, also there are better suited standard library functions than malloc for what you're trying to do.
>>
>>59400709
>multiplying an Object with a Number
no way, jose
>>
>>59399531
>C++ is really good if you just treat it as procedural for most things and OO for really complicated Self contained objects.
but no one codes like that in the "professsional" world
>>
>>59400818
I checked UWP and it looks not mature enough compared to Qt.
Now I have to check the licence and the .Net Core limitations.
However I will probably install Windows 8.1, devs at work are constantly saying it is more robust.
>>
>>59400751
> the only reason someone would write bad C code is because he's a rust shill
Gee, I guess 90% of C programmers are undercover rust shills.
>>
>>59400762
>>59400838
>>59400860
love you guys

>>59400854
how should i break out of using sizeof so much? i definitely don't understand it well, and what would be better than malloc(I'm just trying to allocate and that's the most basic one I know)

>>59400751
it's probably the result of being a javafag and learning C
>>
Why the fuck would anybody use sepples when you lose the ABI stability that C provides. You could keep using sepples and use extern "C" but none of the fags do it. Then the fucking retards start implementing scripting engines over their cluster fuck of c++ instead of just writing library that provides functionality and C api that other languages could easily bind to. What makes sepples fags such assholes?
>>
>>59400930
>how should i break out of using sizeof so much
Using array notation automatically does the pointer arithmetic for you. Basically you should iterate on index and not on the actual memory size.
>>
Is Haskell a real language? Where can I download it?
>>
>>59400930
Do you still need the front and back arrays after appending? The thing is I'm unsure you're leaving those as such if you expect them to be garbage collected or you still plan to use them afterwards. Also by platform dependency I meant if you want to proceed like that you should use sizeof(int) everywhere instead of hard coded 4 size.
>>
>>59400945
>use extern "C" but none of the fags do it.
but I do senpai and I am a heterosexual btw

I thought that they everyone does it
>>
In C++, is there a way for a template class to use the dot operator on the class it contains?
>>
>>59401050
>C++
Stopped reading right there.
>>
>>59400709
I'm most nervous about this recursive method
I am trying to find the equivalence class of the inputed element (elt)
//e.g. 
//index [ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ]
//array [ 1 ] [ 4 ] [ 4 ] [ 5 ] [ -1 ] [ 6 ] [ -1]
//the equivalence class of 4 is 0, 1, 2

int *
classOfRec(struct ecData * ec, unsigned int elt, int * class, int j){
int i = 0;
while(i < ec->size){
if(ec->data[i] == elt){
class[j++] = i;
class = appendArray(class, classOfRec(ec, i, class,j));
}
}
return class;
}

I'm probably being retarded
>>
>>59400297
No matter what the year is, there's just no excuse for using PHP instead of pretty much any other language.

I get that you may want to use it because whatever framework you may want to use happens to be written in it, but as a language, it has literally zero advantages over pretty much anything else.
>>
>>59401017
>sizeof(int)
ah shit, didn't know you could do that
>arrays after appending
i was expecting garbage
>>
>>59401082
also here is the struct
struct ecData {
int size;
int * data;
}
>>
>>59401108
>i was expecting garbage
In this case make sure you free front and back. Or better do as I suggested before and first realloc "first" to sizeof(front) + sizeof(back), this means if you won't have to manually copy front again and in some cases your allocator can get away with simply extending front without having to copy it at all (so you just have to append back), then you only need to free back.
>>
>>59401094
It looks better than javascript or golang for me.
>>
anybody have tips for having a cozy vimrc?
>>
>>59401157
Copy & paste a cozy vimrc. . .
>>
>>59401157
You make changes to it when you realize you want something to behave in a different way than it does.
>>
>>59401157
Yes, install Visual Studio and Windows 10.
>>
>>59401151
thanks it makes sense
>>
>>59401050
Yes, you just use it. If you try to instantiate the template using a class that doesn't have the operator defined, it will fail to compile.

There was a proposal some time ago about a more principled way to do this called concepts, like with traits in Rust or type classes in Haskell, but it doesn't exist yet.
>>
>>59401191
>There was a proposal some time ago about a more principled way to do this called concepts
Those would honestly fix most of the things I dislike about templates. Only thing left might be the insane compile times.
>>
>>59400709
There are quite a few broken things:

* sizeof(front or back) does not do what you think it does.
* You never increase i in classOfRec, so it will loop forever or until class[j++] = i segfaults.
* Just use sizeof(int) instead of 4.

In the end, wtf are you actually trying to do here? Why is "class" an int pointer?
>>
>>59400985
GHC, but it's quite a bad drug, not tripping at all, not even addicting.
>>
>>59401222
Thanks man, here is hopefully better clarification
>>59401082
>>59401129
>>
>>59401313
I assumed you'd catch it by now but front and back are pointers and thus have a constant size (usually 4 or 8 depending on whether you're in protected/compatibility or long mode). You need to use your size field.
>>
>>59401255
Is there something else which has these qualities?
>>
Why are lists so shit in python?
NTH_TRIPLE = 10000 # Num. of triples to generate

seq = [1]
ODD_NUM = 1
n = 0
for i in seq:
if i > 1 and i%i**0.5 == 0:
a = int(i**0.5)
b_SQR = sum(seq[:seq.index(i)])
b = int(b_SQR**0.5)
c = int((b_SQR + i)**0.5)
n += 1
ODD_NUM += 2
seq.append(ODD_NUM)
if n == NTH_TRIPLE:
break
print(a, b, c)

This takes literally hours to finish, and memory usage for the running process climbs into the GiB (currently at ~2.2GiB and cimbing). What's the point of lists when you can't actually use them?
>>
>>59400179
>when you have never created a game engine
>>
>>59401417
>creates an infinite loop that continually grows an array
>WOW WHY DOES IT TAKE FOREVER AND EAT MEMORY?
>>
How do I keep programming as a hobby when I do it for a living? 8 hours of programming a day is more than enough.
>>
>>59401453
Then don't you fucking retard
>>
>>59401426
No, really. The main challenges to making a performant renderer are what you do on the GPU itself, and how you interact with the API to reduce driver overhead. Doing micro optimizations in ASM won't help at all.

Actually, across the entire engine it's mostly about reducing cache misses and branch mispredictions as well as vectorizing math operations. I don't see where ASM comes into play.
>>
>>59401453
amphetamines
>>
>>59401441
>an infinite loop
The loop is only infinite up to NTH_TRIPLE. The point is, once the list grows, it shits itself - the functionality of the list becomes useless.
>>
Why are lists so shit in Haskell?
[1..]
This takes literally hours to finish, and memory usage for the running process climbs into the GiB (currently at ~2.2GiB and cimbing). What's the point of lists when you can't actually use them?
>>
>>59401313
That doesn't really clarify anything except the contents of the ecData struct, though. (And not so much the meaning of it.)
>>
>>59401417
Whyever would you want to save all the odd numbers you've passed through? Obviously you're going to run out of memory that way, no matter the language you use. Is this a troll post?
>>
>>59401476
but they are illegal
>>
>>59401586
in what shit hole are amphs illegal?

i'm guessing you mean they're prescription only. in which case go to a doctor and pretend you're retarded with "ADD"
>>
>>59401562
Because it's an algorithm, and b = sum of nth - 1 terms
>>
>>59401417
Wew
>>
How long does it take to learn boost in c++?
Also what should I learn after c++? (this is my first language, and I like this, but Storusup says one should know more languages).
>>
>>59401666
3 hours
javascript
>>
>>59401666
>learning C++
>learning boost
Why would you want to do either of these things?
>>
Can someone who knows more C++ than me help me out? I got an assignment to evaluate a string based on a finite state machine diagram our professor provided. However my knowledge on string manipulation isn't all that strong. How can I split up a string based on commas or something? For example, I want to split up a string input from the user like abc,def,ghi by the commas, then evaluate each letter individually. I tried reading some string tutorials but I'm still not all that sure of how to do this.
>>
>>59401417
This is why C is easier to program for. Unless you're retarded you get to experience how fast computers are.
>>
>>59401703
Sane options:
>do it yourself
>strtok(str.c_str())
>istringstream + getline

Insane options:
>boost tokenizer
>>
Does anybody have any recommendations for scraping and traversing webpages using C?
I'm building an nCurses application that is basically just gunna spit me back a bunch of links, and since I've decided to write the interface in C I'd like to keep it under that umbrella without making Python script calls or any of that.

Mostly because I hate python.
>>
>>59401612
But the "nth - 1 terms" are just an arithmetic series. You could even calculate the sum mathematically in O(1) instead of going through an array and summing the numbers.
>>
>>59401762
The hint my professor gave was to split everything by the commas into substrings and go from there.
So abc would be a substring and def etc.
But this doesn't really help as strings are still weird in c++ in comparison to python.
>>
>>59401700
I want to contribute to Bitcoin Core project.
I love the language.
>>
>>59401768
use node.js
>>
>>59401691
>3 hours
Are you mocking me :(
>>
File: parser.png (10KB, 873x44px) Image search: [Google]
parser.png
10KB, 873x44px
My parser supports prefix and postfix expressions and I have some ideas. Still unsure whether I'll make it do symbolic computation or a meme language to shitpost with in /dpt/.

>>59401768
What about libcurl?
https://curl.haxx.se/libcurl/c/htmltidy.html
>>
>>59401845
for me personally*
>>
>>59401859
Absolutely not.

>>59401845
use strtok to split the string by delimiter, store each result in an array of arrays (you should learn to treat strings as character arrays), and then just iterate through that array at each index.

>>59401864
I saw that but I havent a fucking clue how to use it properly. I don't really understand what I'm looking at. Does it return a list of nodes? Do I have to parse the whole page by just starting at the top HTML tag and descending down through each node, hoping I find the shit I want?
>>
>>59401899
>Do I have to parse the whole page by just starting at the top HTML tag and descending down through each node, hoping I find the shit I want?
Due to the tree-based architecture of html pages, yeah this is the sanest way to proceed. Note I recommend libcurl because it's quite mature and well-documented imo, but I don't know much about available html C parsers.
>>
>>59401899
Oh strtok just lets me split strings with certain characters I ask it to use? Holy shit I can't believe this exists. Thanks anon. I'll stop getting drunk before assignments are due I promise.
>>
>>59397998

I was making a simple math program that gave the user some random equations to solve but I just got bored with it.

Now I'm sort of creating a silly interactive story where details of the story change by picking random elements from hashes to be called in certain spots. It's essentially pointless other than being a good way to exercise my beginner skills.
>>
>>59401899
>Do I have to parse the whole page by just starting at the top HTML tag and descending down through each node, hoping I find the shit I want?
Depending on the web page, you could quite possibly get away with just a bunch of regexes to match.
>>
>>59400492
dumb frog poster
>>
>>59401977
It, more specifically, hands back a pointer based on the delimiter.
It's not handing you back a copy of that data.
It's just saying "hey here's the first one, it's at these memory addresses"
If you need to store and manipulate them later, use strcpy into your "storage" array.

>>59401917
Alright I'll give it a go. I've never had to do web scraping outside of using Selenium so this just looks a bit...work intensive.

>>59402038
I actually originally did that and the website changed some minor HTML tags. Wasn't worth trying to redo.
>>
>>59402060
>I actually originally did that and the website changed some minor HTML tags. Wasn't worth trying to redo.
It's not like that can't cause problems even if you parse the HTML into a DOM tree. I too have a couple of web-scraping programs that I've written, some with regexes and some with DOM parsing (using BeautifulSoup), and I haven't found any great difference in maintenance burden between the two.

If anything, it just feels more proper to parse the DOM, but then again that's because I have BeautifulSoup in Python. Otherwise I'd never do it.
>>
>>59401703
void tokenize( const std::string &str, const char delim, std::vector<std::string> &res )
{
const char *s = str.c_str(), *a = s;

while (*s != 0)
{
if (*s == delim)
{
res.push_back(std::string(a, s++));
a = s;
}

s++;
}

res.push_back(std::string(a, s));
}
>>
>>59399910
>he doesn't know about make -j
>>
>>59402138
Why is C++ so goddamn ugly
>>
and I'm sitting here webscraping using Java and jsoup

we /webscrapinggeneral/ now
>>
>>59402147
>make -j
>suddenly uses 50GB of memory out of nowhere
Yeah I'll pass.
>>
>>59402197
>compiling on multiple threads uses more memory than compiling on a single thread
No shit.
>>
>>59399910
>B-but my Turing complete template system
>>
>>59401476
is this what heavy amph usage looks like
https://github.com/syohex
>>
>>59402219
So you admit that's a non-argument.
>>
>>59402147
This doesn't really change anything. Pretty much every sane compiled language allows you to compile with multiple threads. C++ is still slow.

C++ also has a bad habit of making incremental builds take longer because even small changes to headers tend to trigger recompilation of every source file that includes them.
>>
>>59399910
cpp error messages really trigger me sanity desu
at least in visual studio
>>
>>59397998
Some python code.

Note: I like to use any and all languages (yes I use both python and C in separate entities)
>>
>>59402309
All languages are shit.
>>
>>59402309
>he doesn't fuel the great language flamewar
lmao get a load of this nigger
>>
>>59402291
Ada will treat you right, boo
>>
>>59402147
Just because you can make it faster, doesn't mean it's not slow anymore.
>>
>>59402167
that's more C than C++.
>>
File: res.jpg (54KB, 600x128px) Image search: [Google]
res.jpg
54KB, 600x128px
>>59398925
A week ago I wrote a program using imagemagick to batch merge various 2d tiles with each other and shadow maps. Does that count?
>>
>>59402369
I was mostly referring to the signature, all those std::'s
Also improper bracketing
>>
>>59402375
that gives me a good idea
i'll probably never develop it though
>>
File: cpp.png (34KB, 1596x1170px) Image search: [Google]
cpp.png
34KB, 1596x1170px
>>59402291
FWIW, it's not just MSVC. Pic related is GCC -- more or less an entire screenful of fairly complex error messages just because I changed a type to mismatch.

I mean, I get that it's probably just trying to be helpful, but I'm not sure it succeeds. And it's probably not the compiler's fault.
>>
>>59402276

I always thought the point of C++ was that it was so picky and specific about how to do things that it sort of streamlined stuff to be faster than other languages.
>>
>>59402412
C++ is fast. Compiling C++ is dog slow.
>>
>>59402412
Well written C++ can have very fast runtime cost. The compilation of C++ is fucking absurdly complex and slow though.
>>
File: 38.jpg (30KB, 308x234px) Image search: [Google]
38.jpg
30KB, 308x234px
>>59402419
Ah yes compiling. I missed that. Whoops.
>>
>>59402391
You can use
using namespace std;
or
using std::vector;
>>
>>59402333

You like getting loads from niggers, dont you?
>>
>>59402462
>Except if you're writing a header file
>Which you're always doing
>>
>>59402462
That's not a nice thing to do in headers though.
>>
>>59402489
who the hell are you quoting?
>>
>>59402520
>my imaginary friend
>>
>>59402520
If you're referring to the use of greentexting, the rhetoric intention was to keep speaking in the voice of the linked post.
>>
>>59402536
Who said that?
>>59402557
Can you stop tying in this retarded fashion if you aren't quoting anyone?
>>
>>59402613
I am the author of the linked post and I liked that guy rhetoric intention
>>
>>59402613
>Can you stop tying in this retarded fashion if you aren't quoting anyone?
It is a direct extension of quoting.
>>
Are linkedin recruiters legit? Just got a message offering me a chance to interview for a web dev job.
>>
>>59402613
Fuck off newfag
>>
>>59402634
Recruiters are like 70% of the reason to even have a LinkedIn to begin with.
>>
>>59401818
You're right. Here what I came up with based on your advice:
NTH_TRIPLE = 10000
n = 0
SUM = 1
num = 1
while n != NTH_TRIPLE:
if num > 1 and num%num**0.5 == 0:
a = int(num**0.5)
b = int((SUM - num)**0.5)
c = int(SUM**0.5)
n += 1
num += 2
SUM += num
print(a, b, c)

My problem I suppose was implementing the algorithm literally instead of optimizing. However, it's still much slower than the formula representation of the same algorithm, which I've implemented like so:
num = 10000
for i in range(1, num + 1):
a = (2*i + 1)#**2
b = (2*i**2 + 2*i)#**2
c = (2*i**2 + 2*i + 1)#**2
print(a, b, c)
>>
>>59402663
I realize you either have crippling autism or you're new. Either way, stop posting.
>>
>>59402671
>However, it's still much slower than the formula representation of the same algorithm
A "formula representation" of an algorithm has no speed, as it is devoid of an implementation. Only a concrete implementation in an actual programming language can be said to have a speed.
>>
>>59402683
I don't see how this relates to my post.
>>59402687
I think you need to re-examine your assumptions since they have led you to believe something this blatantly and obviously false.
>>
>>59402671
What is even the purpose of said algorithm?
>>
>>59402714
>I think you need to re-examine your assumptions since they have led you to believe something this blatantly and obviously false.
What is this blatantly and obviously false thing?

Also, since noone asked already, what gave you the idea that ">"-lines are strictly and only for direct quotes?
>>
>>59402714
What spectrum are you?
>>
>>59402671
Explain what you want to do with your shitty code and I will make it 100 times faster.
>>
>>59402671
>much slower
The code you posted runs in almost literally no time at all, though. Why are you calling that "slow"?
>>
>>59402731
>What is this blatantly and obviously false thing?
Your entire world view.
>what gave you the idea that ">"-lines are strictly and only for direct quotes?
It's simply delusional to say that they aren't.
>>59402733
This question is completely unanswerable.
>>
>>59402520
>>59402613
>>59402663
>>59402714
Shut the fuck up.
>>
>>59402780
>I'm having a hard time hiding my mental deformity
Sad, senpai
>>
>>59402780
>It's simply delusional to say that they aren't.
One might argue that it is delusional to say that they are.
>>
>>59402698
>Only a concrete implementation in an actual programming language
What do you mean?
And maybe I'm confusing what an actual algorithm is, but technically by inputing a variable integer into a formula it, becomes an algorithm (which uses a formula instead of an implementation of an algorithm).
>>59402716
>>59402745
The first is an implementation of Fibonacci's method for generating primitive Pythagorean triples in the Plato family c - b = 1, the second is a formula which generates identical triples.
>>59402758
The latter runs in no time at all, the first gets slower and slower as the variables grow
>>
File: atashi-6.png (92KB, 448x336px) Image search: [Google]
atashi-6.png
92KB, 448x336px
>>59402520
>who
You mean "whom".
>tying
You mean "typing".

>Try using valid English next time.
...
>>
>>59402813
>I'm having a hard time hiding my mental deformity
Who said this?
>>59402818
That itself would be delusional.
>>59402839
Huh?
>>
>>59402813
>>59402818
>>59402839
Stop responding to bait.
>>
>>59402888
Why are you contradicting yourself?
>>
>>59402888
I'm sprinting to bump limit
>>
>>59401703
>How can I split up a string based on commas or something
import std.stdio;

void main(){
string target = "ceial,ceiwu,382u";
string[int] splits;
int splits_count = 0;
foreach(character; target){
if (character != ','){
splits[splits_count] ~= character;
}else{
splits_count += 1;
}
}
writeln(splits.values);
}


IDK what you mean by "I want to evaluate each other"
>>
How do I program a will and/or reason to live?
>>
>>59401417
What is your code snippet trying to do?
>>
Is it normal to feel autistic at times? What should I do?
>>
File: bible.jpg (180KB, 1200x900px) Image search: [Google]
bible.jpg
180KB, 1200x900px
>>59403126
read this book
>>
>>59403126
Pick a framework for interpreting life/death, morality, and how one should ideally treat one's self.
>>
>>59403187
I like the story of the man who built a boat for every animal xD
>>
>>59403126
>>59403168
Go see a psychiatrist.
>>
>>59403168
Also I have noticed that some anime seem to take this feeling away. Does anyone else have something similar?
>>
>>59403060
In lisp, this is just
(cl-ppcre:split "," "ceial,ceiwu,382u")
>>
>>59403225
>ask a psychiatrist what he thinks about javascript
>doesn't respond
You can't trust these people.
>>
>>59403279
>ask a psychiatrist what he thinks about C
>shills for Rust
You can't trust these people.
>>
>>59403276
I like lisp. The same thing could be done if there was a library in D. Think of the library as std.splitBy
so the code would be:
import std.stdio, std.splitBy;
void main(){
string target = "cewe,c8wei,osd";
writeln(target.splitBy(',').values);
}

>>59403302
What's wrong in "shilling" for Rust?
>>
>>59398279
HackMud is just pure programming, a lot of fun. but hard to explain, look it up
>>
>>59403331
nice bug, hiro
>>
>>59403343
nice syntax error, dipshit
>>
>>59403276
You really shouldn't throw lisp into tersenes debate because it will always lose to python, or any ml language. Lisp is sadly very verbose, you could battle it with reader macros but most of the times you don't want to go there.
>>
>>59403225
you can't be a good programmer without at least a minor autism condition tho
>>
>>59403343
lol, wtf?
>>
File: 1488679510958.jpg (126KB, 710x473px) Image search: [Google]
1488679510958.jpg
126KB, 710x473px
I am fucking awful programmer and what I am only doing is browsing Stackoverflow looking for solutions.
>>
>>59403365
That's not a syntax error, idiot
>>
>>59403384
Do they pay you $$ though?
>>
>>59403379
please stop breaking muh 4chins
I need it I don't have friends
>>
>>59403384
>browsing Stackoverflow looking for solutions
I had my first interview. I was allowed to use a laptop when I got stuck. My go-to solution to solving problems is spamming a search engine with keywords. Suffice to say, I did not impress.
>>
>>59400191
Wtf are u doing nigger, why are u loading arrayofTenMillPseudoRanNum object instance every loop run and getting its field.

Make a const int outside of the loop
>>
>>59403376
Forth
>>
File: dpt.png (378KB, 1450x1080px) Image search: [Google]
dpt.png
378KB, 1450x1080px
>>59397998
maybe we gon roll and do something
>>
>>59403376
I agree it can be wordy, but I disagree with that thought. You just have to be willing to write unreadable code from time to time.
Example I posted in a /dpt/ awhile back:
(format t "~3@{~{~a~^ ~}~:*~^~%~}" '(1 2 3))
>>
>>59403526
Roll
>>
>>59403526
>50 rolls, 0 solutions
>>
>>59403526
You deserve to be banned for posting that.
>>
>>59403526
Too easy.
>>
New thread:

>>59403615
>>59403615
>>59403615
>>
>>59403526
i can do anything
>>
>>59402822
>Fibonacci's method for generating primitive Pythagorean triples
The only Fibonacci-related method I know of for generating Pythagorean triples is this:
https://en.wikipedia.org/wiki/Pythagorean_triple#Fibonacci_numbers_in_Pythagorean_triples

But that doesn't seem to have anything in common with the algorithm you've written.
>>
>>59403687
https://en.wikipedia.org/wiki/Formulas_for_generating_Pythagorean_triples#Fibonacci.27s_method
>>
>>59403943
Right. So what do you have against that which you call the "formula representation"? Isn't that pretty much the answer you were looking for?
>>
>>59404158
The answer I'm looking for is why do lists in Python suck so much. Suppose there was no formula: you'd be stuck with an algorithm; my implementation is ~7 times slower than the formula generation for the first 1000 triples. And if the algorithm didn't utilize an arithmetic sequence, you'd have to use arrays, which is ~5 times slower than utilizing arithmetic sequence, and only gets more unusable as the list grows. Basically, beginner resources teach lists, but whenever I've tried to implement them where intuitively applicable, they're actually worthless.
>>
>>59404485
>but whenever I've tried to implement them where intuitively applicable, they're actually worthless.
Keeping some fuck huge list of all the odd numbers isn't intuitive.
>>
>>59404485
>why do lists in Python suck so much
You'd have exactly the same problem if you were using arrays in any other language. Sure, there'd be some constant factor in between depending on overhead and whatnot, but principally it is the same. What were you expecting when you're telling it to save every number? That it won't save it anyway because "that wasn't my intention"?

Obviously, you have consider how to implement your algorithm no matter what language you're using, and if you can use maths to remove actual execution to reach the same result, then all the much better. Not matter what language.
Thread posts: 313
Thread images: 30


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.