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

Maintenance is complete! We got more disk space.
Become a Patron!

/g/ - Technology

View post   

[ Toggle deleted replies ]
File: 144 KB, 1000x1071, dpt_php.png [View same] [iqdb] [saucenao] [google] [report]
58341182 No.58341182 [Reply] [Original] [archived.moe] [rbt]

What are you working on, /g/?
Old thread: >>58335192
Functional Programming Thread: >>58332039

>> No.58341202
File: 514 KB, 810x698, 1483623719550.png [View same] [iqdb] [saucenao] [google] [report]

Thank you for using an anime image!

>> No.58341233

can someone PLEASE explain me how this works?

ranking = sorted(d.items(), key=lambda value: value[1], reverse=True)

I'm an absolute beginner. I know that the sorted() function can sort a simple list, and that in this example, a list of tuples is passed in a descending order based on the value of the dictionary. But how does it work? I fail to understand how lambda works.


>> No.58341243

Text editor poll continues

>> No.58341246
File: 78 KB, 640x640, hitonatsu.jpg [View same] [iqdb] [saucenao] [google] [report]

Minor fixes to my flash card game and added a bunch of decks.
It works really well for a toy program.

>> No.58341267

That is Python, btw

>> No.58341274


>> No.58341285

sorted can sort any kind of data structure, but for creating an order, you need to map the space of your structure to an orderable space (like real numbers). That's why you pass a function (that lambda).

>> No.58341337

this, and you can treat lambda expressions simply as anonymous functions with arguments given before colon in python

>> No.58341366


>> No.58341374


>> No.58341390
File: 337 KB, 640x360, 1474949204825.gif [View same] [iqdb] [saucenao] [google] [report]


>> No.58341409

how would i go about making a c function that given an int array and a "shifter", it would shift the elements of the array after the shifter pos to the left?

for example given the array { 1, 2, 3, 4, 5 } and the shifter 3, it would become { 4, 5, 1, 2, 3 }

>> No.58341478

C# is CUTE!

>> No.58341499
File: 2.73 MB, 480x360, opt_trajectory.gif [View same] [iqdb] [saucenao] [google] [report]

Finding optimal paths: Given initial and final position and velocity what direction of acceleration minimizes the time between the two points.

>> No.58341512

>Jaba but by Microsoft

>> No.58341513

shift n xs = take (length xs) $ drop n (xs ++ xs)

rewrite in C

>> No.58341540

it's less popular so /g/tards can relate to it as the underdog

>> No.58341592


How in the world would that work? Why not go to Haskell if you want something unpopular?

>> No.58341617

because some people want tool that's actually functional

>> No.58341634

Quick /dpt/, post feminine code in your favorite language!
I'll start:

use std::mem::transmute as crossdress;

struct Boy;
struct Girl;

fn main() {
let hime: Girl = unsafe { crossdress(Boy) };

>> No.58341642

This post speaks on more levels than you intended, methinks.

>> No.58341671
File: 33 KB, 552x328, strong typing haskell.png [View same] [iqdb] [saucenao] [google] [report]

doesn't work

>> No.58341687
File: 456 KB, 680x718, 56e.png [View same] [iqdb] [saucenao] [google] [report]


>> No.58341691

haskell is also popular in /dpt/

>> No.58341704

wtf is this shit

if someone is bored and wants to help, is it possible to do it without creating a second array in the function?

>> No.58341730

You need one (1) spare space in order to do that.

>> No.58341733
File: 92 KB, 1280x720, mfw.jpg [View same] [iqdb] [saucenao] [google] [report]

I'm a writing a mpd notification thing in Ruby using libnotify and mpc but I can't program for shit. What I made so far works fine, but my code and how I actually made work is probably bad and I can't tell because as I said, I can't code for shit.


Any tips on how to improve it? Also, I can't solve the notify-send cache thing.

>> No.58341767

That's where the "feminine" part comes in, I think.

>> No.58341793

X := X(Shift_Amount..X'Last) & X(X'First..Shift_Amount-1);

Call this function from your c program, senpai

>> No.58341803


>> No.58341811

so... should I learn c or c++? Is c++ really that hard?

>> No.58341817

How hard would it be to make my own music player? I'm not an experienced programmer.

>> No.58341826

loop through it using modular arithmetic for the array index

but for performance i would use a second array and memcpy

>> No.58341828

What do you want to do with the programming language?

>> No.58341839

Super easy with any modern language + GUI framework.

You could spin one up in WPF in a day or so for barebones functionality if you know C#.

>> No.58341865

i just want to make video games to play
i went to computer science because i wanted to program video games like crysis and blackops

>> No.58341883

Oh boy, you're in for a rude awakening.

You and the other 70% of dropout would-be programmers.

Start with C.

>> No.58341904

learn C++ it's what games use and it's not hard if you're not retarded, if you start with C you'll easily get stuck in a retarded neckbeard mindset and you'll never be able to use the more advanced C++ features probably

>> No.58341931

>What I made so far works fine
That's the most important thing: make it work.
Why did you choose Ruby instead of Bash?

>> No.58341941

well, i'm merely a beginner for now, I only know some thigs whith python.
I just wanna do simple programs (but still useful, mike browsers, text editors, simple classic games ...) for now, just to learn.
Maybe create an OS when I'm way more advanced but I could learn both by then.
I'm not interested in game making.

>> No.58341958

If you don't know C learn it.

>> No.58341962


wait, you're not me

>> No.58341979

in that case you could learn C

>> No.58342016

>computer science
Why did you think these words meant 'productive software developer'?

>> No.58342026

Just learning visual c# that's about it.

Might start working on a reader app/program soon but we'll see

>> No.58342036

Can we trade degrees?
Mine's a worthless games programming degree, and I'd rather go into CS

>> No.58342043

computer science isn't directly relevant for making games but especially for programming game engines and game dev tools it's almost required to have some sort of a compsci background

>> No.58342053

Using VBO with opengl/c++

Do I have create/compile a new fragment shader for every different color I want to use when drawing primitives?

>> No.58342057
File: 33 KB, 590x394, 1460612544671.jpg [View same] [iqdb] [saucenao] [google] [report]

>i went to computer science because i wanted to program video games like crysis and blackops
Is this the part where the lines between reality and fiction start blurring REALLY hard? I swear this is the "neo-typical CS freshman" description almost verbatim.

>> No.58342065

no, use attributes/uniforms/textures

>> No.58342080

tfw you're hijacked ;_;

>> No.58342091

im either too new or too dumb to understand what youre trying to tell me

so please just help me out and tell me why doesnt this work

void shift (int a[], int size, int shifter) {
int b[size];
int i; int j = 0;
for (i=shifter;i<size;i++) {
b[j] = a[i];
for (i=0;i<shifter;i++) {
j = size - shifter;
b[j] = a[i];

for (i=0;i<size;i++) {
a[i] = b[i];

>> No.58342093

>Why did you choose Ruby instead of Bash?
I'm way more used to ruby and wanted to deal with the actual thing instead of getting lost in what I wrote wrong. I could probably write it in bash later to get more used to bash.

>> No.58342097

I'm drawing lines..

>> No.58342104

No, I think this is a form of bait/satire.

>> No.58342110

a beginner should focus on learning proper algorithmic thinking, the more theory and math focused things, not hardware oriented stuff.
simple languages like python are good for this purpose.

>> No.58342212

Yes I will continue learning python as well, and now that i know it quite well (better than I implied actually) I thought it might be interesting to become more versatile

>> No.58342220
File: 64 KB, 1902x401, wrong gender.png [View same] [iqdb] [saucenao] [google] [report]

That's because you posted non-feminine code

>> No.58342229

My problem with your script is that it relies too much on the shell. This is common for Bash scripts, but not really for Ruby/Python stuff. Take this for example: `rm ~/.cover/*`. I'm sure Ruby has a nice way of removing all files in a directory instead of spawning a process that does it for your.

>> No.58342240

Is this Ada?

Fantastic language.

>> No.58342243
File: 46 KB, 924x1039, umngopher.png [View same] [iqdb] [saucenao] [google] [report]

a combination yet-another-archive and way for me to view/search through threads over Gopher

>> No.58342252

alright im retarded i just had to do j = size - shifter before the 2nd loop ;_;

>> No.58342294

I work at a college and this is every CS student I meet.

>> No.58342299

When you ask questions like this you are opening yourself up to being trolled by people who use languages that can do index sliding.

>> No.58342314

Can you not fill the OP up with links to meme threads nobody posts in like the /fpt/ thread? Thanks.

>> No.58342331

Is anyone here familiar with gcc4ti? Is long long int declared as 64bit there?

>> No.58342362

Yes and agreed

>> No.58342369

There is a lot of way to find it. You can compile an application that print the value of sizeof (long long).

>> No.58342390

Sorry, I mis-formulated my question. What I meant to ask is if it's 64bit in every calculator, as I only have the 89 titanium to test.

>> No.58342465
File: 378 KB, 1024x1399, 4321.png [View same] [iqdb] [saucenao] [google] [report]


Think I finally understand what the sin, cos, and tan memes are used for in maths.

They let you find the length of a side of a triangle using one of the angles and one of the side lengths.

Can't remember being taught about it in school, haha.

>> No.58342502

I hate the calling everything a meme meme.

>> No.58342515

Is this a troll?

>> No.58342516

> Think I finally understand what the sin, cos, and tan memes are used for in maths.
You have to be at least 18 to visit this site.

>> No.58342527

>he fell for the "i hate the 'calling everything a meme' meme" meme

>> No.58342550

>he fell for the "'he fell for the "i hate the 'calling everything a meme' meme" meme'" meme

>> No.58342573

You're right. I'll write it in bash as it makes way more sense.

>> No.58342579

No, genuinely didn't know how to use sin, cos, and tan and I passed maths in school, must have just forgot about them.

>> No.58342586

Is anyone here good at recursion?

>integer that represents desired sum
>list of integers
>index n where first n elements of the list sum to less than desired sum, and n+1 sums to the desired sum or more

I can get it going from parsing reverse order passed order

>> No.58342590

Please, stop coding.

>> No.58342617

so negative numbers are allowed?

>> No.58342623
File: 138 KB, 1000x1500, the end of -thinking-.jpg [View same] [iqdb] [saucenao] [google] [report]

>just forgetting about the most basic trigonometric functions
Are you a yuropoor? Amerilard? Fuck, even in Clapistan you don't just "forget" about SohCahToa, they won't let you.

>> No.58342637

let do_my_homework desired_sum integers =
let rec loop n sum = function
| [] -> failwith "no solution"
| x :: xs ->
let sum = sum + x in
if sum >= desired_sum then
pred n
loop (succ n) sum xs in
loop 0 0 integers

>> No.58342667
File: 48 KB, 492x492, 9.jpg [View same] [iqdb] [saucenao] [google] [report]


I wouldn't have learnt about sin, cos, and tan again if I didn't read that trigonometry was important for graphics/games animation.

>Are you a yuropoor? Amerilard?
Neither, I'm British.

>> No.58342668
File: 5 KB, 355x355, ucdefp.gif [View same] [iqdb] [saucenao] [google] [report]

Start at (1, 0) and walk along the unit circle until you make an angle of theta

The x-coordinate of where you end up is the cosine of theta

The y-coordinate of where you end up is the sine of theta

>> No.58342674

No, just the easiest case

>> No.58342701

>not animated to show the point moving along the unit circle

>> No.58342704

I see, a yuropoor. I thought you fags were supposed to have a better education system than us Amerilards; are you considered a special kind of retard over there?

>> No.58342723
File: 62 KB, 873x927, 1467876083137.jpg [View same] [iqdb] [saucenao] [google] [report]

contragulations anon!
one step closer towards being a code wizard

>> No.58342731

Recommend me books im bored

>> No.58342732

they're used for literally every geometric problem you will run into lard ass

>> No.58342746

Calling a Brit a European is like calling them Eurasian, we might be geographically in Europe but we would never identify as European.

>> No.58342748

Haskell From First Principles

>> No.58342804

This is the state of education in Britain.

t. Teacher

(I once had to explain what the ÷ symbol was to a group of 16 year olds; mobile/cell phones have / instead.)

>> No.58342812

my tutor says this is bad code practise, but I don't know why? could one of you help me pls...

// if a is divisible by b return true
public boolean isDivisible(double a, double b) {
double a2 = 0.0; //stores the division
a2 = a / b; //do division
String stringCheck = answer; //stores string check
if (stringCheck.contains(".")) { // checks for .
return false; // return false
} else { //else...
return true; //return true
return true; // return true
// end of isDivisible function

>> No.58342822
File: 21 KB, 520x420, 520px-Hyperbolic_functions.svg.png [View same] [iqdb] [saucenao] [google] [report]

Oh and this interpretation is a little more difficult but generalizes to the hyperbolic trig functions:

Start at (1, 0) with a buddy and walk in the positive direction while your buddy walks in the negative direction until the area of the segment is theta

Then your position is blah blah blah

>> No.58342837


// if a is divisible by b return true
public boolean isDivisible(double a, double b) {
double a2 = 0.0; //stores the division
a2 = a / b; //do division
String stringCheck = answer; //stores string check
if (stringCheck.contains(".")) { // checks for .
return false; // return false
} else { //else...
return true; //return true
return true; // return true
// end of isDivisible function

>> No.58342855

template<unsigned S, std::size_t N, std::size_t... I>
void shift_aux(std::index_sequence<I...>, int (&a)[N]) {
int out[N] = { (a[(I + N - S) % N])... };
std::copy(out, out + N, a);

template<unsigned S, std::size_t N>
void shift(int (&a)[N]) {
shift_aux<S>(std::make_index_sequence<N>{}, a);

>> No.58342863


>> No.58342875

Am I being baited here?

>> No.58342882





Do people actually enjoy writing modern C++? Do you not feel like you need to take a shower after that?

>> No.58342887

Should i take a javascript/ajax class?

>> No.58342888

def subA():
a = 1
b = 2
c = 3
print('a='+str(a), end=', ')
def subB():
a = 4
b = 5
c = 6
print('b='+str(b), end=", ")

a = 7
b = 8
c = 9

why can't you replace str by int when printing? example:
print('b='+int(b), end=", ")

they're numbers after all, why can't you print it as an integer?

>> No.58342893

do the maclaurin series comparisons

>> No.58342919


found the problem
"String stringCheck = answer; "
should be
"String stringCheck = a2"

my bad, it works now. :)

>> No.58342941

Yes, but first you should leave the thread.

>> No.58342985

> Why can't
To prevent/minimise type errors.

>> No.58342996

>in Python

>> No.58343004


Assuming you're not trolling, here's your answer:

Chances are your language has some kind of "get remainder" function. Use that first:


Aside from that, if I were going to write the function the way you did, here is how I would do it:

// Returns ture of a is divisble by b.
public boolean isDivisible(double a, double b)
double result = a / b;
String stringCheck = result; // ??? No idea if this is what you meant in your code
// If the result converted to a string contains a decimal point, then we know it wasn't evenly divided.
return (!stringCheck.contains("."));

There's no reason to comment every single line, particularly when your comment is *painfully obvious*. Comments should document the WHY, not the WHAT, for the most part.

>> No.58343014

Well, yeah, I thought as much.

I have literally no idea about Python; I refuse to learn that clusterfuck.

>> No.58343036

Trying to write an insert sort in Python.
I'm banging my head against the wall because for hours I've been on the brink of understanding how it works I just don't understand the code I read anywhere because it doesn't start at the end ("right side") of the array like much of the documentation says it should.

>> No.58343048

thanks! :D

>> No.58343051

That doesn't make sense since the numbers are integer in the first place. For it to be a string, it would've been '5' instead of 5 for example, ain't it?

this is the following error I'm getting:

>TypeError: Can't convert 'int' object to str implicitly

I don't understand.

>> No.58343076

Python is a strongly typed language though, 2+"2" won't compute, in contrast with Perl or PHP.

>> No.58343098

I'm guessing that 'print' expects its arguments as strings, you're giving it an integer.

>> No.58343099

Not sure if the bate has been taken, or it is bate on top of bate. Help.

>> No.58343102

is it possible to return multiple values from a function in c? for example if i wanted to return the max value from a matrix and also whats its column and row, do i have to create 3 identical functions with different returns?

>> No.58343111

Return a struct

>> No.58343114

print() converts it's arguments to strings using repr() i believe

>> No.58343121

>won't compute
Yes it will, it produces a type error

>> No.58343125


>> No.58343143

pointer arguments

>> No.58343144

Return a string like:
and write a function to parse it. Easy peasy.

>> No.58343150

struct example1 {
int a;
int b;

struct example1 gimme1 (void) {
struct example1 result = {42, 13};
return result;

void gimme2 (int *a, int *b) {
*a = 42;
*b = 13;

>> No.58343162

Are you watching the Daniel Shiffman livestream, /dpt/?

>> No.58343165
File: 71 KB, 958x520, Screen Shot 2017-01-05 at 21.28.32.png [View same] [iqdb] [saucenao] [google] [report]

Seems your right.

>> No.58343172


>> No.58343184


Not sure if triple bait.

Seriously, I spent like two minutes on it addressing some obvious stuff. If you have something to contribute, then do so. If not, fuck off. You make /g/ a worse place.

>> No.58343190
File: 529 KB, 1300x894, 43.png [View same] [iqdb] [saucenao] [google] [report]


>> No.58343206

thanks all

>> No.58343213

What does this have to do with programming?

>> No.58343214

Who is this ill-dressed douche, what's he doing, and why should I care?

>> No.58343215

This is bs BTW.
The 'compsci' you need is to understand the mathematics in certain papers you may come across. But generally you fill that in quickly.

>> No.58343230


Into the trash it goes

>> No.58343235

Doesn't make a difference.

>> No.58343240

I started playing with Rust this week and I like the language but I can say with 100% certainty that this language ecosystem will end up like javascript's if Mozilla doesn't intervene soon.

There is a shit load of "left-pad"-tier crates that implement simple shit not available in the standard libraries. This can't end well.

>> No.58343242

>java.*? progeammers

>> No.58343275
File: 161 KB, 1592x848, Exercise.jpg [View same] [iqdb] [saucenao] [google] [report]

following along with C++ tutorials in the Bjarne "Programming and Principles 2nd edition book"

Maybe you can help me out.

I wasn't able to get
#include std_lib_facilities.h to work in any of my IDEs. The current one I'm running is visual studio 2010, but it wouldnt work on the 2015 computer either.

So instead for every exercise I'm including
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
inline void keep_window_open() { char ch; cin>>ch; }

My current program won't run even though I'm pretty sure my spelling is correct.

>> No.58343292

The idea is that you create std_lib_facilities.h

>> No.58343300
File: 65 KB, 795x375, rails.jpg [View same] [iqdb] [saucenao] [google] [report]

good to know that a lot of rustards are from jabasgribt/ruby

>> No.58343305

when you write "string first_name" you're not just declaring a variable. You initialize it too. Fix your silly comment please.

>> No.58343306

Don't dig yourself any deeper. Just abandon ship.

>> No.58343313

Wait so you want to modify the source array? That's bad practice.

#include <stdio.h>
#include <string.h>

// {1,2,3,4,5}, 3 => {4,5,1,2,3}
void lshift(int *dst, int *src, int len, int shift)
memcpy(dst + len - shift, src, shift * sizeof(int));
memcpy(dst, src + shift, (len - shift) * sizeof(int));

int main()
int i,
src[] = {1, 2, 3, 4, 5},
dst[5] = {0};

lshift(dst, src, 5, 3);

for (i = 0; i < 5; i++)
printf("%d\n", dst[i]);

return 0;

>> No.58343314

What is this? Sin opposite hypo, cos adjacent hypo, tan opposite adjacent?
What's even the point in memorising shit? I thought we stopped with that in the 1980's.
Your fault for using outdated nomenclature gramps.

>> No.58343329

Yes. Sohcahtoa is easy to remeber.

>> No.58343331

NO wait, the class is waitlisted.. should i do android or python programming?

>> No.58343338

well i'm doing it like i do in javascript: i just copy and paste code instead of adding a 10-line library "dependency".

>> No.58343350


>> No.58343352

It's stupid.
cos is x
sin is y
tan is x/y
and cotan is y/x
Is it that hard to remember?

>> No.58343372

But that's completely wrong.

>> No.58343373

the opposite for tan an cotan

>> No.58343380

They have "Rust should provide easy access to high quality crates" as one of their goals for 2017, meanwhile you can just don't use them and let them die peacefully.

>> No.58343388
File: 43 KB, 694x327, Screenshot from 2017-01-05 16-41-34.png [View same] [iqdb] [saucenao] [google] [report]

Pay attention class, this WILL be on the next exam.

>> No.58343392

I know. I was too fast for tan and cotan.

>> No.58343393

Yeah that's how I 'remember' it. But it's more about having a visual image of the unit circle and an intuitive sense of the values on that circle.

Remembering though phonetics is for people who just aim to pass exams.

Or for straight up arbitrary stuff like resistor color coding.

>> No.58343403

tan is y/x

cot is x/y

>> No.58343405

It's a big library that does a simple job.

For instance, instead of adding a dependency to a huge serializing library I just wrote some quick'n dirty code that suits my needs:

fn parse_buf(buf: &[u8]) -> u64 {
let mut val = 0;

for i in 0 .. buf.len() {
val += (buf[i] as u64) << (8 * i);

pub fn parse_u16(buf: &[u8]) -> u16 { parse_buf(&buf[0..2]) as u16 }
pub fn parse_u24(buf: &[u8]) -> u32 { parse_buf(&buf[0..3]) as u32 }
pub fn parse_u32(buf: &[u8]) -> u32 { parse_buf(&buf[0..4]) as u32 }
pub fn parse_u64(buf: &[u8]) -> u64 { parse_buf(&buf[0..8]) as u64 }

of course it doesn't handle bit swapping and other fancy stuff but i don't need it.

>> No.58343411

do -i sin(i x)

>> No.58343421

thinking you don't need cs knowledge is like thinking you don't need to know math. sure you can get by but to be truly good and have an intuition for things and to come up with solutions to new problems on your own you need some level of competence

>> No.58343425

Sorry by job I mean what I wanted to do, which was map integers to enum values. Rust regulars recommended me to use that library which seems overkill to me.

>> No.58343426

Is rust better than C?
Is rust better than C++?

>> No.58343431

I get it now, I'm an idiot.

'a='+ itself is a string, the + doesn't seperate the code but adds whatever goes after.
So you're basically trying to add a integer inside a string and that doesn't work.

In order to make it print out as a integer, it should be:

print('a=', (a), end=', ')

>> No.58343435

>Is rust better than C?
Nothing is better than C.
>Is rust better than C++?
Nothing is shittier than C++.

>> No.58343442

>÷ symbol
: symbol master race

>> No.58343446

>Nothing is better than C.
t. linus

>> No.58343456

Yeah but where's the geometric intuition?

>> No.58343463
File: 49 KB, 644x556, HW.jpg [View same] [iqdb] [saucenao] [google] [report]

I will, sorry I'm a new and just trying to create stuff to reference back to when I get lost. Thank you.

I dumped it into a notepad and saved it as .h, the book says it's supposed to go in the same folder with the .cpp files. Like in Pic related for hello_world it was in the project folder, but it wouldn't detect it with #include std_lib_facilities, so I gave up and did it the long way.

I'm wondering if i'm missing something on my system since I only installed C++

>> No.58343480

Depends on what you mean by better.
If you mean freedom then C is better.
If you mean interop and portability then both C and C++ are better.
If you mean compiler-enforced memory safety and diagnostics then Rust is better.

>> No.58343494

identities relating e

i suppose there's probably some vector stuff that might intuit it

>> No.58343503

If you're using
#include std_lib_facilities.h

That's not going to work.
#include "std_lib_facilities.h"

To include a file in the same directory as your .cpp file.

>> No.58343513

You can reach Rust-level safety with both C and C++ but it takes time to get to that level and it takes time to write code that safe (have you tried checking and handling errno and the output of every single posix call you use?).

>> No.58343517

>I started playing with Rust this week and I like the language but I can say with 100% certainty that this language ecosystem will end up like javascript's if Mozilla doesn't intervene soon.
Top lel. I was in a few of the meetings where they discussed the initial plans for cargo, and they repeatedly cited npm as an positive example. Fortunately Rust (actually LLVM) does know how to do dead-code elimination, so there's no technological barrier to building large Boost-style libraries.

>> No.58343525

Rust is not safer than C++ or even C. If you're using Valgrind and other tools properly then you already have everything Rust can offer you.

>> No.58343535

Compsci is awful at teaching you the 'competence' you're talking about though. University studies are never about that. That's for you to figure out yourself. At best university challenges you with problems you're not prepared for. That's how you learn to navigate in the blind.
Learning terminology is helpful. But if we're talking about game/game engine development that'd 'require' CS you should practically never look back to the old knowledge schools teach. You have to keep modern. Especially now that memory access is the bottleneck. Most of CS algorithms and datastructures aren't taking that into account so it's not rare that (stupid unoptimized access and searching) of flat arrays outperform what you find in books. With that there's of course modern papers being made. Which is where understanding the language slightly helps.

But a CS degree for that is extreme overkill and very inefficient learning.

>> No.58343556

Doubt he thinks that.
Should be 'Nothing is better than C, yet' at least.

>> No.58343565

Nothing can be better than C. The best you can do is having the same feature set with worse syntax.

>> No.58343570

>*is yet


>> No.58343614
File: 204 KB, 1592x848, A1.jpg [View same] [iqdb] [saucenao] [google] [report]

Still doesn't seem to be working, given things aren't color coded like they usually are I'm assuming it's not recognizing them as terms.

pic related

>> No.58343634

Yes, phf is probably an overkill in your case, but it's nothing like left-pad, it's a quite complex well-supported library with a clear purpose and unique functionality. It's not like you can implement compile-time PHF in 10 lines.

>> No.58343635
File: 2.90 MB, 500x540, TooIntelligentTo.gif [View same] [iqdb] [saucenao] [google] [report]

Blog Post:

I'm working for a Israeli high frequency trading firm as a programmer but I also develop algorithms.
People in the financial market are no less retarded than people in any other field.
All stereotypes are lies.
Easiest Shekels I've ever made.

>> No.58343640

Oh and that first paragraph applies to programming in general. Which is why CS students can often be crap. They're not taught to be good programmers.

>> No.58343648

using namespace std;



>> No.58343675

>All I know about Rust I get from LKML - The Posts

>> No.58343695

I'm taking a year off work (yes I can do that) and looking into other fields and I get the feeling it's the same everywhere.

But I'm still worried about jumping to a pursuit of immortality. Naturally it's the best time investment you could do if successful, but it's no doubt where other smart people would decide to put their effort.

>> No.58343706

How much are you earning jew friend?

>> No.58343724

adding using namespace std;
cleared errors for << and the bottom cout, but the rest are still there.

could I have somehow fucked up when creating the std file?

>> No.58343732

Also, the maintainer of that crate is part of the core maintainers(https://www.rust-lang.org/en-US/team.html#Library-team), so I doubt that phf will be abandoned as easily as leftpad.

>> No.58343745

uhh where are the anime programmers?

>> No.58343749

is there any good tutorial to help me understand recursive logic? i just cant into it for some reason

>> No.58343753

I'm not jewish. I don't even live in Israel.

220k + semester bonus

I suggest you learn something about financial markets and get into the boat.
It's fucking easy money, Hollywood was not lying this time.

>> No.58343760
File: 37 KB, 640x480, battle programmer shirase.jpg [View same] [iqdb] [saucenao] [google] [report]

most animes are girls
most girls cant program

most * most = most

most animes cant program

>> No.58343762

But the fact remains, this and most other Rust libraries are about 10 lines of code, which bloats the whole ecosystem to look about 100x times larger than it actually is.

>> No.58343772

sounds comfy

>> No.58343785

>easy money
Well. 220k + semester bonus isn't bad but it's not enough to hire some to work on immortality for me.
I'll consider it. What prompted you to write your post specifically?

>> No.58343787


Have you gotten a basic test program to work?

#include <iostream>

int main(void)
std::cout << "Hello, world!" << std::endl;
return 0;

>> No.58343795

Can you show me those 10 lines-of-code libraries? Because phf certainly doesn't seem to be one of them.

>> No.58343804

is high frequency trading strictly immoral?

>> No.58343806

> this [library is] about 10 lines of code
But this isn't true.

>> No.58343807

t. Haskell

>> No.58343821

If you come from a Christian country, then absolutely.

>> No.58343822
File: 17 KB, 236x334, 23f079e2d06df630bea5b4faeb3eb0e2.jpg [View same] [iqdb] [saucenao] [google] [report]

>games programming degree

>> No.58343825

How so?

>> No.58343831

It is. But the big money is managing fees.
People want to believe they are smart and can make money, even rich people.

I would gas people if they paid me for that.
I really don't care, but I think the financial market is not necessarily immoral.

>What prompted you to write your post specifically?
I'm happy and wanted to share with my fellow shitposters.
I worked as a programmer before that, the salary is much better.

>> No.58343836

>pursuit of immortality
lol wut

>> No.58343837



They'll bleat about how it injects liquidity into the market, which is complete bullshit. The modern stock market means that every buyer can see every seller. It's not like the shitty car broker example that's always trotted out. All HFT does is exploit absurd technology investments to eek out a ridiculously small timing lead on competitors, and use that to extract money from everyone.

>> No.58343845

>could I have somehow fucked up when creating the std file?
Well, in >>58343614 you've got a bunch of error messages originating on line 1 of that file. So probably.

>> No.58343848

hmm, nope.

1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(983,5): warning MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.0" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
1> Touching "Debug\First Name.unsuccessfulbuild".
1> First Name.cpp
1> All outputs are up-to-date.
1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
1>Build FAILED.

Looks like there's something else at fault here?

>> No.58343864


Create a new project named 'Test' and put the Hello World code into it. Frankly, I'm disappointed in you that you haven't already done this.

>> No.58343869

10 lines of code is an exaggeration, don't you think? But it's true that below about 5000 lines, there's no point making something into a library.

>> No.58343886

It is against fundamental Christian values.
You are not making money, you are stealing money.

And don't think it's easy for millionaires to make it into Heaven.

>> No.58343915

not him but 50-100 loc """"libraries"""" seem pretty common on github

>> No.58343926

No not really more than any stock market trading.
Did both of you misread? I said immortality. Not immorality.
Well consider that we will at some point figure out how to extend our lives significantly.
Holding off on that research makes no sense unless there's issues that threaten to eliminate humanity that those same people would prevent.

If you add 20 years of productive life to a human that's huge, especially for the higher education fields. We only work from ~20 to 65-70.
It's a very high return. And at the same time it's a very large quality of life factor.

So its clearly where anyone who thinks they could do something about it would go.

>> No.58343932

I got an amazon giftcard for christmas and I'm thinking of spending it on a C++ book. Is there any books on C++ worth purchasing?

>> No.58343934

Not her.
First of all, what value theory do you use?
You could argue hft generates value by providing liquidity.

>> No.58343935

is HFT stealing?

>> No.58343937

The line about the camel is a mistranslation. It was a nickname for one entrance into Jerusalem with a low ceiling you had to crawl under. The intended meaning was that you have to approach God with humility.

>> No.58343953

Please. How?

>> No.58343954

>You could argue hft generates value by providing liquidity.

Oh man, did I call it, or what?

>They'll bleat about how it injects liquidity into the market, which is complete bullshit.

>> No.58343961

>Did both of you misread? I said immortality. Not immorality.
Yes, I did.

>> No.58343968

And liquidity is supposed to be valuable?

Yes. You're not stealing from individual people, you're stealing from many people. See >>58343837

Wealth will weigh you down

>> No.58343975

Those without wealth can't afford to give to charity.

>> No.58343994

If someone wants to sell or buy an instrument for some reason they need someone to buy or sell to. If they don't do quickly enough they might lose money.
With HFT there is always someone willing to buy or sell the instrument.

Yes. It's a service.

>> No.58344023

>people who aren't millionaires can't afford to donate
t. NEET with ipad, ipod, consoleA, consoleB, PCX, PCY, Laptop

Honestly, even the fact that international finance think it's good is enough for me to think it's bad.

>> No.58344030

Ehh, I'd draw the line at a few hundred lines of code. For example the either crate (https://github.com/bluss/either) which provides a generic Either type with convenience methods, macros and trait implementations is, without docs and test, about a hundred lines big. It still isn't something I'd want to bother implementing and testing myself.

Also the problem with npm and leftpad, that yanking a library makes it unavailable for any dependent libraries, which broke a lot stuff. In contrast, yanking a crate from crates.io only unlists the crate, so that it doesn't show up on the index. Dependent crates still have access to the yanked crate.

>> No.58344034


Here's how they'll try to explain the value of liquidity:

Let's say you have a car that you want to sell. You're not using it, and you'd rather invest the money in starting a new landscaping company. So, you put your car up on Craigslist for $5000.

It takes you a couple of weeks to sell it, and it's kind of annoying.

Along comes the auto broker. He'll offer to buy it from you today for $4000 cash. You decide to take his offer, since you want to put that money to work immediately, and it's worth $1000 simply to avoid the hassle.

A week later, the auto broker finds someone to buy the car for $5000 and he pockets the $1000.

But that's a 20th century example. It's 2017. The stock market cannot be compared to selling a car. Everything is near-instant and openly published. HFT only adds risk to the market, and skims money from everyone.

>> No.58344040

>Yes. It's a service.
market making is a service which an entity can be paid to do. HFT is something an entity does on their own behalf, purely to make a profit (or prevent a loss). HFT does not provide the stabilizing form of liquidity a market maker provides, instead they increase volatility and they compete against other traders which reduces the effective liquidity available to each trader.

>> No.58344045

Well. My understanding of that stuff is that you're supposed to help others to your full ability. If you're wealthy you're probably not doing that.
Ah, catholicism.
Nevermind the Bible then.
>with HFT there's always someone buying the instrument
Only for very specific materials and goods that are often extremely high volume. But most HFT is not trading material things. It's literally just a game.
>international finance thinks its good
Well if you have to trust someone blindly you could do worse.

>> No.58344046

>Honestly, even the fact that international finance think it's good is enough for me to think it's bad.
I'm not a fan of generalization but I agree that if a rich person tells you something is good for you it's probably not.

>> No.58344055
File: 135 KB, 1592x848, A2.jpg [View same] [iqdb] [saucenao] [google] [report]

It's because I've been working from 2 different systems.

Same problem, I think.

>> No.58344066

it's : where I live

>> No.58344086

Google says that is an incremental build issue.
Incremental builds are a mess and at this stage in learning its pointless. So:

>> No.58344090


How are you creating your project? It should be a Visual C++ | Win32 | Win32 Console Application.

>> No.58344097

what happens in perl or php? cast to string?

>> No.58344132

Cast to int.

>> No.58344136

>market making
Market making is one kinf of HFT.

>HFT is something an entity does on their own behalf
You can do market making on your own behalf to.

>purely to make a profit
Same applies to market making, or any other thing for that matter.

>HFT does not provide the stabilizing form of liquidity a market maker provides
Market making is a form of HFT. It has providing liquidity as a main goal, for which people pay. Other forms of HFT have profit from the market as main goal but provide liquidity as well.

>instead they increase volatility
I would have to disagree. The more transactions you have the less volatility you have.

You might be thinking of HFT solely as market spoofing. There are other kinds of HFT, for example arbitrage, that keeps the value of a same instrument the same in many different markets.

>> No.58344146

>Only for very specific materials and goods that are often extremely high volume. But most HFT is not trading material things. It's literally just a game.
Not really, most financial instruments, not to say all of them, are backed up by physical goods.

>> No.58344151
File: 21 KB, 328x323, g96QleC.png [View same] [iqdb] [saucenao] [google] [report]

Yes. Image is javascript. For php, google "PHP: a fractal of bad design "

Not sure about perl

>> No.58344158

>Yes. Image is javascript.
Your mom is javascript.

>> No.58344161

in the same moment as people start dumping a stock, the HFT bots start dumping it too. they're directly competing against the other players on the market.

>> No.58344162

Hmm. So how does a company company like Facebook back its stocks?

>> No.58344168
File: 146 KB, 955x660, A3.jpg [View same] [iqdb] [saucenao] [google] [report]

That's how I've been doing it, pic related. I'm guessing something's wrong with the IDE itself and I'm better off starting from scratch.

>> No.58344172


>> No.58344193


Is that VS 2010?

>> No.58344204

>n the same moment as people start dumping a stock, the HFT bots start dumping it too.
Not necessarily. If the volume is many sigmas from a short term mean then it's probably a flash panic, the best would be to buy.

This not necessarily occur synchronously in all markets. You might long the one that dropped and short the one that didn't.

They sell highly efficient advertising.

>> No.58344211

Did you do: >>58344086

>> No.58344216

That looks like it's written for retards. I'm a mathematician, give me something good.

>> No.58344223

haskell is for retards

>> No.58344234
File: 208 KB, 1723x859, lambda repl.png [View same] [iqdb] [saucenao] [google] [report]


>> No.58344236

>physically backed
>sell prospective ad placements
Anon you're really stretching it 'backed up by physical goods' here.

>> No.58344257



>> No.58344263

>I'm a mathematician
Why are you doing anything with computers then?
>I'm too poor/too unemployed to have others write code for me

Do some God damned math if you're bored.

>> No.58344288

>Anon you're really stretching it 'backed up by physical goods' here.
Advertising is a physical good. You may argue that it's not a tangible good.

What that person meant by no-physical good is something that is merely speculative and has no use in real life. Literally a gamble.

>> No.58344296

>It's yet another primitive interpreter written in Haskell
Can you even write something else in the language?
So it took 250 posts for someone to take my bait, I expected worse.

>> No.58344311

different languages are useful for different purposes

if you want your program to be fast and secure, you use Rust. if you want your program to be fast and insecure you use C. if you want to induce a crippling brain aneurysm you use C++

>> No.58344318

yeah, that's what surprised me aswell, thought it might be bait but you're also an animeposter so i figured it wouldn't be so far-fetched

>> No.58344320


>> No.58344325
File: 26 KB, 461x288, chests.png [View same] [iqdb] [saucenao] [google] [report]


>> No.58344339

if you want to be a retard you use python. if you want to be a useless smug NEET you use haskell

>> No.58344352

It's January 2113. Did it work?

>> No.58344393

that's an extremely simple problem.

>> No.58344410

No, Hitler is still dead

>> No.58344416

And Facebook is a gamble (from the ad perspective). If they'd have anything solid it's the massive amount of user data they own which they can (and are) selling for advertising (or government agencies etc).
Prospective ads aren't physical backing.
But then it's also worth to consider how the physical backing corresponds to the valuation of a company on the stock market. Because when that's off there's lack of backing.

>> No.58344423
File: 82 KB, 1183x628, comfy.png [View same] [iqdb] [saucenao] [google] [report]


>> No.58344446

>t. mad coder that knows he will always be inferior to a mathfag

>> No.58344459

If you're a real mathematician then buy the Art of Programming series or try this http://www.cs.cmu.edu/~rwh/pfpl.html

When you're done join the Rust project to work on standard libraries

>> No.58344471

No, one of the reasons I like C++ so much is because of templates. I really hope the next version will include concepts.

>> No.58344526

Templates are shit compared to real polymorphic types.

>> No.58344561

not a huge difference except syntax, rank-2/rank-n, recursion + code generation

>> No.58344573

Why don't you go suck on a zygohistomorphic prepromorphistic cock flying at you at the rate of 1 gigabyte per second, you flaming Haskell homo?

>> No.58344597

This coming from a fan of the language that generates 1gb of error messages per second once you hit compile

>> No.58344599

OCaml or Coq, not Haskell.

>> No.58344640

>not using polymorphic recursion for type checked de Bruijn indices and the resultant substitution monad

>> No.58344661

>not using type indexed GADTs to ensure that not only are the substitutions correct but that the types of arguments are correct

>> No.58344679

Just buy the C++ Programming language by Bjarne Stroustrup if you already know some C++. Otherwise buy C++ programming and principles (title is something like that) by the same author.

>> No.58344693

I work with dependent types so that doesn't get me anything.
>not having a type of terms for syntax and two mutually recursive types (one for normal terms, one neutral) for semantics to ensure you always normalize

>> No.58344696

Touché, that was actually a decent comeback.

Okay, choke on a bag of Coqs then.

>> No.58344723

I have a quick dumb question. If I have a bunch of strings in my program representing different things, should I do a typedef for each different kind of string?

Basically, how zealously should I create new types just for semantic purposes?

>> No.58344729

Though maybe even with dependent types it would be possible to use GADTs to force eta-expansion...hmm...

>> No.58344746

Even better, use newtypes, also known as structs with one field.

>> No.58344779

cout << "tfw no gf" << endl;

>> No.58344798

>.t stupid mathfag who doesn't know his discipline well enough to apply it for fun

>> No.58344808
File: 39 KB, 739x378, indexed monads.png [View same] [iqdb] [saucenao] [google] [report]


>> No.58344825

>I have a bunch of strings in my program representing different things
sure is summer

>> No.58344840

>be Tuesday
>shit, I have a lot of work to do for that thing I volunteered to do (but don't really care about) last year that has a major milestone that is supposed to go live on Thursday
>buy 4 pack of Monsters
>code code code
>get another 4 pack of Monsters
>code code code
>sleep 4 hours
>buy a 10 pack of Monsters (never seen them before, but stopped at a different gas station on the way home)
>code code code
>sleep 5 hours
>discover and fix 3 earth-shattering-kaboom level bugs

16 cans of Monster and less than 10 hours of sleep over three days, but it works. I have no fucking clue how it didn't crash and burn, but it works.

>> No.58344852

bool steveJobsDead = true;
int iPhoneSize = 3;
void apple() {
while( steveJobsDead )

int main() {
return 0;

>> No.58344871

You're funny, aren't you?

>> No.58344900

I forgot to
#include <altmed.h>

>> No.58344913


>> No.58344921

>two mutually recursive types
Curious, how does your language of choice handle mutual inductive types? I've been using them a lot in Coq lately and it's basically a complete shitshow.

>> No.58345014

rust generics beat c++ templates any day.

>> No.58345015

I use Haskell for languagedev, so they aren't proper inductive types. Haskell does mutual recursion pretty easily because declaration order doesn't matter.

>> No.58345047

Rust doesn't have HKTs (template templates) nor non-type generics.

Rust does have traits (concepts), though, so for most use cases it's a lot better.

>> No.58345050

Are rust generics actual generics or templates?

>> No.58345051

That actually made me laugh

>> No.58345064

There's nothing like template specialization, if that's what you mean.

>> No.58345080

>rust generics
tell us more

some examples?

>> No.58345092
File: 214 KB, 1920x1276, Night shift.png [View same] [iqdb] [saucenao] [google] [report]

Who /nightshift/ here?

>> No.58345096

Declaration order isn't really a problem, the main issue in Coq is convincing the compiler that your functions over mutual inductive types will always terminate. Unfortunately there are some 10+ year old unfixed bugs with that part of the termination checker.

>> No.58345106

Ah, the wonders of syntactic termination checking.

>> No.58345132

That said, there's also no higher-rank polymorphism (except for lifetimes) to capitalize on that.

>> No.58345137

I mean like how are they represented.
Does Rust create copies of blocks of code, or is it like void*?

>> No.58345149


>> No.58345161

I am standing on the edge.
Where should I go from here
I have basic experience in python, C++, C, HTML, Swift.
Should I continue with swift or should I start completely over with javascript, css, json etc?

>> No.58345163
File: 56 KB, 297x347, animu a nice.jpg [View same] [iqdb] [saucenao] [google] [report]

Close to bump limit. New!


>> No.58345164

>type inheritance

polymorphism isn't just inheritance

>> No.58345188


>> No.58345194

It's monomorphized at compile time.

OOP doesn't have a monopoly on preventing code duplication dumbass.

>> No.58345203

That's not how it works retard, wait for the limit

>> No.58345204

Rust generics are trait based. There is no std::enable_if garbage.
fn my_fn<T>(iter: T) where T: Iterator<Item=char> {
// Do something with iter

This function will take any iterator which returns a char.

Fucking delete that shit. New threads must ALWAYS come after the bump limit.
Preposting threads leads to all sorts of problems.

>OOP fag trying to claim features as their own

>> No.58345205

im phoneposting xd so i cant give you any real examples, but here goes: instead of classes, you have structs, and you can implement methods on structs. a trait is like an interface; you can implement then a trait and it's required methods on the struct. functions can then specify generic types and the required traits in the prototype:
fn gay_shit<T: Gay>(victim: T)
Rust favours static dispatch and the compiler will generate multiple copies of the function. That said, I believe you can get dynamic or whatever dispatch working, check the book.

>> No.58345242

>I believe you can get dynamic or whatever dispatch working
I think you would use a Box<Trait> or something.

>> No.58345244


>> No.58345259
File: 151 KB, 542x764, 1480251272235.jpg [View same] [iqdb] [saucenao] [google] [report]

Is there a way to customise the looks of visual studio? I think I'd be a lot more motivated if the was a cute anime girl instead of a white or black surface, even if it marginally sacrifices readability

>> No.58345265


>> No.58345272

That thread is the valid continuation of this thread.

>> No.58345275

>polymorphism isn't just inheritance
We know, that's why I mentioned inheritance and polymorphism as separate things.

FP fag status
Told [x]

>> No.58345281

If it's a continuation then why are there posts after it? Checkmate atheists.

>> No.58345315


>> No.58345323

Why didn't you post an anime picture?

>> No.58345353

New thread:


>> No.58345363

but i did

>> No.58345387

Way too late, sorry anon

>> No.58345541

The only language I know well is Java and I feel like it's a noob language. I hear C++ is a much more powerful language, and in general more useful.

Name (leave empty)
Comment (leave empty)
Password [?]Password used for file deletion.