[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: 319
Thread images: 26

File: hidamari_dpt_waifu2x_traps.png (2MB, 1618x1308px) Image search: [Google]
hidamari_dpt_waifu2x_traps.png
2MB, 1618x1308px
Old thread: >>61221493

What are you working on, /g/?
>>
What api style do you prefer when writing GUI code? Immediate mode/retained mode? OOP/procedural? Setup heavy and automated or iteratively constructed?

I'm gonna have to write something others interface with soon.
>>
>>61225466
Guys I am looking for this design principle I found some time back. It talked about some clever way to manipulate data/class design/ late binding and some whatnot. I am little bit blurry in here but I remember it said "This principle is used extensively in class design of QT framework and KDE framework. What is it ?? fuck
>>
>>61225493
>OOP/procedural?
Functional/Generic
>>
Anyone have a cheat sheet or resource that covers every permutation of *, & in variable declarations for c++?

Coming from Python and having trouble in how I should be reading the variables in my head and which symbol means what.
>>
>>61225523
Got any example api I could look at?
>>
File: 1499227707883.png (2MB, 1618x1308px) Image search: [Google]
1499227707883.png
2MB, 1618x1308px
>>
File: old_hag_langs.png (173KB, 600x355px) Image search: [Google]
old_hag_langs.png
173KB, 600x355px
>>61225466
First for OLD
>>
>>61225493
what does it need to do
>>
>>61225738
It's very general. Any gui stuff really. As simple as drawing static rectangles and as complex as having your own opengl context.
>>
>>61225466
Why is Linux saying I have 16 cores while I have 8? Does Linux tread cores as threads?
>>
I hope the trannies learned their lesson.
>>
File: 1498108612020.webm (924KB, 600x336px) Image search: [Google]
1498108612020.webm
924KB, 600x336px
Why not you porting linux kernel to python?
>>
>>61225466
Rewriting the linux kernel in JS
>>
File: 1429931825299.gif (535KB, 640x636px) Image search: [Google]
1429931825299.gif
535KB, 640x636px
>>61225716
I'm going to make a point of posting more frogs since apparently it triggers the tranny poster so much.
>>
>>61226032
dumb frogposter
>>
>>61225716
Why did you put some gay-ass little doodle on that image?
>>
/dpt/, how do I approach this design pattern?
I have a 2D grid data structure.
I need to do something like wildcard pattern matching and substitution on it, but in 2D.
The problem is, not only can I not figure out an algorithm for it, I can't even begin to fathom what it would actually mean.
How would you even do NON-pattern-matching substitution in 2D? It's not like 1D, you can't just replace a region of a 2D grid with an unequally sized region, can you? From a conceptual perspective, wouldn't that warp the geometry of the grid?
And when you GET to pattern matching, how would you even talk about wildcards? What does a 2D wildcard look like? What does it even MEAN? Sure, an arbitrary number of elements that don't have to match anything, but arbitrary which way? Left-right? Up-down? Both? What about the elements around it in the format grid? Same problem as the unequally sized region issue.
I just don't know where to even start with this.
>>
>>61226213
do you seriously not recognize the anime gopher
>>
>>61226273
just use comonads bro
>>
>>61226325
Of course I do. I was really just trying to subtly insult it.
God damn, it's such a fucking stupid logo.
>>
>>61226362
not as stupid as the language
>>
>>61225507
bloat?
>>
>>61226273
What exactly are you trying to do?
What's the data? What are you matching on it? What is it being replaced with?
>>
How can I use 'in' in python3 to parse any three consecutive digits from a text? Pls help
>>
>>61226774
Example I/O?
>>
>>61226816
Basically, I'm using urlib.request to parse a certain statistic from a webpage. Now, given that the page only has a single three-digit number, I'm using
 from urllib.request import urlopen
with urlopen('website.com/niggers') as response:
for line in response:
line = line.decode('utf-8')
if [HERE GOES THE THREEDIGIT PARAMETER] in line:
print(line)


Note that I can't into Beautifulsoup due to unspecified issues.
>>
>>61225466
First for golang
>>
File: 2017_07_05.png (922KB, 2560x1080px) Image search: [Google]
2017_07_05.png
922KB, 2560x1080px
the usual crap
>>
>Capture-less lambdas have deleted copy-assignment operator
The fucking fuck?
>>
>>61226873
Maybe something like:
if(any(char.isdigit() for char in line:


I don't exactly know the format but that may be close
>>
>>61227031
in haskell this is just

any isDigit line
>>
>>61227029
Decay to a function pointer with unary+.
>>
>>61227031
>>61227045
Thing is, it has to be the Python analogue of
 if any three consecutive chars are digits 

I'm not THAT retarded, anon.
>>
>>61227067
Why the fuck would I want to decay to a function pointer you stupid fucking nigger retard?
Do you hate efficiency? Do you want me to double to size of my struct for no good reason?
>>
>>61227068
Well you could use a regex that would contain [0-9]{3}
>>
>>61227068
>if [HERE GOES THE THREEDIGIT PARAMETER] in line:

so why exactly isn't this working?

is the three digit parameter a string?


line = 'abc123'
if '2' in line:
print(line)
>>
>>61227090
I've got no idea what else you want.
>Capture-less lambdas have deleted copy-assignment operator
Doesn't make sense otherwise. A captureless lambda is a struct with no member variables and one nonvirtual member function. What do you expect the assignment operator to do?
>>
>>61227068
f (x:y:z:ws) | all isDigit [x,y,z] = True
| otherwise = f (y:z:ws)
f _ = False
>>
File: 19748717.jpg (46KB, 545x960px) Image search: [Google]
19748717.jpg
46KB, 545x960px
Any functional fags here?
Is there any function that returns combinations of multiple arrays? zip is 1-1 only. what I want is: [1, 2, 3].combination([-2, -8]) == [[1, -2], [1, -8], [2, -2], [2, -8], [3, -2] [3, -8]]

The length of T[][] is unknown at compile time.
>>
>>61227573
Chicken Scheme's (amb) library can do this.

  (amb-collect
(let ((x (amb 1 2 3))
(y (amb -2 -8)))
(list x y))))


((1 -2) (1 -8) (2 -2) (2 -8) (3 -2) (3 -8))
>>
File: 1499075237453.jpg (75KB, 693x960px) Image search: [Google]
1499075237453.jpg
75KB, 693x960px
>>61227628
>amb
What does it even stand for?
>>
>>61227640
It's like the symbol the singer Prince used.
>>
>>61227640
ambiguous

it comes from the nondeterministic chapter of SICP

it's not especially performant for combinatorial reasons, but if you're just returning all the permutations of two sets it's fine
>>
>>61227573
combinations = [ [x,y] | x <- [1,2,3], y <- [-2, -8] ] 


which is equivalent to
combinations = (concatMap (\x -> concatMap (\y -> [[x,y]]) [-2, -8]) [1,2,3])
>>
>>61227782
What language is that?
>>
>>61227841
Haskell
>>
>>61225466
I live in Texas and is working on a drone based object detection platform to track illegal border crossing.
>>
>>61227853
I wanted multiple arrays, the length is unknown at compile time. So that int[2] was just a test case
auto x = [[12, 23, 34], [0, 1], [-12, -88, -5, -74]];
combine(x) should return [[12, 0, -12], [12, 0, -88], [12, 0, -5], [12, 0, -74], [12, 1, -12], [12, 1, -88], [12, 1, -5], [12, 1, -74], [23, 0, -12], [23, 0, -88], [23, 0, -5], [23, 0, -74], [23, 1, -12], [23, 1, -88], [23, 1, -5], [23, 1, -74], [34, 0, -12], [34, 0, -88], [34, 0, -5], [34, 0, -74], [34, 1, -12], [34, 1, -88], [34, 1, -5], [34, 1, -74]].
>>
>>61227640
>that image
>literally me

Resetting my router 5 times a day. I'm running out of mac addresses here.
>>
File: 1497299991173.jpg (64KB, 638x359px) Image search: [Google]
1497299991173.jpg
64KB, 638x359px
Anons, I need some C++ help.

I'm using a function from a library (nftw from ftw.h, to be specific) that calls multiple times some function that I pass to it. That function I pass needs access to variables, but I don't really want to use global variables.

What's the neatest way of wrapping it?
The way I understand it, I can't make it call a non-static method of an object, so there's no point in wrapping it in a class. So do I have to put it all in a namespace and use global variables anyway?
I might be misunderstanding this C-like way of handling things.
>>
File: f.png (89KB, 353x200px) Image search: [Google]
f.png
89KB, 353x200px
>>61227841
I-I-It's so beautiful
>>
>>61227929
I appreciate that it requires so much less typing. But it lacks expressiveness.
>>
>>61227944
>it lacks expressiveness
Is this a troll? Functional programming is the MOST expressive. Try it for a bit. After some time, you will realise that other paradigms are just trying to do the same thing in an extremely longwinded and retarded way.
>>
>>61227971
'Expressive' means that it's easy to write code that's easy to understand, both for the compiler and for a human reader.

Two factors that make for expressiveness:

intuitively readable constructs
lack of boilerplate code

Compare this expressive Groovy, with the less expressive Java eqivalent:

3.times {
println 'Hip hip hooray'
}


vs

for(int i=0; i<3; i++) {
System.out.println("Hip hip hooray");
}



>you will realise that other paradigms are just trying to do the same thing in an extremely longwinded and retarded way.
I already know. However languages that features a good balance of FP paradigm and performance such as Dlang, Rust are the best way to go. Laziness is not a panacea.
>>
>>61228003
Your example literally shows that a functional style is superior to an imperative style. We don't use stupid loops like that in FP, rather use Map, Reduce etc.

>However languages that features a good balance of FP paradigm and performance such as Dlang, Rust are the best way to go.
>haskell
>poor performance
???

>Two factors that make for expressiveness:
>intuitively readable constructs
>lack of boilerplate code
Ok, but FP excels at both of these for non-brainlets. Haskell has pretty much the minimum "boilerplate" possible.
>>
There's a MapReduce.
Is there a ReduceMap paradigm that could be similarly useful?
Something that takes a list of functions, rolls their functionality to one, then maps them to a(nother) list of inputs to produce a resulting list.
Or maybe it first creates a closure by reducing a normal input list(so that the final closure has some shared property of all the inputs), and then applies that closure to the original list.
Is something like this in use? Or maybe that's what MapReduce ends up doing if it's done recursively anyway? I wish I wasn't dumb so I could think good, somebody save me.
>>
File: 1496020714139.jpg (1MB, 960x1280px) Image search: [Google]
1496020714139.jpg
1MB, 960x1280px
>>61228049
>>haskell
>>poor performance
>???
>>
Can someone please explain what functional programming is actually used for?

Not even memeing.
>>
>>61228188
Fizzbuzz
>>
>>61228188
It's LINQ for advanced programmers + some other stuff
>>
>>61228188
Remember times when somebody had a nice idea in theory but it actually turned out to be shit in practice? That's what functional programming is.
>>
>>61228188
https://www.youtube.com/watch?v=jD8Tu1tqvZo
>>
>>61227874
combos = sequence

main = print (combos [[12, 23, 34], [0, 1], [-12, -88, -5, -74]])
[[12,0,-12],[12,0,-88],[12,0,-5],[12,0,-74],[12,1,-12],[12,1,-88],[12,1,-5],[12,1,-74],[23,0,-12],[23,0,-88],[23,0,-5],[23,0,-74],[23,1,-12],[23,1,-88],[23,1,-5],[23,1,-74],[34,0,-12],[34,0,-88],[34,0,-5],[34,0,-74],[34,1,-12],[34,1,-88],[34,1,-5],[34,1,-74]]
>>
>>61228197
http://blog.ielliott.io/why-LINQ-is-broken/
>>
>>61228264
That's a C# problem.
>>
>>61228188
Psuedo-mathematicians wank over it, mostly. Occasionally useful if you need mass concurrency.
>>
I'm going to implement an imageboard in .NET Core on Azure.

What features do you think are necessary?
>>
>>61228188
General programming with very clear places where IO fit and you have virtually no performance requirements.

Realistically it's for math people who don't actually write anything that anyone would use.
>>
>>61227901

Where do these variables need to be accessed from? Because if it's completely local to the function, you can use static variables.
#include <iostream>

void somefunction()
{
static int counter;
std::cout << counter++ << std::endl;
}

int main()
{
somefunction(); // prints 0
somefunction(); // prints 1
somefunction(); // prints 2
}
>>
File: 1471989921095.jpg (59KB, 1280x720px) Image search: [Google]
1471989921095.jpg
59KB, 1280x720px
Lambda objects in both g++ and clang++ have their move-assignment operators not defined and not defaulted, which causes move operations to fall back to the copy-assignment operator which is defined as deleted. I.e. it's impossible to move-assign a lambda object.
This basically makes unique_ptr's with custom deleter lambdas completely fucking useless, as they can't be moved, which makes the unique_ptr unmovable. Very useless indeed.

Apparently this is the committees fault for having ambiguous wording in the standard.
How the fuck is this not fixed yet? This is a huge problem.

Example using g++:
#include <memory>

int main() {
auto del = [](int *p) {
delete p;
};

std::unique_ptr<int, decltype(del)> p1(new int(3), del);
std::unique_ptr<int, decltype(del)> p2(new int(2), del);

p2 = std::move(p1); // Doesn't compile! decltype(del) is MoveConstructible but NOT MoveAssignable!
}

$ g++ main.cxx
In file included from /usr/include/c++/7.1.1/memory:80:0,
from main.cxx:1:
/usr/include/c++/7.1.1/bits/unique_ptr.h: In instantiation of ‘std::unique_ptr<_Tp, _Dp>& std::unique_ptr<_Tp, _Dp>::operator=(std::unique_ptr<_Tp, _Dp>&&) [with _Tp = int; _Dp = main()::<lambda(int*)>]’:
main.cxx:11:19: required from here
/usr/include/c++/7.1.1/bits/unique_ptr.h:284:16: error: use of deleted function ‘main()::<lambda(int*)>& main()::<lambda(int*)>::operator=(const main()::<lambda(int*)>&)’
get_deleter() = std::forward<deleter_type>(__u.get_deleter());
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cxx:4:14: note: a lambda closure type has a deleted copy assignment operator
auto del = [](int *p) {
^
>>
>>61228353
>posting images + text
>viewing images + text
>>
>>61228403
C++ is a fucking joke. Why are you even using that garbage?
>>
>>61228428
What should I be using?
>>
File: dank.jpg (20KB, 555x76px) Image search: [Google]
dank.jpg
20KB, 555x76px
>>61228188

It's a rebellion against the last 20 years of having OOP forced down our throats.

Certain languages were always functional, Haskell, Clojure, Ocaml, etc. And everyone who ever attended a class anywhere were told they were shit and should die already because OOP is the best thing in the world ever.

And it turns out OOP is no longer cool, so we're getting horrible memes where people take languages like JavaScript and use a map() function and declare they are programming functionally.

I really like it, but honestly, certain languages work certain ways, obsessing over patterns beyond just doing what your chosen language is good at is where the real meme is at.
>>
>>61228441
Use whatever the hell you feel like. It's completely fine to use a general-purpose, high-performance language with a massive user base and a great amount of third-party libraries and extensions. The declarative/functional languages so praised on /g/ are just that - a /g/ meme, the hipsterism of programming. Don't take memes at face value.
While C++ has its issues, such as an ugly, inconsistent syntax (no native for-each loop in AD 2017, please), the lack of a proper dependency/package management system, or lack of modern features such as OS-independent Unicode UTF-8 strings, it is certainly usable and not the monster /g/ makes it out to be if you don't abuse it and decend into the more advanced features. D-lang looks like a nice replacement for C++, though. You might be interested in it.
>>
>>61228462
Why do POOfags and the like always make it an "OOP vs FP" argument?
They have very little to do with each other.
>>
>>61228476
>no native for-each loop in AD 2017
>hur dur what is range-based for
>>
>>61228476
>no native for-each loop in AD 2017, please
std::vector<int> vec{2, 4, 5, 1};
for (int i : vec)
std::cout << i << std::endl;

Or did you mean something else?

Dlang has some great ideas but I don't think it's an adequate replacement, and nobody else seems to think it is. At least it's easy to link with C and C++.
>>
>>61228521
>At least it's easy to link with C and C++.
No it's not. C is easy to link with. Every language worth a shit can link with C.
C++ is a fucking nightmare to link with.
>>
>>61228403
>why the fuck is this not fixed yet
Iirc you didn't have any way of overloading new to use specific alignment without doing global variable hacky stuff until C++14

The committee is lazy and C++ is a bad language.
Use C instead. It's not worth dealing with incomplete languages.
>>
>>61228521
Damn. Got me.
>>
>>61228521
Can you still do this?
foreach (index, element; array)
writefln("%s - %s", index, element);
>>
>>61228486

That's somewhat my point. Use what works well with your language rather than trying to force classes into C or immutability into PHP.
>>
>>61228533
Unless you're using Dlang, which understands name mangling and other C++ fuckery.
>>
tfw too dumb to understand shellsort :^|
>>
>>61228577
You're just calling insertion sort a bunch of times. Instead of sorting the entire array, you sort sub-arrays; for example, every 5th element or something.
Every iteration of shell sort, you reduce the size of the gap between sub-array elements. This tends to push larger elements to the end of the array, smaller ones to the start, and the array gets "more" sorted. At the very end, the gap is 1, and you end up performing a normal insertion sort on the array.
It works pretty well because of some of the properties of insertion sort:
- It works well with small arrays
- It works well with almost sorted lists
What size the gap should be and how it gets smaller is up for debate. Wikipedia had some examples of sequences that have proven to do well experimentally.
>>
>>61225466
I'm trying to make an image scraper in Python but I've been failing miserably so far.
>>
>>61228680
where are you failing and why?
>>
File: 1474228831420.jpg (319KB, 1600x1064px) Image search: [Google]
1474228831420.jpg
319KB, 1600x1064px
tfw still no non-retarded-faggot summer project
why even live?
>>
>>61228874
Kill yourself, you fucking retarded frogposter.
>>
>>61228874
write a virus that deletes all animu from this world
>>
File: devilish.jpg (201KB, 470x595px) Image search: [Google]
devilish.jpg
201KB, 470x595px
>>61228883
>>
>>61228874
just like surf github and start CONTRIBUTING like a madman
>>
>>61228932
>implying I'd touch any project that uses the CoC made by this fucking disgusting tranny
>>
>>61228943
>Caring more about CoCs than programming
Not gonna make it.
>>
>>61229095
If someone goes out of their way to make the CoC more prominent than the actual project, than its a red flag.
>>
>Rust won't let you unborrow values.
I find a new flaw every single day I use this language. It's unbelievable.
>>
File: 1482104508887.jpg (884KB, 1280x1024px) Image search: [Google]
1482104508887.jpg
884KB, 1280x1024px
>>61225633
No, "she" doesn't. Try doing that pose.
>>
>>61229261
Every attempt to fix C++ only results in a worse language.
C++ is clearly the best language ever designed, because all attempts to improve it fail.
>>
>>61228824
I'm not sure how to make bs4 find the img links. I guess I'll have to brush up on HTML.
>>
>>61227880
>mac addresses
1: You can't really run out of mac addresses
2: 4chan does not look at mac addresses
>>
>>61229284
>Clearly a vegetable is the smartest life form on the planet because every attempt to improve its intelligence fails.

Or just irredeemably awful.
>>
>>61229287
1: Pretty sure that was a funpost you're responding to, m8
2: If your ISP doesn't assign you a static IP, which is most of them, you change the mac address on your router then reset your modem and you get assigned a new IP

How can you not know this? It's ban evasion 101
>>
>>61228874
Here are a few ideas from different areas:

>app/web: create a software which implements various creativity methods including a collaborative function and a wizard for selecting the proper one
>systems programming: all sorts of home automation (e.g. automatic watering system)
>computer vision: create a system which recognizes the postman and alerts you. If the postman doesn't deliver you the package record the video and message it to the company
>data analysis / AI: create a piece of software which finds suitable influencers about some topic on twitter and messages them information so that the information is as widely spread as possible
>optimization: create a software which takes your preferences for living (wealthy areas, good schools, distance to work, distance to grocery shopping) and finds you the best apartments fitting your preferences

>>61229286
soup.find_all("img") gets you the img tags. Then you can iterate through the list and get the link with img['src']
>>
>>61229333
Except that you do not need to change the mac on your router to get a new ip address.

How can you not know this? It's ban evasion 101
>>
File: 1425086646175.png (227KB, 449x401px) Image search: [Google]
1425086646175.png
227KB, 449x401px
>>61229354
Are you doubling down on being retarded or something? I don't know what obscure ISP you're referring to that just reassigns IP address by resetting your modem, but the common case by far is assigning them by mac address.
>>
>>61229382
Well, you are wrong. No proper ISP requires you to change your mac.
>>
typedef struct {
test *dummy;
} test;

>can't even declare recursive structures in C with typedef
Holy shit this is bad language.
>>
>>61229382
I don't know what obscure ISP you're referring to that just reassigns the same IP address after resetting your modem.
>>
>>61229395
You shouldn't be typedefing structs because ??? you're brain damaged.
>>
>>61229395
you can just not like that
>>
>>61229409
>you shouldn't do something because implementing decent compiler is hard
Fucking cfags.
>>
>>61228365
They can't be local to the function.

I had it all working as globals in a namespace, but I'm trying to rewrite it as static attributes and methods of a class (since I already had a class that was "controlling" that namespace). It's not working out too well, static a shit.
>>
File: 1487709044849.jpg (882KB, 1024x1280px) Image search: [Google]
1487709044849.jpg
882KB, 1024x1280px
>>61229395
struct test {
struct test *dummy;
};


or

typedef struct test test;
struct test {
test *dummy;
};


Why would you typedef a struct anyway?
>>
>>61228932
>Contributing to FOSS on github: the process
>First you find a library that lies in your field of expertise. If you have none find python/js/php/C# projects
>Read the Readme.md of the project and find what the goals of the project is
>>if the goals are small you can proceed because any big project with big goals won't be needing your small attention span
>Find the dependancy list
>>if it doesn't exist its a good project
>>if it's very small you need to judge the decision to add that dependency over just having their own solution
>>if it's big it's a waste of time to contribute. The project is just a ball of glue. People will tear out your code in no time as the libraries get better/bigger and the cost of learning these libraries is huge
>look at the pull requests/forks
>>if the pull requests don't get any response move on
>>if there is a more popular fork repeat from step one on that fork instead
>>if the attitude towards the pull requests is that the person merging the pulls should do no work whatsoever then skip the project
>find the development build guide
>>if there isn't one and the build steps aren't trivial, skip
>>if there's build steps that cover less than a page with max 3 hyperlinks that aren't any of these:[read our build guide], [use this version of 'hipster build system] and [install visual studio community edition]. You can continue
>find the code style guidelines
>>if the code style guidelines are nonexistent you're ok
>>if the code style guidelines are specific and there's no tool that's supposed to transform your code before submitting a PR skip it
>>if the code style guidelines are purely motivated by semantic clarity (i.e no assignment in conditional statements in C) they're OK
>find if the project is immature enough that you could casually contribute significantly to it
>>if not see if there's small portions of the project you could contribute to
>>if neither skip

There you go. Easy.
>>
>>61229517
You forgot to check if the CoC for the project lets you contribute based on political affiliation, sex or race.
>>
>>61229395
>typedefing a struct
You're stupid.
>>
So I'm working on a c++ template class that has another template class inside of it
like this:

template<typename KeyType, typename EntityType>
class BinaryTree {

template<typename KeyType, typename EntityType>
class Node {
void Set(KeyType key, EntityType entity);
};
};


now Node has some functions e.g. Set(KeyType key, EntityType entity) but how do I implement those?
If I try a generated implementation it gives me this:

template<typename KeyType, typename EntityType>
template<typename KeyType, typename EntityType>
inline void BinaryTree<KeyType, EntityType>::Node<KeyType, EntityType>::Set(KeyType key, EntityType entity) {}


RAW:
template<typename KeyType, typename EntityType>
class BinaryTree {
template<typename KeyType, typename EntityType>
class Node {
void Set(KeyType key, EntityType entity);
};
};
>>
>>61229627
Templates are a bad meme, please use a proper language like ML instead,
>>
>>61229627
"C++ was a fucking mistake"
- bald Danish meme man
>>
>>61229627
You're thinking about this wrong.
template<typename KeyType, typename EntityType>
class BinaryTree {
class Node {
void Set(KeyType key, EntityType entity);
};
};

BinaryTree<int, double>::Node::Set is a function that takes int and double. You don't need a second set of templates.
>>
>>61229651
Oh yeah thx
I was writing all the classes separated and putting them into each other at the end thanks for the help man.
>>
>>61229635
Templates are great, just not C++'s.
>>
>>61229707
Go away Dlang-chan.
>>
>>61229724
never
>>
>Torvalds says to not typedef structs
>goes on to typedef fixed int types
Fucking hypocrite.
>>
>>61229771
Cniles can never keep their story straight when attempting to rationalize C.
>>
>>61229707
No, templates in general are shit.
>>
>>61229771
ints are not structs
>>
>>61229784
Why?
How else are you going to get powerful meta-programming?
>inb4 MP is trash / i dont need it
>>
>>61225787

It's called hyper-threading, lad
>>
>>61229795
>How else are you going to get powerful meta-programming?
By using a powerful and modern programming language? Such as Elixir, Scheme or an ML.
>>
>>61229808
>Elixir, Scheme or an ML.
>modern
>powerful
>>
>>61229771
That was before the time stdint.h was a thing, and I suppose nobody can be fucked going back and changing all of the code.
Also, his argument was about structs, not ints. Even then, his 'Kernel coding style' is a suggestion, not hard rules, and says there are many exceptions to things you might do with it.
>>
>>61229815
>>modern
>>powerful
Exactly anon
>>
>>61229830
they are not.
>>
>>61229837
Well, they are. More powerful when compared to any language with templates at least.
>>
>>61229845
elixir is dynamic, so its auto trash.
Scheme, ML are 2slow
>>
>>61229854
scheme is also dynamic
Ocaml is faster than java.
>>
File: 1484856646127.png (958KB, 900x1138px) Image search: [Google]
1484856646127.png
958KB, 900x1138px
>>61229854
>dynamic
What does that even mean?

>Scheme, ML are 2slow
This is a property of the implementation anon. Both of these languages give you the ability to optimise them properly due to their design so calling them slow is simply wrong.

Also, there are lisp implementations like the SBCL which are considered blazing fast.
>>
>>61229868
Scheme being a lisp flavor is more detrimental.
>>61229876
typed
Have any benchmarks or stuff to show me?
>>
>>61229868
>Ocaml is faster than java.
k tard. ocaml doesn't even have parallel multi threading.

https://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=java&lang2=ocaml
>>
>>61229896
>typed
Yes, they are typed, so what?

>Have any benchmarks or stuff to show me?
Sadly not anymore, there was the Benchmarks Game but they killed it.
>>
>>61229898
Your jvm is running in single thread too.
Also java uses 10 times the memory to be like 3 nanoseconds faster. SAD
>>
>>61229898
>tfw in my high school book it said that the OCaml was a massively parallel language.
>>
>>61229345
>soup.find_all("img") gets you the img tags. Then you can iterate through the list and get the link with img['src']
Thanks mate! I finally did it
>>
>>61229916
Top kek, in some of the examples Java uses 27 times the memory.
>>
>>61229916
>Your jvm is running in single thread too.
confirmed for retard. first the jvm is a specification, not an implementation. second, hotspot, the main jvm implementation, has parallel multi thread since day one.
>>
>>61229940
>knowing and caring this much about jvm
Whose the retard now, Pajeet?
>>
>>61229940
>first the jvm is a specification, not an implementation
He never implied otherwise. Also by "your jvm" he was referring to the one used in that site.
>>
>>61229965
>Whose
>>
>>61229965
hotspot is a fantastic piece of software technology, the current state of art virtual machine for programming languages.
>>
How do I ensure that an unsigned integer type is exactly 4 bytes in C?
How do I ensure that a signed integer type is exactly 4 bytes in C?
Regardless of platform. Preferably portable code.
>>
>>61230018
Oracle pls leave.
>>
>>61230023
static_assert
>>
>>61230023
assert sizeof CHAR_BIT and sizeof int.
>>
>>61230018
No
Also, there is no point for this kind of virtual machines to exist.
>>
How does the idea of functions without side-effects as the gold standard relate to file I/O(both temp and otherwise, if you make a distinction)? Can anybody explain at what point in the program(i.e. scope) I/O is "supposed" to be done for functional programming styles?

For example, is the idea to do it at global scope, or in a function dedicated to writing data(presumably generated by other parts of the program)? Or maybe I'm just misunderstanding something in general.
>>
>>61230023
Something like static_assert(sizeof(int) == 4) or assert(sizeof(int) == 4) on the runtime.
Why would you do that however?
>>
So I have a class, and I am extending it in another class.
In the child class, I want to change only one thing in its huge constructor.
Can I somehow get away with not copy-pasting the whole thing and changing one string?
>>
>>61230043
>relate to file I/O(both temp and otherwise, if you make a distinction)
It doesn't. All of the external communications of the program are considered IO.
>>
>>61230023
use uint32_t and sint32_t
>>
>>61230068
>class
???
>>
>>61230068
Have the constructor in the superclass call a (ideally private) method, then override that method in the subclass.
>>
>>61230071
sint32_t is not defined by the standard while uint32_t is optional and is not guaranteed to be 4 bytes.
>>
>>61230084
Instead of a property, I gave it a getter function, and I override that getter in the child class.
I feel like a hack doing it, but it works. Thanks.
>>
>>61230018
Isn't hotspot unable to tail-call optimize two mutually recursive functions?
>>
>>61230106
so all those modern C guides telling me to use stdint types were a lie?
>>
>>61230018
Correct.
>>
>>61230040
>CHAR_BIT
why?
>>
>>61230106
>is optional
What type of completely standards conforming code needs to make those sorts of assumptions about integer types? Why can't it be over 4 bytes?
>not guaranteed to be 4 bytes
It's guaranteed to be exactly 32 bits.
>>
>>61230119
It's not sintN_t, it's just intN_t.
Yes, he's right about them being optional. For non CHAR_BIT==8 systems, and non-twos complement systems, they cannot support those types.
>>
>>61230116
hotspot/openjdk devs don't care enough; you don't need tco when you have while/for loop.
>>
>>61230119
>so all those modern C guides telling me to use stdint types were a lie?
stdint.h types are fine but it depends on what you are trying to use them for.

>>61230131
>Why can't it be over 4 bytes?
I wonder the same thing.

>It's guaranteed to be exactly 32 bits.
Yes, but it is not guaranteed to be 4 bytes.
>>
>>61230150
Nah, I remember reading something about the JVM spec being fundamentally flawed for this sort of stuff and they'd need to rewrite a large amount of the spec in order to be able to implement it.
>>
>>61230148
>For non CHAR_BIT==8 systems
CHAR_BIT == 16 and CHAR_BIT == 32 should have uint32_t as well.
>>
>>61230155
>I wonder the same thing.
What? You're the one asking the question.
Why don't you know?
>Yes, but it is not guaranteed to be 4 bytes.
So? Why does it matter how many bytes an integer takes up? You just want to know the range of values you can store in it.
>>
>>61230119
>modern C guides
Don't trust them. Every C programmer is fucking retarded so it just better to build your own foundation.
>>
>>61230173
>What? You're the one asking the question.
Nope

>Why does it matter how many bytes an integer takes up?
I wonder the same thing.
>>
>>61230165
that's not true. the ibm's jvm has tco, for example.
>>
>>61230167
Yes, I realised that after I posted. However, how many of those systems have you ran into recently?
I know come CHAR_BIT == 16 systems actually exist (Several DSPs are, I think), but really, it's all so unimportant.
How many """bytes""" (i.e. not octets) some shit takes up. You just need to know how many effective bits you have, so you can know the maximum value.
>>
>>61230192
Hotspot has TCO too, but not when you have multiple mutually recursive functions. Are you sure ibm's JVM is able to optimize mutually recursive functions?
>>
>>61230195
Every single TI DSP that I have used has CHAR_BIT == 16, maybe there was one with 32 as well, not sure.
>>
File: m-150310043525[1].png (32KB, 400x300px) Image search: [Google]
m-150310043525[1].png
32KB, 400x300px
Reminder to develop a secondary skill, so you can change employment when your hand breaks down in your late 30s.
>>
>>61230222
>Implying my hands will break
I don't use emacs and do all my typing on an ergodox, I'll be fine.
>>
Why does nobody here program in Ruby? Ruby is the comfiest language around.
>>
>>61230058
There can be so many reasons. I'm sure you can come up with some.
Serializing data is one such reason.
>>61230040
>>61230031
Doesn't quite please me but thanks.
>>61230071
I'll have to look into this more. It's not so clear cut to me.
>>
>>61225646
Use pointers. Learn pointers first.
>>
>>61228486
Exactly, Ruby is both FP and OOP.
>>
>>61230343
>There can be so many reasons. I'm sure you can come up with some.
Nope, I can't.

>Serializing data is one such reason.
I can't see how.
>>
>>61230222
In doing a lot of gardening.

I'm sure my investments could let me live well anyway.
>>
>>61230222
Trips confirm, this is happening to me at 32 even when laying in bed with my arms at my sides.
>>
>>61225646
What's hard to remember about *, & and &&?
>>
>>61230353
>Nope, I can't.
Not him but wouldn't it make sense to make sure you have the expected number of bytes if you're writing an interpreter or a VM?
>>
>>61230400
Nope
>>
>>61225466
How much time will it take for someone who knows only basic Java to learn Android?
Where should he start?
Free this winter with nothing to do so expanding on previous knowledge
>>
unsigned char penis[4];

Always 4 bytes.
>>
File: 1436881528245.jpg (9KB, 183x185px) Image search: [Google]
1436881528245.jpg
9KB, 183x185px
>>61230150
>you don't need tco when you have while/for loop.
>using loops when goto exists
>>
>>61227901
C++ lambda. Use reference binding
http://en.cppreference.com/w/cpp/language/lambda
>>
>>61230405
Please tell me why it wouldn't make sure that the ints you're going to use to emulate the ints used by the programming language you're interpreting are 32bits if the programming language you're interpreting expects 32bits ints.
>>
>>61230418
You are wrong.
>>61230415
You don't need java, you need XML.
>>
>>61230439
>You are wrong.
he's right.
>>
>>61230426
Java has Goto?
>>
>>61230439
>You are wrong.
Prove me wrong, fgt.

>>61230434
It would make sense to expect them to be at least 32 bits in that case, but it would not make sense to expect them to be 4 bytes.
>>
>>61229771
Sorry, where's the hypocrisy?
Unless you're saying that ints are structs, in which case you're retarded.
>>
>*CURRENT_YEAR*
>not using c preprocessor to have macros in java
>>
>>61230478
But I am.
M4/Lisp macros are better though.
>>
>>61230473
What difference can you see between a 32bit int and a 4 bytes int?
>>
File: 1446964487239.jpg (94KB, 640x640px) Image search: [Google]
1446964487239.jpg
94KB, 640x640px
>>61229403
I'm not that other guy but, Cox does, and Cox is a tier 1 ISP about as big as Comcast. Even if I reset my modem I get the same IP address. Never did figure out how to evade while on Cox so I just obey the rules.
>>
>$CURR_YEAR
>using C
>>
>>61230491
That one is guaranteed to be 32 bits while the other is not.
That one is guaranteed to be 4 bytes while the other is not.
>>
>>61230439
Xml is just layout stuff. I've already started a book and write the code in the examples
Was wondering what you guys would suggest
>>
>>61230512
Are you just trolling anon or is there something wrong with your brain?
>>
>>61230512
Which definition of "byte" are you going on?

>>61230506
C is as relevant as it has ever been.
>>
>>61230526
Nether of these.
How am I wrong?
>>
>>61230531
There are only two definitions of byte and my post applies for both of them.
>>
>>61230547
This conversation is a complete waste of time.
>>
>>61230547
What are these definitions? I'm >>61230526 and genuinely curious now.
>>
File: Capture.png (74KB, 1095x1281px) Image search: [Google]
Capture.png
74KB, 1095x1281px
>>61230531
>C is as relevant as it has ever been.
https://octoverse.github.com/
>>
>>61230023
Don't write code that depends on the size of data types
t. Rob Pike
>>
>>61230620
Rob Pike is faggot and dumb hack.
>>
>>61230562
The C definition (char = 1 byte, CHAR_BIT >= 8)
The standard definition (byte = smallest addressable unit, doesn't talk about byte size in bits)
>>
>>61230620
Rob Pike is a fucking retard.
Nothing he says holds any validity.
>>
>>61230620
Does Go just have one dynamic uint/int?
>>
>>61230644
Fair enough. But Posix mandates CHAR_BIT == 8 though, so wanting your ints to be 4bytes on posix systems isn't that senseless.
>>
>languages with types like long, uint, etc
>languages with types like int64 (where you can't change the number into anything you want, you can only select between 8, 16, etc)
Trash languages.

>>61230712
This was a POSIX 2003 change I think.
On POSIX systems types like int32_t are guaranteed to exist anyway and sizeof(long) >= 4.
>>
>>61230643
>>61230686
I like a lot of his writing, he's an interesting guy.
He gets a lot of things very right, and then sometime around his move to Google he went full retard.
Go is fucking stupid trash. It had such potential but they flushed it down the toilet.

>>61230710
No idea, but they wrote the entirety of Plan 9 without ever testing for endianness or bit width
>>
>>61230735
WHY WOULD YOU EVER WANT TO ARBITRARILY HAVE A 7B INT?

TELL ME THIS.

IT JUST OPENS UP STUPID SHIT WHERE PEOPLE DEFINE AND FORGET STUPID VALUES THAT CAUSE EDGE-CASE BUGS
>>
>>61230738
That's crazy. Doesn't Plan9 have a network stack? You can't have a network without caring about endianness and bit width.
>>
>>61230562
I would guess he's referring to a possible distinction between the definition of a "byte" as "8 bits of memory"(size) and the more useful(in programming) definition of a byte as "8 bits of [contiguous] memory". Although I think you could make yet another distinction if you allowed "virtual bytes."

Refreshing the page, I guess he answered you similarly or more accurately though. I'd also distinguish definitions based on what I said, but mine are more like different colloquialisms where as his are both modern valid definitions of bytes.

Following his I'd say there are a 3 or so common definitions:
1. 8 bits(of size)
2. An 8-bit block of contiguous memory
3. The smallest addressable unit

A fourth would just be a repeat expansion of 3 analogous to 1 and 2.
All I'm saying is when some people say "bytes" they're just referring to 8 bits of/smallest addressable memory, others mean an actual block of memory that size, yet others might use both and assume the listener will distinguish based on context. I'm not sure which is of the first two is considered "correct," if either.
>>
>>61230777
Plan9 does have a network stack, but the managed it somehow. It's part of the Plan9 C guidelines.
>>
>>61230827
Pretty sure these guidelines are "flexible" and not respected everywhere in Plan9's code.
>>
>>61230766
I want to say to my language that I want an integer which is at least N bit long, or that I want an integer that can support a specific range of integers.
>>
>>61230917
You can probably do this with C++ templates.
>>
>>61230790
>1. 8 bits(of size)
>2. An 8-bit block of contiguous memory
These are the bitlet definitions.
>>
>>61230954
Templates are shit though.
But in any case, it won't change the fact that the language has been dirtied with these types.
>>
>>61230917
>or that I want an integer that can support a specific range of integers.
I think by the end you will have done so much to ensure this actually works, that youll realize the reason why we just have 8,16,32,64 in the first place.
>>
>>61230973
>Templates are shit though.
How so
>>
>>61230974
Nope
>>
>>61230428
I have no idea what in the hell this is or how is it supposed to help me, but I'm guessing you're suggesting I can somehow make a member function call look like a regular function pointer?

I've been avoiding lambdas in C++ so far, and it looks quite complicated at first glance.
>>
>>61230415
Answer this plz
>>
>>61231003
Anon's being retarded, you can't pass a lambda that closes over some variables as a function pointer. It's useless to you.
>>
>>61230999
Okay but you still havent given me a use case besides a tiny bit of optimization.
>>
>>61231054
I did: You ask the language what you need instead of selecting a type that the language/underlying platform supports which may provide more things.
>>
>>61231074
BUT WHAT WOULD BE THE PURPOSE?
This seems like a purely embedded use-case where every bit actually matters.
>>
>>61231128
>BUT WHAT WOULD BE THE PURPOSE?
Writing high level code.
>>
>>61231141
> i need my high-level code to worry about variable size down to the byte
"no".
>>
>>61231157
I need my high level code not to explicitly use platform-specific sizes.
>>
>>61226696
I have a musical score. It's represented as a grid where each cell is a 16th note. If the cell is empty, it's a 16th rest, and if it's equal to the previous cell, it's a continuation of the previous note. The reason it's a grid and not just an array is because it has multiple voices. I want to do pattern matching and substitution on the music in a way that can be sensitive to both melody (relationship between cells across a row) and harmony (relationship between cells across a column). Like I'd like to be like, if there's a region with melodies like this and harmonies between them like that, duplicate it, or move it over here, or etc.
It's for an assignment. I'm trying to write a rule-based computer-generated musical composition, like the Illiac Suite. That's the only specification. It's clear all he expects out of us is something that can generate a single melody and doesn't even use pattern matching at all, but he says we can go as in-depth with it as we want. I wanted to do something cooler, but I'm having second thoughts now that I'm realizing what I want to do is complex enough that I can't even visualize it.
>>
>>61231174
But why?
>>
>>61231186
Because I want to write high-level code?
>>
>>61231208
alright m8
>>
>>61231208
Having explicitly platform specific sizes seems higher level than having fixed sizes. That way, the name of the type only has to express what its purpose should be, and the appropriate size for that purpose on the target architecture is decided by the compiler, as it should be, because that is a low level detail you shouldn't be concerned with if you're writing high level code.
>>
>>61231257
Selecting your own sizes and ranges seems higher level than both of these.
>>
>>61231279
It really doesn't, because selecting your own sizes and ranges expresses the intention to be sensitive to that selection, which means concerning yourself with a low level detail, albeit one you spelled out yourself.
>>
>>61231309
No, selecting a predefined size is concerning yourself with a low level detail.
>>
>>61231323
Yeah, but so is selecting a size you define yourself.
Whereas selecting a purpose (integer or character?) and leaving size out of the picture altogether is higher level than either.
>>
>>61225466
good OP
>>
>>61229274
Look the thumb in the bottom hand, its impossible.
>>
There's nothing preventing you from programming C in "functional" way.
Just pass the whole application as struct to every function and instead of pointers just copy structures by value.
>>
>>61232090
C is inherently anti-FP.
>>
>>61232242
It has const and it has function pointers. C is basically lisp with C syntax.
>>
threadly reminder that homosexuals will go to hell
>>
>>61227573
in Haskell this is just
(,) <$> [1..3] <*> [-2, -8]

or
liftA2 (,) [1..3] [-2, -8]
>>
>>61232342
unreadable trash
>>
>>61232271
Implementing shit like currying is a lot of work though.
>>
>>61232441
Yeah Pajeet, you just go eat that HASKELL CURRY.
Nobody in the real world uses it.
>>
>>61232457
>Nobody in the real world uses it.
Brainlet detected.
Next you're going to tell me that nobody uses continuations either.
>>
>>61232373
it is performing the applicative effects of [1..3] and [-2, -8] and returning the results

liftA2 means lift applicative 2 (2 arguments), it lifts a "two argument" function over applicative effects

you can also do

pure (,) <*> [1..3] <*> [-2, -8]

if you want to use <*> twice
(f <$>) = (pure f <*>)

in applicative do notation

do
a <- [1..3]
b <- [-2, -8]
pure (a, b)
>>
>>61232441
Not in lisp
>>
>>61232457
facebook does
>>
>>61232457
>literally too dumb to learn haskell
>calls other people pajeets
inb4 "I was just pretending to be retarded"
>>
What's a more elegant way of creating a directory and making a file in said directory in Python other than os.mkdir and then os.chdir?
>>
>>61232511
What's bad about those?
>>
I know it's not really programming but... making my own invoice/billing system (just for administration) in PHP.

Haven't been programming for a while.

Anyone else with the same problem? Having periods where you program every day and then suddenly you stop?
>>
>>61232523
I don't know, it's the first thing I came up with so I thought there'd be a better way to go about it.
>>
>>61232481
I was talking about C anon.
>>
>>61232547
Well, they literally do what you want, so just use those.
>>
>>61232554
C is not lisp.
>>
>>61232579
I know Anon. That's why I said that currying was a lot of work to implement. Because it's easier in lisp. I was pointing out a difference in order to refute >>61232271 's claim.
>>
Why is video streaming so hard? Why can't you just encode mkv files according to a predictable url? For example, there are 3 qualities, each file is 4 seconds long, and the stream started on 2017-07-05 11:23:00 UTC. You simply request 'https://yourdomain.com:8080/stream/medium/4500.mkv' and play it. How is it such a hard problem to solve, requiring multiple specifications and shit?
>>
>>61232603
Don't bother with retards like >>61232271. Your quality of life will improve tenfold.
>>
>>61232538
Yeah pretty hard when I was in my 2 - 4th year

>think up some cool ideas
>start up with a simple prototype
>think that I have to create the perfect architecture
>procrastinate
>never finish the project
>>
>>61232620
nginx with rtmp-module makes it pretty easy if you're looking for some solution
>>
File: lolimdumb.png (28KB, 1018x275px) Image search: [Google]
lolimdumb.png
28KB, 1018x275px
>>61225466
>What are you working on, /g/?
project euler and I feel retarded as fuck right now. FUck this shit. ;_;
help me. This sounds like kindergarded task, but apperently I cant even crawl
>>
>>61230222
>my secondary skill is violin
I'm fucked
>>
>>61233043
what lang?
>>
>>61233043
PE is literally extra credit high-school math.
>>
>>61228264
>that clickbait title
It brings up a valid difference in the abilites of LINQ, but I find it hilarious that this person thinks that a sorting function (more specifically, a comparison function) shouldn't need to be reimplemented for every class.
>>
>>61233043
Try some nested functions, you just need the naive approach right? Also check for duplicates somehow
>>
>>61230222
>a secondary skill
Programming is a secondary skill.

Programming is only a tool used to realize potentials of other skills. If your only skill is "programming", you're the definition of a code monkey.
>>
>>61233122
What the fuck?
What the fuck do you mean PE is math?
PE stands for physical education you nitwit.
Next you'll be saying physics is music. Oh wait, someone already actually said that.
>>
>>61233104
preferably C.
When numbers get to big I usually switch over to python
>>61233122
Anything til problem 51 probably yes. Apperently it gets harder afterwards (according to their own dificulty rating)
>>
>>61233043
this looks similar to the dynamic change problem
review dynamic programming
>>
61233175
(You)
>>
>>61233175
Project Euler, dumbfuck.

Go back to whatever board you came from.
>>
>>61233171
Programming doesn't have to be a secondary skill.
You can have programming as a primary skill and also many secondary skills.
>>
>>61233201
No one would consider "being able to use a hammer" as their primary skill with "carpentry" as a secondary skill.

Programming is only a tool to facilitate other important skills. Nothing more.
>>
>>61230222
just get a mechanical keyboard and learn proper touch typing dumbass
>>
>>61233192
Excuse me? What the fuck do you mean "project oiler." That sounds like the most retarded job title on earth. "yeah hi i'm here to fucking oil your projects"
In any case such a job certainly wouldn't be math
>>
>>61233241
lol my teacher didn't write euler on the board or anything he just casually talked about oiler in class
>>
>>61233221
Being able to use a hammer is not a skill. Anyone with an arm is able to use a hammer. It takes experience to program.
Also, if the distinction you're making is that secondary skills are tools to facilitate other important skills, then all skills are secondary skills. Name one skill that serves any purpose other than facilitating other important skills, and what other purpose it serves, and no matter what skill you name (unless it's survival) I'll prove you wrong.
>>
>>61233241
Your joke doesn't even make sense, it's pronounced "(You)-ler"
>>
>>61233362
This is wrong.
>>
>>61233371
it aint
>>
>>61233402
Wrong.
>>
>>61233416
no
>>
>>61233440
Yes. You are wrong.
>>
>>61233460
i'm not
>>
>>61227628
What esoteric programming language is this?
>>
New thread:
>>61233495
>>61233495
>>61233495
>>
>>61233043
Start with a simpler task and don't optimize prematurely (see >>61233169)

Imagine having just two coins: 1p and 2p. How many ways are there to to get 1p, 2p, 3p, 4p, 5p?

Total    Different ways
1p 1x1p
2p 2x1p, 1x2p
3p 3x1p, 2x1p + 1x2p
4p 4x1p, 2x1p + 1x2p, 2x2p
5p etc.
>>
>>61233237
Actually, touch typing has been linked to increased chances of RSI.
>>
>>61233500
thanks.
#include <stdio.h>

int coins[] = {200, 100, 50, 20, 10, 5, 2, 1};
int max = 200;
int count[200+1];

int main()
{
count[0] = 1;
for(int i = 0; i < 8; i++) {
for(int j = coins[i]; j <= max; j++) {
count[j] += count[j-coins[i]];
}
}

printf("count: %d\n", count[200]);
return 0;
}
>>
>>61230222
I'll be fine, I type in a more ergonomic way
Everyone seems to type with their fingers on asdfjkl; and their thumbs on the space bar
I type with my fingers on aetbnip shift and my thumbs off the keyboard
It's because I never learned to type, I just used the computer way too much and accidentally started touch-typing
>>
>>61233512
doubt

there are different ways to do it. some people stretch their pinkies far to the sides to press shift and ctrl for example. some people use wrist/palm rests improperly while typing. some people press/rest their wrists against their desk while typing
>>
>>61233550
iktf, I don't really touch type but rather just have memorized the layout and move my hands around
>>61230222
HASH MARK INCLUDE LEFT ARROW ESS TEE DEE AY OH DOT EYCH RIGHT ARROW NEW LINE
INT COINS LEFT BRACKET RIGHT BRACKET EQUALS LEFT BRACE TWO HUNDRED COMMA ONE HUNDRED COMMA FIFTY COMMA TWENTY COMMA TEN COMMA FIVE COMMA TWO COMMA ONE RIGHT BRACKET SEMICOLON NEW LINE
>>
>>61234067
HASH MARK INCLUDE LEFT ANGLE BRACKET ESS TEE DEE AY OH DOT EYCH RIGHT ANGLE BRACKET NEW LINE
NEW LINE
INT COINS LEFT BRACKET RIGHT BRACKET EQUALS LEFT BRACE TWO HUNDRED COMMA ONE HUNDRED COMMA FIFTY COMMA TWENTY COMMA TEN COMMA FIVE COMMA TWO COMMA ONE RIGHT BRACKET SEMICOLON NEW LINE
Thread posts: 319
Thread images: 26


[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.