[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: 320
Thread images: 28

File: K&R himegoto waifux2.png (1MB, 1000x1400px) Image search: [Google]
K&R himegoto waifux2.png
1MB, 1000x1400px
old thread: >>59529672

What are you working on, /g/?
>>
>>59533197
"The most powerful programming language is Lisp. If you don't know Lisp (or its variant, Scheme), you don't know what it means for a programming language to be powerful and elegant. Once you learn Lisp, you will see what is lacking in most other languages." -Richard Stallman
>>
>literal fag shit
delet this
>>
>>59533197
D
>>
I need some program ideas which have nevar been dun befor.

Getting quite demotivated learning programming since all the
programming ideas I have came up with have been already done
or substituted by a different configuration of another program.
Doing examples in a C textbook is getting boring.
>>
>>59533221
welcum too pedofag site
>>
main () { while (malloc(1)); }
>>
>>59533246
microsoft pls
>>
>check stack overflow developer survey
>https://stackoverflow.com/insights/survey/2017
>We asked respondents for their gender identity.
>Specifically, we asked them to select each of the following options that apply to them:
>Male
>Female
>Transgender
>Non-binary, genderqueer, or gender non-conforming
>A different identity (write-in option)
>>
>>59533265
Google just allows Male, Female, Other, and Prefer not to answer for its accounts.
>>
What are some good features to make a programming language good & productive?
What's the best way to handle errors?
Does error handling through exceptions immediately discount a language as being "low level"?
>>
File: MS antisemitism.png (49KB, 202x579px) Image search: [Google]
MS antisemitism.png
49KB, 202x579px
Why would M$ allow antisemitism in their apps?
>>
File: 149020586933.gif (328KB, 500x517px) Image search: [Google]
149020586933.gif
328KB, 500x517px
What's the essential list of Lisp commands?
I've understood the concept around lists, cars and cdrs, but now I want to program something Lisp-interpreter independent.
>>
File: 1489140123312.jpg (25KB, 641x530px) Image search: [Google]
1489140123312.jpg
25KB, 641x530px
>seniority level on LinkedIn says entry level
>position in the advertisement text is for SENIOR level with 5-8 years experience
>>
>>59533240
Someone please answer.
>>
>>59533353
Which Lisp?
>>
>>59533353
Use Scheme. There is no standard Lisp, while Scheme is a standardized version of Lisp.
>>
>>59533361
Let's consider CL or Scheme.
>>
>>59533354
dumb frogposter
>>
>>59533427
What? Common Lisp is standardized. It has a very large standard compared to Scheme.
>>
Kan man programmere på norsk?
>>
>>59533240
please answer, someone?
>>
>>59533468
Lisp =/= Common Lisp
>>
I'm new to C and my code's not working, could someone test it for me and tell me what I'm doing wrong?

#include <stdio.h>
static void test(int dist, int width) {
int o = (width - dist)/2 - 1;
for (; o > 0; o--) printf(" ");
printf("o");
for (o = dist; o > 0; o--) printf(" ");
printf("o\n");
}
static long thing(int l, char c, char delim) {
for (; l > 0; l--) printf("%c", delim);
printf("%c\n", c);
return 100000000;
}
int main() {
int i = 4, j = 0, w = 8;
do {
test(j, w);
j += i;
i -= 2;
} while (i >= -6);
thing(5*w, '\\', '=');
thing(5*w, '<', ' ');
thing(5*w, '/', '=');
i = 4; j = 0; w = 8;
do {
test(j, w);
j += i;
i -= 2;
} while (i >= -6);
return 0;
}
>>
>>59533353
Just start a project and google your way through your problems until you get an idea of what kind of operations are useful. As you learn more you'll discover more efficient ways of doing things that you probably hacked together before.
There's no laundry list of "here's how to instantly be successful with language XYZ". This is in general, not just Lisp
>>
>>59533489
The name Lisp either refers to the Lisp family OR Common Lisp specifically. Be more specific.
>>
>>59533472
Ja, det är nära nog svenska. Men bokmål går inte.
>>
File: 1402143399019.png (302KB, 1920x1080px) Image search: [Google]
1402143399019.png
302KB, 1920x1080px
>>59533478
>>
The answer is Lisp machines. What is the question?
>>
>>59533437
Most of what you'd need to know to get up and running quickly is covered in Practical Common Lisp.
>>
Is there any point in learning Haskell when Idris is about to reach version 1.0?
>>
>>59533218
>Richard Stallman
Stopped reading right there.
>>
>>59533508
Well, the discussion started out as a question of whether assembly is an abstraction of machine code or merely a translation.
>>
>>59533537
Nope, they're both useless.
>>
>>59533537
Only to make learning Idris a lot easier. Most resources I've seen assume some kind of Haskell knowledge.
>>
>>59533544
>there
Stopped reading right there.
>>
>>59533568
>>there
>Stopped reading right there.
>>
>>59533573
>
Stopped
>>
>>59533559
Is this something implementation specific? I've read the 2010 standard and there was no mention of this.
>>
>>59533246
>Richard Stallsman
>>
File: c.png (46KB, 719x351px) Image search: [Google]
c.png
46KB, 719x351px
Any tips for getting familiar with a fuckhuge C codebase? Trying to contribute to open source but it's hard to start
>>
>>59533587
Throw it in the garbage and start over.
>>
>>59533574
>
Reading
>>
>>59533596
>
>>
>>59533494
Well the first thing I notice is-----
*pauses to actually test*
*compiles fine*
*runs*

... You motherfucker.
>>
>>59533587
>Trying to contribute to open source but it's hard to start
what project?

start small, anon
>>
>>59533592
;_;

>>59533612
freetype
>>
>>59533609
>>
>>
>>59533611
epik
>>
59533622
>>
>>59533622
>>
>>59533617
>freetype
start typing, then
>>
Concurrency is the future.
>>
>>59533635
I thought font rendering would be straight forward but it's actually just 200,000 lines of autism
>>
>>59533642
Concurrency are jokes hard
>>
>>59533587
What program is that you used to get the statistics?
>>
>>59533689
cloc
>>
Is it just me or is Java losing market share to C#. Is it possible that C# will overtake Java?

I'm just speculating but it seems that C# has become the prominent player in my area. It has more job offers than Java.
>>
>>59533716
I thought that already happened a few years back, might just have been in my area.

I think Java will stick around for a long time even if it no longer has the largest market share, there's so much legacy Java code around that will never be migrated to another language.
>>
>>59533696
You gave me an idea. I'm going to create my own version of cloc using Go!
>>
>>59533739
It was trash before it even began.
>>
>>59533739
Please don't.

Go is not a suitable language for any purpose.
>>
>>59533716
Yes, I definitely see it. I see more jobs asking for C# than for Java. Java will probably be around a long time because of legacy shit, but most people are going to transition to C# because it is a better language and you don't have to deal with Oracle fuckery.
>>
>>59533659
Maybe if you're not programming functionally.
>>
>>59533785
Concurrency is easy if you don't have shared mutable state!
>>
>>59533749
What language do you recommend then?
>>
>>
>>59533818
C++
>>
>>59533830
Shit tech support, should have know snek.
>>
>>59533848
pls no step
>>
File: cache.php.jpg (34KB, 800x533px) Image search: [Google]
cache.php.jpg
34KB, 800x533px
>>59533860
You would not s-step on s-snek, would you anon-kun?~
>>
>>59533869
Python is shit.
>>
>>59533926
raise NotAnArgument
>>
>>59533869
I don't step on Python because it's an abstract concept but I do step on people who use it
>>
>>59533926
Your life is shit.
>>
>>59533949
>>59533926
>>
>>59533696
I just tried this and it said 50% of my C++ project is written in D.
>>
>>59533959
>cow snakes
Is this a new organization plot to remove logical thinking?
>>
I have a loop with 2 different escape checks that both do different things.
So i have
while(1)
if(check1)
do1()
return;
if(check2)
do2();
return;
doNormal();

But the loop parameter just feels wrong, is this standard practice or is there a better way.
>>
>>59533988
SOMEONE ANSWER ME RIGHT NOW!!
>>
>>59533988
Some situations do call for everything to be done while inside of an infinite loop.
It may behoove you to write that as a recursive function instead, however.
>>
>Purely Functional Data Structures by Chris Okasaki
Has anyone done this for C?
>>
>>59533649
>I thought font rendering would be straight forward
That was most definitely a mistaken assumption. I'd rather deal with high-end graphics shaders than font renderers.
>>
Continuations or coroutines?
>>
File: houin.png (560KB, 1920x1080px) Image search: [Google]
houin.png
560KB, 1920x1080px
>>59533986
get a life nerd
>>
rate my sieve of erismathea!
    char *a = (char *) calloc(LIMIT + 1, sizeof(char));
size_t i, j, sq = sqrt(LIMIT);
for (i = 2; i < sq; i += (i > 2) ? 2 : 1) /* skip even */
if (!a[i])
for (j = i * 2; j < LIMIT; j += i)
a[j] = 1;
>>
>>59533988
>his language doesn't have cond
>>
>>59534018
Neither, there's no reason for either of them.
>>
>>59534028
>calloc
mixed code and declaration
no braces
useless comments
four spaces indentation
confusion between char and bool
implicit cast

1/20 because you try
>>
>>59534009
I cant think of how recusion would be any better, but thanks for the suggestion.
>>59534029
Cond does the same thing, just hidden behind another "function".
>>
>>59534028
Man, just friggin hard-code the case of i=2. That is NOT an appropriate use of a ternary operator.
>>
File: gcc.png (35KB, 812x612px) Image search: [Google]
gcc.png
35KB, 812x612px
>make -j
>>
>>59534028
It's shit, not only because you can't spell eratosthenes but the program is also crap.
>>
>>59533988
I don't see anything wrong there, at least within the context given. Each check leaves the loop?
>>
>>59534053
You mean a macro.
>>
File: 1478132750131.jpg (53KB, 600x593px) Image search: [Google]
1478132750131.jpg
53KB, 600x593px
>>59534028
for (i = 2; i < sq; i += (i > 2) ? 2 : 1)
>>
>>59534069
Yeah, i could use break instead of return for this example. thanks for your validation.
>>
>>59534028
What is this, O(sq*LIMIT)?
>>
>>59534066
>windoze
>>
>>59534084
I need 1.5GB of memory to sieve all the primes up to 2 billion, so maybe.
>>
>>59534028
An insult to erosthenes, this faggot approximated the circumference of the earth over 2000 years ago and you just shat all over him
>>
How are tripcodes generated?
I assume it must be some kind of hashing-like algorithm, but is the spec known?
>>
>>59534176
Yes, it is.
>>
>>59534188
yea this is what I got using some program from the internet, but I would like to know how it works.
>>
>>59534176
Yes, it's known. You can read it in the original futaba (2chan) source code, or basically any chan website.
>>
>>59534214
That's nice, don't mind the search engine though. Asking on /g/ is easier, right?
https://en.wikipedia.org/wiki/Imageboard
>>
>>59533545
It is an abstraction.
The saying that assembly is a 1:1 mapping to machine code is not entirely correct.
>>
>>59533836
Rust*
>>
>>59534260
>is not entirely correct
Yes it is. Optimising assemblers do not count for anything.
There exists a machine code equivalent for each assembly instruction, and you can easily go back and forth between the two.
>>
>>59534176
I use this for a realtime imageboard I created a while back.
https://github.com/KenanY/tripcode
>>
>>59534214
The algorithm is really simple.
Convert the password to Shift-JIS, which is mostly identical to ASCII except for 2 characters.
The salt is a 4 character string made up of the second and third character of the password plus the characters "H."
All characters in the salt string outside the range ./0-9A-Za-z are replaced with .
The characters ":;<=>?@" are replaced with "ABCDEF".
The characters "[]^_`'" are replaced with "abcdef"

Then you pass the untouched password + the salt into crypt() or DES_fcrypt or equivalent.
Trim the first 4 characters off the returned hash and that's your tripcode.
>>
>>59534291
>Macros
>Labels
>Meta instructions
>Text representation instead of binary
I don't think so m8.

Assembly is an abstraction on top of machine code, no matter how you look at it.
A translation layer is still an abstraction layer.
>>
>tfw found out racket has a turtle
what the fuck why is this so fun to fuck aroudn with
>>
>watch my project partner push the spacebar 4 times to make a tab
>ithoughtthiswasameme.png
>thefileisalreadyusingtabsholyfuck.jpg
>>
>>59533468
scheme and common lisp are opposites. scheme is itself, but it's very simple and elegant. common lisp took everything from a bunch of lisps and amalgamated them together, thinking more is better
>>
>>59534291
>There exists a machine code equivalent for each assembly instruction, and you can easily go back and forth between the two.
This is just not true
>>
>>59534379
>caring how other people type
>>
>>59534379
>his editor doesn't autoconvert tabs to spaces
>>
>>59534372
raco?
>>
>>59533468
>Common Lisp is standardized
A standard doesn't mean much when you need non-standard interpreter extensions for doing anything useful
>>
>>59534425
I care when they mix whitespace
>>
>>59534379
is he good? maybe his autistic habit every good programmer has
>>
>>59534440
comes with the default distribution i believe
>>
>>59534450
It was a turtle joke.
>>
Any tips on writing functions for producing recursive sequences? I'm having trouble breaking it down (or even where to start). I'm doing this in Scala
>>
Java is better because they poo in loos not toilets.
>>
>>59534471
A loo is a toilet.
>>
>>59534446
yeah, but if you're bashing space for indent it's pretty safe to assume they're not mixing tabs and spaces.
>>
>>59534447
No, I was pulled on because he only knows Python and we needed C
>>
>>59534386
Did your post have a point?
>>
>>59534484
>A loo is a toilet.
No it's not !
you are an idiot !
>>
>>59534442
What non-standard "interpreter" extensions? You sound like you don't know much about CL.
>>
>>59534492
kys nigger faggot
>>
>>59534494
Then what is a loo?
>>
>>59534511
>it's another namecalling when anon doesn't get his way in an argument episode
>>
Should more languages have call/cc?
>>
>>59534485
I don't care what whitespace you use, but the file was already using tabs for indent. I was bashing him pressing the space button multiple times rather than the tab.
>>
>>59534513
It's a hole where you poo.
>>
>Debug code for 1/2 a day due to iterator problem
>Check API
>Turns out iterator cannot be reused
Fuck you too
>>
>>59534545
https://groups.google.com/forum/#!msg/comp.lang.lisp/1Ggl_BUi3Yg/VFTIDaJqRK8J
>>
>>59534509
TCO is optional, not always available. READ operates a little differently in every implementation. The standard is mute on spawning new processes and communicating with them.
>>
>>59534596
>TCO
total cost of ownership?
>>
>>59534617
tail call optimization
>>
How to i make a recursive rule to DeclLoop, instead of writting the same COMMA ID over and over again?

/* int a; */
Decl -> Type ID SEMICOLON

/* int a,b,c,d; */
DeclLoop -> Type ID COMMA ID COMMA ID COMMA ID SEMICOLON

>>
Little known fact, C allows multiple return values if you use the comma operator.
>>
>>59534631
What language is this?
>>
>>59534651
Yacc (Yet Another Compiler Compiler)
>>
Any tips on how to set up database?
I want to make a program to track media I've read, for example manga, books, and comics.
I'm stalling at how to do the database, I was planning on using sqlite.

Since a book has different info than a manga should I have different tables for them?
Should there be a bunch of columns that only a few entries actually use, e.g., isbn number. That seems like a waste.

I feel like a retard.
>>
>>59534631

e : e comma id
| Type id
>>
>>59534596
Most if not all compilers implement TCO (ABCL is a notable exception, because JVM). You'll need to elaborate on your READ claim. Your last claim I agree with, but that is largely mitigated by libraries using read-time conditionalization.
>>
Seems like making bot networks is all the rage nowadays. How would one go about setting that up. I know the algorithm part but what about the logistics of setting up an operation that big. That is the part that is stumping me. Or do I go about setting up a botnet?
>>
>>59534708
Develop a common communication protocol.
>>
>>59534646
I don't believe you. Post a compilable program that does this.
>>
>>59534732
I talking more about the hardware aspects.
How much processing power I need. How much bandwidth. How do I disguise all my bots to make them not appear to be coming from a single IP etc. I can make a single bot. The problem is going from a single bot to maybe a thousand of them.
>>
>>59534758
That's why botnets typically propagate via malware.
>>
>>59534755
he's wrong.
the only way to return multiple values would be in a struct
>>
>>59534676
hmm thanks.

but where does the semicolon enter?

you meant like this?
DeclLoop: DeclLoop COMMA ID
| Type ID SEMICOLON
>>
>>59534776
Yes I get that but there are also large legitimate companies that farm out bots be it to shill on reddit, click ads on twitter/facebook or even viewbot for twitch. They operate in grey areas and I highly doubt all of them use botnets.
>>
>>59534063
hardcoding things outside the loop feels like cheating
i already write all my loops this way, have you ever skipped through c strings before?
You don't even need a for loop, just a ternary operator and some pointer substraction.
>>
>>59534668
This is a common situation. One option is to have a central table for common columns, each record stores a type and has a foreign key to a media-specific table. There are a bunch of alternatives, no real silver bullet. Just pick something and run with it.
>>
>>59534792
Perhaps, but they probably have the money to build the infrastructure needed to do all of that.
>>
>>59534789
No, you create a production rule for the loop, then you have
DeclLoop Semicolon

e.g.

DeclRec : DeclRec COMMA ID
| Type ID

DeclLoop : DeclRec SEMICOLON
>>
>>59534823
Yes. That is what I want to know. How does one built such infrastructure and the logistics that go into setting up such hardware. Doesn't mean that I will actually do it. I want to know the information cause it interest me. Don't have to spoonfeed me, just point me in the right direction.
>>
Anyone here knows anything about GeneXus?
>>
>>59534844
Well, of course you'll need a network of computers. Think about the cost of one computer, then multiply that by how many you'd want. Then if you wanted multiple connections to the internet, you'd have to factor in the cost of one internet connection and multiply it by however many you'd want, or look into a plan that would support multiple IPs. They'd still be traceable to you, so you'd have to obscure your connection in some way.
>>
Python the animal or Python the language?
>>
>>59534835
thanks!
>>
>>59534903
Python the trash.
>>
how can proceduralfags compete?
>>59534900
>>
Do memory blocks not freed with free() get freed when the program terminates? Or will that memory still be used?
>>
>>59534888
Won't it be simpler to buy one a very good server and then virtualize every instance of the bot instead of multiple computers?

Also won't it be better to get a very good VPN plan or if it is against the TOS, purchase servers all over the world to route your traffice through instead of getting multiple internet connections or multiple IPs from a single ISP?
>>
>>59534915
>he doesn't eta reduce
Trash.
>>
>>59534921
If your language isn't complete garbo, the garbage collection would terminate any memory blocks when they are no longer needed.
>>
>>59534809
Okay, I guess I'll try that way and see how it works.
Also how should I be assigning an id to a single piece of media, some googling shows people using uuidgen but it seems like I could just increment some counter or similar.
>>
>>59534915
How long does that take?

my solution >>59534028 takes 0.06s to fetch all primes up to 2,000,000
>>
>>59534938
I'm talking about a language without garbage collection like C. Does the memory leak stop once the program terminates?
>>
>>59534877
not really.

what are you even using that for?
>>
>>59534946
Yes
>>
>>59534936
>eta reduce
what's that

> Does the memory leak stop once the program terminates?
sometimes
>>
>>59534946
it only stops if you have the OS to clean up after your mess

in an embedded environment, you're completely on your own, any leaks are permanent until you reset, which isn't an option on most embedded microcontrollers.
>>
>>59534946
Yes. Your OS manages program memory so the memory leak would stop provided your program terminates properly.
>>
>>59534953
>>59534974
>>59534978
b-but Linus said otherwise ! ! ! !
https://www.youtube.com/watch?v=67m5jwoNkfo
>>
>>59534978
>Your OS manages program memory
>implying
How do you know what my custom OS does?
>>
>>59534923
Certainly. I'd say those are better ideas.
>>
>>59534967
You can eliminate the x in your main since it appears on both sides.
>>
>>59534987
If your custom OS can't do simple program memory management, please don't call it an OS. That is like calling a block of metal with no wheels a car.
>>
>>59534985
>Provided your program terminates properly.
It is not the OS fault if your program is garbage and leave traces in the memory that the OS cannot terminate or identify and terminate.
>>
>>59534967
>eta reduce
Transforming (\x -> f x) into f
>>
>>59535004
but what if he has created an os that transcends the need for memory management

what if he has created an os, that a program can be like "malloc" and the os is like "here's your pointer" and it's just magically a pointer to the beginning of an unoccupied block of memory of the correct size, without any need for memory management going on behind the scenes -- like what if it computes that pointer based on some... *other* way of doing it
>>
>>59534989
Yes. And how would one get more detailed information on these logistics. Like I said I know the rough idea of executing such a system but I am interested in the exact details.
>>
>>59535028
That is the human equivalent of knowing a fact without actually storing the fact in your memory. How would one go about doing that?
>>
>>59535028
Go to bed, Terry.
>>
>>59535028
what the fuck

skynet pls
skynet your drunk go home
>>
>>59535047
Store some axioms and means of deriving the fact from them
>>
>>59535054
>>>/r/ibbit
>>
>>59535060
Go to bed
>>
>>59535067
and my axe!
>>
>>59535068
Shan't
>>
>>59533310

What antisematism? Are you referring to the extension from a user who calls themselves "JewsOfHazard?" Have you contemplated that the user may just be a Jew (or a group of Jews) who was a fan of the movie "The Dukes of Hazzard?"
>>
std::this_thread::sleep_for(std::chrono::milliseconds(x));
>>
What are some things I should program (or be able to) in C to show intermediate skill before I move on to OOP? I already know some of the basics of OOP but I haven't really delved much into it yet and I really like C and imperative programming right now.
>>
>>59535195
sum of all primes below 2 mil
>>
>>59535176
std::this_thread::is_fucking_dead();
>>
>>59535195
fizzbuzz
tic tac toe
pong
>>
>>59535195
logarithmic time fibonacci
>>
>>59535195
If you want to move on to OOP probably one of the best things to learn how to do with procedural code is ADTs
>>
>>59535195
Don't fall for the OOP memes, seriously.
Procedural programming is a much better way to program.
>>
>>59535195
>move on to OOP
regression
>>
>>59535223
abstract data types?
>>
>>59535195
I have mixed feelings on the subject, but all-in-all I think it's better not to do too much procedural memory management if you're moving to OOP. While it's closer to the way Computers manager memory internally, it's a very bad idea to use procedural memory management techniques in an Object Oriented environment.

So I recommend just doing some algorithms and moving on.
>>
>>59535255
ye
>>
>>59535195

a(1) = 1
a(2) = 1
a(n) = a(a(n - 1)) + a(n - a(n - 1)), for n > 2

Write a function that outputs 1 to n for a given n. (Hint: you don't want to blow the stack for large n, recursion or more specifically tail-recursion could help here)
>>
>>59535247
it's not regression if it's better though
(which oop is)
>>
>>59533494

brilliant
>>
File: l.png (210KB, 1920x1080px) Image search: [Google]
l.png
210KB, 1920x1080px
>>59535206
>fizzbuzz
IF YOU AV FIZZ

DEN I AM GIV YOU BUZZ

IF YU AV BUZZ
DEN IM AM GIV U FIZZ

IM A FIZZ
A BUZZ
>>
File: 1468540941275.jpg (122KB, 845x740px) Image search: [Google]
1468540941275.jpg
122KB, 845x740px
>>59535286
>(which oop is)
That deserves a smug anime face.
>>
File: 1484099528997.gif (3MB, 355x201px) Image search: [Google]
1484099528997.gif
3MB, 355x201px
>>59535286
>>
>>59535298
>/b/
>Most of us are in our 30s and 40s
>>
>>59534939

You should be able to let your DB take care of assigning a unique ID. The DB will take care of incrementing a counter.
>>
>>59535299
>>59535321
it's simply objectively superior
>>
File: 1482164713193.gif (178KB, 281x484px) Image search: [Google]
1482164713193.gif
178KB, 281x484px
>>59535406
stop it anon, i can't take it any more
my sides are gonna burst
>>
>>59535344
>in your 30s and 40s
>4chan
>>
I have a meeting with Brian Kernighan in a few days, what should I say
>>
>>59535411
do you mean to tell me you would write a computer game procedurally

because only a moron would do that

if you write your game using a base class for a game object, subclasses for different types of game objects, and mixins for combinable attributes of those different types of game objects, you'll have a much easier time than if you tried to write the whole game procedurally
>>
>>59535432

C was a mistake.
>>
File: 07d.jpg (239KB, 500x750px) Image search: [Google]
07d.jpg
239KB, 500x750px
>>59535434
>he thinks your everyday programmer has time to piddle away abusing his talent to write useless things like computer games
>>
>>59535434
I wouldn't write a computer game at all because all programming languages are trash.
>>
>>59535434
>>>/v/
>>
File: 1482611332506.gif (371KB, 500x281px) Image search: [Google]
1482611332506.gif
371KB, 500x281px
>>59535434
stop
it's too funny
>>
https://github.com/jhallen/joes-sandbox/tree/master/editor-perf

Where were you when Sublime BTFO'd Vim and Emacs in intensive tasks?
>>
>>59535449
how could you even say that, programming languages are elegant and beautiful, YOU'RE fucking trsah prOGRGREAMAIN IS A FYUCJKING ART YOUF PIESCE OF HUMAN GARBA RGE GODDDDDDDD
>>
>>59535482
porcedura;l lanogauegas are soreely unsuitede for usde in wruiting computer gsames and thatq';s is the logn and short of it
>>
>>59535555
drunk quads
>>
>>59533739
But can you beat Rust?
https://github.com/cgag/loc
>>
If a C-Note equals 100usd, how much are
my C++Notes worth?
>>
>>59535598
Trash.
>>
>>59535176
http://en.cppreference.com/w/cpp/chrono/operator%22%22ms
>>
File: 1490181201460.png (289KB, 650x550px) Image search: [Google]
1490181201460.png
289KB, 650x550px
>>59533197
girl *hime = (girl *) malloc(sizeof(boy));
>>
What's the most popular FUNCTIONAL programming language?
>>
File: thinking-face.png (53KB, 256x256px) Image search: [Google]
thinking-face.png
53KB, 256x256px
if A and B and C and D { ... }
else if A and E and C and D { ... }


Is it safe to assume that if the second bit of code ran that B is false?
>>
>>59535630
None of the functional languages are popular. And none of the popular languages are functional.
>>
>>59535630
prolog
>>
>>59535445
>>59535478
>I can't admit my language has flaws in a certain area so I'll shit on it! That'll show them!
>>
>>59535639
Not if A was false.
>>
File: k.png (83KB, 1198x615px) Image search: [Google]
k.png
83KB, 1198x615px
>>59535630
won't lemme add more baka
>>
>>59535601
That can't be right. I've at least 200 files.
>>
>>59535607
wait wtf does this mean i can make basically a suffix like i can make 1.0r be 1.0f or 1.0 depending on how i define the r operator
>>
>>59535614
I think you mean
 girl* hime 
>>
>>59535672
yeah
>>
>>59535682
that's fucking amazing. based C++ wins again
>>
File: 2017-March-23_00-48-56s.png (5KB, 499x332px) Image search: [Google]
2017-March-23_00-48-56s.png
5KB, 499x332px
>>59533494
for anyone curious this is the beautiful output
>>
File: eg3.png (18KB, 674x352px) Image search: [Google]
eg3.png
18KB, 674x352px
>>59535691
>based C++
>>
>>59535663

The else if block wouldn't have run if A was false.
>>
>>59535701
You happy to see me, anon? Or is that a test.exe in your command prompt?
>>
>>59535713
Of course it wouldn't. What's your point?
>>
>>59535691
It is kinda amazing but you're also limited to the types of parameters that you can pass to the literal, and your names have to start with _ otherwise you will get a compiler warning that other names are reserved for the standard.
>>
>>59535277
Not him, but I think this is right:
#include <stdio.h>
#include <stdlib.h>

static unsigned *mem = NULL;
static size_t mem_cap = 0;
static size_t mem_len = 0;

static void cleanup_mem(void)
{
free(mem);
}

unsigned a(unsigned n)
{
// Undefined for 0
if (n == 0)
exit(1);

// Initalise memorisation storage
if (!mem) {
mem_cap = 256;
mem = malloc(mem_cap * sizeof *mem);

if (!mem)
exit(1);

mem[0] = 0;
mem[1] = 1;
mem[2] = 1;
mem_len = 3;

atexit(cleanup_mem);
}

// Expand memorisation storage
if (n >= mem_cap) {
while (mem_cap < n)
mem_cap <<= 1;

unsigned *ptr = realloc(mem, mem_cap * sizeof *mem);
if (!ptr)
exit(1);

mem = ptr;
}

unsigned prev = mem[mem_len - 1];
for (; mem_len <= n; ++mem_len) {
prev = mem[mem_len] = mem[prev] + mem[mem_len - prev];
}

return mem[n];
}

int main(int argc, char *argv[])
{
int n = argc < 2 ? 100 : atoi(argv[1]);

if (n < 0)
return 1;

printf("%u\n", a(n));
}

I imagine this implementation might trash the cache quite a bit, when computing a large n.
I'm not really sure about how the data looks for a large n.
>>
>>59535753
>trash
thrash*
>>
>>59535753
Another correction:
>while (mem_cap < n)
while (mem_cap <= n)
>>
>>59535718

It means that A must be true.
>>
>>59535790
That was a given. Your posts were a waste of time.
>>
if Myself.virginAfter30 = 'true':
Myself.destroy()
else:
Myself.enjoy()
>>
>>59535805

But you said "not if A was false" which is not possible.
>>
>>59535818
pathetic
>>
>>59535822
Yes it is. Anything is possible if you create a new universe in which it is true.
>>
>>59535836

It's implied that the universe in which the first and second A exist is the same one.
>>
>>59535845
Nice hypothesis, now you'll have to prove it.
>>
>>59535742
i'm trying to do this

typedef float real;

constexpr real operator "" _r(long double x) {
return x;
}

int foo = 1.0_r;


it seems to compile but my editor says function '_r' can't be resolved. what do?
>>
>>59535885
Seems like your editor is just not aware of user defined literals.
>>
>>59535885
Resolve it.
>>
>>59535639
if (A & B & C & D)
else if ((A & E & C & D) & !(A & B & C & D))

(A.E.C.D).!(A.B.C.D)
(A.E.C.D).(!A + !B + !C + !D)
!A.A.E.C.D + !B.A.E.C.D + !C.A.E.C.D + !D.A.E.C.D
false.E.C.D + !B.A.E.C.D + false.A.E.D + false.A.E.C
false + !B.A.E.C.D + false + false
!B.A.E.C.D

Assuming my boolean algebra is correct, yes.
>>
>>59535920
just rewrite this using types and have your typechecker test it
>>
>>59535858

You can prove it using resolution and factoring, but I'm not going to write the proof.
>>
>>59535645
Popularity is not absolute measurement but relative.
>>
>lua.org is down
>>
Why is there hate for Go here? It's a nice language with good concurrency.
>>
>>59536183
Because everything else is better.
>>
>>59533494
>static long thing(int l, char c, char delim) {
C toddlers LOL
>>
>>59536183
Made by google
>>
>>59533506
no
>>
>>59536216
No, made by Rob Pike, Ken Thompson and Robert Greisemer.

>>59536186
>Because everything else is better.
Great argument, well done.
>>
>>59536253
When they were at google
>>
>>59536265
So?
>>
>>59536077
Lua BTFO
>>
>>59536279
Fuck off CIA
>>
>>59536280
Lua just wants to be loved ;_;
>>
>>59536287
Is that even an argument?
>>
>>59536183
Slower than Java
webdev language
No generics, languagelet like C, but not nearly as fast
Creators assume you are retarded for using Go
>>
>>59536311
It is. Because I don't trust google.
>>
>>59536291
I love Lua
Maybe it's good that it's embedded only language, but I'd wish for more.
>>
What makes a language embedded language? Why are plugins written in those languages?
>>
>>59536368
It usually has nothing to do with language but the implementation.
You can easily include it in your project by just linking to the library, starting the scripting languages system and making it execute files.
Usually they support inlining C code or just have otherwise easy interface to calling C library functions.
>>
>>59536368
The language is embedded when it is run within some program environment and usually it works only with elements of the program it is embedded in.
See: VBA for MS Office, JS (and VBS) for web browsers
>>
Given two lists, (a b c) and (d e), how would you write a function which makes (a b c d e) list in Lisp?
>>
>>59536508
A = {a,b,c};
B = {d,e};
C = Join[A,B];

:^))))))
>>
How do you integrate parsing within a control loop?
>>
>>59536508
>null + list2 = list2
>list1 + list2 = cons (head list1) (tail list1 + list2)

in Haskell
[]     ++ ys = ys
(x:xs) ++ ys = x : (xs ++ ys)
>>
>>59536630
Using Java?
>>
Anyone know scala, and how to write something that does this ?
/**
* Use foldLeft to sum the number of characters in a tree of strings
*/
def countOfTree(tree:scala.collection.immutable.TreeSet[String]):Int = {

}
>>
I'm new to python and I'm fumbling something really basic with list iteration

>>> array = [1,2,[3,4,5]]
>>> for x in array[2]:
... print(x)


I want this to print the index it's iterating at in the array at array[2] not the content array[2][x]
>>
>>59536610
>in Lisp
Reading comprehension: 0/0
>>
>>59536718
NaN
>>
>>59536683
https://docs.python.org/3.6/library/functions.html?highlight=enumerate#enumerate

This is the function you want.
This is the code you are looking for.
for index, x in enumerate(array[2]):
# prints index
print(index)
# prints value
print(x)
>>
>>59535753
This would be a million times shorter functionally
>>
>>59536796
Well there are 975 characters in total, so can you please provide a version in ~0.001 characters?
>>
>>59536508
In scala you could flatmap and do nothing to them

Is this right?
>>
>>59536650
def countOfTree(tree:scala.collection.immutable.TreeSet[String]):Int = {
???
}
>>
>>59536650
Good luck on the scrabble scorer...
>>
>>59536819
Yes.

In Haskell, that would be (>>= id)
(>>= id) is join, which is part of the more regular definition of a monad

>>59536650
>>59536833
1) Write a function to convert a string into a score
2) Write a function to compute a sum using foldleft
3) sum . map score
>>
>>59534909
>>59534938
Your OS already does this when the process terminates
>>
Why do Rustfags think the Stackoverflow survey means anything? Being the most wanted language is not a big deal if your language is barely used. People just haven't grow to hate the language, as they say: familiarity breeds contempt.
>>
New thread:

>>59536938
>>59536938
>>59536938
>>
>>59536508
(append '(a b c) '(d e))
>>
>>59536183
>Why is there hate for Go here?
I don't know about here specifically but the usual critique it doesn't have feature X. Some values of X are good language features, some are not, some are things you really would expect from something you're expecting humans to write but the language designers have been very firm in trying to keep the language minimal, for better or worse.

>>59536314
>Slower than Java
It has roughly equal performance to C, which is faster or slower than Java based on what benchmark you use and the point in the JVM/GCC/LLVM release cycle but it does concurrency better (inb4 "sprinkle some atomic on it and it just works!") and there's no way you can defend Java as plainly faster that Go.

>webdev language
Nope

>No generics, languagelet like C, but not nearly as fast
Again, C-like performance, better type system, and a spec that doesn't make writing a well defined program something you need to memorize a novel to do.

>Creators assume you are retarded for using Go
Based on what?
>>
>>59537682
>roughly equal performance to C
>C-like performance
Are you fucking serious?
See >>59529772
>>
>>59537693
unsourced graph, try http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=go&lang2=gcc instead
>>
>>59537728
go is an order of magnitude slower than C in a lot of those.
>>
>>59537777
That's true for two of the 10 benchmarks, one of which is stupid (regex, basically comparing binds against the native library. Go's std regex lib is provably in a different complexity category than C's) and the other is suspicious since it stands alone seemingly without reason but I didn't read into the source enough to throw it out
>>
>>59536779
thank you!!
>>
>>59533537
Idris runtime system, typechecking/compilation speed and code optimization are currently complete shit compared to GHC.
Thread posts: 320
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.