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

/dpt/ - Daily Programming Thread

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

Thread replies: 326
Thread images: 28

File: 1501617238611.png (103KB, 333x500px) Image search: [Google]
1501617238611.png
103KB, 333x500px
Old thread: >>61672457

What are you working on. /g/?
>>
File: 1374577328217.png (224KB, 554x439px) Image search: [Google]
1374577328217.png
224KB, 554x439px
>What are you working on. /g/?
I was going to work on my wayland compositor backend, but I really can't be fucked at the moment.
>>
>>61683771
>I really can't be fucked at the moment
are you sure?
>>
>>61683771
whys that?
>>
>>61683744
I'm writing my neetbot.
>>
clojure for the brave
>>
>want to program
>i don't have any big project goals or any idea about what I want to program
fookin kill meh
>>
>>61683815
>>i don't have any big project goals or any idea about what I want to program
I just can't sympathise with this.
I have craploads of things I want to program, but they're all too grand in scale and would literally take years to complete.

>>61683787
>>61683789
Is lack of motivation really such a surprising thing in /dpt/?
>>
>>61683921
no just figured it was something else.
if you cant be fucked with it anymore, ill take the source as i want to get rid of X .
>>
File: Sad computer guy.jpg (27KB, 533x388px) Image search: [Google]
Sad computer guy.jpg
27KB, 533x388px
Working on improving my implementation of the Shunting Yard Algorithm.

Is there any better way to do this? I'm trying to think of ways to simplify some of the condition statements, but I've got nothing.
('op' is a data type holding a char ("symbol") and an integer ("precedence") )

void push_operator(char token, std::stack<op>& Op_Stack, std::vector<std::string>& OUTPUT)
{
std::cout << "Converting: " << token << " to token " << std::endl;

op curr_token = get_token( token );
op top_q_op;


if(Op_Stack.size() > 0)
{
top_q_op = Op_Stack.top();

/* while there is an operator at the top of operator stack
with >= precedence and the operator is LEFT->ASSOCIATIVE*/
while( Op_Stack.size() > 1 &&
curr_token.precedence <= (top_q_op = Op_Stack.top()).precedence)
{
/* Pop Operators from op */
OUTPUT.push_back( std::string (1, top_q_op.symbol));

/* Removes top element and goes to next operator*/
Op_Stack.pop();
}

/* Push current token onto operator queue */
Op_Stack.push(curr_token);
}
else /* If the operator stack is currently empty*/
Op_Stack.push(curr_token);
}
>>
>>61683947
Forgive the redundant line right below the if statement
>>
>>61683947
>Is there any better way to do this?
Not using a horrible meme language.
>>
how do haskell fags feel about this guy

https://twitter.com/bitemyapp/status/892541653118058496
>>
Dumbass university student with a professor and TA who don't communicate here.

import pyglet
from pyglet.window import key

window = pyglet.window.Window()
image = pyglet.resource.image('test4.png')
sprite = pyglet.sprite.Sprite(image)
other_image = pyglet.resource.image('test4.png')

@window.event
def on_draw():
window.clear()
sprite.draw()

@window.event
def on_key_press(symbol, modifiers):
if symbol == key.A:
image = pyglet.resource.image('test2.png')
sprite.draw()
print('The "A" key was pressed.')
elif symbol == key.B:
image = pyglet.resource.image('test3.png')
sprite.draw()
print('The "B" key was pressed.')
else:
print('I don\'t even...')

pyglet.app.run()


I can see the messages print to the console, but the image never changes. I know I am fucking something basic up here, but I don't know what it is. Please help.
>>
>>61683815
I sympathize with this a lot.
I have a very, very vague idea of the kind of stuff I want to program, but no actual project ideas.
Everything I like to program is silly impractical fun, and not marketable at all, either.
I should change fields.
>>
>>61684574
don't have pyglet installed to test

sorrry
>>
>>61684565
1. thats you
2. he's streaming himself "writing" a book so I don't really care at all
>>
>>61684595
why post?
>>
>>61684609
1. it's not. he said he wrote a book so i thought he might be a luminary
2. fair enough
>>
>>61684618
to show that someone is listening, perhaps
>>
>>61684651
thanks
>>
>>61684574
try something more like this
https://paste.installgentoo.com/view/raw/a47ea7bb
>>
>>61685079
Nope, same problem as before.
>>
>>61685132
ok, give me a sec, I'll actually install pyglet and try it out... just was guessing before. don't let shitty TAs & profs discourage you :)
>>
>>61685132
>>61684574
>sprite = pyglet.sprite.Sprite(image)
recall this when you change image
>>
>>61683815
make a figlet font interpreter (or just an ascii art word art generator if that's too much), that can print any word. just an idea.
>>
>>61685163
Still nothing.
>>
Watching Mark's 2005 SF interview...
at 2:02 he's asked about the funding(what I pitched, omg, I was so informal as well about it: "Get venture capitalists. Do it now!" I said in the living room to get the info. sent in there to Harvard to Mark.

I also watched his kegger interview where he said "Some of his friends approached him about it..."

It was a Harvard site when I got involved in getting it going, having the business and design stuff.

So, really, I'm just trying to get the stuff out there.

Richard
fbfounder.Native
>>
>>61685195
So you're doing...
image =
sprite =
sprite.draw()
?

I have nothing, then.
>>
File: B7S0djdCIAA6cIa[1].jpg (65KB, 506x662px) Image search: [Google]
B7S0djdCIAA6cIa[1].jpg
65KB, 506x662px
i have learned enough assembly to understand this picture
>>
>>61685164
Nice and detailed documentation, everything you need:
http://www.jave.de/figlet/figfont.html
>>
>>61685246
Yep, nothing. I even tried making them global.
>>
>>61685269
They already were global.
Look online for pyglet resources for help.
>>
>>61685252
Choosing a manticore as the cover of that is too high brow of a joke for /dpt/. Kill yourself (nice work anon).
>>
>>61685252
>>>61673400
>>
>>61685269
sorry, pyglet crashes hard on my machine... :( gonna tinker a bit more. C programming would be easier at this point!
>>
I'll be dmned if he didn't have my expressions down at that point...hah!...


Richard
fbfounder.Native
>>
File: C3OwJc1XUAAqrp-.jpg (129KB, 1199x893px) Image search: [Google]
C3OwJc1XUAAqrp-.jpg
129KB, 1199x893px
manlet C#/Swift/php for 10 years

please help me switch to using C. Need good books/tutorials (something a little more advanced than "le hello world! xD" or explanations on what integers are)
>>
Is Kevposting allowed?
>>
>>61685452
>Richard
>fbfounder.Native

What?
>>
>>61685079
>>61685429
got it working for labels... images cause the crash on my machine. There's another way to do this more similar to your original. Will post in another sec.
https://paste.installgentoo.com/view/raw/3c504fbd
>>
>>61684574
>>61685553
And here's the example similar to your original. Just replace labels with the images.
https://paste.installgentoo.com/view/raw/3fc8e434
It was indeed an issue of using global. Not a Python guy myself, that's why I missed it at first, but it does make sense.
>>
>>61683975
C++ may not be the most fun (or useable) language but it is (((Enterprise)))) which can make learning it a worthwhile investment for some people.
>>
File: UI.png (241KB, 879x386px) Image search: [Google]
UI.png
241KB, 879x386px
Working on improving the UI in my minecraft clone. Right now there's no way to distinguish between different shaped blocks of the same texture, so I'm working on that.

Wrote a new shader to render the model at the angle I wanted. I fucking hate transformation matrices and made a few mistakes. Longblock is long.

Right now it's just reading data from the first block in the first chunk, which happens to be a grass block. So I have to modify it to read data from a different source (an array of blocks to be rendered at that angle), then I have to render said blocks to a texture for the UI to reference.
>>
>>61685518
do you have the full version of this
>>
File: 1413777090510.png (1MB, 1920x1080px) Image search: [Google]
1413777090510.png
1MB, 1920x1080px
>>61685652
Here you go, senpoointheloo.
>>
>>61685669
धन्यवाद
>>
>>61685604
You should go to >>>/vg/agdg
>>
>>61685669
>C++ less than 200kg
That image is a load of crap.
>>
File: 123ertgh.png (261KB, 1920x1080px) Image search: [Google]
123ertgh.png
261KB, 1920x1080px
>>61685669
>>61685652
optimized image
>>
>>61685553
>>61685584
Thanks. Now I can finally start work on actually making something.
>>
>>61685681
you should get >>>/out/
>>
>>61685676
स्वागत है
>>
>>61685681
I'm neither using unity nor gamemaker though.
>>
>>61685715
good luck anon!
>>
>>61685676
>>61685729
मेरी नट्सक पर चूसना और अपनी मां वेश्या को बकवास करना
>>
POORUNES OUT
>>
Watching this one now:
·Interview with Facebook Founder and CEO Mark Zuckerberg from 2006. Monday, May 14, 2012.

At 1:10...
(more of keeping me in anonymity)

He even laughed(s?) like me?

I was looking for a socially awkward guy...believe it or not.

I'm not recalling having the idea for the book, but I do recall having the movie idea...

Richard
fbfounder.Native
>>
>>61685781
(आप)
>>
>>61685824

भारतीय मास्टर्ड रेस हैं और सफेद महिलाओं को सेक्स करने के लिए आवंटित करेंगे ओबामा सर्वश्रेष्ठ प्रधान मंत्री हैं कृपया मुझे तुम्हारी मां के हाथ पकड़ने दें?
>>
>>61685518
Search for books. I haven't built up my book library or I'd send you some.

Richard
fbfounder.Native
>>
>>61685859
>>61685825
What are you saying?
>>
>>61685544
After 12 years, I'm finally viewing the videos. That's what. It's been very difficult.

I expect skepticism. That's fine.

Hell, I didn't even get the names of the guys building it into a business. I just knew I wanted it done. And it just so happened that thefacebook was the site chosen.


I may eventually write a book.

Yep. I'm a tribal member.
I don't think I had that put on the profile on the site(it was Harvard then; thefacebook).

Richard
fbfounder.Native(its not a site)
>>
File: woah.png (265KB, 1278x1434px) Image search: [Google]
woah.png
265KB, 1278x1434px
I'm training a wavenet to output shitty memes.
>>
>>61685936
Fascinating.
>>
>>61685962
What kind of shitty memes?

Pepes? Gondolas? Anime girls holding gnostic programming books? Anime girls in trump hats?
>>
>>61685584
I've had the exact same problem in one of my lab assignments. Took me ages to figure it out, and I still don't know why it works that way. I thought variables are supposed to be declared global in a function only if they are to be used outside of it.
>>
>>61686009
*If they are not already declared outside, of course.
>>
>>61685993
Crash bandicoot woah music.
>>
>>61683744
Working on Java now, know C pretty well. I hear java is garbage though, even tho this intellij shit makes coding pretty easy compared to c and even C++. What language do you think is more valuable here?

Also what nonpleb languages should i learn??
>>
>>61686251
Also am learning python in order to not be a complete frog when the AI overlords take power
>>
>>61686251
>Also what nonpleb languages should i learn??
for your own use? common lisp
nothing will put more power in your hands
if you're working alone, nothing is better
>inb4 slow
it's not, it compiles and some compilers can compete with C levels of speed

that said, it's a mess try and read someone else's lisp code, which makes it impractical for team based projects
>>
the thing I really hate about learning to program is that I never fully learn something. there are always some voids of missing knowledge that could be filled by reading a good book, but I don't know where the voids are so I would have to read the whole book and it would take a lot of time
>>
File: 1500609764674.png (243KB, 480x462px) Image search: [Google]
1500609764674.png
243KB, 480x462px
>>61683744
https://softwareengineering.stackexchange.com/questions/354803/should-i-test-this-code-and-if-so-how
>tfw nobody answers and get downvoted
pls respond
>>
>>61686009
You need to explicitly tell python you are using the global variable otherwise it creates a new variable in the current scope
>>
File: 1495746725070.png (173KB, 600x355px) Image search: [Google]
1495746725070.png
173KB, 600x355px
>>61685518
Ask me questions on tox: 81306870B4662E9CCC39FF81B929464E010F356B5DCAD7AA188F45FBD4110F1EB5AF9A64A8D1
>>
I want to do a program that will check a directory for changes (recursively) and do something when a file changes. In Linux I can use inotify, but what do I use in Windows? I'm going to use either python or c# depending on library availability for this.
>>
>>61686518
Can't you use linux subsystems for windows or whatever?
>>
>>61686560
Targeting more than Windows 10 so no. At least Windows 7.
>>
Working on a tool for creating parsers rapidly. Should help make prototyping super easy if you don't have a parser on hand.
>>
>>61686604
Cool, something like this?
https://pypi.python.org/pypi/tatsu
>>
>>61683947
>Shunting Yard Algorithm
is this still essentially what all calculators use? or has it been trumped?
>>
File: 1501553716914.jpg (236KB, 691x625px) Image search: [Google]
1501553716914.jpg
236KB, 691x625px
How do you even start to program. What languages should you learn and in what order?
>>
>>61687026
C
scheme (via sicp)
ASM
C++
common lisp
Java/C#
skid shit/ meme langs
>>
>>61687026
Try them all.
Find which one you like.
>>
>>61686753
Not really. It's a GUI that will allow developers to create a parser visually and export to either ANTLR3 or Bison grammars.
>>
File: 000055-VirtualBox.png (29KB, 882x311px) Image search: [Google]
000055-VirtualBox.png
29KB, 882x311px
hey /g/uys i did another haskell
>>
>>61687186
awe, that's really sweet darling!
>>
>>61686963
The Wikipedia page mentions that the shunting yard algorithm led to more advanced operator parsing, but I don't know how widespread more advanced parsing algorithms are
>>
>>61687209
patronizing

>>61687186
cute
>>
why doesn't this work
(defun lstOP (op L)
(if (cdr L)
(op (car L) (lstOP op (cdr L)))
(car L)))


when this does

(defun lst+ (L)
(if (cdr L)
(+ (car L) (lst+ (cdr L)))
(car L)))
>>
>>61687186
Rewrite it to use an infinite list. Will run faster too.
>>
>>61687325
It doesn't work because you're using common lisp when you could be using scheme.

Shitposting aside, you have to use funcall in common lisp because functions and variables use different symbol tables.

Only scheme gets to enjoy what you wrote.
>>
>>61687373
> because functions and variables use different symbol tables.
pretty gay desu
>>
>>61687373
>functions and variables use different symbol tables
I have never vomited so much... Why the hell would anyone use CL?
>>
>>61687390
Same reason people use C++ over C desu. It's more "fully featured"
>>
Which meme language should i learn
>>
>>61687734
Rust
>>
>>61687395
And that is why people laugh at and scorn sepples and CL users.
>>
I'm trying to port some code from C++ over to C#, and I don't know the equivalent of pointers in C#, if they exist at all.

What am I meant to do when I come across pointer usage from C++? For example, a class in my C++ code contains a pointer to an object.
template <typename T>
class Vertex {
private:
T *value;

public:
Vertex(T *value);
T *getValue() const;
void setValue(T *value);

//Equality check. This also requires an equality check to exist for T. If it does not (e.g. custom class), make sure you impemented one
bool operator==(const Vertex<T>& v) const{
return (this->value == v.value);
}
};


What would be the appropriate way to store this information in a C# class?
    class Vertex<T>
{

//T value; //<-- What should go here?

public Vertex(T value) {
this.value = value;
}

public T getValue() {
return this.value;
}

public void setValue(T value) {
this.value = value;
}

//Implement equality check later
}
>>
>>61687734
Java
>>
>>61687773
This was what I was thinking of going with
Whats something cool about Rust?
>>61687791
pajeet please
>>
>>61687787
Does C# not have references?
>>
>>61687787

&address
>>
>>61687824
everything in C# is just a reference
>>
>>61687911
what about references? are they just references too?
>>
>>61687787
In C#, almost everything except value types are references. So what you have in the comment is correct for those.
For value types, you'd have to box them to operate on them as if they were references.
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/types#boxing-and-unboxing
>>
File: 1467996343753.jpg (19KB, 326x273px) Image search: [Google]
1467996343753.jpg
19KB, 326x273px
bump
>>
so with Javascript I was able to read a class variable by using something like "getEmploymentDate (Name) { var date = Employees.[Name].EmploymentDate"; return date;}" (I know it looks like shit, I'm on mobile currently.)

Is there a way do something similar in C#?
>>
Explain this
#include <iostream>
#include <string>

using namespace::std;

int main()
{
string name;
printf("Enter your name\n"); //fine
getline(cin, name);
printf("Your name is %s\n", name); //prints weird shit
cout << "Hello, " << name << endl; //fine
return 0;
}
>>
>>61688627
Is Name a string? It is possible.

public class Employees
{
public object this[string propertyName]
{
get { return this.GetType().GetProperty(propertyName).GetValue(this, null); }
set { this.GetType().GetProperty(propertyName).SetValue(this, value, null); }
}
}


This will allow you to do something like this
// init
Employees emp = new Employees();

// access
emp["enter name of employee here"].propertyExample
>>
>>61688758
dumb sepples poster
>>
>>61688758
With printf, use name.c_str() instead of name
>>
>>61688758
works for me
>>
>>61688813
Thanks
>>
>>61688803

Thanks. Is there a term for this kind of thing?
>>
>>61688940
https://en.wikipedia.org/wiki/Associative_array
>>
official /dpt/ notepad
https://etherpad.net/p/KJ6LvtHFZs
>>
i plan on buying an arduino to fuck around with, but i dont actually know shit about electronics
is picking up the basics good enough or do you need advanced stuff?
>>
File: sample haskell code.png (5KB, 629x75px) Image search: [Google]
sample haskell code.png
5KB, 629x75px
/dpt/ sure is dead today
>>
File: tfwnotcodinglikechad.png (8KB, 762x43px) Image search: [Google]
tfwnotcodinglikechad.png
8KB, 762x43px
>tfw I code like a robot
>>
>>61689167
the basics is more than enough but you won't hurt for knowing more. You'll want a breadbox/breakaway board or whatever they're called.
>>
I want to make Java slightly less verbose, is this bad?
package std;

public class io {
public static <T> void println(T a) {
System.out.println(a);
}
public static void println() {
System.out.println();
}
}


import static std.io.*;

public class hello {
public static void main(String[] args) {
println("Hello World");
println(1);
println(1.0);
}
}
>>
>>61689309
>I want to make Java slightly less verbose
Good luck
>>
>>61687026
depends what the fuck you want to do and your plans for the future, webdev or science or phone apps all have their own dominant languages

don't learn obscure shit languages tho, pick from the top 10
>>
>>61687026
https://en.wikibooks.org/wiki/Haskell
>>
>>61689309
That's only slightly less verbose.
>>
I don't know anything about C, can someone tell me what does this do?

 * ((int*)d) == c 


I assume it's a pointer to a pointer or something like that.
>>
File: this_is_fine.jpg (32KB, 567x273px) Image search: [Google]
this_is_fine.jpg
32KB, 567x273px
>look for a C++ library to implement a certain simple feature
>[Library] is a header-only C++ library that makes an extensive uses of templates
>>
>>61689615
Whatever d is, it gets treated as a pointer to int.
Then you dereference d and compare the int result to c.
>>
>>61689618
>header-only library
Why do they do this?
>>
>>61689635
Thanks!
>>
c fags, what exactly does this guarantee?

#pragma omp parallel for
for(int i=0; i<1000000; i++){
...
>>
>>61689644
They like long compile times and bloated binaries.
They also hate having to rely on decades of progress on linking times we got thanks to C.
Or having to admit that despite being a "modern langage", sepples still doesn't have something standard to manage builds.
>>
>>61689674
>
#pragma

>>>/sepples/
>>
>>61689693
no this is c shit, sepples has civilized tools like <thread> and <mutex> etc
>>
>>61689705
>>>/pthread.h/
>>
>>61689693
pragma is standard
>>
>>61689718
>raw pthread
>civilized
>>
>>61689743
>use C
>complain about it not beeing high level
Just go back to java pajeet
>>
>>61689753
there's no excuse not to have BOTH low level AND high level comfy tools for EVERY FUCKING THING in a language in 20fucking17
>>
>>61689785
This. Just use Haskell.
You can FFI C whenever you want.
With macros you can do it inline.
You can write high performance ugly code.

>inb4 gc
>>
>>61689785
Sounds to me like your just plain old lazy
>>
>>61689825
>learned c++
>lazy
>>
>>61689844
you sound mad and defensive
as if someone just found you out
Im going to leave you with that thought
>>
>>61689856
you sound too lazy to master a real language like c++
>>
>>61689674
https://msdn.microsoft.com/en-us/library/68ah4xc7.aspx This?
>>
>>61686963
it led to recursive functions.

How can you not tell just from the name?
>>
File: IMG_20170802_122938922.jpg (2MB, 2340x4160px) Image search: [Google]
IMG_20170802_122938922.jpg
2MB, 2340x4160px
Writing a midi controller interface or DMX lighting control
Currently working on the rendering and I/O loop
>>
>>61689902
great photo
>>
File: IMG_20170802_122932079.jpg (3MB, 4160x2340px) Image search: [Google]
IMG_20170802_122932079.jpg
3MB, 4160x2340px
>>61689904
Kek
>>
>>61689912
>>61689902
Those bezels... Fuck
>>
Is there any good custom preprocessor?
>>
>>61689678
>compilation time
So make sure they're in the same compilation unit. Use a precompiled header

>linking time
This is not applicable here. Think before you post.
>>
File: IMG_20170729_194104406.jpg (3MB, 4160x2340px) Image search: [Google]
IMG_20170729_194104406.jpg
3MB, 4160x2340px
>>61689915
Perfect laptop for live shows, touchscreen is pretty nice
>>
>>61689942
lisp
>>
>>61689805
Fuck off, idot faggot
>>
File: kiyoshimo_computer.jpg (190KB, 850x1202px) Image search: [Google]
kiyoshimo_computer.jpg
190KB, 850x1202px
>>61683947
I'm gonna go over your code line by line:

void push_operator(char token, std::stack<op>& Op_Stack, std::vector<std::string>& OUTPUT)

Using a name such as token for the char argument is not a good idea, it's not a token, it's just a char that is going to become a token. It makes the next line:
std::cout << "Converting: " << token << " to token " << std::endl;

look especially confusing. I'd change it to something like token_char (or op_char, for reasons that will become apparent later).

op curr_token = get_token( token );

Why does the function whose name is get_token return an op? It should either be renamed to get_op (and curr_token renamed curr_op), or the op type itself should be renamed to token. Personally, I'd get rid of this function entirely and just give op (or token) a constructor that takes a char argument.

op top_q_op;

This variable is useless, I'll show you why in the next paragraphs.

if(Op_Stack.size() > 0)
{
top_q_op = Op_Stack.top();

This conditional is useless, because the same condition should checked for in the while loop. That while loop is wrong by the way, I'll show you that it should be Op_Stack.size() > 0 instead of Op_Stack.size() > 1.

To be continued...
>>
>>61690298
Where are the arguments?
>>
>>61690298
Let's examine what happens when we have an expression like 3 * 5 + 2. First, the 3 get's pushed on the output stack, next the * gets pushed on the operator stack, then 5 get's pushed on the output stack. So far so good. But what happens when we get to +? The control flow enters the conditional, but because the size of operator stack is only 1, it doesn't enter the while loop that follows. The + is pushed onto the operator stack after * and after that 2 is pushed onto the output stack. Then, because there is no more input, first the + and then the * get popped off the operator stack and pushed onto the output stack. Here's what we get: 3 5 2 + *. The result of this is 21 instead of 17 because the operator precedence is messed up. If you change Op_Stack.size() > 1 to Op_Stack.size() > 0, everything works as expected, because the control flow enters the conditional as well as the loop, pushing * first onto the output stack first and pushing + onto the operator stack after that. Then, at the end, + gets push onto the output stack too, but it is after * this time.
>>
>>61690304
Whoops, meant to reply to >>61690288
>>
>>61690314
curr_token.precedence <= (top_q_op = Op_Stack.top()).precedence)

Assignment to top_q_op here makes the earlier assignment redundant. You should get rid of top_q_op anyway, because the top() method of std::stack returns a reference, so there is no performance penalty to using it directly.

    Op_Stack.push(curr_token);
}
else /* If the operator stack is currently empty*/
Op_Stack.push(curr_token);

As I think you've noticed yourself, these four lines can be replaced with two:
}
Op_Stack.push(curr_token);


I didn't mention anything about your comments yet, but I can see a really big flow in them. Some of them are just not true and the only way they contribute to the code is to mislead whoever's reading it. This comment for example:
/* while there is an operator at the top of operator stack
with >= precedence and the operator is LEFT->ASSOCIATIVE*/

It mentions left-associativity, but the code doesn't check for that in any way. Next one:
/* Pop Operators from op */
OUTPUT.push_back( std::string (1, top_q_op.symbol));

It says something about popping (though I'm not sure from what, does op mean operator stack?), but that next line of code is actually pushing a new element onto the output stack. Comments that are inaccurate are generally considered worse than no comments at all (but that doesn't mean you shouldn't comment your code!). Make sure that what you write in them is factually correct.

Lastly, you should develop a convention about which case you use for what, because it makes it more obvious what something is. Personally, I use snake_case for variables, camelCase for functions and methods, CapitalizedCamelCase for the names of any custom types (classes, structs, unions, aliases made with typedef or using, enums and so on) and ALL_CAPS for anything that's #defined, constants and enumerators (names inside enums), but any system is good as long as it's consistent.
>>
>>61690325
Taking all of this into consideration, here is an improved version of your function:
void push_operator(char op_char, std::stack<op>& op_stack, std::vector<std::string>& output_stack)
{
std::cout << "Converting: " << op_char << " to operator " << std::endl;

op curr_op( op_char );

/* while there is an operator at the top of operator stack
with >= precedence */
while( op_stack.size() > 0 &&
op_stack.top().precedence >= curr_op.precedence )
{
/* Push the top operator onto the output stack */
output_stack.push_back( std::string (1, op_stack.top().symbol) );

/* Pop the top operator from the operator stack */
op_stack.pop();
}

op_stack.push(curr_op);
}


PS. Shunting yard doesn't care about associativity, once you converted an expression to RPN, you can change the associativity yourself for operators such as = by simply flipping the order of evaluation of its two operands.
>>
>>61690325
>Lastly, you should develop a convention about which case you use for what, because it makes it more obvious what something is. Personally, I use snake_case for variables, camelCase for functions and methods, CapitalizedCamelCase for the names of any custom types (classes, structs, unions, aliases made with typedef or using, enums and so on) and ALL_CAPS for anything that's #defined, constants and enumerators (names inside enums), but any system is good as long as it's consistent.
This is a lovely convention.
>>
How slow is emulated float arithmetic on a processor without an FPU?
>>
>>61689961
See, you're exactly the kind of sepples retard I'm talking about.

>So make sure they're in the same compilation unit.
So now I have to restrict my code in some kind of way and expose the whole lib in a single TU by adding an unnecessary layer, thing that could've been done by the damn library anyway. What is the purpose of a library if I can only use it in a single TU? Also a library using templates means that I have to write templates too to expose the whole functionality of the library, which means I have to write everything in headers, which means that everything that depends on these headers will need to be recompiled and I'm back to square one.

>Use a precompiled header
You missed the part where I talked about how there's no standard build system so depending on how I build my project, the way to do this is completely different and requires me to tinker with my configuration more than necessary.

>>linking time
>not applicable
No, YOU think before you post. The only benefit to headers only libraries are nothing to link against, so you don't have to link the lib or any of its dependencies since there's nothing to link. The thing is it increases the compilation time by a fuck ton multiplied by each TU where I use the library. Whereas linking requires to be done ONCE per build and symbol resolution is a fuckton faster than preprocessing and instancing templates.

That's why I can't take anything using boost seriously.
>>
C++ templates would be good if it weren't for C++'s linkage model
>>
>>61690477
C++ templates would great if headers didn't exist.
>>
>>61690536
Precisely. I suspect D handles them much better.
>>
Is there a civilized way to check if a string is numeric in C++??
bool isNumeric(const std::string& input) {
return std::all_of(input.begin(), input.end(), ::isdigit);
}


Like
fn parsable<T: FromStr>(s: &str) -> bool {
s.parse::<T>().is_ok()
}

Or
isNumeric("123");
>>
>>61690565
What's wrong with (1)?
>>
>>61690477
>>61690536
C++ should add void* based generics.
Then you can have all the other good stuff - rank n types, hkts, etc
>>
>>61690597
How would that work/look?
>>
>>61690579
-132 is not numeric
>>
>>61690565
>The power of C pee pee
#include <sstream> // for istringstream

using namespace std;

bool isNumeric( const char* pszInput, int nNumberBase )
{
istringstream iss( pszInput );

if ( nNumberBase == 10 )
{
double dTestSink;
iss >> dTestSink;
}
else if ( nNumberBase == 8 || nNumberBase == 16 )
{
int nTestSink;
iss >> ( ( nNumberBase == 8 ) ? oct : hex ) >> nTestSink;
}
else
return false;

// was any input successfully consumed/converted?
if ( ! iss )
return false;

// was all the input successfully consumed/converted?
return ( iss.rdbuf()->in_avail() == 0 );
}


The more deep I go into, the more shitty it gets
>>
>>61690600
It would look similar but you wouldn't be able to specialise.

It would use void* (i.e. pointer indirection) and there'd be one set of code rather than copy/pasting similar code for different types.
>>
>>61690632
I'm not sure how this differs from void* usage already.
>>
>>61690623
Abandon streams, use strtol, and check if the conversion succeeded.
>>
>>61690600
>>61690632
And it'd be written differently because it would be part of the type.
>>
>>61690643
Type safety
>>
>>61690654
>>61690647
Could you mock up what you're picturing syntactically?
>>
>>61690679
Imagine this code
template <typename T>
struct LList {
T* elem;
LList<T>* next;
};


In almost any major platform, LList<int> and LList<float> are the same, right?
It's just int* vs float*

Similar for a lot of code
>>
>>61690679
>>61690742
Similarly if you wrote something that took a LList<T> and returned a T* (the head), that's the same code.

Now not only does that mean you don't need to duplicate it, but it means you can imagine instantiating it "at runtime", because "instantiating it" always produces the same code.
You just need to make sure the types match up at compile time.
>>
>>61690742
>>61690759
How would a function that sum the elements in this LList work then? It's a different opcode - you'd need some form of dynamic dispatch.
>>
>>61690742
template <typename>
struct list;

template <>
struct list<void*>
{
void* value;
list<void*>* next;
};

template <typename Tp>
struct list<Tp*> : list<void*>
{
using base = list<void*>;
};


Something like this, then? I think most compilers already do that for you.
>>
>>61690799
>template <typename>
>struct list;
What is this, a template prototype? I never knew something like that was possible.
>>
>>61690815
Yup, you can declare it, and then specialise.
>>
>>61690783
There are two ways.

One, is now that you've got your type that /can be instantiated at runtime/, you can simply instantiate it at compile time if you really want.

Two, is to take an "add" function (and a "zero") as a parameter.
This is the essence of fold/reduce/accumulate.
in other notation the type would be:

\/A. A -> (A -> A -> A) -> List A -> A
Another way of writing this, using tuples:

forall <type A>  // hypothetical
A(*)(
A,
A(*)(A,A),
List<A>
)


I guess since the list always has at least one value, we don't technically need a zero.

>>61690799
I don't know, but this way you always know it's generic and a uniform representation, and so you can do stuff at runtime.
You can even take parameters with polymorphic types.
>>
>>61690826
And then have the standard case refer to the specialized case without running into the problem of it not yet being declared.
You learn something new every day.
>>
>>61690565
>>61690623
>>61690645

#include <cstdlib>

bool isNumeric(const std::string& input, int base) {
const char* c_input = input.c_str();
char* endptr;
std::strtol(c_input, &endptr, base);
return c_input + input.size() == endptr;
}
>>
Hey /g/, sorry for the retarded question but I have a little problem.

I got a small little in-house program that deals with item prices, I got a problem with the price itself because everything after a comma (,) returns as 0 so it fucks up the prices, what do.
>>
>>61691520

I'm a retard and forgot to mention this is Php
>>
File: DeepinScreenshot_20170802232903.png (171KB, 1920x1080px) Image search: [Google]
DeepinScreenshot_20170802232903.png
171KB, 1920x1080px
>>61690922
Give up, just use Regex
>>
>>61691520
So your prices are strings? I don't know if PHP has a Decimal class but if it has. Use that.

Also, commas are not used for decimals. Dots (.) are. Are you a europoor?
>>
>>61691643
Regex has a fair bit of overhead associated with it.
It seems overkill for something as simple as that.
>>
>>61691643
use the parser monad
>>
>>61691683
>monad
>C++
Making me think
>>
File: 16472847.jpg (27KB, 480x580px) Image search: [Google]
16472847.jpg
27KB, 480x580px
Nim is the shape shifting magic loli of languages.

>Looks young and tender
>Actually 45 year old under the skin
>Can change into a 30 or a 20 y/o
>Can do all sorts of templates/macros related magic

Prove me wrong, protip: you just can't
>>
>>61691660

We use dots for decimals here, I've figured I could use number_format to convert numbers into a proper format but I'm unsure if it's merely for inputs or outputs.
>>
>>61691956
>shape shifting magic loli
That would be common lisp because of reader-macros.

var
sum = 0
count = 0

for line in stdin.lines:
sum += line.len
count += 1

Not using statement terminators was a mistake.
>>
>>61692045
>statement terminators
'\n'
>>
>>61692078
because programming in white space is so much fun?
dumb meme poster
>>
>>61692091
Heh, it's fun and that's how python got so popular
>>
https://pastebin.com/raw/2iG6ZLgU
rate my pajeetcode
it works but I'm kinda concerned that I actually butcher the last block of the dump
>>
>>61692165
So, what does it do?
>>
>X& & = X& && = X&& & = X&
>X&& && = X&&
based sepples
>>
Ive had a bug for awhile relating to my opengl and objective-C app. Ive been thinking of offering 10$ to the first person who finds it. You only have to look through maybe 40 lines of code. Anyone interested?
>>
>>61692343
Learn the difference between lvalues, rvalues, prvalues, xvalues and glvalues now.
>>
>>61692511
Well, I am. It's just funny how convulated it gets. Of course, the confusion might resolve when I get more comfortable with the language
>>
File: ez.png (233KB, 660x446px) Image search: [Google]
ez.png
233KB, 660x446px
>>61692530
Good luck!
>>
>>61691688
yes
>>
Why does the c++ unordered_map makes you build a pair out of what you want to insert instead of just being
map.insert(key, value)

I am sure there is a good reason but i don't get it.
>>
>>61692662
leaking implementation details.
STL maps are garbage
>>
making some json data to frontend
>>
>>61692716
STL is garbage
>>
>>61692662
can't you do map[key] = value?
>>
>>61692780
might be a bad idea depending on what your value type is, since map[key] may default construct it before copy assigning to it
>>
>>61692802
You might be right.

Incidentally, does map.insert({key, value}) work?
>>
IS IT TRUE THAT IT IS IMPOSSIBLE TO SCAN A PACKED STRUCT WITHOUT UNDEFINED BEHAVIOUR IN STANDARD C?

IS IT POSSIBLE TO DO WITH C++ WITHOUT INVOKING UNDEFINED BEHAVIOUR?
>>
>>61692840
It should work.
>>
>>61692716
I thought it was because this way no matter what stuff you are passing (copied, moved, bamboozled), once the pair is in it can be used/moved around being sure no shit happens.
I.e. if the structure is implemented with nodes i would rather move around pairs than type T since i might add overhead is there is no move implemented for it or something.
This is just what i thought on a whim and i am sure that's not it.

>>61692780
It default constructs, and yes, it allows me to do insert without making a pair. Still no idea why i have to make a pair to use insert.
I am actually curious if what you wrote would first default construct and then copy, which is even worse.
Fuck we need to get back to pointers, all this >implied shit that must be guessed is so stupid.
>>
>>61692284
it's an EFI application that can write out parts of memory onto the system partition as raw data
you can install it to an usb stick, run it and then dd the contents to a file
then you can parse the file for interesting stuff
>>
>>61692842

Yes, apparently

https://stackoverflow.com/questions/5473189/what-is-a-packed-structure-in-c#5473235

"Undefined behavior" in C never means "It's 100% NIST certified pure entropy" though

You should expect most undefined behavior to be dependent on the machine it is running on.

So if you plan to make whatever you are doing run on different CPUs or if you are making something that needs to be very reliable, then you should not rely on undefined behavior. Otherwise, you should just do whatever works on your machine.
>>
>map.insert(make_pair<T>(k, v))
>map.emplace(k, v)
Choose one please
>>
>>61692662
Use emplace. It's exactly what's this method is for.
>>
i'm making a bittorrent client in python 3. first time reading and implementing a spec. no idea what i'm doing really, so i'm just stumbling my way through it.
>>
Help a brainlet out /dpt/. I created an images folder in my src folder of this java thing I'm writing. Is it necessary to add the images folder to "sources" in the IDE or will it pick it up automatically since I made it inside src? (Using Netbeans btw, trying to figure this shit out.)
>>
>>61692981
emplace gentoo
>>
on the offchance someone can save me some work, in bash or perl preferably:
say I have a list
Dog
Cat
Rabbit
Mouse
Rabbit

how do I calculate and display the percentage of total they occur, such as:
Rabbit 40%
Dog 20%
Cat 20%
Mouse 20%

Please help, thanks :)
>>
>>61683744
What a good quck guide on Perl?
>>
>>61693326
can I get the stuff there with class.getResources() I mean. I dont understand the documentation.
>>
>>61693410
#!/bin/bash
total=$(wc -l < list)
words=$(sort --unique < list)

for word in $words; do
count=$(cat list | grep -F "$word" | wc -l)
percent=$(bc <<< "scale=2; $count / $total;" | cut -d. -f2)
echo "$word $percent%"
done
>>
Me and my bro trying to fit Bad Apple into 32K of Arduino's flash memory. Although we stuck at compressing it to less then 200K, so I think I am going to cheat and get external I2C EEPROM with additional 256K - going to use remaining space to put music.

Because using SD card or Serial is too easy.

BTW, any advice good compression algorithm for small data will be appreciated - already tried Markov's Chains and Run-Length encoding.
>>
>>61693513
Actually thought about doing this in C... And realized that it's not the right tool for this job. Python is indeed more suited for this job. Don't know anything about bash, but I see it works too.
>>
>>61690340
Isn't it better to use
    while( !op_stack.empty() &&
op_stack.top().precedence >= curr_op.precedence )

there instead of
    while( op_stack.size() > 0 &&
op_stack.top().precedence >= curr_op.precedence )

?
>>
>>61683744
Something like this possible in C++?
auto get_numbers ()
{
auto x, y;
cin >> x >> y;
return {x, y};
}
>>
>>61693618
No, it doesn't have the inference for that.
>>
>>61693636
How about this?
auto get_number ()
{
auto x, y;
cin >> x >> y;
return (x, y);
}
>>
>>61693670
No.
>>
>>61693670
Nope.

You can do that in Haskell though

(,) <$> readLn <*> readLn
>>
>>61693709
I'm not interested in Haskell
>>
>>61693670
What would that mean?
>>
>>61693794
Return a type inferred tuple
>>
>>61693784
Well then.

Here's C++:

#include <tuple>
template <typename T, typename S>
std::tuple<T, S> get_number()
{
T x;
S y;
std::cin >> x;
std::cin >> y;
return std::make_tuple<T,S>(x,y);
}


Note this doesn't actually check that T and S can be std::cin'd, or that they can be default initialized
>>
>>61693522
Pick one of those Lempel-Ziv variants that you find on all unixen, and pick one whose decompression algorithm has a small theoretical program complexity. Then hand-make a minified assembly implementation, stick in front of the payload and hand-optimize the result. Ain't easy but you can do it.
>>
>>61693810
*initialised
>>
>>61693810
>std::make_tuple<T,S>(x,y);
kek
>>
>>61693810
You're doing it wrong. Either brace-initialize the return value
#include <tuple>
template <typename T, typename S>
std::tuple<T, S> get_number()
{
T x;
S y;
std::cin >> x;
std::cin >> y;
return {x, y};
}


Or infer the return type and parametes to make_tuple
#include <tuple>
template <typename T, typename S>
auto get_number()
{
T x;
S y;
std::cin >> x;
std::cin >> y;
return std::make_tuple(x,y);
}
>>
>>61693843
return {x, y};
will be a tuple by default in C++17.
>>
>>61693843
>{x, y};
hmm
>>
>>61693850
>return {x, y};
>will be a tuple by default in C++17.
Now this is shitty design
>>
>>61693850
Gorgeous.
>>
>>61693850
Wait what?
>>
File: IMG_1046.jpg (17KB, 125x125px) Image search: [Google]
IMG_1046.jpg
17KB, 125x125px
>write a method/function/procedure that takes an int n and returns true if n is even. The method cannot use the multiplication, modulus, or division operators
>>
>>61693860
>Gorgeous
Are you out of your mind?
>>
>>61693850
God damn y'all are real scared of arrays huh?
>>
>>61693863
bool isEven(int n)
{
return !(n & 1);
}
>>
>>61693870
Begone skeleton
>>
>>61693850
the fuck

I'm actually glad I'm not associated with such madness
>>
>>61693875
You can't have arrays of heterogeneous types dummy.
>>
>>61693863
Haskell
isEven = even
>>
>>61693850
but why
>>
>>61693850
There's 50 bad design decision, then 50 decisions worse, then modern Hell++.
>>
>>61693870
>>61693905
>>61693923
>>61693926
What's wrong with that?
What else should it be?
>>
>>61693858
>>61693860
>>61693861
>>61693875
>>61693905
>>61693923

wait till see atomic smart pointers
>>
>>61693850
Give source or I don't believe it.
>>
>>61693934
Is there any difference between arrays and tuples anymore? might as well start writing pyshit
>>
>>61693513
thanks
>>
>>61693934
>What's wrong with that?
that's normally array notation
>What else should it be?
it should throw a fucking error because you're trying to make an array of two different types

90% of the time someone's going to write that, they're probably going to do it by accident and get weird behavior
>>
>>61693951
A tuple has heterogeneous elements.
An array does not.
>>
>>61693951
arrays are a special case of tuples
>>
>>61693863
What kind of contrived shit is that? Guess binary ops are out also, faggot? Enjoy your communist linear runtime.
bool even? = true
even? = not (even) while n--
even?
>>
>>61693968
Doesn't look like it, since { } now can contain heterogeneous elements in nu-C++
>>
>>61693966
{, } is normally set notation

>>61693951
>>61693966
>>61693968

It should be possible to write a function which takes a tuple of homogenous elements and returns an array.
I.e.

std::tuple<T, T, ... > -> std::array<T, _>
>>
>>61693858
>>61693860
>>61693861
>>61693875
>>61693905
>>61693923
>>61693926
>>61693948
Sorry guys, I was just kidding.
>>
>>61693976
And more efficient
>>
>>61693981
Yes, { } constructs a tuple by default.
What is confusing you?

>>61693983
In fact that could be an isomorphism/<->
>>
>>61693915
What in the fuck actually is Haskel? It's seems very odd. Here's how I did it, doesn't seem elegant but i couldn't think of anything else.
public static boolean isEven(int i) {
while(i>0)
i-=2;
return i==0;
}
>>
>>61694004
Pure functional programming.
>>
>>61694004
Haskell's Prelude (part of its standard library that is imported by default) has functions called even and odd that do that
>>
>>61693863
(define (even? n)
(= 0 (remainder n 2)))

Modulus is not the same thing as remainder. :^)
(define (even? n)
(not (bit-set? n 0)))


>>61694004
He's just defining isEven to be the same thing as even dummy. Use a bit test.
>>
>>61694004
He just called an isEven library, nothing special, just as stupid as the question itself
>>
>>61694004
>>61694023
And since functions are first class values, you can just do

isEven = even
rather than

isEven(int n) { return even(n); }
>>
>>61693995
>{ } constructs a tuple by default.
huh?
>>
>>61694041
Well it did according to anon who apparently lied
Keep up with the conversation
>>
>>61694038
bool (*isEven)(int) = &even;

dumb nigger
>>
>>61694080
in C++ this is just

auto isEven = &even;
>>
>>61694075
How about stop spouting nonsense? Yes, that goes for you too.
>>
>>61693863
int[] initEvens()
{
int[] evens;
for (int i = int.min; i <= int.max - 1; i +=2)
{
evens ~= i;
}
return evens;
}

bool isEven(int n, int[] evens)
{
import std.algorithm.searching : canFind;
return evens.canFind(n);
}

void main()
{
import std.stdio : writeln;
static evens = initEvens();
2.isEven(evens).writeln;
}



:*)
>>
>>61694088
C++ doesn't even have an isNumeric function
kek
>>
>>61694102
>.writeln
please end this ugly meme
>>
>>61694115
fuckton better than cout <<
>>
>>61694115
Never
>>
>>61694115
>meme

kys
>>
>>61694135
>kys
>>
>>61694102
>import std.algorithm.searching : canFind;
Stop being autistic and just import std.algorithm
>>
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0428r1.pdf

Oh man, why. Now we only need to be able to specialize lambdas.
>>
>>61694151
yes, kill yourself
>>
>>61694151
>>
>>
>>61694160
>[]<>(){}
truly this is the best timeline
>>
>>61694186
>[]<>(){}();
>>
>>61694102
Shieeet niggo

If you want to do extra-points in dynamically disfunctional programming:
def(:even, memoize(fn(n)
true if n == 0
else not(even(n-1)))[/code]
So you can slowly build a hashmap of whether numbers are even or not, in order to improve time complexity at infinity.
>>
>>61687026
Can't hurt to start with python or javascript. Both will teach you the basics of scripting and logic but javascript might help you transition later on better to compiler languages like Java and C/C++.
>>
>>61694186
>>61694202

holy shit
C++ is such a joke language at this point
>>
>>61694102
>>61694080
>>61694024
>>61694004
>>61693978
>>61693915
>>61693885
>write a program that will count from 1-100. If a number is divisible by 3, it should print "fizz", if it is divisible by 5, it should print "buzz", if it is divisible by both, it should "fizzbuzz"
>>
>>61694232
It's not possible.
I can't do it.

>>>/sci/
>>
>>61694231
This is because C++ lacks vision of what it wants and what it doesn't

C++ is like your awkward old uncle that tries really hard to fit in but fails miserably
>>
>>61694232
I don't know any abstract algebra, sorry.
>>
>>61694258
system fw-based pure language with C monad and typeclasses and modules when?
>>
>>61694265
stop throwing random buzzwords anon
>>
>>61694275
>system fw
a type system that features polymorphism and type level lambdas

>pure
pure

>C monad
directly write low level C-style code with no performance hit

>typeclasses
ad-hoc polymorphism

>modules
collections of definitions and other program pieces
>>
File: IMG_1143.png (1MB, 750x1334px) Image search: [Google]
IMG_1143.png
1MB, 750x1334px
Anyone read this? Is it a good resource? I'm only on chapter 2, I wanna git gud at programming because currently I don't understand half of the stuff people talk about in these threads.
>>
>>61694289
Modules are a separate file full of function/struct/class definitions
>>
>>61694309
they don't have to be separated by file
>>
>>61694320
They should be.
>>
>>61694349
No, on many occasions you don't want to break everything up into multiple files.
You're enslaving your language to specific filesystems
>>
>>61694305
Then you should read a boon on C++ instead
>>
Wait, do we continue in the muslim thread that should have been deleted ages ago or do we create new thread, then we would again have 2 /dpt/'s. Fuck.
>>
>>61694358
>No, on many occasions you don't want to break everything up into multiple files.
I never had felt the necessity to use glorified namespaces but whatever floats your boat
>>
>>61694375
Idk man, C++ seems to have way too much going on and also I have a lot of experience with Java already and very little with C++
>>
>>61694232
(define (fizzbuzzablefactoryfactory fizzer buzzer)
(lambda (begin end)
(define (fizzify n)
(cond ((= 0 (modulo n (* fizzer buzzer))) "FizzBuzz")
((= 0 (modulo n fizzer)) "Fizz")
((= 0 (modulo n buzzer)) "Buzz")
((number? n) n)
(else (error "Illegal Argument Exception -FIZZBUZZABLEFACTORYFACTORYOBJECT OBJECT"))))
(lambda ()
(map fizzify (iota (+ end (- begin) 1) begin)))))
(((fizzbuzzablefactoryfactory 3 5) 1 100))

See? Lisp is enterprise too.
>>
>>61694305
I don''t know this book but if it's concise and a university book should be good.
It doesn't have bullshit on the title so it should probably be fine.

>>61694375
In my opinion C or Java are better for algorithms and data structures.

C because it's small simple, less magical than Java, and you get a feel how these data structures work and handle the memory in a real computer.
Java because it's high level. automatically handles the memory and you will get to results faster without having to learn C peculiarities.

C++ looks to me like the worst of both worlds, having at the same times access to C constructs and C++ constructs and it's a keyword heavy language. It will shift the focus from learning about data structures and algorithms to learning about the weirdness and the multiple ways (none completely right and none completely wrong) to do the same thing.
>>
>>61694400
That C++ has a million different things that are all trying to address the same problem in different awkward ways is a C++ problem
>>
File: consider.jpg (29KB, 600x600px) Image search: [Google]
consider.jpg
29KB, 600x600px
new thread
>>61694500
continued dubs
>>
>>61694452
Since you already have experience with Java stick with Java and learn algorithms with Java
Java has a bad reputation around here but it's a fine language, verbose but simple and fine and it just makes sense
It's no wonder that most universities use it to teach algorithms
>>
>>61687186
nice

Here's a simple ruby implementation
def chan(a, b, m)
sum = 0
while b <= m
sum += b if b % 2 == 0
a, b = b, (a + b)
end
return sum
end

puts chan(0, 1, 4_000_000)
Thread posts: 326
Thread images: 28


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

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


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