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

/dpt/ - Daily Programming Thread

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

Thread replies: 319
Thread images: 47

File: karen haskell.png (818KB, 1280x719px) Image search: [Google]
karen haskell.png
818KB, 1280x719px
What are you working on, /g/?


Previous Thread: >>58709139
>>
how do I declare a new object in C++ without using new?
>>
thank you for using an anime image
>>
how do I delete an object in C++ without using delete?
>>
>>58714430
I posted this in the previous thread, but here seems pretty nice.

What does /dpt/ think of a Tox powered podcast where we talk about our projects? We all join a group chat, negotiate a time, record our version of it, and distribute it somehow (torrent, upload to website).

If people like the idea, i'll set up a Raspberry Pi ToxBot and post the ID here
>>
>>58714442
class IHopeYouLikeCplusplus
{
const char* message = "Hey! Hope you're having a great day!"
}

int main()
{
IHopeYouLikeCplusplus a1;
}


Source: https://www.tutorialspoint.com/cplusplus/cpp_classes_objects.htm
>>
File: d.jpg (77KB, 1280x720px) Image search: [Google]
d.jpg
77KB, 1280x720px
>>58714442
Nande?
>>
>>58714442
>>58714459
Malloc and free
>>
>>58714442
Paddle paddle{...};
auto paddle = Paddle{...};


If it's a field you want to define in a constructor:
Object::Object : paddle{...} { ... }
>>
>>58714459
>>58714442
malloc and free should work just like they do in C
You can also just use the stack, but that might not fit your use case.
>>
>>58714430
Thank you for using an anime image, OP.

>>58714396
I'd like to know too.

>>58714442
You don't, pretty much. It works like >>58714440 - if you want to put it on the stack (as a local variable), you don't use new. If you need a pointer to it, you require the keyword new.

>>58714459
Maybe I'm feeding a troll.

>>58714464
That'd be kind of neat, but I wouldn't participate personally if it's intended to be recorded and indexed publicly.
>>
>>58714459
If an object has a destructor, it automatically is destroyed once it goes out of scope
>>
File: img_034.png (277KB, 416x406px) Image search: [Google]
img_034.png
277KB, 416x406px
>>58714442
>>58714459
How do I suck dick without being a faggot?
>>
File: muy pronto.png (173KB, 1440x900px) Image search: [Google]
muy pronto.png
173KB, 1440x900px
>>58714470
>>58714472
>>58714476
>>58714479
>>58714480
>>58714485
maybe I need to put an example.

I don't want to create a pointer for just a simple value of my object.
>>
>>58714505
>Using large icons on the taskbar

Do you have bad eyes or are you incapable of pointing at small things
>>
>>58714485
>That'd be kind of neat, but I wouldn't participate personally if it's intended to be recorded and indexed publicly.
I'm also the BasicTV guy. I would take these episodes and broadcast them as they came out.
>>
>>58714505
Are you asking how to define your constructor?
Paddle::Paddle() { ... }

You can construct that SDL_Rect like so if it's a field of Paddle called rect:
Paddle::Paddle() : rect{0, 0, 100, 100} {}
>>
File: p.png (500KB, 700x808px) Image search: [Google]
p.png
500KB, 700x808px
Will reading SCIP actually make you good at coding or is it just for turbonerds who want to understand fundamentals they'll never actually use.
>>
>>58714529
why do you put rect between : and {}?
>>
>>58714505
Just a fair warning, these questions you're asking are somewhat vaguely worded, and low enough level that they're covered by basic tutorials; they might be irritating some people because of that.

By "simple value" my best guess is you want it to be on the stack (to learn about C++, you need to know what the stack/heap and pointers are) as a local variable, in which case, you would do it like the first code snippet in >>58714440 .

>>58714523
Might be the default size in Windows 7, but I can't remember anymore.
>>
File: test (4).png (532KB, 602x699px) Image search: [Google]
test (4).png
532KB, 602x699px
>>58714538
It's a meme lol
>>
>>58714505
I dont think you know how to ask this question very well. But i think you just want something on the stack? If so I think you can do
padle A(...); 
>>
>>58714544
yeah, I want the arguments of the constructor to change the rectangle value without using a pointer.
>>
>>58714541
It's called the initializer list. You can also do
Paddle::Paddle() {
rect = SDL_Rect{0, 0, 100, 100};
}

but the initializer list is recommended because doing it in the constructor itself will not work for classes that don't have a default constructor (as C++ will try to default construct all the fields if they're not constructed in an initializer list before running the constructor).
>>
>>58714557
I'm confused because in Java and C# you can easily call new on everything you make, but on C++ there's no need to call new on everything.

>>58714562
thanks, that answer my question.
>>
>>58714551
Yeah but like /lit/ meme books are also good books a lot of the time
>>
Gonewild ripper with Python

Give it a reddit account, it pulls down all nsfw posts they've made that are hosted on reddit, imgur, gfycat, and eroshare.

Functionality is done but it has no interface, no error handling, no logging. I have to call it from the repl for now.
>>
>>58714430
that is a really cute picture of karen
>>
>>58714571
One of the pieces of audio I used to test BasicTV on the live stream was an audiobook copy of Gravity's Rainbow

10/10 would stream again

IJ is terrible tho
>>
>>58714538
SICP will teach you how to program, not write code.

If you don't use these "fundamentals" in your coding then you're not worth your own salt as a programmer.
>>
File: muy pronto.png (152KB, 1440x900px) Image search: [Google]
muy pronto.png
152KB, 1440x900px
should I give up on C++?
>>
File: image.gif (469KB, 639x360px) Image search: [Google]
image.gif
469KB, 639x360px
>>58714637
>coding for any reason other than ez money with minimal human contact
>>
>>58714570
Java and C# take away a lot of your power that you get from pointers. Pointers in computers are very important and powerful at a low level. But the benefit is you dont have to worry as much about the intricacies of pointers and the mistakes you could make. In c/c++ you can declare things without new because you decide how you want to use your variables. Either on the heap or on the stack which have their own befits/drawbacks.
>>
>>58714442

Object object;
Object objectFromConstructor(args, go, here);
>>
File: mom_what.png (128KB, 577x441px) Image search: [Google]
mom_what.png
128KB, 577x441px
>>58714660
But you haven't even done anything.
>>
>>58714570
Calling new in C++ technically does the same thing that the keyword does in C# and Java - memory is allocated from the heap and the object is constructed at that memory location. In C++ though you can statically construct objects ie. from the stack rather than the heap. Stack allocations is the same thing as using primitives, you just do:
typename foo; // calls default constructor

typename foo(x,y,z...); // constructor with arguments


when you use new in C++, ie. heap allocation, you also have to later explicitly use the delete keyword to free the memory (something which is done by the garbage collector in Java and C#). Tbh you should do some tutorials on dynamic memory in C++.
>>
>>58714660
You dont have to use an initializer list thats just the hotest new meme on the block. You can also use a java style of constructors.
>>
>>58714692
c++ is too hard.
>>
>>58714570
Since you're starting out with C++ you should probably avoid new/delete and stick to smart pointers (unique_ptr, shared_ptr) if you need heap allocation. new/delete may seem straightforward, but you need to be thinking of exceptions and copy semantics whenever you use them.
>>
>>58714660
>>58714708
FFS it's telling you what you need to change. You should also think about getting glasses since you can't tell () from {}.
>>
>>58714693
To add to this make sure your destructors take care of anything dynamically allocated within your class itself otherwise you will still run into memmory leaks.
>>
>>58714708
learn an easy language like Haskell
>>
File: smug25.jpg (177KB, 881x675px) Image search: [Google]
smug25.jpg
177KB, 881x675px
>>58714748
>>
File: muy pronto.png (152KB, 1440x900px) Image search: [Google]
muy pronto.png
152KB, 1440x900px
>>58714731
It doesn't work.
>>
>>58714748
This desu desu
>>
File: 1473998174864.jpg (15KB, 212x216px) Image search: [Google]
1473998174864.jpg
15KB, 212x216px
>>58714763
Are you even trying?
>>
>>58714790
c++ is too hard 4me
>>
>>58714763
lad, we told you already, the constructor should look like
Paddle::Paddle(int x, int y, int widht, int height)...

It's not void, and it's a member of the Paddle class so you do the Paddle::
>>
>>58714803
Go back to C# if you don't want to use C++, then.
>>
>>58714763
I think you just enjoy asking dumb questions and not actually thinking for yourself desu.
You should, like, fix that attitude.
>>
File: muy pronto.png (172KB, 1440x900px) Image search: [Google]
muy pronto.png
172KB, 1440x900px
>>58714809
>>58714820
>>58714830
m8, yesterday I coded pong in libgdx in like five minutes.

It's been two hours and can't get a stupid rectangle on screen in C++
>>
File: 1475648148606.jpg (82KB, 400x500px) Image search: [Google]
1475648148606.jpg
82KB, 400x500px
>>58714430
I just wanna elicit a response from a web server and print it, why doesn't this work?
#include <iostream>
#include <boost/array.hpp>
#include <boost/asio.hpp>

using boost::asio::ip::tcp;

int main(int argc, char **argv)
{
try
{
if (argc != 2)
{
std::cerr << "Usage: ./client <host>" << std::endl;
return EXIT_FAILURE;
}

boost::asio::io_service io_service;
tcp::resolver resolver(io_service);
tcp::resolver::query query(argv[1], "http");
tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);
tcp::socket socket(io_service);
boost::asio::connect(socket, endpoint_iterator);
boost::system::error_code error;

std::string message = "GET / HTTP/1.1\r\n";
boost::asio::write(socket, boost::asio::buffer(message), error);

for(;;)
{
boost::array<char, 128> buf;
size_t len = socket.read_some(boost::asio::buffer(buf), error);

if (error == boost::asio::error::eof)
break;
else if (error)
throw boost::system::system_error(error);

std::cout.write(buf.data(), len);
}
}

catch (std::exception &e)
{
std::cerr << e.what() << std::endl;
}

return EXIT_SUCCESS;
}
>>
>>58714672
Just nitpicking, but it's unfair to lump Java and C# together here. In C#, you can do most of the pointer-related stuff you'd ever need safely with IntPtrs/Marshalling/etc. For the rest, you can use the unsafe keyword, at which point you just get C++ pointer addressing/dereferencing semantics and arithmetic. Also, C# structs are heap-allocated value types with automatic boxing/unboxing.
>>
>>58714850
so in initializer list, you don't do equals, just do it like
Paddle::Paddle::(blah blah):
rectangle(blah,blah)
{
}


Now the next thing you should do before you continue shitting the thread up is DO A TUTORIAL or at the very least practice doing some basic algorithms or some shit so you can get hang of the language.
>>
/dpt/, have you ever asked yourself, what the fuck were your parents thinking?
>>
>>58714857
*stack-allocated
>>
>>58714857
oh yea sorry I forgot C# has an unsafe mode, haven't used C# much. All I remembered is that java and C# are nearly the same language at least for syntax. But yea he was asking it like he never used unsafe mode in C# since he's trying to avoid pointers altogether and doesn't realize there is an alternative to calling new for every class.
>>
>>58714907
Dad was thinking in binary, mom in quarternary.
>>
>>58714856
Please respond.
>>
File: what_did_he_mean_by_this.png (179KB, 359x769px) Image search: [Google]
what_did_he_mean_by_this.png
179KB, 359x769px
>>58714907
>>
>>58714997
Java and C# were pretty much the same language around 2005ish. Since then, C# has come a long way, and Java has not. In particular, C# is made by people working down the hall from the people who make F#, and they are all friends with each other and they share ideas for features and the F# ML nerds are always suggesting stuff like "hey, what if... tuples" and the C# bros listen and they add it to the language. Whereas Java is developed by Oracle.
>>
What's the point of asynchronous programming?
>>
But why wouldn't you just do things synchronously so they're easier to understand?
>>
>>58714581
>I have to call it from the repl for now.

I think that is the best interface. I always make libraries then implement a really simple cmdline utility around it if it's really really necessary.
>>
>>58715441
>asynchronous
basically things happen at the same time
>>
>>58715441
Bascailly doing expensive operations in some other thread just to not lock the current one. This helps a lot to, for example, UI responsiveness.
>>
>>58715461
Do you not know what the prefix a- means?
>>
>>58715466
So it's event driven programming with threads?

I'm finding it really hard to wrap my head around all this. Everything's all different, the only "async programming" that seems to actually work is network programming, everything else just isn't compatible. For example I still have to get window events for user input.
>>
>>58715483
I know what it means, maybe I worded that incorrectly. I meant that things happen at the same time independent of one another, as opposed to synchronous programming where things happen together.
>>
>>58715441
multithreaded applications are wonderful for speed
>>58715451
IMHO it is better to understand internal workings as partitioned off and specialized blocks, and it can really help speed up the program.

For example, i'm working on networking for BasicTV, and the two things that still need to be done is connection making and making requests for data. Now, if 10,000 nodes exist on the network at any given time, which ones should I contact for the information?

Every single piece of data that gets read into the socket has its ID cataloged and for every ID that is requested, it goes through all of those IDs and finds the IDs that are closest to it in the linked list. Every ID has to be looked up in a table, and a lot of them have to be read back from the disk. Then the process repeats to travel a distance up and down the linked list from that point.

>>58715501
>For example I still have to get window events for user input
Whatever information needs to be transported ought to be done through some FIFO buffer between the two threads
>>
>>58715441
To always make forward progress instead if needlessly waiting and blocking on things.
>>
Why would I want to learn metaprogramming and what is metaprogramming?
>>
>>58715555
http://www.defmacro.org/ramblings/lisp.html
>>
>>58715555
generally just programming at a higher level
>>
>>58715555
>What is metaprogramming
Metaprogramming is writing programs to write programs. One common example is C macros.

>Why would I want to learn metaprogramming
Personally, it helps make redundant code less error prone, more uniform, and easier to maintain
>>
>>58715555
Metaprogramming is when you manipulate the syntax itself.
>>
>>58715528
>Whatever information needs to be transported ought to be done through some FIFO buffer between the two threads

I mean about the API. You can epoll on a socket fd but you can't epoll on files and also not on X/wayland/windows/whatever events I think. Signals make the entire thing infinitely worse. It's just a mess.

Honestly sometimes it feels like the best way to solve communication problems is to do it like we humans do it: messaging. 0MQ good for this?
>>
>>58714496

Wear a skirt, make sure the balls don't touch, and say no homo before and after.

>>58714856

Why are you using TCP sockets in Asio to do what libcurl was made for?
>>
>>58715501
>>58715603
Window managers will generally queue up events so that, instead of blocking on the next event, you can check if there even is a next event before getting it. In Windows this is accomplished with PeekMessage.
>>
long time no see /g/

I need to search the archive for a thread, not sure if it made it to archive or was deleted but it relates to happenings and is important.

I need to search via information that I can only see when I mouseover "view", because I dont remember the thread title, or the words in OP.

I know I am going to need to go deeper than just curl | grep 'regex' in order to search content of relevant threads. Has anyone ever done a search like this, or have a script for something like this?
>>
>>58715657
>when I mouseover "view"
can you give some examples?
>>
>>58715668
like I remember words in the thread that were important that could be candidates for searching for the correct OP.
I know the date and approximate time.
I know the approximate number of responses to the thread

These are all things I could use to narrow down a search to an appropriate number of human browsable threads from thousands to less than 100
>>
>>58715686
Best I can say is try and download every thread that ever existed and git gud at regexp
>>
>>58715698
do you know of an easy to implement spider that could do the download part for me?
Downloading them all by hand alone would be more labor intensive than just looking through the thousands of threads
>>
>>58715716
I made something like that for farming /pol/ threads about Pizzagate. It just downloads all links from a website.

I think you would benefit more from a recursive wget (set the depth pretty high). Find as many websites that would have that archive and download them all.
>>
>>58715747
this is recent, it should still be on the 4chan archive. So it doesnt need to be big, it just needs to be fast.
>>
>>58715814
If you really need fast, then axel downloads multiple files at one time to get past per connection quotas (only works when they are the limit).
>>
>>58714430

I've been working on a simple Makefile generator for out of source builds.
>>
File: 1482601650648.jpg (17KB, 317x379px) Image search: [Google]
1482601650648.jpg
17KB, 317x379px
>>58714660
>VStoddler
Yes of course
>>
File: crow.jpg (14KB, 324x451px) Image search: [Google]
crow.jpg
14KB, 324x451px
I just made a project of two C++ files to check how linking worked, and g++ compiles the programs but fails to link them, gives me a
undefined reference to
error.

I even tried
$ g++ -c
for both files and then linking them, but it doesn't work. What the fuck do I do?

$ g++ splitTest.o split.o -o myProgram
splitTest.o: in function 'main':
undefined reference to void split<std::ostream_iterator ...
>>
Is a lisp interpreter the same thing as a compiler?
Also, I'm reading SICP and using scheme, is everything with scheme done at runtime? Like I just type commands into terminal and the interpreter spits things back out at me? It feels really weird not writing some type of text file, and not compiling it.
>>
Project Euler 10...

A little stuck since I'm still using the Sieve of Eratosthenes to make primes.

What is another way of generating primes that's better, but still implementable for a beginner/brainlet?
>>
>>58715997
REPL, yes exactly.

You can compile LISP code though. You can also write it and load it too.

If you are new to all of this try Racket. It makes things easier for newbies to understand.
>>
>>58716043
if the candidate prime you are checking is n

you only need to check upto
if (yourPrimesList[i] <= sqrt(n)) {
doMath();
} else {
break;
}
>>
>>58716044
Crazy.
I'll check it out Racket, too, thanks.
>>
File: bigcover3e.jpg (610KB, 1024x1266px) Image search: [Google]
bigcover3e.jpg
610KB, 1024x1266px
Will pic related teach me how to write a kernel and a shell?
>>
import std.stdio: writefln;

void main() {
const uint to = 10000;
auto sieve = new bool[to];
uint[] primes = [];
foreach (uint i; 2 .. to) {
if (!sieve[i])
{
sieve[i] = true;
primes ~= i;
for (uint j = i * 2; j < to; j += i)
sieve[j] = true;
}
}
writefln("Primes below %s (%s found):\n%s\n", to, primes.length, primes);
}
>>
>>58716254
It's shit.
>>
>>58716254
please use local imports

void main() {
import std.stdio : writefln;
>>
>>58716329
So is your mom, but you don't hear all those men complaining.

>>58716362
I'm sorry, senpai!
>>
>>58716385
you also accidentally used a set of unnecessary braces (after foreach) and put the brace after if (!sieve[i]) on the wrong line
>>
File: Untitled.png (110KB, 1200x400px) Image search: [Google]
Untitled.png
110KB, 1200x400px
Best C++ IDE?

I don't want visual studio on my system.
>>
>>58716404
>put the brace after if (!sieve[i]) on the wrong line
Again, very sorry!

>a set of unnecessary braces (after foreach)
That one's not unnecessary. The danger of having the program not work right after adding another line and looking for the problem for minutes overshadows the wasted space of two additional braces, one space and one newline.
>>
>>58716444

visuel studoi
>>
>>58716444
vim
>>
>>58716527
If it requires me to set up a compiler it can go fuck itself.
>>
>>58716532
>set up
What, you mean "use"?
>>
>>58716536
No, I mean setup

I have tried 10 fucking times to set up Clang and it never works.

And Im not going to use shitty compilers like g++
>>
>>58716545
what's wrong with visceral studious
>>
>>58716545
Have you considered a career in burger flipping? Might be more your speed.
>>
>>58716558

Hey considering you have no more arguments other than insults, I'm going to assume that you have the attention span of a goldfish.
>>
>>58716579
Said the guy who is too stupid to install a compiler.
>>
>>58716607
Do you have clang++ installed on your Window system?

Is it working perfectly?

If you can't answer these questions honestly, nothing you say means shit.
>>
>>58715616
Because I am trying to learn to use asio to do what asio was made for.
>>
>>58716617
Ok kid.
>>
>>58716444
emacs
t. nigger
>>
>>58716444
What OS?

I find vim + plugins way very comfy
>>
>>58715885
If you use g++ -c you'll have to invoke a linker to link them together.

Try this:
g++ -o myProgram splitTest.c split.c
>>
>>58716444
vim and gcc (or cl or mingw on windows)
>>
>>58716248
Still need an answer.
>>
>>58716444
I have used all three.
Code::Blocks is very restricted, has almost no configurability
Elcipse CDE is kinda okay but I got used to Vim
Netbeans is better but fonts are fucked for some reason.

Use Vim or Emacs. Linus uses Emacs and he codes the most complex C project. Wozniak uses vi. You have no excuse.
>>
>>58716617
>Window system

Lmfao
>>
>>58716805
Find about the book? Read the chapter names?
>>
File: severe_disappointment.png (530KB, 751x607px) Image search: [Google]
severe_disappointment.png
530KB, 751x607px
>mfw my code crashes cygwin compiler
Guess I'll just go fuck myself
>>
>>58716877
Dude
Just
Install
Linux (Preferably nixOS)
>>
>>58716894
Thanks Stallman
>>
>>58716894
You mean GNU/nix GNU/OS
>>
>>58716254
Rate my superior version of this program:
program primes
implicit none

integer, parameter :: n = 100

integer :: i, num_primes = 0
logical :: sieve(n) = (/.false., (.true., i = 2, n)/)

do i = 2, n
if (sieve(i)) then
sieve(i**2:n:i) = .false.
num_primes = num_primes + 1
end if
end do

print '(A I0 A I0 A)', "Primes below ", n, " (", num_primes, " found):"

do i = 2, n
if (sieve(i)) then
print '(I0)', i
end if
end do
end program primes
>>
File: 1478058734841.png (168KB, 727x682px) Image search: [Google]
1478058734841.png
168KB, 727x682px
If you had to compare languages to actual languages, what would C be to C++? Like Spanish to Portuguese? Or more like French?
>>
>>58716931
Trying to compare programming language to natural languages is pretty fucking stupid.
You are a fucking frogposter though, so stupidity is to be expected.
>>
File: frog legs.jpg (18KB, 250x250px) Image search: [Google]
frog legs.jpg
18KB, 250x250px
>>58716937
This honestly perfectly sums up what I was about to say, except the bit about frogposters, which I hadn't really noticed

But completely agree with
>>
File: 1477145594220.jpg (44KB, 540x556px) Image search: [Google]
1477145594220.jpg
44KB, 540x556px
>>58716937
>>58716941
sorry m7s, I forgot where I am
>>
File: thinking_hotaru.png (372KB, 954x768px) Image search: [Google]
thinking_hotaru.png
372KB, 954x768px
>>58716931
Are natural languages even recursively enumerable? If not then they're not even in the Chomsky hierarchy which means that there are in general no decision procedure for figuring out if two natural languages are identical given the grammars, let along a natural language and a programming language.
>>
Latin to French
>>
>>58715574
>>58715576
>>58715579
>>58715583
Nice!
What more languages involve metaprogramming?
>>
>>58716958
that's a cute saber

>>58716993
idris
>>
>>58716993
rosettacode.org/wiki/Metaprogramming
>>
>>58716970
He wasn't talking about them being equal and your post is a tangent.

pretentious frogposter
>>
File: smug_youko.png (341KB, 784x549px) Image search: [Google]
smug_youko.png
341KB, 784x549px
>>58717060
How else would you find a proper correspondence between languages so that you can compare them? You do realize that semigroups have so little structure that equivalence up to presentation is the only thing we can say about correspondences between them right?
>>
>>58716976
If you're answering >>58716931 that doesn't make much sense given that Latin is vastly more complicated than any of the languages directly descended from it.
>>
Can someone explain the difference between
class test
and
struct test final
in C++ to me?
>>
>>58716894
But what if the client wants a Windows version of your POSIX-compliant product, and you have neither time or skills to port it to Windows API?
>>
>>58714660
Yes. You're hopeless.
>>
File: 1478137361079.gif (650KB, 647x363px) Image search: [Google]
1478137361079.gif
650KB, 647x363px
>>58717070
I DIDN'T request a comprehensive paper
>>
>>58717110
They're not really similar.

class test
declares an ordinary class. Its members are private by default and you can derive other classes/structs from it.

struct test final
declares a struct. As a struct its members are public by default. final means you can't derive other classes/structs from
struct test
.
>>
>>58717150
Ah, I see. So everything is public by default, and it can't be inherited from.

Thanks.
>>
>>58717150
>>58717151

You can derive from structs
>>
>>58717161
Yes, though not if it has final in the head of the definition.
>>
File: 1432164169261.png (289KB, 586x634px) Image search: [Google]
1432164169261.png
289KB, 586x634px
>>58717134
Though you could classify all context-free languages by morphisms from just one single grammar. However it's definitely not the case that natural languages would turn out to be context-free or even merely context-sensitive, which means that not even do you need multiple grammars whose morphisms classify the entirety of context-free languages, you'd need uncountably infinite many of them.
In addition semantics can't be tracked mathematically as easily as syntax, which means that natural languages might not even fit into formal language theory as a whole.
>>
>>58717336
>traitor
Sorry anon here's a little kiss for you.
>>
>>58717370
I'll forgive you if you renounce frogposting

>>58717198
Do people actually use final for classes themselves?
It's an obscure C++ feature
>>
>>58716805
read "The AWK Programming Language"
>>
>>58717120

Use cross platform libraries
Never use POSIX or Win32 exclusive functions
Compile with x86_64-w64-mingw32-gcc for Windows programs
Test with wine
>>
>>58717560
if you're only ever targeting POSIX and Windows (as most likely you are) there's nothing particularly nasty about employing the union of extended library functions provided by all platforms
Most likely the biggest pitfall will be providing portable build and configuration scripts
But yeah this is good advice
>>
>>58717560
>Actually targeting Windows
What is wrong with you?
>>
>>58717651
He wants all the goy monies.
>>
>>58717651

90% of the desktop market.
>>
>>58717662
That has the flawed assumption that other people actually want to use your programs.
>>
>>58717671
there will be a lot more potential users though
>>
whats more hipster haskell or scala
>>
>>58714334
SBCL is widely considered to be the best Common Lisp interpretation.

It's solid and hella fast. You can even reach into assembly if you want.
>>
>>58717687
There is only a single potential user: you.
>>
Is there an open source parser/lexer/tokenizer for C code?

I want to break C code into tokens but don't really want to make my own recursive descent parser if I can help it.
>>
>>58717712
welcome to hell
>>
>>58717712
Here is a pretty simple C compiler:
https://github.com/rui314/8cc

You could probably gut it for the lexer and parser without too much effort.
>>
>>58717700
You're angry
>>
So I am solving project Euler problem.
I'm on the Collatz Sequence and I made the program to solve the problem.
It just does't run to completion.
Please help

Main.cpp
#include "Main.h"
namespace coll {
int counter(1);
int doEven(int numb) {
if (numb != 1) {
if (numb % 2 == 0) {
counter++;
return doEven(numb / 2);
} else
return doOdd(numb);
} else
return counter;
}
int doOdd(int numb) {
if (numb != 1) {
if (numb % 2 != 0) {
counter++;
return doOdd((3 * numb) + 1);
} else
return doEven(numb);
} else
return counter;
}
int chainLength = 0;
int temp = 0;
int theBestInput = 0;
int longestChain() {
for (int a(2); a < 1000000; a++) {
if (a % 2 == 0)
temp = doEven(a);
else
temp = doOdd(a);
counter = 1;
if (temp > chainLength) {
chainLength = temp;
theBestInput = a;
}
}
return theBestInput;
}
}


Main.h
#pragma once
namespace coll {
extern int counter;
extern int theBestInput;
extern int chainLength;
extern int temp;
int doEven(int numb);
int doOdd(int numb);
int longestChain();
}


Test.cpp
#include "Main.h"
#include <iostream>
int main() {

std::cout << coll::longestChain() << std::endl;
return 0;
}
>>
>>58715576
Narp. It's writing programs that write programs.
>>
File: 1477698043701.jpg (158KB, 720x480px) Image search: [Google]
1477698043701.jpg
158KB, 720x480px
Holy shit, I'm going to JUST myself if you guys don't validate my opinion. I have been reading function stack frame and the texts are too autistic.

Here is what I understand:

>main()
>child()
>last()

1. main() creates a function stack (Just a buzzword for a few adjacent blocks of memory)
2. it passes on it's local vars to child()
3. child() then passes it's local vars to last() (It's called "pushing a stack entry to the bottom")
4. last() gets computed
5. last() returns results to child()
6. local vars of last() get BTFO from the memory (it's called ""stack frame"")
7. child() gets computed
8. child() returns result to main()
9. local vars of child() get BTFO
10. All these because C variable lasts only within scopes
>Last in
>First out

What else am I missing?
>>
>>58715616
Sucking dicks isn't just for homosexuals, Ruby.
>>
>>58717789
I'm going to need the code you're talking about for context.
>>
>>58716929
Language?
>>
>>58717791

It's also for women, bisexuals, and trans women. The first of these does not need to worry about not being a faggot. The latter must practice what I have mentioned.

>>58717789

>All these because C variable lasts only within scopes
Oh it's not limited to just C. Most languages use the stack for local variables. Also, not all local variables will be inside the stack. Some can live entirely in the registers, particularly if they are short lived.
>>
>>58717831
Don't forget vacuum cleaners.
>>
>>58717803
There isn't any but I can make a sample code if you want.

I just want to know if this is how stack frame model works

>>58717831
I know but is there anything I am missing regarding the stack frame model concept?
>>
>>58717840
>I know but is there anything I am missing regarding the stack frame model concept?
Return values are occasionally saved on the stack (if it's too big for a register).
>>
>>58717874
So a stack frame is just some blocks of memory that contains data within a scope?
>>
>>58717778
What a clumsy way to write C++. I don't see where the infinite loop is, using recursive functions doesn't help.

One way to do it in C:
#include <stdio.h>

int collatz_chain(int n)
{
int len = 0;

while (n != 1) {
if (n % 2 == 0) { // even
n /= 2;
} else {
n = 3*n + 1;
}
len++;
}

return len;
}

int main(void)
{
int max = 0;
int seed = 1;
int len;

for (int i = 2; i < 100000; i++) {
len = collatz_chain(i);
if (len > max) {
seed = i;
max = len;
}
}

printf("Seed of the longest Collatz chain between 2 and 100000: %d (length %d)\n", seed, max);

return 0;
}
>>
>>58717828
Fortran. It was the first time I've ever wrote any.

>>58717831
>Most languages use the stack for local variables. Also, not all local variables will be inside the stack. Some can live entirely in the registers, particularly if they are short lived.
That's why people should use the "proper" terminology: 'automatic variables'. Meaning that they live for the block they're defined in, but doesn't really say where they're allocated. 'stack allocated' can be misleading and/or incorrect.

>>58717840
>There isn't any but I can make a sample code if you want.
Nah, it's fine. I thought you were going through an actual example or something.

>1. main() creates a function stack (Just a buzzword for a few adjacent blocks of memory)
Technically, main doesn't do it. It's already there when the program starts (i.e. the kernel does it).
>passes it's local vars
That's not really how it works. In C, when you pass a parameter to a function, a copy is made.
Unless you're talking about passing pointers to local variables.
>local vars of *() get BTFO
>10. All these because C variable lasts only within scopes
Automatic C variables only last for their scope. Static and dynamic variables (gotten from malloc) have different scopes: the entire program and until the call to free respectively.

Also note, especially with modern CPUs, the stack is used for a lot less than it used to be.
For example, with the AMD64 SystemV ABI (the one that Linux, MacOS and *BSD use), most integer/pointer/float arguments are passed into registers and not on the stack. The stack is only used when the arguments are too large or too numerous to fit into registers.
>>
>>58717904
>Static and dynamic variables (gotten from malloc) have different scopes
Different lifetimes, I mean.
They still are scoped the same.
>>
>>58716931
Programming languages have a lot more common than actual languages. It would be more of a case of Afrikaans vs dutch
>>
>>58716993
Lisp is well known for its metaprogramming.
>>
>>58717903
I rewrote it so that all methods used recursion.

I don't know what you mean by 'where the infinite loop is'
There is no infinite loop. The program just crashes before it can finish.

Main.cpp
#include <iostream> 
#include "Main.h"
namespace coll {
int counter(1);
int doEven(int numb) {
if (numb != 1) {
if (numb % 2 == 0) {
// std::cout << numb << " ";
counter++;
return doEven(numb / 2);
} else
return doOdd(numb);
} else
// std::cout << 1 << std::endl;
return counter;
}
int doOdd(int numb) {
if (numb != 1) {
if (numb % 2 != 0) {
//std::cout << numb << " ";
counter++;
return doOdd((3 * numb) + 1);
} else
return doEven(numb);
} else
// std::cout << 1 << std::endl;
return counter;
}
int chainLength = 0;
int temp = 0;
int theBestInput = 0;
int longestChain(int input) {
if (input < 1000000) {
if (input % 2 == 0)
temp = doEven(input);
else
temp = doOdd(input);
counter = 1;
if (temp > chainLength) {
chainLength = temp;
theBestInput = input;
input++;
return longestChain(input);
} else {
input++;
return longestChain(input);
}
} else return theBestInput;
}
}


Main.h
#pragma once
namespace coll {
extern int counter;
extern int theBestInput;
extern int chainLength;
extern int temp;
int doEven(int numb);
int doOdd(int numb);
int longestChain(int input);
}


Test.cpp
#include "Main.h"
#include <iostream>
int main() {
std::cout << "BEST: " << coll::longestChain(2) << std::endl;
return 0;
}
>>
>>58717969
Besides Lisp.
>>
>>58714850
Can you please fuck off back to libgdx then, thnx.
>>
>>58717976
Are you compiling with optimisations turned on?
It's likely that TCO is not taking effect and you're getting a stack overflow.
>>
>>58717833

And fleshlights, and many other inanimate objects. But you also cannot apply the term "faggot" to these. The only kind of person who would worry about becoming a faggot from sucking dick would be someone who is biologically male.

>>58717840

There's not much to it.

Before function call:
1. Push in-use volatile (caller-save) registers to the stack
2. Pass arguments through registers.
2a. Excess arguments pushed to the stack in reverse order.
2b. On some architectures (32-bit Intel), all arguments are passed on the stack
3. Make "call" instruction
3a. This should push the return address of the function onto the stack
3b. On RISC architectures, you may need to save the link register manually.

In function call:
4. Save base pointer to stack and set base pointer to stack pointer (optional in optimized functions)
5. Push any non-volatile (callee-save) registers to the stack that one wishes to use
6. <body of function, may involve numerous stack operations, including doing this same function call dance over again>
7. Restore non-volatile registers
8. Restore base pointer if necessary
9. Make "ret" instruction (also sometimes known as "jump and link")

After function call:
10. On relevant architectures, restore link register
11. Restore volatile registers.

Also, I think on some platforms there's something about creating a "red zone" for locals.
>>
>>58717978
Lisp is the only valid metaprogramming option. All other languages have deficient metaprogramming systems.
>>
>>58717992
I never used the word 'faggot', Ruby.
>>
>>58717985

This is what I am typing:
g++ Test.cpp Main.cpp -o CollatzSequence

I will add -O but I don't know what to put after it.
>>
>>58718007
-O2 should be fine
>>
why is java so much less popular on codewars than python even though java is more popular in general?
>>
>>58718019
Java just works. Python is good for pseudocodes
>>
>>58718026

so python is better for small algorithmic problems?
>>
>>58718005

The initial question was how to suck dick without being a faggot. All of my responses have been predicated under further explaining my answer to that particular question. Women and objects are not relevant to my explanation.

>>58718019

Because no one programs Java for fun.
>>
>>58717996
Besides only valid metaprogramming options.
>>
>>58718019
Java is more popular in business settings.
Python is more popular as a learning language plus it carved itself a niche in academia (look up scipy).

I'd wager that codewars is more popular with younger folk, and those are more inclined towards python.
Also Java is quite strict when it comes to writing the code, so even if you know both, python may be more preferable for quickly writing a solution to some algo problem.
>>
File: dsa.png (10KB, 509x155px) Image search: [Google]
dsa.png
10KB, 509x155px
>>58718013
How long did your take to print the result?
>>
>>58718039
Of course, I use it to taste my pseudocode and I program in C. There is always a python shell running besides my vim window
>>
>>58718040
I'm just here to speak up for vacuum cleaners, Ruby.
>>
>>58718056
You've obviously got an infinite loop going on in there.
>>
>>58718073

Right, but a vacuum cleaner does not come into a programming thread and ask how to suck dick without being a faggot. Neither can it post on the Internet, nor can it be capable of being a faggot, even had it a mind of its own.

>>58718056

>300KB memory usage, could fit entirely in L2 cache
>Throwing the CPU against the wall
Finally, a well-programmed application that can make USE of the advances in CPU technology
>>
>>58718044
install gentoo
>>
File: Untitled.png (174KB, 1920x1080px) Image search: [Google]
Untitled.png
174KB, 1920x1080px
>>58718089
I did 4 tests to prove that it works.

It might be possible that the higher numbers are breaking it but I doubt it.
>>
>>58718101
>Right, but a vacuum cleaner does not come into a programming thread and ask how to suck dick without being a faggot.
That's why I need to speak up for them, Ruby.
>>
>>58718101
>Finally, a well-programmed application that can make USE of the advances in CPU technology

Are you saying this sarcastically?
>>
>>58718146

Yes. Hence the capitalization for emphasis.
>>
>>58718129
$ g++ shit.cpp -O2 -ftrapv
$ ./a.out
Aborted (core dumped)

Integer overflow is the issue.
>>
File: adsgadsg.png (54KB, 550x377px) Image search: [Google]
adsgadsg.png
54KB, 550x377px
>>58718160

This fixed it. I changed all the int to
 long long 
and it worked.

#include <iostream> 
#include "Main.h"
namespace coll {
long long counter(1);
long long doEven(long long numb) {
if (numb != 1) {
if (numb % 2 == 0) {
//std::cout << numb << " ";
counter++;
return doEven(numb / 2);
} else
return doOdd(numb);
} else
//std::cout << 1 << std::endl;
return counter;
}
long long doOdd(long long numb) {
if (numb != 1) {
if (numb % 2 != 0) {
//std::cout << numb << " ";
counter++;
return doOdd((3 * numb) + 1);
} else
return doEven(numb);
} else
//std::cout << 1 << std::endl;
return counter;
}
long long chainLength = 0;
long long temp = 0;
long long theBestInput = 0;
long long longestChain(long long input) {
if (input < 1000000) {
if (input % 2 == 0)
temp = doEven(input);
else
temp = doOdd(input);
counter = 1;
if (temp > chainLength) {
chainLength = temp;
theBestInput = input;
input++;
return longestChain(input);
} else {
input++;
return longestChain(input);
}
} else return theBestInput;
}
}


#pragma once
namespace coll {
extern long long counter;
extern long long theBestInput;
extern long long chainLength;
extern long long temp;
long long doEven(long long numb);
long long doOdd(long long numb);
long long longestChain(long long input);
}


#include "Main.h"
#include <iostream>
int main() {
std::cout << "BEST: " << coll::longestChain(2) << std::endl;
return 0;
}
>>
in c++, when should you use dynamic memory?
>>
File: doggo wan the fishe.jpg (272KB, 1920x1200px) Image search: [Google]
doggo wan the fishe.jpg
272KB, 1920x1200px
I've only ever done network programming in Java during Uni, and didn't really understand it at that time.

I want to implement a IRC style client server program so I can learn about sockets, and I think it would be managable, but I'm wondering about using a library like boost.asio or cpp netlib.

Because I'm so stupid, I don't really understand the benefit of using one of those libraries. What do you guys recommend for someone who just wants to learn.
>>
>>58718207
You shouldn't use C++ for any purpose.
For C however, you should use dynamic memory when you need something which outlives the function it was defined in, or is too large to be allocated "normally".
>>
Can any haskell nerds make a wrapper for this?

https://github.com/oblitum/Interception

This guy did it for c#
https://github.com/jasonpang/Interceptor/tree/master/Interceptor
>>
>>58718207

Use the heap when:
1. You don't know how much memory you will use in the end, including in linked data structures and re-sizable data structures.
2. You do know, but the amount is ridiculously large.
>>
>>58718228
Why don't you just do it yourself?
>>
>>58718214

>something which outlives the function it was defined in
Declare it on the stack in the calling function, pass a pointer to the function it is to be created from.
>>
>>58718248
Yes, I would normally do that, but that doesn't work for dynamic data structures.
>>
>>58718237
because im not a haskell nerd
>>
>lectures start again today
>neural, emergent, and agent technology
>mobile applications
feels good lads
>>
I am trying to bruteforce a part of an url via JavaScript. If it's wrong I'll get a 403 error, but I can't find a way to catch that error with JavaScript so the loop can continue with guessing the next one. It appears on the console and in the network tab, there should be a way to catch it.
>>
>>58718316
Then why do you care?
>>
>>58718345
because it would be cool
>>
>>58718342
>mobile
trash
>>
>>58718444
muh employability
>>
File: wew lads.png (210KB, 1440x900px) Image search: [Google]
wew lads.png
210KB, 1440x900px
wew lads.
>>
>>58718490
are you from 2010 my nigga, visual studio is now free (2015 community)
>>
>>58718499
what's wrong with using 2010?
>>
>>58718505
it's 2010 express edition
>>
>>58718490
>default windows wallpaper
>default taskbar items
>ie
>1440x900
>windows media player
>qbittorrent
>taskbar unlocked
>>
>>58718509
explain
>>
>>58718505

Doesn't have an up to date compiler. If your compiler doesn't support all of C++11 and C++14, it's total garbage and you should stop using it.
>>
>>58718505
For one the compiler in the newer versions are vastly better and other shit
>>
Why the fuck doesn't lisp have syntax for accessing objects fields?
You have to do
(let ((x (get-foo)))
(foo-field x))

instead of
(let ((x (get-foo))
x.field)

You can't even fix that whit macros.
>>
>>58718522
>>58718524
I'm not doing nothing advanced, just pong.
When I get a newer PC I'll install W10 or some shit.
>>
>>58718505
Nothing. 2008 was the peak. Anon is retarded. 2010 is fine.
>>58718522
Why would you force yourself to use the inferior IDE just to use the slightly updated compiler? Especially when you can just get the compiler to work with 2008.
Or just do your release build on the modern compiler.
>>58718490
Who put you up to this?
>>
>>58718531
You can fix that with reader macros.

Not much point in objects when you have closures.
>>
>>58718342
Anon if you can come here to /dpt/ and comment on what the most interesting things you learned in school were every day. Maybe I can feel a lot better or worse about deciding to not go to university.

I learn so much but I'll never know what I'm missing. I always find the things they promise to teach you to be far too little considering the massive time you're given.
>>
File: wew lads.png (232KB, 1440x900px) Image search: [Google]
wew lads.png
232KB, 1440x900px
>>58718563
>Who put you up to this?
what?
>>
>>58718563
shit, had to google that expression.

nobody, I want to learn SDL.
>>
>>58718600
OK. Cool.
>>
>>58718533
>When I get a newer PC I'll install W10 or some shit.
What the fuck are you on about, cunt?

VS2015 works on Windows 7.

There is no excuse for not using the more up-to-date toolset other than laziness.
>>
>>58718627
Why do I need to use the most modern compiler?

I see nothing wrong with office 2003.
>>
>>58718512
You forgot the worst part of it all.

>language code is ES
>>
>>58718642
Oh, shit, you're right.

My bad.

Let me go find my Office 2003 install disks because I forgot how much better they are to use right now.
>>
>>58718588
ive had nearly 2 months off m8, im looking forward to actually doing something again

>I always find the things they promise to teach you to be far too little considering the massive time you're given.
fucking tell me about it m8, i average about 2-3 hours a day of time spent actually in university doing something. university is bullshit for programming desu.
>>
File: text4164.jpg (142KB, 573x430px) Image search: [Google]
text4164.jpg
142KB, 573x430px
>>
would c with glfw be an upgrade over c++ with sfml?
>>
File: Capture.png (21KB, 536x623px) Image search: [Google]
Capture.png
21KB, 536x623px
I'm really confused. I wrote some matrix functions in javascript and did a quick test to see if they weren't too slow against other libraries but mine seems to be faster somehow? This can't be right because it's even beating gl-matrix.

The only real difference is that I'm using objects with altered prototypes whereas the other two are using plain functions.

Am I misunderstanding something? Should I try initialising outside? I do it this way because that's how it will be using mostly.
>>
>>58718696
>>58718709
:thinking:
>>
>>58718696
I unironically feel this way now that I'm doing non-trivial tasks.

Also, some of the "fun" stuff feels like that even more: I wired a disco ball to light up when specific conditions are met in the processes at my company.
>>
>>58718696
You get this feeling with NN desu.
But really it's just you looking at patterns which the program probably haven't discovered.
>>
>>58718701
I like C and glfw but it depends entirely on what you feel needs upgrading.
Glfw doesn't give you nearly as much as sfml does. If you just want it to be out of your way glfw is good. If you want to use it sfml let's you use it.
>>
Am I the only one here who listens to the Fragmented Podcast with Donn Felker and CowShit GoatPal?
>>
>>58719097
I mean Donn Felker and Pajeet...
>>
>>58714538
>you
You in particular? Probably not lmao
>>
what the fuck am i doing?
>>
>>58719567
using loonix on arm
the more important question would be "can it play anime?"
>>
>>58714430
I made a power outlet that I can control using an app with arduino
>>
Is it possible to compile everything with bare hands?
>>
File: 1472684516553.png (171KB, 374x347px) Image search: [Google]
1472684516553.png
171KB, 374x347px
So I spent a year learning Haskell full-time.
Where can I collect my job?
>>
>>58719649
>a year
sub 80 iqs aren't allowed here
>>
>>58719634
Yes.
That was a standard undergraduate exercise at my university. Translate C to Assembly on paper in an exam. Literally CompSci 101. I sucked at my studies but even I could do that easily.
>>
>>58719649
Stop false-flagging, please.
>>
>>58719661
>assembly
what kind of machine you've got if it runs assembly without further compiling it down?
>>
>>58719679
Assembly to machine language is just a 1:1 mapping. Use an opcode table if you care that much.
>>
>>58719661
>Translate C to Assembly
Did you translate standard library functions? :-)
>>
Is there any books on good library design?
>>
Rate my converter, /dpt/.
#!/usr/bin/perl

use v5.14;

$a = <>;
$a = reverse $a;
$a =~ s{(\d)(\d)?(\d)?([0-3])?}
{("M" x $4) .
(($3 == 9) ? "CM" :
(($3 > 4) ? ("D" . ("C" x ($3 - 5))) :
(($3 == 4) ? ("CD") : ("C" x $3)))) .

(($2 == 9) ? "XC" :
(($2 > 4) ? ("L" . ("X" x ($2 - 5))) :
(($2 == 4) ? ("XL") : ("X" x $2)))) .

(($1 == 9) ? "IX" :
(($1 > 4) ? ("V" . ("I" x ($1 - 5))) :
(($1 == 4) ? ("IV") : ("I" x $1)))) }ex;

say ($a);
>>
>>>>>>>>>>Exception handling
is this a meme?
>>
>>58719878
delete your post and rewrite it with the correct usage of "meme".
and no, it's not a "meme". it's just plain trash
>>
>>58719660
Sub 80 IQs are the reason this place exists.
>>
>>58719968
wow not so harsh daddy
>>
>>58719983
don't tell me you're a refugee
>>
>>58720011
no im Albanian so the correct answer is I wish I was
>>
>>58720030
how brave of you to reveal your true colors
>>
>>58720063
i got a fever and decided to come
this lesson is a fucking meme bad decision desu senpai
>>
>>58720084
plus you can get nasty infections too.
>>
>>58718505
It's a microsoft product and microsoft slips spyware into compilers
>>
>>58720250
(tinfoil)
>>
File: 1479898360331.jpg (993KB, 1182x1581px) Image search: [Google]
1479898360331.jpg
993KB, 1182x1581px
>>58720264
>>
I need an introduction to logic programming.

I don't have a background in mathematics, so I'd like to avoid that as a pre-requisite.

Does anyone know of any good titles? A link would be ideal, but I'm happy to find a copy myself.
>>
>>58720285
learnprolognow.org
>>
>>58720311
Ehh.
>>
>>58720274
good luck not browsing the internet then faggot.
>>
>>58720285
>I don't have a background in mathematics
so in other words you're a pajeet? Remove yourself from this thread
>>
>>58720340
You want to learn logic programming, what now?
>>
>>58720377
I'm a white, Oxbridge-educated male doctor. I'm well above Pajeets in the social hierachy.

>>58720379
Yeah, I have read through that site, but I wanted something more general.
>>
File: enough.jpg (30KB, 316x202px) Image search: [Google]
enough.jpg
30KB, 316x202px
>regex works in regex tester
>not in .net
>>
>>58720406
Solution: don't use .NET
>>
File: mens butts.png (23KB, 1089x69px) Image search: [Google]
mens butts.png
23KB, 1089x69px
>>58720274
>>
>>58720406
You're probably getting something mixed up somewhere in the area of list of strings vs block of text, or non-global search.
>>
File: output.webm (524KB, 466x345px) Image search: [Google]
output.webm
524KB, 466x345px
>>58714430
>What are you working on, /g/?
Trying to set up shader hot-loading in rust.
>>
"Recursion is so great. It is the best thing ever!"
- Nobody
>>
>>58720481
"Recursion is so great. It is the best thing ever!"
- (You)
>>
>>58720481
"Recursion is so great. It is the best thing ever!"
- Me
>>
ABSORB?!!!!!!
>>
>>58720481
>>58720509
>>58720534
"Recursion is so great. It is the best thing ever! Recursion is so great. It is the best thing ever! Recursion is so great. It is the best thing ever!"
- /dpt/
>>
Hi /dpt/
I want to learn Haskell and I'm downloading stack right now, but I wanted to know what task do Haskell excels over other languages, so that I can include it on my daily tools.
>>
>>58720687
You get to feel smug.
>>
>>58714430
>What are you working on, /g/?
a 4chan library to shitpost & easily make bots with. I made a couple of game bots for different boards. Looks like this

var board = new Board("g");

var thread = board.Threads.FirstOrDefault(t => t.Subject.Contains("/dpt"));

if (thread != null)
{
var captcha = Captcha.Request();
// Show captcha.Image to user & solve
captcha.Solution = "whatever";
Post post = thread.CreatePost("Thank you for using an anime image.", captcha, OptionalPostArgs.Default);

post.Quoted += (rep) =>
{
Console.WriteLine("Got a (You) from >>{0}", rep.PostNumber);
}

thread.AutoWatcher.Start();
}


r8
>>
>>58720706
do you mean I shouldn't learn it?
>>
>>58720722
Lots of abstraction hidden behind that code.

Also, it looks like you've completely abstracted the existence of thread pages away, which is probably fine for your uses but will force you to make 10+ requests even if the thread you're looking for is on page 1.
>>
>>58720722
goodluck with the captcha lmao
>>
>>58720750
I'm saying that Haskell has the advantage of making you feel smug, regardless of its usefulness in comparison to other modern, high-level languages.
>>
>>58720774
>captcha
What, are you poor?
>>
>>58720765
It only makes one request to 4chan API to fetch the entire catalog, no need to get it per-page.
>>
>>58720789
Oh shit, forgot about the catalog endpoint.

brb looking at some code
>>
Which language is used most in Japan?

Java/C++?
>>
>>58720285
>>58720400
If anyone else is interested, I found something decent:
http://spivey.oriel.ox.ac.uk/wiki2/files/logprog/logic.pdf
>>
>>58720827
those fuckers use a lot of microsoft stuff, so VB I would say
>>
>>58720827
Older stuff in C/C++
Newer stuff tends to be developed in Java or Ruby the most.
>>
>>58720827
japs strive for correctness, so maybe haskell or rust
>>
New thread:
>>58720859
>>58720859
>>58720859
>>
>>58720722
Doesn't handle thread wars.
>>
>>58720557
"Recursion is so great. It is the best "Recursion is so great. It is the best "Recursion is so great. It is the best (...) ever!" ever!" ever!"
- TINA Is Not Acronism
>>
>>58714856
You are missing the last \r\n on your writes.
It's a header per line plus an empty line to tell it you are done sending headers.
>>
>>58714430
Finished a decision tree implementation in CL that produces native code to classify objects.
>>
>>58717996
This isn't entirely true, forth supports metaprogramming to an extent, as well as Tcl.

But Lisp definitely is the best, no argument :>)
>>
>>58718709
How large are your test matrices? It could be that the overhead of gl-matrix is causing this. Try it out on some large matrices, i.e. 12,000 x 12,000 or so. See what happens.

Post results, genuinely curious.
Thread posts: 319
Thread images: 47


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