Quantcast
[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr / vt ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Due to resource constraints, /g/ and /tg/ will no longer be archived or available. Other archivers continue to archive these boards.Become a Patron!

/g/ - Technology


View post   

[ Toggle deleted replies ]
File: 102 KB, 1500x680, cs-grad-combination.png [View same] [iqdb] [saucenao] [google] [report]
65371850 No.65371850 [Reply] [Original] [archived.moe] [rbt]

What are you working on, /g/?

Previous thread: >>65359542

>> No.65371941

>>65371850
my mental health problems

>> No.65371954

>>65371850
Turned down a Haskell job today in favor of a C++ job.

>> No.65371972

>>65371954
>things that never happened

>> No.65371975

>>65371850
how would /g/ solve it?

>> No.65371998

Ideas for c/c++? I want to work on something useful.
Is there any particular program or feature that you want done?

>> No.65372006

I did my own binary data encryption program in C

>> No.65372031

Fuck CUDA

>> No.65372040

>>65372006
Is it military grade?

>> No.65372077

>>65371998
I've always wanted a progran that told me I am a brainlet in at least thirty different languages.

>> No.65372093

>>65372040
Probably not. But it will probably be good enough to stop most amateur hackers from bothering to crack it. I could post an encrypted file if anyone wants to try.

>> No.65372101

>>65371975
(,,) <$> ['A'..'C'] <*> ['A'..'C'] <*> ['A'..'C']

>> No.65372110

Why doesn't c standard have macro like zero that's basically
#define zero(p) memset(p, 0, sizeof(*(p)))

>> No.65372138
File: 600 KB, 718x718, 1492554590171.png [View same] [iqdb] [saucenao] [google] [report]
65372138

>refused yet another job offer
keeping my sweet employment virginity for a haskell job.

>> No.65372154
File: 66 KB, 568x612, 1499400580700.jpg [View same] [iqdb] [saucenao] [google] [report]
65372154

>>65372031
>t. asshurt amdjeet

>> No.65372168

>>65371998
take something not useful and add anime and tiddies to make it more useful

>> No.65372170

>company puts new job ad
>"we highly encourage females apply because we want more even gender distribition"

Isn't this like exteremely sexist? So they will hire a less experienced female just to force 50%

>> No.65372175

>>65372110
Because it was made almost two decades ago and back then nobody thought it would be a good thing to have.

>> No.65372187

>>65371850
>that pic
I know the guy who wrote that code. He dropped out of CS and did Software Engineering instead. He's an employed C++ code monkey now.

>> No.65372190

>>65372170
as if any female will complain about it.

>> No.65372199

>>65372187
Is it you?

>> No.65372216

>>65372101
doesn't even give a solution for the puzzle,
there's 12 "questions"

sequence $ replicate 12 ['A'..'C']

>> No.65372221
File: 34 KB, 601x508, e7db9e4e33592de521b23e955084488e.jpg [View same] [iqdb] [saucenao] [google] [report]
65372221

>>65372199
>Is it you?
N-no. I'm a CS gradute. Honest...

>> No.65372229

Remember kids, it is perfectly alright to enjoy mems like haskell, brainfuck or functional programming. Just don't put it on your CV if you don't want to get it thrashed instantly

>> No.65372247

>>65372229
>not wanting to stay NEET

>> No.65372257

>>65372093
sure go ahead

>> No.65372261

>>65372170
>Isn't this like exteremely sexist?
Yes, it's just toxic masculinity trying to assert its superiority and to put women down again. This is why we need more female CEOs to institute such measures instead.

>> No.65372268

>>65371850
I'm can't think of any other way to solve this in C++ except by recursion. I'll leave the brainlet meme implicit

>> No.65372272

>>65371975
Tuples[{A, B, C}, 12]

>> No.65372290

>>65371972
Its actually true, though.

>> No.65372292

>>65372272
how does that translate to python though?

can you use itertools?

>> No.65372294

>>65372290
Post the position and we'll see

>> No.65372295

>>65372229
>t. i put template metaprogramming fizzbuzz on my CV
I'm sure they'll call you back. Any day now.

>> No.65372302
File: 183 KB, 750x1050, cs-grad-units.png [View same] [iqdb] [saucenao] [google] [report]
65372302

>>65372187
>>65372199
>>65372221
It was posted a couple threads ago.

>> No.65372307

>>65371998
JSON<-->Struct converter that doesn't suck

>> No.65372331

Why are low-IQ "coder" brainlets always so proud about their illiteracy and lack of education?

>> No.65372351

>>65372307
>JSON<-->Struct converter that doesn't suck
>in C++
Basically never going to happen in a trashlang like that.

>> No.65372355

>>65372331
>>65372331
because that's what's what all the ads told them to do.

>> No.65372374

>>65371850
what's the non pleb way to solve this?

>> No.65372385

>>65372355
>that's what's what all the ads is of tellings they be of doings
What did she mean by this?

>> No.65372411

>>65372307
>>65372351
What are the criteria for "doesn't suck"?
https://github.com/nlohmann/json

>> No.65372443

>>65372093
>>65372257
Here it is
https://my.mixtape.moe/aycxep.7z

>> No.65372471

>>65371975
>>65371975
count from
000000000000 to
222222222222
in base 3, and print out the strings with 0-2 mapped to A-C.

>> No.65372478

>>65372331
>why are lonely kissless virgins living in their mother's basement so proud about their autistic behavior, repulsive personality and disgusting appearance ?

>> No.65372505
File: 137 KB, 340x340, 729.gif [View same] [iqdb] [saucenao] [google] [report]
65372505

>>65372411
>Every type can be serialized in JSON, not just STL containers and scalar types. Usually, you would do something along those lines:
ns::person p {
j["name"].get<std::string>(),
j["address"].get<std::string>(),
j["age"].get<int>()
};

>It works, but that's quite a lot of boilerplate... Fortunately, there's a better way:
ns::person p2 = j;
// that's it
assert(p == p2);

>To make this work with one of your types, you only need to provide two functions:
void to_json(json& j, const person& p) {
j = json{{"name", p.name}, {"address", p.address}, {"age", p.age}};
}

void from_json(const json& j, person& p) {
p.name = j.at("name").get<std::string>();
p.address = j.at("address").get<std::string>();
p.age = j.at("age").get<int>();
}

Oh my fucking sides... The absolute, irrecoverable, mind-boggling state of C++ and its """programmers""".

>> No.65372518

>>65372110
Because a lot of time the size isnt exactly sizeof and C programmers aren't afraid to type an additional 10 characters when they memset.

>> No.65372544

>>65372110
Because that's almost always incorrect?

>> No.65372568

>>65371850
Trying to get a chess program working in Java. My logic for check is wrong yet I can't see the problem.
>Not sure if my knowledge of chess is bad, or my programming is bad.

>> No.65372569

>>65371998
Recreate useful libraries from other languages and choose to selfishly keep them to yourself or become a hero and release them for free.

>> No.65372612

>>65371975
well what is the problem?

>> No.65372624

>tfw want to post my github but do not want to get doxxed/affiliated with 4chan irl

>> No.65372631

>>65372624
yea you better not post it bitch

>> No.65372637

>>65371975
http://rosettacode.org/wiki/Combinations_with_repetitions

>> No.65372657

>>65372624
protect your hyperlink with military grade rot13 encryption. only the true programmers among us will be able to decode it.

>> No.65372684

>>65372411
That library crashes with invalid json. It is horrible to work with

>> No.65372697

>>65372657
>rot13
Isn't that the encryption the French special forces us?

>> No.65372704

>>65372657
>military grade rot13
lol

>> No.65372706 [DELETED] 

>>65372471
In swift this would be something like...
let vals = [A, B, C]
let n = 12
let combinations = Int(Double(vals.count), Double(n))
for i in 0..<combinations {
let string = String(i, radix: vals.count).map({ str in
let padding = 12 - str.count
"\(String(repeating: "0", count: padding)\(str)".map({ vals[Int($0)!] })
})
print(string)
}

>> No.65372709

>>65372684
Crashes or throws an exception? Very different things

>> No.65372720

>>65372657
uggcf://tvguho.pbz/junggurshpxvfguvfohyyfuvg

>> No.65372730

>>65372709
literally don't know the difference senpai. it just stops working

>> No.65372745

>>65372706
oops I that second map should be applied the the result of the first one, not inside...

>> No.65372764

>>65371972
yea, everyone knows there's no Haskell jobs.

>> No.65372774

>>65372637
didn't know about that function

nice

solution:
from itertools import combinations_with_replacement
n, k = 'A B C'.split(), 12
for i in (list(combinations_with_replacement(n,k))):
print (''.join(i))

>> No.65372801

>>65372110
>Why doesn't c standard have macro like zero that's basically
>#define zero(p) memset(p, 0, sizeof(*(p)))
Wonderful idea, lad. Linus would absolutely love this. You should submit a PR.
https://lkml.org/lkml/2015/9/3/428

>> No.65372809

>>65372706
>.map({ vals[Int($0)!] })
That shit makes Rust even look pretty.

>> No.65372810

>>65372730
Crashing would be a segfault or similar because of unsafe code. Throwing an exception means it can be caught and you can handle the error. C++ exceptions and a bit controversial, but in this case you can have a clean interface where the parse function always returns a valid JSON object. If the input isn't valid, the function never returns (it throws and you can catch where appropriate).

>> No.65372811

let vals = ["A", "B", "C"]
let n = 12
let combinations = Int(Double(vals.count), Double(n))
for i in 0..<combinations {
let string = String(i, radix: vals.count)
let padding = 12 - str.count
let padded = "\(String(repeating: "0", count: padding)\(str)"
print(padded.map({ vals[Int($0)!] }))
}

fix'd maybe, my 10 iq can't handle this

>> No.65372817

>>65372774
>list(combinations_with_replacement
cwr() is a generator, forcing it to a list is retarded

>> No.65372821
File: 20 KB, 450x300, eyebleach.jpg [View same] [iqdb] [saucenao] [google] [report]
65372821

>>65372637
>D

>> No.65372839

>>65372817
yeah you're right
from itertools import combinations_with_replacement
n, k = 'A B C'.split(), 12
for i in combinations_with_replacement(n,k):
print (''.join(i))

>> No.65372865

>>65372637
In C++
#include <stdio.h>
#include <vector>
#include <string>

using namespace std;
vector<string> options{ "iced", "jam", "plain" };

void print_vector(vector<int> v, int n, vector<string> s){
for (int i = 0; i < n; ++i)
printf("%s\t", s[v[i]].c_str());
printf("\n");
}

int combination_with_repetiton(int sabores, int bolas, const vector<string>& v_sabores){
sabores--;
vector<int> v;
for (int i = 0; i <= bolas; ++i)
v.push_back(0);
while (true){
for (int i = 0; i < bolas; ++i){ //vai um
if (v[i] > sabores){
v[i + 1] += 1;
for (int k = i; k >= 0; --k){
v[k] = v[i + 1];
}
//v[i] = v[i + 1];
}
}

if (v[bolas] > 0)
break;
print_vector(v, bolas, v_sabores);
v[0] += 1;
}

return 1;
}

int main(){
combination_with_repetiton(3, 2, options);
return 0;
}

>> No.65372877

How the fuck do I read multiple lines from a file using istream? I can't figure out shit.

>> No.65372884

>>65372821
???
import std.stdio, std.range, std.algorithm;

T[][] combsRep(T)(T[] lst, in int k) {
if (k == 0)
return [[]];
if (lst.empty)
return null;

return combsRep(lst, k - 1).map!(L => lst[0] ~ L).array
~ combsRep(lst[1 .. $], k);
}

void main() {
["iced", "jam", "plain"].combsRep(2).writeln;
10.iota.array.combsRep(3).length.writeln;
}

>> No.65372886

>>65372877
std::getline

>> No.65372893

>>65372865
>sabores
>bolas
wetbacks pls go

>> No.65372897

>>65372893
retard alert

>> No.65372915

>>65372884
The iterative version.

>> No.65372919

>>65372897
back behind the wall with your mexican excuses

>> No.65372921

public class Math_E{ //this multiplies out the values within a stored 2-dimensional array against those stored in a vector untill i can do variable-dimension

static void matx2d(int[] L1, int[] L2){
int len = L1.length*L2.length;
int[] products = new int[len];
for(int i = 0; i < len; i++) {
products[i] = (L1[i%L1.length]) * (L2[Math.floorDiv(i, L1.length)]);
System.out.print("i:"+i+"-L2["+Math.floorDiv(i, L1.length)+"]-L1["+i%L1.length+"] -- ");
}System.out.println();//for formatting reasons
for(int n: products) {
System.out.print(n+":");
}
}



public static void main(String[] args) {//main method
int[] L1 = {1,2,3,4};
int[] L2 = {2,4,6,8};
Math_E.matx2d(L1, L2);
}

}


i feel pretty proud of myself, i managed to write a program that multiplies 2 (vectors?) like in matrix multiplication and then stores that in a product array. Please /dpt/, tell me how i can improve.

Also, what's going on with the combination shit? Combinatorics or something?

>> No.65372925

>>65372886
If I call getline a second time will I get the next line?
I feel retarded

>> No.65372935

>>65372919
>thinking that is Spanish and not Portuguese.

mutt pls

>> No.65372954

>>65372925
yea

>> No.65372966
File: 231 KB, 1200x1698, compile.jpg [View same] [iqdb] [saucenao] [google] [report]
65372966

>>65372809
If you think it's so pretty why don't you marry it

>> No.65372967

>>65372921
>tell me how i can improve.
fix your pajeet formatting
>Combinatorics or something
yep, combinations with repetition, called 'variations' in some languages

>> No.65372981

>>65372935
>spic noises
back to your HUEhole, subhuman

>> No.65372997

>>65372967
>combinations with repetition, called 'variations' in some languages
hm, this may or may not be true
http://users.telenet.be/vdmoortel/dirk/Maths/PermVarComb.html

>> No.65373002

>>65372981
>not knowing about Portugal

sad

go prep the bull, mutt

>> No.65373019

>>65372865
man this seems ingenious. i can't wrap my head around it

>> No.65373026

>>65373002
>knowing about Portugalese
there's a difference between knowing the language you br-holes speak, and caring about it

>> No.65373043

>>65372865
>8 space indentation

>> No.65373044

>>65373026
>you br-holes speak,
but i'm Portuguese, though.

>> No.65373053

>>65373044
I don't care which part of br you come from, you all look the same to me

>> No.65373055

>>65373043
>not doing it like Linus Torvalds (Linux kernel style)

pleb detected

>> No.65373077
File: 209 KB, 1200x1076, mapa-da-europa-portugal.jpg [View same] [iqdb] [saucenao] [google] [report]
65373077

>>65373053
>I don't care which part of br you come from
nice reading comprehension

>> No.65373079
File: 19 KB, 885x464, Cp-PmgcWcAAeX7z.jpg [View same] [iqdb] [saucenao] [google] [report]
65373079

>>65373055
>not using fibonacci indentation

>> No.65373101
File: 964 KB, 397x658, kys.gif [View same] [iqdb] [saucenao] [google] [report]
65373101

>>65373079

>> No.65373106

>>65372967
>fix your pajeet formatting
for a formatting guide or anything somewhere, how do i format correctly?

>> No.65373107

>>65373077
huh, who knew the brazilians made spain name one of its states after their shit
for shame, spain

>> No.65373113

>>65371975
Guess you can always just do this:
#include <stdio.h>

#define LEN 4
#define OPTS 3

int next_combo(int *combo, int len, int opts) {
int i;

for(i = 0; combo[i] == opts - 1; ++i) {
combo[i] = 0;
}

if(i < len) {
++combo[i];
return 1;
}else {
return 0;
}
}

int main(void) {
int combo[LEN] = {0};
char answers[OPTS] = {'A', 'B', 'C'};

do {
for(int i = 0; i < LEN; ++i) {
printf("%c", answers[combo[i]]);
}
printf("\n");
}while(next_combo(combo, LEN, OPTS));
}

>> No.65373124

>>65372967
>yep, combinations with repetition, called 'variations' in some languages
i have a vague idea of how to do that with 1 loop, a modulo operator, and generics.

>> No.65373136

>>65373079
this, but unironically

>> No.65373150

>>65373106
- don't have inconsistent formatting - tidy it up and show some respect for the readers of yo code (including yoself)
e.g.
-
static void matx2d(int[] L1, int[] L2){
int len = L1.length*L2.length;
int[] products = new int[len];

- unnecessary blank lines
Just the basics of tidy code
for(int i = 0; i < len; i++) {
products[i] = (L1[i%L1.length]) * (L2[Math.floorDiv(i, L1.length)]);
System.out.print("i:"+i+"-L2["+Math.floorDiv(i, L1.length)+"]-L1["+i%L1.length+"] -- ");
}System.out.println();//for formatting reasons
for(int n: products) {
System.out.print(n+":");
}
}



public static void main(String[] args) {//main method
int[] L1 = {1,2,3,4};

tf is this clusterfuck, srsly

>> No.65373173

>>65373124
code or it didn't happen

>> No.65373176

I was learning Python the other day and I got to the part about slicing lists and I thought it was really cool. Until I actually used it.
List[0:4] slices out elements 0-3 in the list. What were they thinking? Why is the first number inclusive but the second number is exclusive? I actually find this infuriating.

>> No.65373195 [DELETED] 

>>65373176
The first number is the start index, the 2nd is the length.

>> No.65373199

>>65372921
I'm 95% sure you can optimize this algorithm to run faster, I didn't look at it tho bc the format is shit, here is some reading:
https://en.wikipedia.org/wiki/Strassen_algorithm

>> No.65373205

>>65373176
Because second argument is length you retard

>> No.65373209

>>65373176
>Why
because they're gay like that with their [incl:excl] intervals. Something about it being easier to do shit, but that's retarded and worse for readability/robustness.
Errone knows
[a;b] is incl-incl
[a;b) is incl-excl
and so on
>>65373195
nice b8

>> No.65373211

>>65373205
>retard
Excuse me?

>> No.65373223

>>65373205
this is bait

>> No.65373230

>>65373150
sorry when i copy-pasted it came out wrong:
public class Math_E{ //this multiplies out the values within a stored 2-dimensional array against those stored in a vector untill i can do variable-dimension

static int[] matx2d(int[] L1, int[] L2){
int len = L1.length*L2.length;
int[] products = new int[len];
for(int i = 0; i < len; i++) {
products[i] = (L1[i%L1.length]) * (L2[Math.floorDiv(i, L1.length)]);
}
return products;
}



public static void main(String[] args) {
int[] L1 = {1,2,3,4};
int[] L2 = {2,4,6,8};
int[] p = Math_E.matx2d(L1, L2);
for(int i: p) {
System.out.print(i+" ");
}
}
}

//for i in len(L1)^2: product = L1[i%len(L1)]*L2[i//4]

>> No.65373236
File: 805 KB, 409x226, 1507851402936.gif [View same] [iqdb] [saucenao] [google] [report]
65373236

>>65373209
>[a;b)
just do like all the civilized people
>[a;b[

>> No.65373247

>>65371941
Same bro. Here's to getting better

>> No.65373256

>>65373230
third time's the charm, sweetheart

>> No.65373260

>>65372637
This isn't a solution, as {jam, plain} == {plain, jam} while {A, B} != {B, A}

>> No.65373271

How would I combine this into one operation? (python3)

results[:] = [d for d in results if d.get('key') not in ('value1', 'value2')]
results[:] = [d for d in results if 'key2' not in d.keys()]


I am p shit with list comprehension

>> No.65373272

>>65373230
fuck, again!
public class Math_E{ //this multiplies out the values within a stored 2-dimensional array against those stored in a vector untill i can do variable-dimension

static int[] matx2d(int[] L1, int[] L2){
int len = L1.length*L2.length;
int[] products = new int[len];

for(int i = 0; i < len; i++) {
products[i] = (L1[i%L1.length]) * (L2[Math.floorDiv(i, L1.length)]);
}
return products;
}



public static void main(String[] args) {
int[] L1 = {1,2,3,4};
int[] L2 = {2,4,6,8};
int[] p = Math_E.matx2d(L1, L2);
for(int i: p) {
System.out.print(i+" ");
}
}
}

//for i in len(L1)^2: product = L1[i%len(L1)]*L2[i//4]

>> No.65373278

>>65373236
>anime pic
?

>> No.65373287

>>65373260
yep, my bad, I realized that I was indeed looking for plain-ass variations in >>65372997

>> No.65373304

>>65373272
almost!
Also, I'd try to be a bit more consistent about the space before opening curly braces, and maybe throw a space between for and (

>> No.65373306 [DELETED] 

>>65373271
Just add the 2nd check onto the first one with and.

>> No.65373310

>>65373209
It's a basic mathematical convention you dipshit. Read a book, nigger!

>> No.65373311

>>65373271
results[:] = [d for d in results if d.get('key') not in ('value1', 'value2') else if 'key2' not in d.keys()]

i think.

>> No.65373353

>>65373311
nope, for some reason, you cant use else if in combination with list comprehension.

>> No.65373364

>>65373310
>less readable and more prone
>basic convention
yeah right
what's next, you're gonna tell me that conventional flow is the opposite of physical flow?
https://www.allaboutcircuits.com/textbook/direct-current/chpt-1/conventional-versus-electron-flow/

>> No.65373391

>>65373311
>>65373353
wait you niggas can't be that retarded
just use an or ffs

>> No.65373413

>>65373272
>>65373304
this better?
public class Math_E{
public static void main(String[] args) {
int[] L1 = {1,2,3,4};
int[] L2 = {2,4,6,8};
int[] p = Math_E.matx2d(L1, L2);
for (int i: p) {
System.out.print(i+" ");
}
}

/** This is a method which takes 2 vectors (stored as lists) and cross-multiplies them,
* then stores the products into another list and returns that.
* @params: List 1, List 2
* @return: products
*/
static int[] matx2d(int[] L1, int[] L2){
int len = L1.length * L2.length;
int[] products = new int[len];
for (int i = 0; i < len; i++) {
products[i] = (L1[i%L1.length]) * (L2[Math.floorDiv(i, L1.length)]);
}
return products;
}
}

//for i in len(L1)^2: product = L1[i%len(L1)]*L2[i//4]

>> No.65373434

>>65372967
>>65372997
yep, I was retarded to not trust my gut:
https://www.codeproject.com/Articles/26050/Permutations-Combinations-and-Variations-using-C-G
>the complete list of combinatorial collections is:
>Permutations
>Permutations with Repetition
>Combinations
>Combinations with Repetition
>Variations
>Variations with Repetition

>> No.65373439

>>65373391
i feel like a retard now.

also you can do that with the or/and/xor/not operators?

>> No.65373448

I figure that if types can depend on shared mutable atomics then operations can automatically be marked relaxed/consume/acquire/release as appropriate.

>> No.65373455

Why do I have to implement/overload != if I have already ==? Inequality is just the inverse of equality...

>> No.65373460
File: 115 KB, 1192x856, 1508645314272.jpg [View same] [iqdb] [saucenao] [google] [report]
65373460

How do you decide which a version control revisions should become releases?

>> No.65373462

>>65373413
myeah whatever, but my main complaints still remain:
- wrong indentation for return products;
- minor autism: inconsistent spaces before opening curlies

>> No.65373468

>>65373455
Dumb language...

>> No.65373474

>>65373460
That's what deadlines are for

>> No.65373481

>>65373439
I'd assume so until proven otherwise.
>>65373460
What kind of question is that? The one which is fit to be released, of course.

>> No.65373510

>>65373391
>>65373439
>>65373481
results[:] = [d for d in results if d.get('key') not in ('value1', 'value2') or 'key2' not in d.keys()]
[\code]
does not work in my tests. Am I being retarded?

>> No.65373535

>>65373510
possibly, have you tried parentheses?
I'd assume the parser would need them.

>> No.65373538 [DELETED] 

>>65372006
The thing is Google forms can automatically generate a spreadsheet from the responses, it's just not in the format that I want

>> No.65373546

>>65373455
In theory you can implement x!=y to be more efficient than !(x==y). But a decent language will let you implement either or both.

>> No.65373561

Why is system() frowned upon?

>> No.65373563

>>65373462
so like this:
}
return
}

or like this
}
return
}

or like this
}
return
}

?

>inconsistent spaces
please be less autistic in the future thx

>> No.65373573

>>65373538
wrong reply, nigga
don't be beleetin
what's the format it gives, and what's the format you need?

>> No.65373600

>>65373455
>Why do I have to implement/overload != if I have already ==? Inequality is just the inverse of equality...
Because there's no way to enforce an overloaded `==` to have the actual semantics of an "equality" operator.

>> No.65373603

>>65373535
yup. This does not work
results[:] = [d for d in results if (d.get('key') not in ('value1', 'value2')) or ('key2' not in d.keys())]


It just filters nothing with this code.

>> No.65373608

>>65373561
It's really easy to exploit.

>> No.65373616
File: 11 KB, 250x241, 1465826643844s.jpg [View same] [iqdb] [saucenao] [google] [report]
65373616

>>65373603

>> No.65373623

>>65373563
>please be less autistic in the future thx
oh you pajeet piece of shit, I was trying to soften the criticism, but I see you need something more direct:
This type of sloppiness does not have a positive effect on your colleagues' (or teachers'/groupmates') perception of the quality of your work. Most often it's the sign of freshman-tier code.

>return
Obviously nr. 2: it's a direct-child statement in the body of the function, it should obviously be indented as such. What kind of logic would lead you to think the other two aren't retarded?

>> No.65373640

>>65371850
[[a + "-" + str(b) for a in ['A', 'B','C']] for b in range(1,13)]

>> No.65373662
File: 81 KB, 638x479, propositional-equality-and-identity-types-26-638[1].jpg [View same] [iqdb] [saucenao] [google] [report]
65373662

>>65373600
>no way
*blocks your path*

>> No.65373664

>>65373603
give us a http://sscce.org/ luv
in other words, give us the smallest input showing the issue, and the expected output

>> No.65373673

>>65373603
you've done if (statement) or (statement). do if (statement or statement)

>> No.65373679
File: 115 KB, 902x331, webMergeGoogleForms4.png [View same] [iqdb] [saucenao] [google] [report]
65373679

>>65373573
Don't have access to it rn but it looks something like this. I'd like to format it so that every new response is listed with a row spaced between the previous entry, the timestamp is truncated to just the date and certain columns be capitalized. Donno where to start.

>> No.65373683

I want to learn reverse engineering for iOS I got books thanks to 4chan but if some found exploit where they put , and how much money they get because
>I am poor
>having a dream of buying 1080 ti with ryzen threadripper
> still can't achieve it

>> No.65373684

>>65373662
>Intensional Type Theory
>Intensional
lrn2spell moran

>> No.65373692

>>65373662
What does it have to do with this discussion? Just how autistic are you?

>> No.65373703

>>65373679
export to a format easily read in python, add a few lines of code, re-export to something importable, et voila
alternatively, see if python doesn't already have a lib for working with jewgle shiits

>> No.65373705

>>65373692
>Just how autistic are you?
where do you think you are ?

>> No.65373712
File: 47 KB, 750x574, 1489296532584.jpg [View same] [iqdb] [saucenao] [google] [report]
65373712

>>65373683
>if some found exploit where they put , and how much money they get because

>> No.65373718

>>65373683
>having a dream of being a consumer whore
cheesus wept

>> No.65373723

>>65373684
>Intensional logic is an approach to predicate logic that extends first-order logic, which has quantifiers that range over the individuals of a universe (extensions), by additional quantifiers that range over terms that may have such individuals as their value (intensions).

>>65373692
(==) : (x : A) -> (y : A) -> Maybe (x = y)

>> No.65373726

>>65373683
If you're a poorfag you should make a porn game and put in on patreon. check out /aco/weg

>> No.65373729

>>65373723
>pseuding intensifies
I'll ask you again, tard: what does it have to do with the discussion at hand?

>> No.65373731
File: 27 KB, 600x488, d6d.jpg [View same] [iqdb] [saucenao] [google] [report]
65373731

>>65373703

>> No.65373738

>>65373729
>there's no way to enforce an overloaded `==` to have the actual semantics of an "equality" operator
Categorically wrong.

>> No.65373747

>>65373731
This ain't me

>> No.65373778

>>65373747
good thing too, otherwise I'd need to be taking some serious DID meds and all

>> No.65373802

>>65373664
Okay:
results =
[{"key1": "value1"},
{"key1": "value2"},
{"key1": "value3"
"key2": "random bullshit"},
{"key1": "value3"}]


should return:
results =
[{"key1": "value3"}]


So a dict containing 'key2' needs to be filtered from the list, and a dict containing 'key1' needs to be filtered only when it has the value 'value1' or 'value2'.

>> No.65373811

>>65373738
>Categorically wrong.
>categorically
>pseuding intensifies even further
Please, don't use expressions you don't understand. Feel free to show me those languages where you have to overload `==` and `!=` separately which have the ability to enforce equality semantics, fucktardino.

>> No.65373825

>>65373802
whoops I mean:
results =
[{"key1": "value1"},
{"key1": "value2"},
{"key1": "value3",
"key2": "random bullshit"},
{"key1": "value3"}]

>> No.65373856

>>65373811
You said there is no way to do it, not "no languages currently do it".

>> No.65373858

>>65373802
ah, I see.
Use an and instead of an or - you want both filters to happen after all. Try it without parenthesis afterwards.

>> No.65373862
File: 92 KB, 856x1089, image-10.jpg [View same] [iqdb] [saucenao] [google] [report]
65373862

What's the difference between a typeclass and an interface
>inb4 one's poo and the other's useless

>> No.65373873

>>65373623
>Most often it's the sign of freshman-tier code.
very well then, would
for (byte i = 0; i <= 255; i++) { ...code
be more to your liking? or how about
for(byte i = 0; i <= 255; i++){ ...code
since its easier to type?

>Obviously nr. 2
number 2 it is then.

Here is final code, already moving onto permutations:
public class Math_E{//a class containing a bunch of math functions, Math_Extended
public static void main(String[] args) {
int[] L1 = {1,2,3,4};
int[] L2 = {2,4,6,8};
int[] p = Math_E.matx2d(L1, L2);
for(int i: p) {
System.out.print(i+" ");
}
}

/** This is a method which takes 2 vectors (stored as lists) and cross-multiplies them,
* then stores the products into another list and returns that.
* {@code}
* @param: List 1, List 2
* @return: products
*/
static int[] matx2d(int[] L1, int[] L2){//for i in len(L1)^2: product = L1[i%len(L1)]*L2[i//4]
int len = L1.length*L2.length;
int[] products = new int[len];

for(int i = 0; i < len; i++){
products[i] = (L1[i%L1.length]) * (L2[Math.floorDiv(i, L1.length)]);
}
return products;
}

/** This is a method which takes an undefined number of integers and permutates them .with repetition.(wr) Then
* Stores each permutation as an element in a list.
* @param: int... nums
* @return: products
*/
static int[] permr(int... nums) {return nums;}/*to be added to*/
}

>> No.65373888

>>65373862
An interface implies an object and methods. Type classes have constants and functions.

>> No.65373916

>>65373873
>for (byte i = 0; i <= 255; i++) {
is more readable for my taste.
But as always, check with the project's preferred style, in the real world consistency always beats ideology when it comes to formatting.

To bust your balls a bit more:
>for(int i: p) {
but
>for(int i = 0; i < len; i++){
Bad attention to detail :^)

>> No.65373923
File: 194 KB, 1280x640, scanSeed[1].png [View same] [iqdb] [saucenao] [google] [report]
65373923

why are you not using rxjava?

>> No.65373925

>>65373862
one's poo and the other's useless

>> No.65373926

>trying to use tkinter to make a simple GUI for a simple python script
>trying to make said python script work from command line arguments on windows
>trying to compile said python script
>all of the above at once
args on windows are tied to the way python installed the path somehow, so when you're running the script from command line none of the args you pass it even get to the script itself, let alone are accessible

>> No.65373936

>>65373923
>pic
what is this, yet another babby's drag and drop visual programming gimmick?

>> No.65373943

>>65373856
>You said there is no way to do it, not "no languages currently do it".
I was answering that anon's question about why he's forced to overload both operators, fucking retard, and the answer is because his language provides no way to make sure that == actually means equality. How is that difficult for you to process?

>> No.65373952

/sqt/ ignored me so I hope someone can answer my stupid question

How do I determine what language I should use for a project? Say I where to make 2 games 1 with and 1 without a server connection what languages would I use and why?

>> No.65373957

>>65373926
>python
>windows
>work
oh you poor bastard

srspost: why Windows and not a shitty VM with a sane dev/run env?
>inb4 python packaging and deployment is an utter mess

>> No.65373961

>>65373858
weird. The and statement only removes 'key2' and ignores dicts with value1 or value2.

Parenthesis do not make a difference.

>> No.65373971

>>65373952
>How do I determine what language I should use for a project?
If you're asking this, you're probably not comfortable with more than one programming language (if any), so fucking learn one language and then use it for your project.

>> No.65373977

>>65373943
Why the hostility about trying to make conversation?

>> No.65373989

>>65373916
>Bad attention to detail :^)
fuck you too buddy >:^[
public class Math_E{//a class containing a bunch of math functions, Math_Extended
public static void main(String[] args){
int[] L1 = {1,2,3,4};
int[] L2 = {2,4,6,8};
int[] p = Math_E.matx2d(L1, L2);
for (int i: p) {
System.out.print(i+" ");
}
}

/** This is a method which takes 2 vectors (stored as lists) and cross-multiplies them,
* then stores the products into another list and returns that.
* {@code}
* @param: List 1, List 2
* @return: products
*/
static int[] matx2d(int[] L1, int[] L2){//for i in len(L1)^2: product = L1[i%len(L1)]*L2[i//4]
int len = L1.length*L2.length;
int[] products = new int[len];

for (int i = 0; i < len; i++) {
products[i] = (L1[i % L1.length]) * (L2[Math.floorDiv(i, L1.length)]);
}
return products;
}

/** This is a method which takes an undefined number of integers and permutates them .with repetition.(wr) Then
* Stores each permutation as an element in a list.
* @param: int... nums
* @return: products
*/
static int[] permr(int... nums){return nums;}/*to be added to*/
}

methods will be .(){ while loops and conditionals will be . () {
I am a freshman and currently have no standard being taught, should i go with the google java formatting standard?

>> No.65373995

>>65373977
>Why the hostility
Are you new here, anon? I'm actually shocked that you just dropped it instead of spending your next 50 posts proving to me that I actually meant what you thought I meant.

>> No.65374015

I have a problem with c code. I have a byte in existing code but I want to overwrite the first two bits 0b00000011 using the first two bits from another uint8_t variable. how?

>> No.65374023

>>65373961
post [input, code, expected and observed output] pls
You can save yourself some time by making it a two-liner that's easier to modify and copy/paste
in = [{"k1": "v1"}, {"k1": "v2"}, {"k1": "v3", "k2": "v4"}, {"k1": "v3"}]
[{"key1": "value3"}] == [d for d in results if (d.get('k') not in ('v1', 'v2')) or ('k2' not in d.keys())]

note the key/key1 discrepancy in your code (>>65373603
) and sample i/o (>>65373802), replicated in my example above (k vs k1)

>> No.65374043

>>65373995
>actually shocked that you just dropped it instead of spending your next 50 posts proving to me that I actually meant what you thought I meant.
>>65373977
yeah what is this, amateur hour?
I'm always looking for autist love quarrels to recursively hide(tm) with my spanking new 4chan extension (buy now, only 19.99 while supplies last!)

>> No.65374062

>>65374023
>[{"key1": "value3"}]
should be
>[{"k1": "v3"}]
obviously

>> No.65374086
File: 93 KB, 256x256, autismoko.png [View same] [iqdb] [saucenao] [google] [report]
65374086

OwO

>> No.65374089

>>65374023
and 'in' should be 'input' or whatever (likewise in the list comprehension, instead of 'results')
man, that's some pretty shitty attention to detail from me, but that's what I get for not testing the code before posting

>> No.65374109

>>65372801
>https://lkml.org/lkml/2015/9/3/428
damn, this dude has a thing for coprophilia, shit and manure in each paragraph.

>> No.65374113
File: 58 KB, 679x769, PHHHHHBBBBBBBBBBBBBBBBBBBT.png [View same] [iqdb] [saucenao] [google] [report]
65374113

>>65371850
>tfw I asked /g/ help with the code in the OP
>tfw graduating with a CS degree in a top 10 CS university

There really is no point to college huh.

>> No.65374117

>>65373862
>What's the difference between a typeclass and an interface
Type classes are non-intrusive. You can take any existing type, implement the appropriate functions for it and use it wherever a member of the relevant type class is expected.

>> No.65374118

>>65374015
CS student here:
temp = 0xvar AND 0x02 (masks off all but first 2 bits
target = target XOR/OR/AND temp

what exacly do you hope to do with those first two bits and the target word, if i may ask?

>> No.65374127
File: 231 KB, 1000x1000, 1521122951563.png [View same] [iqdb] [saucenao] [google] [report]
65374127

>>65374086
>OwO

>> No.65374133

>>65374043
>the tard is still anally frustrated about the JS discussion earlier
Thanks for informing us. Top quality contribution.

>> No.65374151

>>65374133
>buttmad that his autism gets filtered by anyone with a brain
happy awareness day, sweetie

>> No.65374155

>>65373957
because I literally do not program for a living and most of the python stuff I do is so basic it's not even funny to think about it, and I still struggle with it

>> No.65374158

>>65374015
this should work
src &= ~0b00000011;
src |= (dest & 0b00000011);

>> No.65374175

>>65374113
>he fell for the education meme
Fucking brainlet. I never went to college and I make 140k a year as a professional C++ software engineer. No wonder you literally fail at something as simple as this:
for(int i = 0; i < pow(3, 12); ++i) {
std::cout << i % 3 << std::endl;
}

>> No.65374187

>>65374118
>temp = 0xvar AND 0x02 (masks off all but first 2 bits

This doesn't do what you think it does. 0x2 is just 2, which is 0b00.......010

>> No.65374192

>>65374175
Any career advice? How do you get your foot in the door without a degree

>> No.65374200

>>65374155
>literally do not program for a living
Phew, I was worried for a second that your "muh Windows" requirements were justified.
This is great. Since you can hack shit up (muh unix philosophy):
- stop being a masochist
- create a shitty VM with some low-maintenance loonix (latest Ubuntu or something else that's non-meme)
- have your tools work instead of torturing yourself trying to do non-.NET shit on Windows

>> No.65374205

>>65374187
whoops forgot how to count in binary for a second there. Meant 0x03

>> No.65374211

>>65374175
>Flexing on internet strangers by sharing his salary

who hurt you

>> No.65374214

>>65374151
Please don't tell me more about how you hide my posts. I know you've already stated in some 15 times by now, but it breaks my heart every time. I'm too upset to even mention it again some 6 hours later. If only I had buns of steel like you...

>> No.65374240

>>65374192
>Any career advice?
Learn to solve simple tasks like that effectively. Study my solution and learn from my design choices. You will learn a lot more from the pros than from college scams.

>> No.65374252

>>65373926
You could try with cygwin.

>> No.65374256

>>65374175
>Fucking brainlet. I never went to college and I make 140k a year as a professional C++ software engineer. No wonder you literally fail at something as simple as this:

I read this in the voice of Duke Nukem

>> No.65374259
File: 9 KB, 300x300, 3248283895.png [View same] [iqdb] [saucenao] [google] [report]
65374259

>>65374211
Imagine being this retarded.

>> No.65374261

>>65374214
ey I'm not the one getting butt blasted about being ignored, hun

>> No.65374266

>>65374062
>>65374089
fuck yes that seems to work. Thank you so much for sticking with a noob like me!

>> No.65374277

>>65374266
no probs m8
did you figure out what the issue was?

>> No.65374284

>>65374175
>>65374113
I can't even figure out what the thing is supposed to do.

>> No.65374288

>>65374158
compiles ok but doesn't work, it's a good start though, thanks.
>>65374118
pseudocode is not my strong point but thanks anyway. Since you asked i'm modifying some open source code for debouncing buttons, I want to bypass the debouncing routine as the button I am using does not bounce, however the other buttons in the byte must be debounced.

>> No.65374294

Is there anything special I need to do when (serially) writing and reading files larger than 8mb in Java? I'm writing a hashmap and reading it back perfectly fine when the file size is small, but when it gets around 8-9mb I get Optional Data Exceptions when reading back. What causes it and how do I get around it?

>> No.65374304

>>65374261
Please stop. If you mention 5 more times how you filter my posts, I will have to kill myself. You're really exposing my anal devastation for all to see when you yell repeatedly that you're hiding my posts. It especially hurts when you mention it hours later and really shows that I simply can't get over your not reading my posts.

>> No.65374316

>>65374284
Imagine a quiz with 12 questions, each question has three answers.

Objective is to print out all possible combinations.
AAAAAAAAAAAA
AAAAAAAAAAAB
AAAAAAAAAAAC
AAAAAAAAAABA
AAAAAAAAAABB
AAAAAAAAAABC


etc, until you print each combination, which is 3^12 different combos.

>> No.65374323

>>65374284
>I can't even figure out what the thing is supposed to do.
Probably because you're another CS brainlet; too dumb for reading comprehension, like most degree holders. It solves the problem in OP's pic.

>> No.65374338

>>65374304
take your meds, hun;
I'm sure one day you'll learn to talk without getting laughed at.

>> No.65374339

>>65374323
Yeah cuz the problem is very clear from OP's retarded pic right?

>> No.65374357

>>65374316
yep. Google-able term: variations with repetition of {A B C} choose 12

>> No.65374363

>>65374338
Please stop anon please i just can't take it anymore don't mention again how you filter my posts because it shows my utter butthurt please. Why can't we just be friends? Please don't tell your friends on FB how you owned me and made my booty explode with immeasurable pain.

>> No.65374373

>>65374288
>but doesn't work
Really? This seems to work for me

#include <stdio.h>
#include <inttypes.h>

int main()
{
/* e is the expected result of a */
uint8_t a, b, e;

a = 0b01010101;
b = 0b00000010;
e = 0b01010110;

a &= ~0b00000011;
a |= (b & 0b00000011);

printf("%u %u\nCorrect: %u\n", a, b, e == a);
return 0;
}

>> No.65374375

>>65374277
yeah well, >>65373858 was the solution, but I made a typo for value1 while trying it.... But on the plus side, >>65374023 is a nice debugging technique I had not realized

BTW, I don't get why and is used instead of or. It seems counter intuitive.

>> No.65374394

>>65374316
>>65374339
Going by /dpt/ logic, you guys must have at least a CS Ph.D.

>> No.65374430

>>65374373
but I don't want to add the binary numbers, just overwrite them, like so:
a = 0b01010101;
b = 0b00000011;
e = 0b01010111;

>> No.65374443

>>65374375
>on the plus side, >>65374023(You) is a nice debugging technique I had not realized
please, you're too kind
but srsly
>don't get why and is used instead of or. It seems counter intuitive.
try to simplify it:
a = [2,3,4,5]
b = [i for i in a if i is not X]
c = [i for i in b if i is not Y]

is equivalent to
a = [2,3,4,5]
c = [i for i in a if ((i is not X) AND (i is not Y))]

>> No.65374455

>>65374363
cmon bby, I'm almost there, post some more butthurt for me

>> No.65374473

>>65374339
I mean it kinda is.
Which parts do you find hard to grasp?

>> No.65374489

>>65374175
>>65374192

I can see some CS programs being scams but i think it unwise to throw them all under the door, especially considering uni's like MIT who consistently innovate new solutions.

For programming jobs you don't really need a magic paper, programming is more of a trade then an academic pursuit since just about anyone can do it. Certainly garbage code can be made as can be made great code, the key to that being an understanding of mathematics and computational organization. Seriously, if you don't know math you don't know how to program well, case in point:
def sum(n):
if n <= 1:
return n
return n + sum(n-1)

.vs.
def sum(n):
return ((num*(num+1))/2)

one is constant time, the other goes into stack overflow.

It certainly helps to have connections, and if you want to be something more than a code monkey its worthwhile to do uni at MIT or somewhere else. It also impresses large scale companies too if you have magic paper at a hard uni. If you plan on doing something more worthwhile then being a code monkey (like computer engineer, or pentester) then Uni or the appropriate certificate is an absolute MUST).

It also helps to be a contributor to large projects like tensorflow, and to load your repo with neato things you worked on (ike a ray-tracer for instance).

>> No.65374517

>>65374430
Nothing is being added. You have to override things in steps. Are you not trying to replace the lower 2 bits in a, with the lower 2 bits from b?

>> No.65374528

>>65374443
ah yeah. Because i should not be X and i should not be Y. Thanks

>> No.65374530

>>65374430
oh that just a simple OR operation on the first 2 bits and then a XOR operation on everything else.

>> No.65374566

How do i get a job if ive never worked before and im still in school? my github has my labs and projects from some classes. also my gpa a shit

>> No.65374578

>>65374566
just suggest working at a lower wage :^)

>> No.65374590

>>65374517
temp = btn_unbncd &= ~0b00000011;
temo = btn_dbncd &= ~0b11111100;
btn_dbncd |= (temp & temo);

that's right. what's wrong with this code? I'm sorry I couldn't run the earlier code as this is on an avr, I have no compiler environment set up.

>> No.65374672

>>65374566
What kind of labs/projects?

>> No.65374679

Does functional programming even exist? I was watching a video on jewtube and a Pajeet was comparing imperative and functional code. Seems to me that what it boils down is to using a Java library that does very specific stuff (e.g. processing a string in order to find how many times letter 'e' shows up) instead of using iteration and whatnot, but wouldn't that library implement those iterations internally anyway? If that's the case, isn't functional programming just a meem that basically makes it easier to write but bloated with additional libraries and ultimately more shitty? Red pill me on functional programming (I have like 6 days to learn enough to solve basic shit) please.

>> No.65374696

>>65374679
Functional programming has burritos (aka Monads)

>> No.65374720

>>65374679
>was watching a video on jewtube and a Pajeet
>boils down is to using a Java
are you actually surprised that pajeets can't into non-poo?

>> No.65374722
File: 5 KB, 221x250, 1510803462325.jpg [View same] [iqdb] [saucenao] [google] [report]
65374722

>>65372110
>what is calloc

>> No.65374725

>>65374679
That's Pajeet "FP" which basically just means map and reduce in imperative languages.

Functional programming is Lisp or Haskell.

>> No.65374758

>>65374672
1 incomplete app i made in 12 hours
1 java program to align dna sequences using needleman-wunsch
1 verilog program for tug of war
The rest are simple labs in java/c/c++/matlab

>> No.65374870

>>65374316
J master race
'ABC'{~ 3 #.inv i.3^12

>> No.65374895

>>65374722
It is probably UB :^)

>> No.65374904

>>65374679
>pajeet
>entire comparison is done in Java

That's real even if you're trolling it's true.

>> No.65374927

>>65374530
thanks senpaitachi, got it working.
const uint8_t btn_dbncd_mask = (btn_dbncd & 0b00111100) & (btn_unbncd & 0b00000011);

>> No.65374963

>>65374696
>Monads
I looked it up and sounds jerry rigged to be honest. Wikipedia says that these shits are:
>Define a data type, and how values of that data type are combined.
>Create functions that use the data type, and compose them together into actions, following the rules defined in the first step.
And I don't see how this is exclusive of FP. You can do that shit in any language.
>>65374725
>Functional programming is Lisp or Haskell.
But I need to do FP stuff on Java for my homework. I don't get to choose.
>>65374720
I don't even know how much of what he said was bullshit, because many of his jokes fell flat or were cringey, but the video is sone official Oracle shit so it's gotta be good right? Also allegedly Java now supports the lambda thing, so FP should be possible just like in any FP language shouldn't it?
>>65374904
Not trolling this is the video https://www.youtube.com/watch?v=wjF1WqGhoQI I watched like 20 minutes of it and looks legit. What doesn't look that impressive is the whole concept of FP.

>> No.65374966

Help /dpt/! I am studying some math shit and accidentally into tech and now I have to find out what if the system doesn't have a 'div' and I want to find modulo. It is 86 btw

>> No.65374981

>>65374963
>But I need to do FP stuff on Java for my homework. I don't get to choose.
RIP

>> No.65374991

>>65374175
What you think that is a solution?

>> No.65374992

>>65374963
>I need to do FP stuff on Java
Ahahhahah rajish... tough poo

>> No.65375007

>>65374963
>video is sone official Oracle shit
>it's gotta be good right?
I'm not sure how to break it to you, Timmy, but...
>allegedly Java now supports the lambda thing, so FP should be possible just like in any FP language shouldn't it?
only if you think FP is just a bit of syntax sugar for higher order functions
>Refactoring to Functional Style with Java 8
>What doesn't look that impressive is the whole concept of FP.
Being underwhelmed by "Functional Style Java 8" is like expecting "Chinese style British restaurant" to be the reel deel

>> No.65375024

>>65374963
>I need to do FP stuff on Java for my homework.
Just do the damn exercises in the way they ask you to, but don't for a second think that your crippleLang's FP-flavored bandaids have anything to do with proper FP
>inb4 what's proper FP

>> No.65375039

>>65374966
neat, I'm '86 too

>> No.65375046

>>65375024
>trying to explain a white man's way to a subhuman

>> No.65375051

>>65374963
>But I need to do FP stuff on Java for my homework. I don't get to choose.
Is that even fucking possible?
Can you give functions arguments that are other functions in Java?

>> No.65375061

>>65375046
There may be fewer of them in that hole, but there's always the occasional one fit to be a honorary Aryan

>> No.65375067

>>65375051
>Is that even fucking possible?
>Can you give functions arguments that are other functions in Java?
holy fuck how clueless are you

>> No.65375080

>>65375051
>this is the level of dptards that jump on the Java hate bandwagon
pathetic

>> No.65375099

>>65375051
in retro-java you needed to do some fucked up shit like creating an instance of an anonymous class that implements an interface that contains precisely one method which models the function type

it's still as horrifying under the hood but now you have more syntax sugar so it just looks like higherOrderFun(SomeClass::someFunction)

>> No.65375118

>>65375099
fuck that ghetto shit, just straight up use a lambda

>> No.65375121

>>65375007
>only if you think FP is just a bit of syntax sugar for higher order functions
That's exactly what I've been saying since the beginning retard. What proof even exists that FP is any different? Isn't everything gonna be ultimately compiled into loops and data actually changing in the registers? Then it looks like FP is just a fancy way to write it simpler with the aid of libraries and special notation.
>>65375024
>>65375046
>>65375061
I'm not even indian or black you retarded niggers. I'm just a guy with a FP homework in Java.
>>65375051
>Is that even fucking possible?
The dude in the video pretty much solved the first one of my 3 programs. I have to like fizzbuzz some shit... and prime numbers and what not. I wrote the code in my mind and it looks good enough, and I imagine that the second program will be the same but with strings instead of numbers. This brings me to another main point: The solution to everything seems to be using a very specific library that applies to a very narrow set of cases; how the fuck am I meant to know all the libraries that exist and how to use them? Look them up one by one in the some catalog or some shit? Normal programming sounds easier and faster than this gay shit.

>> No.65375143

>>65375121
>What proof even exists that POO is any different? Isn't everything gonna be ultimately compiled into loops and data actually changing in the registers? Then it looks like POO is just a fancy way to write it simpler with the aid of libraries and special notation.

>> No.65375157

>>65372925
loop over getlines till getline returns end of file

>> No.65375158

>>65375061
that may be true, although if that is the case, they will find the way themselves.

>> No.65375170

>>65375121
>The solution to everything seems to be using a very specific library that applies to a very narrow set of cases; how the fuck am I meant to know all the libraries that exist and how to use them? Look them up one by one in the some catalog or some shit?
You could apply this to standard Java coding even more so than to FP (which tends to have fewer but more generic funcs and data types)

>> No.65375181

>>65375158
Give the benefit of doubt, until they disqualify themselves - sadly, exhibit A: >>65375121

>> No.65375211

>>65375080
Ignore him and make another class my poo.

>> No.65375220

>>65372216
>>65372101
replicateM 12 "ABC"

>> No.65375268

>>65375039
owo that is gay.
Seriously need answers though.. How to get modulo without any divide thing?

>> No.65375274

>>65375143
But the alleged benefit of OOP is reutilization, which is something that exists at the level of the source code; you can always reutilize the same sourcecode regardless of how it compiles. On the other hand FP claims that there are no side effects and that no loops are used and no data written... but then these things are gonna happen in the compiled program anyway because that's how the CPU does it? FP sounds like a very poor idea to be honest.
>>65375170
>You could apply this to standard Java coding even more so than to FP
Doesn't look like that to me. I've been able to solve many problems with only input/output and loops. The idea that you have to call a library to go over a list and tell you which numbers are even is retarded to me. And on top of that we know that internally it's implementing some kind of counter to not exceed the array limit... so doesn't that make the whole concept pointless?
>>65375181
Another niggerpost with no argument? I don't think you even program, let alone FP.

>> No.65375319

>>65375181
whatever lies within your patience limits m8, sure as hell not in mine

>> No.65375334

>>65375274
>The idea that you have to call a library
holy fuck how brain damaged are you to be this badly misinformed
m8 you seriously underestimate how clueless you are

>>65375319
yeah, reaching those very quickly with this guy's pajeet-tier overconfidence

>> No.65375342

>>65375268
n mod k: iterate until i*k > n. n - (i-1)*k = n mod k
there's probably a better solution

>> No.65375350

>>65375220
no imports allowed :^)

>>65375268
divide using subtraction

>> No.65375357

>>65375274
>then these things are gonna happen in the compiled program anyway because that's how the CPU does it?
Programming paradigms (procedural, OOP, FP, everything) are about complexity management, otherwise we'd all just code everything in assembly.

>> No.65375360

>>65375342
>>65375350
eh.. the 86 thing doesn't have that.

>> No.65375364

>>65375274
you are absolutely clueless. of course you can do anything with loops, your programming language is turing complete.

>> No.65375372

>>65375268
literally
- loop subtraction till under zero (8-3=5-3=2-3=-1)
- add the number once back again (-1+3=2)
- yer result is the remainder (2)

>> No.65375393

>>65375372
B-but how?

>> No.65375395

>>65375372
or, y'know, until B is smaller than A

>> No.65375433

>>65375395
sure whatever, too brain dead at the moment to give any non-tard-tier advice
>>65375393
what do you mean how?

>> No.65375461

>>65375433
I don't know how to loop yet..

>> No.65375482

>>65375461
let mod' a b = until (< b) (flip (-) b) a


fun to experiment

>> No.65375483

>>65375461
what language?

>> No.65375499

>>65375334
>holy fuck how brain damaged are you to be this badly misinformed
>m8 you seriously underestimate how clueless you are
That's why I am asking, but nobody has been able to present a counterpoint. As I said, I watched the video and what he did was to call a library to work over the string and return the prime numbers. That's what FP is about according to my current understanding, and nobody has been able to present proof of the opposite. I'm just gonna have to assume that you all are butthurt and pretend to program in Haskell to feel 1337.
>>65375364
You're just stating the obvious. Doesn't explain why FP isn't an absolute meme of a very vulgar nature anyway.
>>65375357
This is probably the first useful reply, thanks. It makes a lot of sense, but doesn't FP make everything more retarded? The pajeet called a library to replace a loop, and he claims it's simpler because it takes less lines of code and doesn't have so many logic conditions. But introducing that library means that the preprocessor has to copy paste like 10k lines of code anyway, and chances are that in those lines are loops and shit that allegedly goes against FP. So what do you gain from that from a performance standpoint, and why do they pretend that they're not using loops, and why is that supposed to be a good thing anyway? I can suddenly see why /g/ talks about Lisp ans Haskell so much, this paradigm is bottom of the barrel like many of the things advertised here.

>> No.65375504

>>65375482
>(flip (-) b)
haskeks will defend this

>> No.65375507

>>65375483
86

>> No.65375530

>>65375499
>but doesn't FP make everything more retarded? The pajeet called a library to replace a loop, and he claims it's simpler because it takes less lines of code and doesn't have so many logic conditions. But introducing that library means that the preprocessor has to copy paste like 10k lines of code anyway, and chances are that in those lines are loops and shit that allegedly goes against FP. So what do you gain from that from a performance standpoint, and why do they pretend that they're not using loops, and why is that supposed to be a good thing anyway? I can suddenly see why /g/ talks about Lisp ans Haskell so much, this paradigm is bottom of the barrel like many of the things advertised here.
this is quality pasta
holy shit I've gotta try this to trigger fp wankers one of these days

>> No.65375531

>>65375504
hell yeah you know I will

>> No.65375542

>>65375482
>>65375504
>>65375531
flip (-)
use subtract

>> No.65375551

>>65375483
MAS or something but she calls it >>65375507
sometimes

>> No.65375556

>>65375530
Don't troll nigger. I am making genuine inquires about a legitimate question. It's just that either nobody here understands what FP is meant to be any better than I do, or FP is actually a very trashy design philosophy. And since FP languages seem to be awfully unpopular, I guess it's the second one.

>> No.65375557

>>65375542
whoops forgot that existed

>> No.65375562

>>65375507
>86
>TI-86
ffs learn how to provide sufficient context, we're not mind readers
I thought you were being retarded and referring to x86 assembly for an imaginary CPU or some shit
here:
http://ti86world.tripod.com/programming/chapter05.htm
get cracking

>> No.65375574

>>65372821
D looks good though retard

>> No.65375592

Hay guys I'm doing a simple calculator on c, and I want to implement options for the user to clear memory, quit or other shit (commands like clr,and, ect) problem I'm having is that sscanf can only fit whatever parameters you give it so I can't have a int char int, and a char*3, sscanf at the same time, the only work around would be to set two different functions with math on one and misc on the other, but that some what ruins the flow imo. Any pointer are appreciated.

Tl;Dr need something that can accept a variety of inputs without haveing to make separate functions for each section of inputs in c.

>> No.65375608

>>65375556
>It's just that either nobody here understands what FP is meant to be any better than I do, or FP is actually a very trashy design philosophy.
oh god this keeps getting better and better
m8 you've got a gift for trolling people, you know that right?
>And since FP languages seem to be awfully unpopular, I guess it's the second one.
>muh appeal to popularity
right tool for the job m8: FP wankery is/was better suited for more academic shit back in the day, it's getting back in the hype/meme cycle tho
you know the old saying, "Haskell is best suited for writing Haskell compilers"

>> No.65375609

>>65375592
if you want to not tie a noose as a side effect, use C++ and get smth smth Console Object

idk myself, read into windows docs

>> No.65375623
File: 98 KB, 256x256, WTF Is This Shit.png [View same] [iqdb] [saucenao] [google] [report]
65375623

>>65374927
>const uint8_t btn_dbncd_mask = (btn_dbncd & 0b00111100) & (btn_unbncd & 0b00000011);
please explain

>> No.65375624

/dpt/ at it again with tired wars and terminology crap.
Let's try something new:
>https://en.wikipedia.org/wiki/Programming_paradigm
Pick your poison(s) from that list and anons suggest a PL best suited for the combo you provided.

>> No.65375626

>>65375530
>The pajeet called a library to replace a loop
>called a library
>this is literally my level of understanding of FP
>>65375556
>I am making genuine inquires about a legitimate question
>FP is actually a very trashy design philosophy
Stay in skool kid

>> No.65375639

>>65375626
>called a library
more like, level of programming knowlege

>> No.65375640

>>65375626
To be fair, this is honestly entertaining.

>> No.65375649
File: 108 KB, 1024x889, 1024px-Programming_paradigms.svg.png [View same] [iqdb] [saucenao] [google] [report]
65375649

>>65375624
From the wiki to help tards pick a decent combo and not make up a new one

>> No.65375659

>>65375639
Ah, a sign of humility! Can this be?
Alright, would you agree that
>called a library
should be
>called a function
?
Disclaimer: I haven't seen the pajeet video (and have no intention to), so I may be totally off base here, but I don't give enough of a fuck either way.

>> No.65375666

>>65375624
Nondeterministic reactive programming

>> No.65375682

>>65374927
>(btn_dbncd & 0b00111100) & (btn_unbncd & 0b00000011)
This absolutely does not do what you were asking for before

>> No.65375683
File: 3 KB, 125x96, 7.jpg [View same] [iqdb] [saucenao] [google] [report]
65375683

>>65371850
I'm learning python. I am learning branching now

>> No.65375706

>>65375649
Ooh, beginner friendly!
>>65375666
>not choosing Deterministic Reactive Constraint Memory
pleb

>> No.65375716

>>65375626
>>65375639
>>65375659
I am deliberately avoiding to use the word function because a programming function could be confused with a mathematical function (FP has those right?) when talking about FP in a language that supports both. He didn't use a mathematical function, he called a method in a class to specifically go over the string and find the primes. I find your fixation on this distinction pedantic; and your inability to put 2 and 2 together a sign that you don't know about the basic principles of FP. No wonder no one here can answer my question soundly: you niggers don't program in FP either.

>> No.65375719

>>65375649
If I choose one can I change later or do I have to go down with the ship, as it were?

>> No.65375721

>>65375542
hi Nero

>> No.65375734

>>65375716
>I find your fixation on this distinction pedantic; and your inability to put 2 and 2 together a sign that you don't know about the basic principles of FP. No wonder no one here can answer my question soundly: you niggers don't program in FP either.
weak b8 m8, only works on actual autists
if you're back to that tone, you're free to fuck off

>> No.65375735

Is there a better way to do this in C?

if (isupper(c))
val = c - 'A';
else if (islower(c))
val = c - 'a' + 26;
else if (isdigit(c))
val = c - '0' + 52;
else if (c == '+')
val = 62;
else if (c == '/')
val = 63;
else if (c == '=')
val = 0;
else
val = -1;

>> No.65375751

>>65374963
>that vid
James Gosling has the most retarded accent i have ever had the displeasure of hearing.

>> No.65375755
File: 15 KB, 500x375, came-here-to-laugh-at-you.jpg [View same] [iqdb] [saucenao] [google] [report]
65375755

>>65375716
>I am deliberately avoiding to use the word function because [irrelevant argument]
>instead I'll say "called a library"

>> No.65375763

>>65375624
Concurrent functional value-level generic
Please be gentle

>> No.65375771

>>65375735
What in the world are you trying to accomplish

>> No.65375775

Anyone knows anything that could help me with this?
>>65375592
Otherwise I'll just find a work around.

>> No.65375784

>>65375639
wait, you're not >>65375716?
ho-lee-fuck that guy's irredeemable
I feel sad for whoever has the misfortune of having to teach him shit, he fits the obnoxious sperg cliche to a T.

>> No.65375789

>>65375771
converting from base64 to ASCII

>> No.65375810

>>65375775
scanf's are not the right tool
just read a line, tokenize (e.g. split on space), then match

>> No.65375815

>>65375789
ASCII is 7 bits wide.. How are you going to handle 128+ values?

>> No.65375819

>>65375755
>[irrelevant argument]
Work on being more honest to yourself. Pretending to be retarded isn't something to be proud of.
>>65375734
>you're free to fuck off
Yes, I'm going to StackExchange to ask people who actually have a clue of stuff. Upon seeing the whole thread I noticed that it's all code-monkeying queries and no discussion about actual concepts or ideas; I admit that it was wrong to expect an answer to a question of this level here.

>> No.65375833

>>65375775
why don't you read everything into strings and then process it depending on the actual input.
if ('0' < arg1[0] && arg1[0] < '9' ) /*if first arg is a number*/
{
//do stuff
}
else /*if it is a character*/
{
// do something else
}

>> No.65375834

>>65375350
>>65375268
division is just repeated subtraction.
So 7 % 2 === 7 - 2 => 5 - 2 => 3 - 2 => 1
----a-----b
in psuedocode:
while(i > 0)
if(a-b<=0)
return a
a -= b

>> No.65375846

>>65375819
I don't think he was pretending tho, if someone had no idea what fp means then they wouldn't understand how those terms might cause confusion in this case.

>> No.65375851

>>65375784
nope. just thought that your insult was directed towards the wrong thing as libraries aren't a strictly "FP" thing

>> No.65375863

>>65374963
>What doesn't look that impressive is the whole concept of FP.
FP is a shitty /dpt/ and reddit meme

>> No.65375865

>>65375789
You are not converting base64 to ascii. Every character in base64 represents 6 bits. There is no correct mapping of a single character of base64 to a single character of ascii.

>> No.65375872

>>65375846
or you might realize that the pure/impure function distinction is irrelevant to the basic-bitch level of this guy's question
In any case, this weak attempt at covering his incompetence ("calling a library", sheesh) should not distract you from the main issue. If it does, that doesn't speak well of your ability to follow an argument and spot inconsistencies in it.

>> No.65375899

>>65375851
You have a point here, I should've made a more general insult, as it seems the guy's incompetence isn't limited to FP.
Then again, with his ratio of smugness to substance, it didn't seem to matter too much.

>> No.65375904

>>65375815
>>65375865

https://en.wikipedia.org/wiki/Base64#Examples
this is what i'm doing

is there a better way of handling cases like >>65375735
in C?

>> No.65375923

>>65375904
>install haskeltoo

>> No.65375967

>>65374316
If you want a clever approach:
Treat your answer as a number that can be printed in trinary.
Then you just pad the left of the output string with 0's, and convert to letters.

A = 0
B = 1
C = 2

easy-peasy.

For bonus points, you can thread your answer to certain number intervals (think like merge sort: start with entire thing, delegates task to two sub-threads, etc until size is <100 units), and have those produce lists, and the higher level bits just merge lists. It'll be over in no time.

>> No.65375996

>>65375819
>muh argument isn't irrelevant
see >>65375872
>StackExchange
>people who actually have a clue of stuff
I could make a shitpost about this, but this is getting old
>have a clue of stuff
ESL detected
probably a factor in why you get so butt frustrated
>Upon seeing the whole thread I noticed that it's all code-monkeying queries and no discussion about actual concepts or ideas; I admit that it was wrong to expect an answer to a question of this level here.
- a) yeah man, those grapes were sour anyway, not like you went in with the most bulli-me tone possible
- b) alternatively, and one might reasonably argue, equally valid: hownew.ru

>> No.65376001

Holy shit /dpt/ is autistic today.

>> No.65376023

>>65375967
>parallelize and
>It'll be over in no time.
serialization/synchronization overhead won't kill ur gainz?

>> No.65376032
File: 1.56 MB, 540x501, 1514263287892.gif [View same] [iqdb] [saucenao] [google] [report]
65376032

>>65376001
>today

>> No.65376047

>>65376001
we aim to please

>>65376032
stole my line

>> No.65376065

>>65375872
Don't flip at me for playing the doubles advocate but
>should not distract you from the main issue
And the main issue would be solving the question. It was a "basic bitch question" but nobody here was able to answer it despite how strongly Fp languages are memed. That really tells a lot about the people here.

>> No.65376071

>>65375967
>It'll be over in no time.
we can only hope brother HH

>> No.65376074

>>65375967
Parallelization probably wouldn't help here.

>> No.65376092

>>65376065
>don't get distracted from the issue
>learn to spot inconsistencies
>gets distracted from the issue while claiming stuff about inconsistencies
yeah well spot

>> No.65376115

>>65376065
>bantz=flip
man you snowflakes are getting soft
>nobody here was able to answer it
>was able to answer
>could be arsed to answer such obviously heavy-handed bait (or aggressive cluelessness, if honest)
ftfy
>how strongly Fp languages are memed.
no argument here, I do my share of trolling the FP cultists

It's simple, really: you go in with bad-faith arguments, you're going to get deservedly shat on.
Everything else is lib-arts-tier rhetoric.

>> No.65376119

>>65375899
>ratio of smugness to substance
clever
Yeah, but that leaves you vulnerable to the possibility that, by some chance he realizes your mistake and gets even more smug and obnoxious.

>> No.65376126

>>65376071
underkekd

>> No.65376141

>>65376115
Oi this is just what I meant when I said not to flip. Don't write a novel. I know you're salty because somebody rubbed in the fact that you don't know basic stuff, but still not anyone's fault.

>> No.65376156

>>65376119
>leaves you vulnerable to the possibility that, by some chance he realizes your mistake and gets even more smug and obnoxious.
Sure, don't particularly care in an anonymous chinese cartoon board. I'll just switch to regular baseless shitposting mode for that argument, not that this isn't 80% there already.
>>65376141
kek
cmon m8, gotta be a bit less obvious with yer b8
or are you that delusional?

>> No.65376171

>>65376141
You should fuck off for being Australian but he does come across as somewhat butthurt for whatever reason.

>> No.65376197

>>65376156
¯\_(ツ)_/¯

>> No.65376211
File: 18 KB, 918x208, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.png [View same] [iqdb] [saucenao] [google] [report]
65376211

why is this happening

>> No.65376215

>>65376171
>highlighting logic gaps=butthurt
but of course

>> No.65376271

>>65376211
Off by one error in the index ranges?

>> No.65376273

>>65376211
Because you're bad

>> No.65376278

Next thread:
>>65376274
>>65376274
>>65376274

>> No.65376289

>>65376273
I'm using visual basic, the fact I'm bad is a given

>> No.65376322

>>65376171
>should fuck off for being Australian
to the contrary, we need more bantz-certified wankers up in this bitch

>> No.65376329

>>65375904
>this is what i'm doing
It may be what you're trying to do, but it is not what you're doing. 4 characters of base64 encodes three bytes (aka 3 ascii characters). You are not doing it correctly if you are converting one base64 character to one ascii character

>> No.65376331

>>65376289
Understandable. Try stepping through it with a debugger, that error seems weird but I don't know shit about VB

>> No.65376382

>>65376074
>produce a list containing these 3^12 combinations
>sequential list
Paralellization would help. Joining a list takes O(1): it's literally shifting one pointer. If you were to seperate the entire thing into chunks, and do these chunks ona core each, you can easily save time. You do this like a top-down merge-sort: stopping when you get to chunks of ~100-1000, or some arbitrary number like that.

Then you print in a single print statement and it takes no time compared to the time required for sequential printing.

>> No.65376433

>>65376382
>Then you print in a single print statement and it takes no time compared to the time required for sequential printing.
You're mixing parallelization of the variation generation, and combining the print statements.
I seriously doubt you're going to get gains worth the effort+complexity by parallelizing the generation.

>> No.65376723

>>65376215
>bad-faith arguments, you're going to get deservedly shat on
Basically muh feelings ain't it? Would be nice to see facts instead of emotional reaction but I guess you're that kind of person instead.
>"I totally highlighted them logic gaps there dude"
What? Top kek now you're talking absolute bullshit. I also think you're deluded and ready to cry yourself to sleep.

>> No.65376917

>>65376723
>Basically muh feelings ain't it?
Let's see:
>A1: Hey guys, I can't seem to figure out the benefits of FP, or at least video X doesn't seem to do a great job of demonstrating them in a way that clicks with me, ...
>A2: Holy fuck is FP really this shit, this Pajeet called the Java libraries, and if that's all that FP is, it's totally retarded. Is it really that shit, or are you guys that clueless that you can't answer?
So you're saying both of those deserve the same response or effort?
>Would be nice to see facts instead of emotional reaction
Emotional? Nope.
Mocking? Plenty.
Facts? Please, that'd be falling for Cunningham's Law.
>totally highlighted them logic gaps there dude
The fact that you're missing them isn't my concern, especially because:
>I also think you're [...] ready to [...] sleep.
Yep.

>> No.65377604

fizzBuzz :: Int -> IO ()
fizzBuzz 101 = putStrLn ""
fizzBuzz x
|mod x 15 == 0 = do {putStrLn "FizzBuzz"; fizzBuzz (x+1)}
|mod x 3 == 0 = do {putStrLn "Fizz"; fizzBuzz (x+1)}
|mod x 5 == 0 = do {putStrLn "Buzz"; fizzBuzz (x+1)}
|otherwise = do {putStrLn (show x); fizzBuzz (x+1)}



Did I good?

>> No.65377623

>>65376211
It tells you right there m8 the value can't be null

>> No.65377934

>>65372302
kek

>> No.65377977

>Rust has Option<T>
>C++ has std::optional<T>
>D has Nullable!T
Nice.

>>
Name (leave empty)
Comment (leave empty)
Name
E-mail
Subject
Comment
Password [?]Password used for file deletion.
Captcha
Action