[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: 315
Thread images: 19

File: BENKYO.png (3MB, 2121x1591px) Image search: [Google]
BENKYO.png
3MB, 2121x1591px
What are you working on, /g/?

Previous thread: >>59962532
>>
leggings make you code better
>>
C was a mistake
ML was robbed

It didn't have to be like this
>>
>mfw compiling a 100 LoC JS """app""" takes twice as long as compiling my 12k LoC C++ project

When did everything go so wrong?
>>
>>59968861
C was decent choice at the time.
Lisp was robbed.
ML was created afterwards and still doesn't support native threads.
>>
>>59968867
When C became the de facto standard systems programming language instead of Pascal.
>>
Is inference for dependently typed systems generally the same as with Haskell/ML-like type systems?
>>
>>59968895
speak English, doc
>>
File: 1489030087271.jpg (134KB, 1280x720px) Image search: [Google]
1489030087271.jpg
134KB, 1280x720px
>>59968908
I don't think I can make that post more English.
>>
>>59968895
>>59968908
>>59968980
he means dumb it down you fuckin' child prodigy
>>
>>59968994
I replied to that right here >>59968980
>>
>>59968895
yes
>>
>>59968895
>>59968980
I know you wanted to sound cool, but this is all readily available on wikipedia.

https://en.wikipedia.org/wiki/Dependent_type
>>
>>59968895
no
>>
>>59968895
maybe
>>
>>59969069
>I know you wanted to sound cool
What makes you think so?
>but this is all readily available on wikipedia.
What I asked isn't there.
>>
>>59968895
can you repeat the question?
>>
>>59969124
you asked if the way these languages determines type is similar, how are you not able to extrapolate that from that page and subsequent links? Also, what sort of boring ass question is that? "hey guys do other languages infer types like Haskell hwufaw look at me i'm asking the smart questions".
>>
What do you guys think about the people that go into cs because they think it's easy big money?
>>
>>59969168
>you asked if the way these languages determines type is similar
I didn't ask that.
>how are you not able to extrapolate that from that page and subsequent links?
How would I be able to do that if the information isn't there?
>"hey guys do other languages infer types like Haskell hwufaw
If you thought that this is even slightly similar to my post, you lack basic reading skills.
>>
>>59969194
That they're right.
>>
>>59969208
the definition:
Type inference refers to the automatic deduction of the data type of an expression in a programming language

are you fucking retarded?
>>
hi how was ur day
>>
>>59969222
Fuck off you fucking faggot
>>
>>59969213
"determine types" is pure nonsense.
>are you fucking retarded?
You are fucking retarded. A comment that stupid doesn't even deserve a proper response.
>>
>>59969227
I got trips tho
>>
>>59969260
I don't give a shit
>>
>>59969239
> "determine types" is pure nonsense.
just because your reading comprehension is at a pre-grade school level doesn't mean it's nonsense you fool. Let me make it easy for you:

Inference:
a conclusion reached on the basis of evidence and reasoning.

Determination:
the process of establishing something exactly, typically by calculation or research.

again, are you a fucking full on retard?
>>
>>59969294
hmmm check em
>>
File: Bueno.jpg (50KB, 546x366px) Image search: [Google]
Bueno.jpg
50KB, 546x366px
>>59969222
nice trips dog
>>
>>59969329
Hurr muh repeating numbers
Fucking /b/tard
>>
>>59969295
>just because your reading comprehension is at a pre-grade school level doesn't mean it's nonsense you fool
Are you being retarded on purpose?

>a conclusion reached on the basis of evidence and reasoning.
This implies prior rules.
>the process of establishing something exactly, typically by calculation or research.
This does not say anything about prior rules.
Only a double-digit could possibly think these two things are the same.

>again, are you a fucking full on retard?
Go calm yourself, and maybe tomorrow you'll be able to speak to me properly and respectfully.
>>
>>59969364
edgy
>>
Going through "C++ primer" by Lippman, but there's an example i don't fully understand and the explanation doesn't cover my doubts:
// returns the index of the first occurrence of c in s
// the reference parameter occurs counts how often c occurs
string::size_type find_char(const string &s, char c,
string::size_type &occurs)
{
auto ret = s.size(); // position of the first occurrence, if any
occurs = 0; // set the occurrence count parameter
for (decltype(ret) i = 0; i != s.size(); ++i) {
if (s[i] == c) {
if (ret == s.size())
ret = i; // remember the first occurrence of c
++occurs; // increment the occurrence count
}
}
return ret; // count is returned implicitly in occurs
}


Why is variable occurs of type size_type and not just unsigned int? What is the purpose of the second nested if (ret==s.size)? Isn't ret always equal to s.size since it's set that way in the first line of the function?
>>
>>59968831
I just solved the roads and libraries problem on Hackerrank ( https://www.hackerrank.com/challenges/torque-and-development ) with a hand-rolled algorithm. Here's my code, am I doing it right?

use std::io;
use std::collections::HashMap;

struct GraphComponents {
arr : Vec<usize>
}

impl GraphComponents {
fn new(n : usize) -> GraphComponents {
let arr = (0..n).collect();
GraphComponents {arr : arr}
}

fn true_parent(&self, mut i : usize) -> usize {
while i != self.arr[i] {
i = self.arr[i];
}
i
}

fn add_edge(&mut self, mut i : usize, mut j : usize) -> usize {
let tpi = self.true_parent(i);
let tpj = self.true_parent(j);
let tp = std::cmp::min(tpi,tpj);

while i != tp {
let parent = self.arr[i];
self.arr[i] = tp;
i = parent;
}

while j != tp {
let parent = self.arr[j];
self.arr[j] = tp;
j = parent;
}
tp
}

fn reduce_parents(&mut self) {
let size = self.arr.len();
for i in 0..size {
let parent = self.arr[i];
self.arr[i] = self.arr[parent];
}
}

fn count_components(&self) -> HashMap<usize,usize> {
let mut h = HashMap::new();
for &val in self.arr.iter() {
*h.entry(val).or_insert(0) += 1;
}
h
}
}


(Cont in next post)
>>
File: 1463664163621.jpg (21KB, 564x471px) Image search: [Google]
1463664163621.jpg
21KB, 564x471px
How can I find interesting, small projects on GitHub to contribute to?
>>
>>59969390
aaaand i fucked up the layout.
>>
>>59969396
fn read_ints() -> Vec<usize> {
let mut s = String::new();
io::stdin().read_line(&mut s).expect("Read error.");
s.split_whitespace().map(|x| x.parse().expect("Parse error.")).collect()
}

fn handle_query() {
let params = read_ints();
let n = params[0];
let m = params[1];
let library_cost = params[2];
let road_cost = params[3];

let mut components = GraphComponents::new(n);
for _ in 0..m {
let input = read_ints();
components.add_edge(input[0]-1,input[1]-1);
}
components.reduce_parents();

let output : usize = components.count_components().values()
.map(|x| library_cost + (x-1)*std::cmp::min(library_cost,road_cost))
.sum();
println!("{}",output);
}


fn main() {
let n = read_ints()[0];
for _ in 0..n {handle_query();}
}


The main advantage of this algorithm is that it should require less space than a more traditional graph search algorithm if the edges are read one by one from an input stream.
>>
>>59969390
>What is the purpose of the second nested if (ret==s.size)? Isn't ret always equal to s.size since it's set that way in the first line of the function?
No, ret is past the buffer at the beginning, so when the first time a character occurs, it's set to the position of that character instead, otherwise it just keeps the first occurence of the character.
>>
>>59969397
https://github.com/search?q=interesting%2C+small+projects
>>
>>59969382
arguing semantics, the last refuge of the mouth-breathing haskell basement dweller.

"calculation' itself implies rules you idiot. Unless free-form jazz math is something knew I haven't heard about yet?

>Go calm yourself, and maybe tomorrow you'll be able to speak to me properly and respectfully.
children have to earn respect from their elders you little punk
>>
File: 1469304275628.png (11KB, 430x409px) Image search: [Google]
1469304275628.png
11KB, 430x409px
Is it

- hello world
- Hello world
- Hello World
- Hello world.
- Hello, world.
- Hello, world!
- Hello, World!
or anything else?

I tend to "Hello, world!".
>>
>>59969390
>Why is variable occurs of type size_type and not just unsigned int?
No idea. It's just confuzing for no clear reason at all.

>What is the purpose of the second nested if (ret==s.size)?
>Isn't ret always equal to s.size since it's set that way in the first line of the function?
except they set it to i in the block to mark the first occurence of c. Then, in subsequent passes, its value will not be changed again by the code.
>>
>>59969449
For me, it's "sdioughdfiguh"
>>
>>59969449
hello to za wurdou
>>
>>59969449
$ python2 -c 'import __hello__'
Hello world...


Python3 isn't that depressive:
$ python3 -c 'import __hello__'
Hello world!
>>
>>59969442
>arguing semantics
Semantics:
of or relating to meaning in language

Why would I not be arguing about that when you can't comprehend basic English?

>the last refuge of the mouth-breathing haskell basement dweller.
I don't use Turing-complete garbage.
>"calculation' itself implies rules you idiot
It doesn't. And that sentence says "calculation and research", which can easily mean constructing new rules and calculating something using these rules.
>children have to earn respect from their elders you little punk
You're going to get your heart broken, you sensitive boy.
>>
>>59969449
Grüß Gott!
>>
>>59969427
>>59969454
Oh shit, I understand now. Thanks!
>>
If i have a List of numbers in C#, say
 { 1,4,6, 8, 9, 11, 12, 15, 18, 21, 27 ,29} 
, and i want to make all combinations of 5 numbers, where for example 2 of them are even and 3 are odd, how to do it?
>>
>>59969550
>C#
stop right now
>>
>>59969550
LINQ
>>
>>59969562
That's what i also think, but i can't seem to figure out how to write meaningful command
>>
>>59969561
>>C#
>stop right now
stop right now
>>
>>59969550
Split into odd & even sublists. Then return all pairs of two integers from the even sublist, and all triples from the odd sublist.
>>
>>59969581
> >>C#
> >stop right now
> stop right now
stop right now
>>
>>59969562
>>59969575

Also, i found a good library for combinations, i already can write all combinations of selected numbers, but i can't filter them
>>
>>59969605
The thing with combinations is that you want to filter as little as possible, and generate them cleverly instead. Otherwise your algorithm can easily get pwned by combinatorial explosions.
>>
>>59969605
>Also, i found a good library for combinations, i already can write all combinations of selected numbers, but i can't filter them
how come?
>>
>>59969663
Simple, don't know how to approach
>>
>>59969561
>>59969581
>>59969600
epic
>>
>>59969672
>epic
epic
>>
File: forghorn.jpg (117KB, 835x578px) Image search: [Google]
forghorn.jpg
117KB, 835x578px
>>59969493
>It doesn't. And that sentence says "calculation and research", which can easily mean constructing new rules and calculating something using these rules.

welp you're contradicting yourself now.

you do realize that a deductive system (that is how type inference is implemented by the way--though you knew that already right?) is step by step right? How in the fuck do you think the type is inferred if multiple determinations are not first made regarding the evaluated expression?

>You're going to get your heart broken, you sensitive boy.
you misunderstand, I just can't abide fucking useless douchebags coming onto /dpt/ and asking bullshit generic questions with the hopes somebody will rub up against their E-Chode.
>>
SO stats just confirmed C for being a NEET/hobbyist language.
>>
>>59969396
So basically you specify which connected component a node points to by pointing to the first node in that component? And you use a clever algo to update your representation efficiently as you add new edges?
>>
File: anal beads.png (31KB, 163x1551px) Image search: [Google]
anal beads.png
31KB, 163x1551px
>>59969550
BEHOLD

var input = new List<int> { 1, 4, 6, 8, 9, 11, 12, 15, 18, 21, 27, 29 };

input.Where(x => x % 2 != 0)
.MuhCombinations(3)
.SelectMany(x => input.Where(muhDick => muhDick % 2 == 0).MuhCombinations(2), (ayy, lmao) => ayy.Union(lmao))
.Distinct()
.Select(x => string.Join(", ", x))
.ForEach(WriteLine);


And the extension method:
public static IEnumerable<IEnumerable<T>> MuhCombinations<T>(this IEnumerable<T> elements, int k) => k == 0 ? new[] { new T[0] } : elements.SelectMany((e, i) => elements.Skip(i + 1).MuhCombinations(k - 1).Select(c => (new[] { e }).Concat(c)));
>>
Already know Java & Python, friend came up to me and said "lets make a game for a game jam" and now I wanna learn C++. Looked up some tutorial videos and practice sites. Whats the best resource for learning a new language?
>>
>>59969829
Working on small projects that force you to work with documentation while tackling various topics.
>>
>>59969827
Holy fuck, give me some time to analyze this
>>
>>59969827
Genius

how does one get to this level?
>>
>>59969998
A cheeky marriage of stack overflow and the ability to reason about sets of things.

Also, a blatant disregard for performance if no one says it's mission-critical.
>>
>>59970048
your MuhCombinations makes combinations, but what if i already have a list of all possible combinations?
>>
>>59970070
>what if i already have a list of all possible combinations
A list of all possible even and odd combinations in groups of 3 and 2 respectively, or a full powerset of the raw initial data?
>>
>>59970086
full set of all numbers
>>
It's this season again.

I want to learn some functional language to cleanse my brain from the dirt of imperative CRUD shit I do at work, what would you suggest?

I want a language that is based on either CIL or Java, or at comparable to them (i.e. has a lot of existing libraries, proper threads with no GIL). Preferably with good emacs/vim/ide support

Is F# kawaii? Is there better enterprise-level candidate to learn nowdays?

I don't want to lisp (too old and parenthesisy), scheme(only fast implementation - Stalin - takes ages to work), Haskell (I don't have PhD in functions' endomorphisms) , Ocaml (GIL threads)
>>
>>59970086
>>59970104

i found some library for making combinations, it's literally
Combinations<int> listofCombinations = new Combinations<int>(rawList, 5); //for 5 elements in a combination
>>
>>59970104
Then fucking Select over it, it's inefficient but nothing should be blocking you should it?
>>
>>59970106
Scala
>>
>>59970122
Then use that twice to make two lists of combinations; one for your even constraints, one for your odd constraints.

Then get combinations of these sets together.
>>
>>59970104
Then the highest performance algorithm is probably to delete that huge array immediately and generate the combinations in groups of 3 and 2.

If say, 10% of the numbers are odd, splitting into groups give you a thousand-fold improvement.
>>
>>59970106
well, you said functional but said you wanted it based on Java so I'd suggest you try out Scala. It works within the JVM, uses Java styling, and provides support for functional programming.
>>
>>59969827
One of these days I'll be able to LINQ like this.
>>
Currently trying to learn the syntax of a member.

When exactly are you supposed to use "static"?
>>
>>59968895
You're not the boss of me now
>>
>>59970106
>>59970134
>>59970143
https://www.coursera.org/learn/progfun1
Been there done that. It's very progressive and you learn a lot of interesting programming patterns you wouldn't have thought of. A good exercise. I didn't do the rest of the curriculum but reactive programming sound exciting.
>>
>>59970163
Depends on the language you CUNT. Also read up, we're not your coach.
>>
>>59970106
>enterprise-level candidate
>functional
I don't understand.

Yes, some functional languages are occasionally used somewhere in an enterprise, but it sure as hell ain't common.
>>
>>59970187
Is this the fabled /g/ autism I hear so much about?
You're not obliged to answer my question, anon. If your autism is that enhanced, instead of ignoring my post you can hide it.

Also, C#.
>>
>>59970176
>>59970196
I use Scala a lot mostly when working in Spark, while it's definitely OOP most of the parallel computations and stuff that are done on the cluster I'm running my Scala code across is functional but is collected/accumulated into objects.

it's definitely not common in most day to day applications and such but becomes more prevalent in things like analytics or if some aspect of your stack relies on simulations or is heavily computational.
>>
>>59968861
If C was a mistake, then surely someone came up with a better alternative?
>>
>>59970212
>When exactly are you supposed to use "static"?
Google it. I'm not even joking. If you're using Rob Miles' Yellow Book 2016 edition, look in the glossary.
>>
>>59970212
RTFM

https://msdn.microsoft.com/en-us/library/79b3xss3.aspx

This page literally explains everything in detail, showing you the purpose of a static class (not so common), and the purpose of static members within a non-static class (common).

int.TryParse()
is a great example of a static method:
http://sourceof.net/#mscorlib/system/int32.cs,148
>>
File: 1491088768857.png (292KB, 1051x1920px) Image search: [Google]
1491088768857.png
292KB, 1051x1920px
>>59970212
Also, C#
>>
>>59969550
Is this a programming challenge

Join@@@Tuples[Subsets@@@({Select[{1,4,6,8,9,11,12,15,18,21,27,29},#1],#2}&@@@{{EvenQ,{2}},{OddQ,{3}}})]


Here's what it returns
https://pastebin.com/x2uKiZAg
>>
>>59970252
>>59970268
Right, the explaination I found previously was a bit complicated but I think I get it now.
Thanks.

>>59970273
I believe you forgot your meme green quotation arrow.
>>
>>59970306
THIS IS THE PRICE I PAY FOR TRYING TO FIT IN
>>
File: 170419rmrqonvjyspt.png (271KB, 1920x1080px) Image search: [Google]
170419rmrqonvjyspt.png
271KB, 1920x1080px
Wrote screenfetch-like script for gentoo.
>>
>>59970327
Where's the repo?

You did make this FOSS, right?
>>
>>59970327
it looks cool but makes me sad inside.
>>
>>59970337
https://github.com/DmitryHetman/gentoofetch
It's written in dash, don't detects nvidia/amd GPU yet.
>>
>>59970176
>scala
weird and outdated.
The haskell course in edx is better imho.
>>
>>59970340
Why sad?
I'm sad becouse of doing stupid scripts, and being unemployed. I want to create my own /chan were will be no rules.
WindowsCucks and GayOSfucks will be not allowed.
>>
>>59970378
>Your lang is weird and outdated.
>mine is Haskell!
Do you realise how off-the-hook you sound? Although monads and lenses blew my mind at some point, the language we're talking about is a clusterfuck of unhygienic extensions and added syntax. It's such an overgrown ugly patchwork even CL is better ffs. Meanwhile scala has regular syntax and workable namespaces.
>>
>>59970417
>no rules
>already defining rules that are virtually unenforceable
>is unemployed and a linux elitist
Like fucking poetry.

Man, you need to get off of /g/ for a bit and realize that 90% of /g/ is grandstanding.
>>
File: 1485023734149.jpg (61KB, 1000x800px) Image search: [Google]
1485023734149.jpg
61KB, 1000x800px
In python:

a = list(range(5))
b = a
a[2] = 12
print b
Outputs b as: [0, 1, 12, 3, 4]

Why?
>>
Creating a french-based language
importe standard.bi;

publique vide principal()
{
pour(i = 0; i <= 100; i++)
{
si i % 3 == 0
{
affiche("fizz");
}
sinon si i % 5 == 0
{
affiche("buzz")
}
sinon si i % 5 == 0 && i % 3 == 0
{
affiche("fizzbuzz")
}
sinon
{
affiche(i)
}
}
}
>>
>>59970519
#define if si
#define else non
#define public publique
#define void vide

Wow that was hard.
>>
>>59970519
It's shit
>>
i`m stuyind C and DS, by programming my own DS library. this is what i have so far:
blist.h
struct node{
int num;
struct node *next;
};
struct node *begin;
struct node *end;
void add_node_end(int val);
void add_node_begin(int val);
void print_list();


print_list.c
#include <stdlib.h>
#include <stdio.h>
#include "blist.h"

void print_list() {
struct node *aux;
aux = begin;
printf("\n");
if(aux != NULL)
for(;aux != NULL; aux = aux->next)
printf("%i\t", aux->num);
else
printf("empty list");
printf("\n");
}


add_node_begin.c
#include <stdlib.h>
#include <stdio.h>
#include "blist.h"

void add_node_begin(int val) {
struct node *new_node = (struct node*)malloc(sizeof(struct node));
new_node->num = val;
new_node->next = begin;
if(begin == NULL){
begin = new_node;
end = begin;
} else {
begin = new_node;
}
}


add_node_end.c
#include <stdlib.h>
#include <stdio.h>
#include "blist.h"

void add_node_end(int val) {
struct node *new_node = (struct node*)malloc(sizeof(struct node));
new_node->num = val;
new_node->next = NULL;
if(begin == NULL){
begin = new_node;
end = begin;
} else {
end->next = new_node;
end = end->next;
}
}


the next is going to be the other types of list and stack, queue, trees etc.
>>
>>59970511
why what?

it is correct
>>
File: mexican_alien.jpg (85KB, 553x674px) Image search: [Google]
mexican_alien.jpg
85KB, 553x674px
I'm trying to implement a variant of Dijkstra's algorithm. The regular version of the algorithm uses a binary heap with a decrease-key. The version I'm trying to implement doesn't use a decrease-key.

It's been a bitch to find an implementation of this version of Dijkstra, but I've found one. Unfortunately, it's a bit more mathematically verbose than my self-taught pleb self is used to. I'm trying to translate it into plain-english pseudo code that I can then implement myself.

Any help is appreciated, either in pseudocode or your C-like language of choice.

// v is vertex
// s is source vertex
// Q is min-oriented binary heap, ordered by distance
// from s to a given v
// d is array to track distance from s to v
// w is a weight function

1. perform the following initializations:
(i) Q←O // I think this means initialize binary heap as empty, that's a null set symbol I believe
(ii) for each v ∈ V[G] do
d[v]←+∞ // I understand this loop -- set distance from s for every vertex as infinity until processed by the algorithm
(iii) Insert(Q)(s,0) // place source on the heap

2. while Q != O do // while binary heap is not empty
(i) (u, k) ← Delete-Min(Q)( ) // remove the minimum vertex from the binary heap and do something. not sure about (u, k). assignment of some kind?
(ii) if k < d[u] then // if k is less than the distance of u from the source-vertex (what are k and u?)
d[u]←k // assign k as the distance of u from source-vertex? edge relaxation?
for each (u, v) ∈ E[G] do // for each adjacent edge(?) of v
if d[u] + w(u, v) < d[v] then // if distance of u from s plus some weight function(?) is less than the distance of v from s
Insert(Q)(v, d[u] + w(u, v) ) // insert v with an associated distance(?)
d[v]←d[u] + w(u, v) // set v's distance to u's distance plus some weight function result?

// END PROCEDURE


This is pretty confusing.
>>
Has anyone been to any of the programming related meetups? Are they gay as fuck full of ppl just trying to get participation points and 'active in the industry' creds?
>>
>>59970519
Merde! Putain de la fromage!
>>
>>59970511
Most languages would have similar behavior.

What don't you understand?

Why do you think it shouldn't do this?
>>
>>59970423
lol no.
The haskell based course is better than the scala one.
Now that said I won't dare use haskell for real stuff.
But if I had to choose a JRE based language to do functional stuff it would be kotlin.
>>
>>59970511
Frogposters need to kill themselves
>>
>>59970547
>'active in the industry' creds
This, mostly.
>>
>>59970511
I don't know the proper python parlance for it, but "b" isn't a copy of "a" when you do assignment like that. It's a reference. So a and b are both references to the same list, and any operations you do on its' elements will be reflected regardless of which one you look at, since it's the same list either way.

If you want a second list, you'll need to instantiate another list and copy its' contents over if that's what you wanted to accomplish.
>>
>>59970568
Or being eaten by a french
>>
>>59970566
Haven't tried Kotlin. What does it do better than Scala or Clojure for functional stuff?
>>
>>59970494
No rules for normal people. Who cares about Windowsfags.
>>
>>59968867
>JS
>Compiling
>>
>>59970653
Nothing. Is actually worse for FP out of the box (you can use libraries like funKtionale though) but is easier to work with than scala and way better than plain Java. Its also compatible with JRE 6.
>>
let ptr = 0x1234 as &mut u8;
*ptr = 24;


>This is illegal in Rust
Defend this rustfags.
>>
>>59970793
It'd segfault in C anyway
>>
>>59970597
If you want the whole picture :
https://youtu.be/_AEJHKGk9ns
It's a short talk about this, and it really drives the point home. Most of the PyCon talks are great.
>>
>>59970417
just think about the story this script tells.
> runs gentoo
> has spec script for stationary host machine
> script is essentially meta and of little applicability
>>
For online games (think LoL or something), should the client poll the server every time it wants updates, or should the server send data unsolicited? Client polling seems like it'd be easier to implement, because you can have very clear protocol definitions. A "GetPlayerPositions" always receives a "PlayerPositions" response from the server, and so on. But I guess it has a decent performance cost in having to process all those polling requests. Thoughts?
>>
>>59970805
Uh, no it wouldn't.
Why are you assuming my platform, CPU mode, and memory layout?
C does not define that writing to 0x1234 will segfault. It's a perfectly legal memory access actually.
>>
>>59970839
you should look into game state architecture there are some general white papers out there on emitting and handling events in a shared state.

unrelated note checkout out Gamelift and Lumberyard if you're looking to make something with a ton of network players.
>>
>>59970855
So it's undefined behavior, even better
>>
>>59970793
unsafe 
is for you if you're into this kind of thing. How does the saying go again ? "Implicit is better than explicit" ?
>>
>>59970839
For maximum client performance send data unsolicited.
If the server hasnt heard from the server for X milis, send a return request.
If that goes unanswererd for X milis, assume they DC'd and dont resent untilthey solicit.

For maximum server performance dont sent unless solicited, But games like LOL have servers powerful enough for max out (former responce).
>>
>>59970836
Think of it as exclusive for Gentoo GNU/Linux
>>
Should i always be using smart pointers in favor of raw pointers in c++?
>>
>>59970935
At first I thought I'd hit the bottom of this well of dispair but the floor just fell away
>>
>>59970901
Except C does not define 0x1234 as invalid memory.

>>59970925
>Forcing me to shit up my code base with ugly unsafe blocks and extra indentation
No thanks
>"Implicit is better than explicit"
No it isn't. Implicit is a shit show as proven by C++.
>>
>>59970952
Yes, for most definitions of always.
>>
>>59970952
raw pointers works faster.
>>
>>59970971
>says explicit is better than implicit
>doesn't want to be explicit about what they're doing with a keyword

doublethink
>>
does the operating system free up all the memory my program was using when it is closed? why would i got through the trouble of manually deleteing everything if windows is going to do that anyways?
>>
>>59970993
The perf difference between raw pointers and std::unique_ptr is tiny.
Maybe if you're using std::shared_ptr would raw pointers be a (maybe) noticeable speed increase.

>>59970998
Too much explicitness is is bad and bloats up code.
In this case the unsafe is just unnecessary, stupid, and already obvious.
>>
>>59971004
>managing your own memory

I bet you change your own oil, too, pleb.
>>
>>59970971
>Except C does not define 0x1234 as invalid memory.
Is that why I get a segfault when I try to run it?
>>
>>59971004
technically things aren't deleted that space is just reallocated and filled with something different when the time comes. If you search your RAM manually you'll find all kinds of garbage lying around in there
>>
>>59971004
Yes. Because if you have memory leaks you can't keep your program open for a long time without bogging down the computer.
>>
>>59970793
let ptr = 0x1234 as *mut u8;
unsafe { *ptr = 24; }

?
>>
>>59971004
From what I understand the memory leak occurs when you're constantly dynamically allocating memory in a loop of sorts. If you only do it once in your program it isn't much of a problem.
>>
anyone know why my INSERT OR REPLACE query isn't working in SQLite? It just inserts...the replace if exist part doesn't work.

INSERT OR REPLACE INTO RequestItems (replacement_num, item_num, part_letter_control_num, part_letters, comments, control_num, height, width, depth, is_direct_import) VALUES (:replacement_num, :item_num, :part_letter_control_num, :part_letters, :comments, :control_num, :height, :width, :depth, :is_direct_import);
>>
>>59970971
Does the standard define 0x1234 as valid memory? Does it say what will happen when you do anything with it regardless of what ANSI-compliant compiler & platform you use? No? Then it is undefined behaviour.
>>
>>59969827
goddamn C# is comfy
>>
>>59971029
The reason you get a segfault is because your platform and OS combination defines it as invalid.
The C standard does not, as proven by the fact that if I execute that code in my kernel running in ring0 with the first megabyte of physical memory identity mapped, it runs fine and just simply mutates the value at that address to 24 and continues on.

Fucking learn a thing or two about the machines you program on and the languages you program with.
>>
>>59971098
So it's undefined behavior
>>
>>59971089
>>59971111
Just because it's undefined in the C standard doesn't mean it's undefined on your platform, fucking retard.

It's perfectly defined behavior in my kernel for example, it'll access the first megabyte of physical ram.

It's the fact that Rust bans this outright that makes it shit.
Accessing the memory in my kernel is legal, why can't Rust just trust me! I know what I'm fucking doing.
>>
>>59971060
Why even program at that point if you are going to be literally faggot about it?
>>
recommend me a good project oriented C# course/book
>>
>>59971152
Adding an unsafe block won't spawn a velociraptor next to you. If you need to do low-level platform-specific stuff, you use unsafe. If you're not doing anything low-level or platform specific, you don't.

Rust doesn't ban unsafe code. It just requires you to mark where you do it.
>>
>>59970793
Rust isn't a systems programming language
Ptr : Integer with Address=>16#1234#;
...
Ptr := 24;
>>
>>59971241
>Rust doesn't ban unsafe code. It just requires you to mark where you do it.
And it calls itself "systems programming language". It's fucking pants on head retarted.
>>
>>59971131
Well at least I finally got you to admit it's undefined behavior as I originally pointed out
>>
>>59971282
You dumb cunt. The behavior is defined. Trying to access protected memory will segfault the program.
>>
>>59971256
>Rust isn't a systems programming language
The fuck? Yes it is you fucking retard.
>>
>>59971131
Suppose you are managing an open source project and you are skimming through a file to check that the latest pull request doesn't create a segfault. Would you accept a "why don't you trust me?" from the guy who made the pull request?
>>
>>59971241
>Adding an unsafe block won't spawn a velociraptor next to you.
It did when I tried it.
>>
Remember when Go was the next big thing? Now it's Rust. Guess what happened to Go: the hype ended.
>>
>>59971282
And you're missing the point entirely.
Do you have an IQ below 100?
>>
>>59971331
Mozilla is willing pay shills way more than Rob "faggot" Pike.
>>
>>59971312
Of course not, because I know better than him.
However in my case, I know better than the compiler, so it should trust me.

So your point is kind of fucking stupid.
>>
>>59971306
How would you do
>>59971256 or >>59970793
Without an unsafe block?
>>
>>59970553
Not op but it feels weird that b becomes 'linked' with a just with 'b = a'. The = makes it feel like a was copied to b, but not 'linked' to b.
>>
>>59971374
>Without an unsafe block?
If you think having the unsafe keyword automatically makes a language "not a systems language", then you're fucking retarded.
>>
>>59971395
It apparently has no concept of what an address is. How is it a systems language again?
>>
>>59971395
Might as well just program the stuff in C and compile it as library. Then use rust for the scripting as it was meant to be with it retared (((unsafe))) blocks.
>>
>>59971374
>Without an unsafe block?
whoa man, you have to add ONE BLOCK (that has you type a whole word) in order to do a thing??
>>
>>59971374
>How would you do
>>>59971256 or >>59970793(You)
>Without an unsafe block?

That depends. How would you do the same thing in C++ without a reinterpret_cast?

Just because Rust requires you put it in an unsafe block doesn't mean it isn't a systems programming language.
>>
>>59971300
Not defined in the standard = UB
>>59971336
What point, all you did was dance around calling it UB for a few posts
>>
>>59971419
I'm not agreeing with the person you're responding to, but that's pretty damn annoying and stupid having to introduce a whole new level of indentation and braces.
>>
>>59971412
Yes it does fuck tard.
What do you think a &reference or a *pointer is in Rust?
>>
>>59971453
My point is that C allows it, while Rust prohibits it.
>>
>>59971473
Unsafe and prohibited, apparently.
>>
>>59971506
Not if you wrap it in an unsafe block, it's perfectly allowed.
>>
>>59971491
>while Rust prohibits it
Apparently not, as has been explained multiple times
>>
>>59971506
Also, references are 100% safe.
Pointers are also 50% safe. You can declare and define a pointer in safe code, but you can only dereference it in unsafe code.
>>
>>59971457
You can add it as a modifier in a function definition, just like how you would mark a function/method as inline or virtual in sepples.

You can also add it as a modifier to an impl or trait block. You literally only need the version with its own braces/indentation if you are doing a single isolated unsafe operation somewhere.
>>
>>59971491

>Rust prohibits it
Only without an unsafe block. You're basically committing a syntax error.
>>
>>59971560
It's not a syntax error. It'll parse perfectly fine.
It'll just cause the sanity checker to yell at you.
>>
>>59971526
>If you break of the safety semantics that we shill and that rust is all about, you can do it
>>
>>59971600
The point of rust is that it allows you to implement safe interfaces on top of unsafe interfaces.
It's also generally better designed than C++, more powerful, and more performant than C++ according to benchmarks.
>>
>>59971588

I'm aware that it's semantics and not syntax, but it is easier to think of it LIKE an syntax error. It's not that what you want is not possible, but rather, you wrote it wrong.
>>
>>59971600
>Having to mark where you use UB is bad, instead the compiler should complicity roll over and not generate shit while any other programmers or users reading my code should have no indication I did this on purpose.

C is clearly superior
>>
>>59971628
C still completely destroys Rust.
>>
>>59971233
Appress Accelerated C# 2010
>>
>>59971628
And my point is you might as well be calling a c library since your language doesn't allow setting variables at addresses.
>>
>>59971663
Imagine being so retarded that you can't remember what people explained to you a few posts earlier
>>
>>59970546
Almost no library implementations of heaps come with decrease key methods. Generally what you do is just ignore decreasing keys and continue adding duplicate nodes with different distances, since you are guaranteed to get the minimum distance one first. Usually you either keep track of a visited set or some Boolean field in the node class itself (i.e. visited == false while we haven't actually visited, and when we finally do pop it from our min heap, set to true, don't add any more copies of this node, and don't process this node ever again).
>>
>>59971654
>>59971657
Nice argument and damage control.

>>59971663
>since your language doesn't allow setting variables at addresses.
It does.
It just requires an unsafe block if that address is some arbitrary one that you defined.
Taking a reference to something and dereferencing it in rust is perfectly legal and safe.
>>
>>59971663
>>59971600
>wow, I have to add one whole keyword to do this xD
>>
>>59971628
>and more performant than C++ according to benchmarks
care to post those benchmarks?
>>
I love programming
>>
>>59971729
I love you <3
>>
>>59971729
I love shit posting, I don't even have to mark it unsafe.
>>
>>59971679
>>59971711
>>59971687
Unsafe is designed to break out of the safety semantics at you shill as the virtue of rust. Using it admits it's too restrictive for such a simple concept.
>>
>>59971736
Fuck off, homo
>>
>>59971744
META
E
T
A
>>
>>59971729
unsafe {
Fuck off and kill yourself faggot.
}
>>
Is there any reason to use foreach in C#? I've read that manually iterating a list with a for loop is always more effecient. Is this true, and if yes, does foreach have any purpose?
>>
>>59971751
Did you miss the part where I said
>The point of rust is that it allows you to implement safe interfaces on top of unsafe interfaces.
>>
>>59971780
clarification: with a "manual for loop" I mean something like this:

for (int i = 0; i < list.Length; i++)
{
}
>>
Why can't I mutate strings directly in javascript?
Why does my textbook recommend I write 2 anonymous functions just to scramble all the letters in a string?
>>
>>59971790
So does literally any language that has interface to C or that can inline C/ASM/C++
>>
>>59971793
they should compile to the same thing
>>
>>59971793
foreach would probably be faster since it uses iterators and therefore doesn't incur the overhead of bounds checks. At least in Rust anyway. I assume it's the same in C#, unless C# is shit.
>>
>>59971790
I definitely did miss that they admit it's too restrictive. Thanks.
>>
>>59971806
So foreach is only used due to incompetence or for better readability?
>>
>>59971803
No other language can guarantee safety at compile time.
>>
>>59971658
>2010
Mate...
>>
>>59971819
First of
>Other
Once you use unsafe you might as well use c for that block

Secondly, your half assed static analyzer isn't good enough to make that claim.
>>
>>59971815
Use iterators (= foreach) when possible. It makes the code more clear. Index based iteration is due to incompetence. It's a relic from Fortran.
>>
>>59971780
foreach
is actually faster in some cases.

This is a moot point, though.

Worry about making your code work, making it easy to understand and follow for your team, and producing the right outputs.

If you determine a particular part of your application to be too slow, start examining whether something needs to be rewritten using other language constructs to fit the situation.
>>
>>59970839
it literally doesn't matter because a single node needs to handle only 10 players
>>
>>59971857
>Once you use unsafe you might as well use c for that block
Sure, you can. But it'd be easier to do it in Rust if you're already using Rust.

>Secondly, your half assed static analyzer isn't good enough to make that claim.
Except it is.
The borrow checker may not be perfectly fine grained, but it does guarantee memory safety.
>>
>>59971751
Opening a random source file of redox OS:
redox-os/binutils -
binutils/src/bin/hexdump.rs

(fuck you 4chan for not allowing github links)

you find a single unsafe in a 200 LOC file.

Random file 2 (a driver!):
redox-os/drivers -
drivers/pcid/src/main.rs

2 tiny unsafe blocks in 162 LOC.

You can get very far with only minimal use of unsafe blocks even in low-level code. In high level code where you just call libraries for most tasks, you pretty much never need it at all.
>>
>>59971356
>Of course not, because I know better than him.
>>
>>59971876
Alright how about RuneScape then?
>>
>>59971890
>(fuck you 4chan for not allowing github links)
Fuck you Reddit.
>>
>>59971901
it literally does not matter because of sharding
truth be told you can scale to multiples of thousands of simultaneous users network-wise, but your game logic will choke
just use a fixed-rate world update & state update transfer
>>
>>59971894
What's the problem?
>>
>>59971889
>Memory safely
That's the start of the pyramid. Thinking your code is safe and correct because you don't have memory leaks is dangerous.
>>
>>59971924
It gave me a good chuckle.
>>
>>59971909
Since when did github links become a Reddit thing?
>>
Can this be more simplified (besides use the 'reverse' function)?
(defn my-reverse
"Reverse a list."
[xs]
(loop [[y & ys] xs res '()]
(if (empty? ys)
(conj res y)
(recur ys (conj res y)))))
>>
>>59971915
Fuck it I'll just use RPC over TPC and if it becomes a problem later on then future me will have to figure it out.
>>
>>59971931
Memory leaks are considered safe in Rust actually.
>>
>>59971940
Lurk more Reddit.
>>
File: 1485252171642.jpg (104KB, 1000x1430px) Image search: [Google]
1485252171642.jpg
104KB, 1000x1430px
>>59970568
>mfw

>>59970544
>>59970553
why isn't b [0, 1, 2, 3, 4]. Do they point to the same object (a and b) like in Java?

>>59971387
amen anon

>>59970597
THANKS! So, it's in like Java. Gonan watch recommended video.
>>
>>59971961
I lurk here for most of my day every day.
I don't visit reddit at all.
>>
>>59971111
>Writing OS
>oh no i cant write to 0x1234 which contains a memory mapped device because its undefined behavior

Since when writing to memory is undefined behavior ?

char *DeviceData = 0x1234;
Data[Index] = 10;

is that fucking shit undefined ?
>>
>>59971976
Please die
>>
>>59971978
I don't believe you, Rust shill
>>
>>59968895
No. In dependently typed languages you generally have type level lambdas and higher rank polymorphism which makes inference undecidable. That being said, it's often still supported but the algorithm may "give up" instead of giving you a type or a type error.
>>
>>59971982
On my computer writing 10 to address 0x1234 launch a nuclear strike.
>>
>>59971988
What makes you think I'm the Rust shill?
>>
>>59972001
It causes dragons to fly out of my USB ports on mine.
>>
>>59972006
Because you're defending a bad language made by horrible people.
>>
File: just fuck my shit up.jpg (110KB, 759x508px) Image search: [Google]
just fuck my shit up.jpg
110KB, 759x508px
>map/filter/reduce was invented to deal with immutable arrays

What's wrong with a fucking for loop.
>>
>>59972023
What makes you think I'm defending any language at all?
I just simply asked when github links became a reddit thing.
>>
>>59971931
You can still leak memory if you have circular references, just like in say Python. What you can't do without unsafe is do things like a double free, or otherwise overwrite memory that has already been freed,or is being used by another part of your program.
>>
>>59971857
One you use inline ASM you may as well chuck C out the window and use ASM cause C is clearly to restrictive.
>>
>>59972031
muh state
>>
If i have 2 lists of integer lists in c#, how do i make 1 unified list with all combinations between those 2 lists?
>>
File: UB.jpg (52KB, 844x203px) Image search: [Google]
UB.jpg
52KB, 844x203px
>>59971982
>C Standard 6.3.2.3
>>
>>59972038
>You can get very far with only minimal use of unsafe blocks even in low-level code. In high level code where you just call libraries for most tasks, you pretty much never need it at all.
Your smooth talking doesn't work on me, Antifa.
>>
>>59972001
upvoted
You are so funny
>>
>>59972049
var tuples = list1.SelectMany(fun x1 => list2.Select(fun x2 => new { x1 = x1, x2 = x2, }));

not tested
>>
>>59972001
>Architecture standart
>Language standart
Thats why there are diffrent compilers for diffrent architectures which implement the same language standart, granted there are diffrences when it comes to specific keywords like inline machine code instructions.
>>
>>59972059
I never said that. That isn't me.

Why do you think that everyone who disagrees with you must be the same person?
>>
>>59972031
Too verbose, and annoying to read when nested.
>>
>>59972052
Fine you got me , I'm a pajeet.
Still it implies defined behavior that is implemented by the general architecture and the specific compiler for that architecture :^)
>>
>>59972067
Might have to
.Distinct()
after this; that's going to give you a cartesian product, which I think will produce multiple of the same combination.
>>
>>59972100
You should just fuck off back to >>>/reddit/ samefag
>>
>>59972110
No FUCK YOU, creating a new array every time you want to change a single array member is wasteful as fuck.
>>
>>59972100
I still don't believe you.
GitHub is unethical. It's closed source and ran by SJWs.
>>
>>59972067
>>59972121

Nah, doesn't work, tried to populate Listview with it but it just displays System.Linq.Enumerable... and with Distinct it says x1 = System.Collection...
>>
>>59968895
>>59972000
There's also bidirectional type checking, which divides the syntax into terms whose types may be inferred and terms whose types must be checked. Typically with bidirectional type checking it is only necessary to annotate top level items. Regular type inference with unification can often have exponential or even doubly exponential time complexity and bidirectional type checking doesn't require unification to be practical so it is also much faster.
>>
>>59972141
Well, yeah, because each element is a collection.

.Select a string.Join on what you have now.
>>
File: Screenshot_2017-04-19_20-21-48.png (36KB, 967x572px) Image search: [Google]
Screenshot_2017-04-19_20-21-48.png
36KB, 967x572px
So I want to write a circle-only physics engine in opencl and display the result in opengl.

I calculate the physics and get an opengl VBO full of the x, y and r values. Some are visible from the screen and some are not. Is there some way to display them using opegl 2.1?
I somehow need to transfer the parameters to actual triangles. Should I just solve it in opencl?
>>
>>59972141
Create a concrete type instead of the anonymous type for your record. You can use distinct if you want.

DO NOT FORGET TO SORT ACCORDING TO A CORRECT SORT ORDER.

Add a final .ToArray() to retrieve an array. Attach to the format event of your listview to format items.

ENJOY
>>
>>59972122
I posted these:
>>59971060
>>59971241
>>59971312
>>59971890

Any other post else was not by me.
>>
>>59972031
>What's wrong with a fucking for loop.
It's not as fancy
>>
>>59972031
I don't think that's true. map/filter/reduce are combinators to factor out boilerplate for common loop patterns and they work just as well if not better on mutable data structures.
>>
>>59968831
Writing an excel parser for wage slavery tasks.

Anyone ever use EPPlus to read Excel sheets that don't follow a template? I'm honestly considering using the Interop library just to avoid how asinine the EPPlus documentation is.
>>
>>59972170
You're out of luck with 2.1 unless you use extensions for geometry shaders or instancing. Generate the geometry using OpenCL as well.
>>
>>59972124
So use a language that isn't shit?

Rust or Python create iterators/iterables and can fuse everything into a single loop with O(1) extra memory.

Haskell and other lazy languages can use lazy linked lists which also allow loop fusion.

Copying the entire array is the naive implementation, a well written standard library doesn't do that.
>>
>>59972124
What language does this?

That implementation would be silly.
>>
>>59970241
JAI is my hope. I'm really happy so far with the features shown but I wish he'd follow through on some of the ideas in his initial videos. Scope capture especially.
>>
>>59972183
You're not even me you fucking faggot. Stop pretending to be me.
>>
To people that write more serious projects in javascript : Do you follow the class oriented or prototype (native) oriented style of writing? What is the common agreement?
>>
>>59972292
>JAI

>> Made by the guy who wrote braid.

Sounds promising. Will check that out.
>>
>>59972317
More than anything the principles he outlines behind making the language is promising. It's a nice contrast to other languages.
>>
>>59972310
>What is the common agreement?
That JS is shit.
>>
>>59972292
>Scope capture
Sounds pointless. Why not just put the code in a function? He also talks about ownership for multithreading which Rust already does everywhere.
>>
>>59972341
Yeah I know, but what about my first question my dear anon
>>
Is it possible to make C/C++ preprocessor interpret an integer literal as a string literal?

I want to do something like
#ifdef _MSC_VER
const char* ver = "version: " _MSC_VER;
#else
const char* ver = "version: " "unkown";
#endif

except thist doesn't work becase _MSC_VER expands to an integer literal and not a string literal.
>>
>>59972310
I got tricked into maintaining chromecast (((apps))). It uses prototyping.
>>
>>59972355
He has a long explanation of how it provides the programmer with more granular steps for reworking the code along with some mild thread safety checks. It's something that me personally I would love to have because it's something I do a lot and even if it's a relatively mild convenience I can see it gonna compound to a lot.
https://youtu.be/5Nc68IdNKdg?t=1829
There's a lengthy bit on it here. It's not very dense content though so I dunno if you'd bother watching it.
>>
>>59972427
Thank you anon for this info
>>
>>59972067
What's "fun" here?
>>
>>59972462
>more granular steps for reworking the code
I understand this from the primer but I don't see the point.
>>
>>59972491
I can see you not understand this bit with the capture specifically. But surely you find yourself making a code change and it's very simple in concept but there's so much mechanical work to do to the code it's really bothering you and you feel interrupted. I feel that way all the time in C++.
>>
>>59972524
The total amount of work is the same though. I simply don't see the point in making your in between steps of refactoring valid to compile.
>>
>>59972524
What about using parameterless lambdas if you are worried about what you capture? The syntax is kind of ugly-looking but it's quite powerful.
>>
> his language doesn't properly eta-reduce it's continuations
>>
Nim
>>
>computer "scientist"
>software "engineer"

When they call themselves this, its clear they are just trying to muscle in on science and engineering because of their insecurity.
But how can they muscle in on other fields?

>computational "mathematician"
>source code "linguist"
>artificial intelligence "psychologist"
>computer network "sociologist"
>electronic "physician"
>non carbon "biologist"
>silicon "philosopher"
>data tree "horticulturist"
>system soul "theologian"
>non human logic systems of ambiguous gender "womens studies major"
>>
>>59972417
I looked it up, since my simple Idea was to just use STR(x) #x at first, but it was wrong:
#include <iostream>
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#define _MSC_VER 10
#ifdef _MSC_VER
const char* ver = "version: " STR(_MSC_VER);
#else
const char* ver = "version: " "unknown";
#endif
int main(void) {
std::cout << ver << std::endl;
}

>>
File: quoting.jpg (7KB, 200x135px) Image search: [Google]
quoting.jpg
7KB, 200x135px
>>59972761
>>
>>59972761
If computer science isn't science then what is it?
And if software engineering isn't engineering then what is it?
>>
r8 or h8

#include <stdio.h>

int max_of_four(int a, int b, int c, int d) {
return a >= b ? a >= c ? a >= d ? a : d : c >= d ? c : d : b >= c ? b >= d ? b : d : c >= d ? c : d;
}

int main() {
int a, b, c, d;
scanf("%d %d %d %d", &a, &b, &c, &d);
printf("%d", max_of_four(a, b, c, d));
return 0;
}
>>
>>59972761
Test results indicate that you are: retarded. Please cease from posting from now on. Thank you.
>>
>>59972546
>The total amount of work is the same though.
No because you're not keeping all your code obviously. I haven't heard of anyone who starts writing a system and keeps all their code in the shipping version. If you have smaller steps you're allowed to spend less effort on the code you throw away.
>>
>>59972806
0/10
>>
>>59972806
max_of_four(int a, int b, int c, int d) {
return max(max(a, b), max(c,d));
}
>>
File: 1491280407879.gif (1MB, 350x272px) Image search: [Google]
1491280407879.gif
1MB, 350x272px
>>59972761
scientists leverage computers to enhance their research you dingaling.

MPP systems aren't a walk in the park--you need somebody qualified you dingaling.

>but how can they muscle in on other fields?
no engineers have muscles they are all nerds you dingaling they use their mind
>>
>>59972764
wtf?
Can you give me the citation for this? I'd like to read up on what the hell is going on here.

Oh, and thanks for the help.
>>
>>59972806
>define max(a,b)
>max(a,b,c,d) = max(max(a,b),max(c,d))
>???
>save some memory
Same can be done with gcd and lcm desu.
>>59972835
This guy gets it.
>>
>>59972806
(max a b c d)
>>
>>59972804
https://youtu.be/2Op3QLzMgSY?t=9
computational mathematician
Is the most appropriate title anon mentioned.
>>
>>59972828
What does this have to do with it?
>>
Is it worth it to learn Rust? Should I just stick with C++ instead?
>>
>>59972915
there are some good ideas it has taken
>>
>>59972915
no and yes
>>
>>59972915
If you don't need any big C++ libraries then there's no reason to use C++ over Rust.
>>
New thread:

>>59972925
>>59972925
>>59972925
>>
>>59972804
seems to me it's mostly just americans who have this notion that science and engineering are strictly physical. in other languages it's not a problem and we call it "natural sciences" when talking about physical sciences. framing CS as a field of mathematics sort of makes sense but not all of it is really math.
>>
>>59972906
At the extreme, if you could instantly do code changes to fit your design you could explore design more rapidly and you can focus more on investigating the design to find what's good and whats bad about it, so you can modify/delete it and make a better system.
Allowing you to spend less time refactoring code for your changes is a step toward that ideal. Lambdas/local functions are good for that because unlike more accessible functions they're not gonna be touched elsewhere. In the case of capture you often allow yourself much less rewriting (figuring out what local variables were used and passing them everywhere takes time). Only capturing part of variables allows the code to be more easily moved out of the local scope to be reused because you've made
a pretty list you can decide on what's appropriate to work into the function and what's actually arguments.

The video i linked really gives a better picture than my 5 minute description of this.
Thread posts: 315
Thread images: 19


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