[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: 315
Thread images: 35

File: edgelord.jpg (846KB, 1200x1600px) Image search: [Google]
edgelord.jpg
846KB, 1200x1600px
What are you working on, /g/?

Old thread: >>60737494
>>
Python doesn't use braces, time to move to python
>>
re-writing WASM in JS
>>
>>60746981
>>
>>60747019
>"pointless" braces
dropped xD
>>
i see the Lisp fags are riled up again.
>>
File: 1200px-Blank_whiteboard.jpg (62KB, 1200x900px) Image search: [Google]
1200px-Blank_whiteboard.jpg
62KB, 1200x900px
>enter the room
>see pic related
Your move, anon?
>>
File: dlang_chan.jpg (70KB, 349x368px) Image search: [Google]
dlang_chan.jpg
70KB, 349x368px
Threadly reminder that dlang-chan has RAII; she's quite fast in execution and compilation; and she's super duper cute! Say something nice about her, /dpt/!

>Tour
http://tour.dlang.org/
>Books
https://wiki.dlang.org/Books
>GC
https://dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/
https://wiki.dlang.org/Libraries_and_Frameworks#Alternative_standard_libraries_.2F_runtimes
>>
>>60747064
Draw a penis
>>
>>60746547
>Unlike RAII. Which is a a massive overhead.
Explain
>>
>>60747065
rdmd is kewl to bee honest
ability to write small nifty "scripts" in a non-retarded language is neat
>>
>>60747099
Dub is also really handy.
>>
File: 1495510388344.jpg (155KB, 450x425px) Image search: [Google]
1495510388344.jpg
155KB, 450x425px
>>60747064
*sums the reciprocal of primes over 20 million*
*get a finite result with the zeta function*
>>
>>60747099
Yeah, it was actually one of the reasons I started learning it. After reading some stuff on dlang-chan, I learned it was designed to pretty much handle any situation--hence "general purpose".
>>
>>60747064
once upon a time on the interview I summed up infinite natural numbers series to -1/12, guys were baffled lol
>>
>>60746958
Damn. that picture.

In between that guy's skin complexion and the light on his face.. he already is a painting.
>>
I know this is like First Grade stuff, but first time try-er here

How to I position Images as same Height (next to each other) while Also scaling

So far I set the Image height 1500px but it just scratches the image... looks ugly
>>
>>60747187
/wdg/
>>
hi /dpt/ i need life advice, should i get a job after graduating or apply for masters programs at prestigious universities and get into a lot of debt? should i keep going and get a phd after that? should i aim for masters programs that are research intensive, or coursework intensive if i do that? should i work for a few years and then get a masters? work for one 1-2 years? not get a masters at all? help me
>>
>>60747308
Do you really want to spend the rest of your life in academia?
>>
>>60747308
>and get into a lot of debt?
Jesus christ no. If you want a Masters or PhD, try getting funding for it via grants or similar. If you can't, then get a job.
>>
modules ruin all fun, my own recursive folder scanner is so much slower than glob ree

def copytree(src):
for item in os.listdir(src):
src_item = os.path.join(src, item)
if os.path.isdir(src_item):
print(src_item)
copytree(src_item)
elif os.path.isfile(src_item):
print(src_item)

# TIME
# real 12.62
# user 1.12
# sys 1.45


def globby(src):
for item in glob.glob(src + "/**", recursive=True):
print(item)

# TIME
# real 2.77
# user 0.80
# sys 0.68
>>
>>60747369
They're both horribly slow
>>
File: 1475378609364.jpg (123KB, 685x1050px) Image search: [Google]
1475378609364.jpg
123KB, 685x1050px
>>60747308
education in _good_ places >> anything else, if you ask me
networking, skills, prestige, options, you name it

not an American though so I don't really understand your debt shenanigans
>>
File: 1464143124471.jpg (1MB, 1412x1200px) Image search: [Google]
1464143124471.jpg
1MB, 1412x1200px
>>60747308
>doing grad studies without funding
Can't think of a more cucked thing.
>>
>>60747395
how can I make it faster?
>>
>>60747369
>recursive
Found your problem
>>
>>60747398
all the affordable universities are 90% foreign students. it spooks me a bit, as if they're just selling degrees for the money. i really do want a masters degree at some point, but i've also heard from professors that if you're not doing research in a masters program it's worthless, while seeing that top schools have masters programs with zero research and all coursework
>>
>>60747428
Write it in C. Multithread it and make a bunch of speculative system calls in a separate thread and process the tree you've saved in memory.

You probably don't care that much.
If you're asking how to make your version as fast as the library just look at the library.
>>
>>60747465
>I'm afraid of foreignites
>.t American
Surprising..
>>
>>60747494
>C
Garbage.
>>
>>60747369
Why are you re-inventing the wheel?
>>
>>60747508
>anything else
Garbage.
I'm hoping for JAI. Or D. Doubt D will be all that great though.
>>
>>60747506
>foreignites
>>
>>60747064
I'd just like to interject for a moment. You appear to be using an element from this image in your post: https://commons.wikimedia.org/wiki/File:Blank_whiteboard.jpg
You may have done this accidentally, but you've violated the terms of its copyright license. This is a serious offense and I hope you take it as seriously as it deserves.
Not to say that you're not allowed to create derived works from this image, you are, but this picture is released under the Creative Commons Attribution-ShareAlike 3.0 Unported license. Therefor, you are free:

to share - to copy, distribute and transmit the work;
to remix - to adapt the work;

Under the following conditions:

attribution - You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
share alike - If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.

In this case, the attribution requirement is resolved simply by including the following in your post:

Photo © BrokenSphere / Wikimedia Commons, CC BY-SA

Now that you have read this, I hope you have a better understanding of your rights and obligations when remixing and sharing this work. They will let you edit, now be nice and credit~
>>
File: 1490461840788.jpg (71KB, 620x400px) Image search: [Google]
1490461840788.jpg
71KB, 620x400px
>>60747506
disgusted and foreigners are the words you're looking for, pajeet
>>
>>60746958
>not an anime image
REEEEEEEEE
>>
>>60747369
Oh Anon you're not even using TCO!


Ohwaityoucan't. Rewrite it in C.
>>
>>60747548
If they are selling degrees for money, what's wrong with it, are you against free market?
>>
>>60747573
the figures i look up to have masters degrees and phds. but i don't feel like they got them because they needed them to get a decent job, i feel like they got them because in those days it was prestigious and you did cutting edge research
>>
>>60747525
>>60747548
https://youtu.be/WjOoC6bzMCk?t=205
>>
>>60747181
pics or it didn't happen
>>
>>60747428
write it all in assembly
>>
>>60747561
dumb implicit frogposter
>>
>>60747567
C doesn't guarantee TCO either. Of course, a real programmer can optimize their own tail calls and doesn't need a compiler to do it for them.
>>
is there any way to block indian programming tutorials on youtube?
>>
>>60747828
Stop searching for information on youtube.
Avoid language specific searches.
>>
>>60747773
>C doesn't guarantee TCO either
Sure, but it's a low-hanging fruit that any compiler would take.
>>
>>60746958
Quick question, Java:
public class Person {
private String name;
private int age;
private int weight;
private int height;

public Person(String initialName) {
this.age = 0;
this.name = initialName;
this.weight = 0;
this.height = 0;
}

public void setHeight(int newHeight) {
this.height = newHeight;
}


Why do they use this.variable every time? Wouldn't it work the same if they just type height? Is it just a conventions thing or is there a functional reason? For example:
 public void setHeight(int newHeight) {
height = newHeight;}

would do the same thing, wouldn't it?
>>
>>60747853
Yep, that would be the same. However, one can argue that using this.height makes it more readable, however bullshit that claim may be.
>>
>>60747065
W-what happened to Dlang-chan? She looks different.
>>
>>60747884
Also doesn't it help with disambiguation between constructor/setter arguments and instance variables? Or does Java not allow them to use the same name?
>>
>>60747895
She finally looks like how the language looks: like trash.
>>
>>60747895
The autist got bored of her previous incarnation and moved on to the new hot thing, much like how people (rightfully) moved on from D.
>>
Alright /g/, you have 10 minutes to name what features your ideal language would have. Then I'll tell you how dumb you are.

t. Rob Pike
>>
>>60747895
dlang-chan v1 wan't cute enough for how D makes me feel. Also, and more importantly, the first iteration of her was too influenced on what I was watching at the time. Decided to separate the two.s
>>
>>60747902
post yfw this works
setHeight (int height){
height=height;
}
>>
>>60747930
read macros
>>
File: 1488455828323.jpg (71KB, 718x783px) Image search: [Google]
1488455828323.jpg
71KB, 718x783px
>>60747942
>>
>>60747930
Natural language-like syntax; none of this _();}; malarky.
>>
>>60747930
its like go but good
>>
>>60747853
You don't have to in most of these language. Can't recall Java specifically.
But yes you could have the scope of a member function import member symbols without a this pointer/reference.
>>
>>60747930
I've been thinking about a programming language design for a while now, but I can't really be bothered explaining it.
It's really just C with legacy cruft removed, and a better type system which could allow for better optimisations.
>>
File: baldlet.jpg (77KB, 335x293px) Image search: [Google]
baldlet.jpg
77KB, 335x293px
>>60747969
>>
>>60747461
alright I made a similar one without recursion, and it was significantly faster. recursion really sucks, I'll never listen to recursionfags again.

def norecursion(src):
folder_list = [src]
while len(folder_list) is not 0:
src = folder_list.pop(0)
for item in os.listdir(src):
src_file = os.path.join(src, item)
if os.path.isdir(src_file):
print(src_file)
folder_list.append(src_file)
elif os.path.isfile(src_file):
print(src_file)

real 4.85
user 0.93
sys 1.30


>>60747494
you're right I don't care too much right now, but I'm interested in how I could maybe optimize it (in Python). I'll try multithreading another day.

>>60747522
I was just making something simple to sync two folders and wanted to compare my own method to a module 4fun
>>
>>60747958
There is that language that does that, I don't remember the name. Plot twist: it's in French.
>>
>>60747930
A high level way to deal with the low level details of hardware that's more productive for what I do with low level details.

I don't know what that'd look like. Sounds pretty messy.

There's not much else that's needed.
>>
>>60748006
>recursion really sucks, I'll never listen to recursionfags again.
It's because there's no TCO. Recursion is gonna be slower if you don't have TCO, that's a given.

It's often easier to write recursive versions of things though. Even if handling the stack often is a very straightforward translation.
>>
>>60748006
who started the recursion meme anyways? The guy who got me into programming taught me to always use recursion. I mean it's cool looking I guess.
>>
I'm going MAD

With Flask_sqlalchemy, how do I convert an entire database table to json?

The best I've managed is to make a

var = Table.query.get(1) variable with only one row in the table. Then I can jsonify like
jsonify(username=table.username,
profilepictureurl=table.profilepictureurl,
city=table.foo,
gym=table.boo)

and when I print(var) I get <models.Table object at 0x1067cfb70>

when I set var to var = Table.query.all() I get
[<models.Table object at 0x1067cfc18>, <models.Table object at 0x1067cfcc0>] when printed instead, and when I try to jsonify the var it just says the table Model isn't serializable

I'm begging you, I've looked all over for hours.
>>
>>60747930
>case insensitive
>goto labels and functions are interchangeable
>operator overloading as syntactic sugar for function calls
>standardized name mangling/ABI
>member functions (but they're really just pointers to regular functions with an implicit first argument)
>optional gc
>>
>>60748001
>guy: what kind of frames for your spectacles are you after?
>baldlet: i wanna make elton john look straight
>guy: say no more!
>>
>>60748068
oh, and destructors/RAII
>>
>>60748038
It started in mathematics, which is disgusting left-wing trash.
>>
i did a lot of java in high school/college a couple years ago and i'm trying to get back into some coding. is java still relevant or should i try something new? also, does anyone have that project idea list? i'm feeling distinctly unoriginal today on project ideas
>>
File: 1482434658366.png (258KB, 635x457px) Image search: [Google]
1482434658366.png
258KB, 635x457px
>>60748086
>>
>>60748038
>meme
>>>/v/
>>
>>60748086
Math is a form of anime. And anime is strictly right wing.
>>
>>60748100
Still relevant certainly. One of the biggest languages.
I don't like it though, same with many other people.
>>
>>60746958
Working on a mobile App. Making it offline first. Hard as fuck because it has a lot of legacy code, half-way reactive implementations, not fully MVP architecture.
>>
>>60748006
>recursion really sucks
This. Turing complete languages are garbage.
>>
Can someone explain the purpose of function prototypes aside from making things less confusing or w/e.
>>
>>60748204
They are useless.
>>
>>60748182
>mobile App.
Not programming.
>>
>>60748204
They make the compiler know how to call function from other translation units without needing their full definition.
>>
>>60748152
Oh golly gee, looks like the gate keeper is back. See you bois after 9 hours!
>>
>>60748173
good to hear. i guess i just need to get some creativity lol. thanks!
>>
File: Chudat.jpg (98KB, 378x485px) Image search: [Google]
Chudat.jpg
98KB, 378x485px
>>60748172
Right. It can be shown that the category of anime is equivalent to the ω-category.
>>
>>60747064
Write down a quick proof of the Collatz conjecture.
>>
>>60748292
>>60748301
Mathematics isn't programming.
>>>/trash/
>>
>>60748234
Why is that not programming?
>>
>>60748309
Do not respond to bait, anon.
>>
Why does larry wall look like a pedophile?
>>
>>60748309
He says that because he's retarded.
>>
>>60748329
All men look like pedophiles to lolis, right girls?
>>
>>60748350
Hai oniichan uguu~
>>
Weebs get out
>>
File: 1490363878974.jpg (38KB, 500x400px) Image search: [Google]
1490363878974.jpg
38KB, 500x400px
>>60748305
Programming (not to be confused with c*ding (what most """people""" here do)) is a form of mathematics. Which means it's a form of anime.
And category theory itself is a form of anime.
>>
>>60748234
are mobile apps proofs?
>>
>>60748360
Its onee-chan! Just because I like sports doesn't mean I'm a guy!
>>
>>60748381
"apps" don't even exist. So no.
>>
>>60748390
is flappy bird a proof?
>>
>>60748372
What is the point of your post? Programming is mathematics, but mathematics is not programming.
>>>/b/
>>
>>60746958

I'm retaking a class on UML drawings since I'm kind-of shaky on them. Also teaching a lab section on python best practices where I basically say "Read the PEP's and Google Style Guide" over and over.
>>
>>60748398
where are your parents from?
>>
File: 1490226694518.png (754KB, 736x715px) Image search: [Google]
1490226694518.png
754KB, 736x715px
>>60748397
>What is the point of your post?
To show that your posts are invalid.
>Programming is mathematics
Which means your posts are invalid.
>>
>>60748411
Alabama
>>
>>60748395
No. This "flappy bird" doesn't even exist.
>>
>>60748440
This is wrong.
>>
>>60748477
This is wrong.
>>
>>60748381

Ok, if building an App using an MVP architecture with RxJava. Coding a repository pattern that grabs the responses from a database layer + network layer to offer a smooth "offline first" UX. Working with a middleware nodejs server. If all that is not programming according to you, IDK what the fuck you think programming is.

Using metasploit for pentesting and posting shit in 4chen maybe? xD
>>
>>60748482
Two wrongs make a right, so your post is invalid.
>>
>>60748462
Someone should write it in Haskell then.
>>
>>60746958
Listening to this
https://www.youtube.com/watch?v=RT46MpK39rQ
>>
File: 1493972667618.png (446KB, 379x583px) Image search: [Google]
1493972667618.png
446KB, 379x583px
>>60748492
>Two wrongs make a right
Prove it in anime. You simply wouldn't be able to, which means your post is invalid.
>>
>>60748483
>building an App
>MVP architecture
>Coding a repository pattern
>database layer
>UX
>middleware nodejs server
That was ENTERPRISE QUALITY!

>>60748492
>Two wrongs make a right
Wrong.
>>
>>60748523
Why would someone be using this "Haskell"?
>>
>>60748524
I'm still pissed about how shit the mic sounded.
Also, big sponsor for dlang-chan when?
>>
>>60748538
You have lured me into an impossible task: there is no valid anime.
>>
File: img_242512-23-11.jpg (76KB, 900x600px) Image search: [Google]
img_242512-23-11.jpg
76KB, 900x600px
>>60748460

Thanks for volunteering an answer, but no. They're not from Alabama.
>>
>>60748063
anyone? It's fucking insane that you have to resort to pajeets shitty stockoverflow solutions for this shit
>>
>>60748565
>there is no valid anime.
Prove it.
>>
Why the fuck do so many people want to make video games?
>I want to create x/y/z video game with a/b/c features!
>I want to create the next major technology xD
I've seen both of these so many times, is it from the whole "geek culture" thing that started in 2007? Be honest, how many of you started programming because you wanted to create a video game or the next google or something?
>>
File: 1492916064416.png (821KB, 1000x750px) Image search: [Google]
1492916064416.png
821KB, 1000x750px
>>60748565
What do you mean by "valid"? Consistency? If so, there is definitely a form of anime which is consistent.
>>60748585
Now that's an impossible task.
>>
File: C++.jpg (24KB, 300x440px) Image search: [Google]
C++.jpg
24KB, 300x440px
I'm learning C++
>>
File: coincidence.jpg (10KB, 452x523px) Image search: [Google]
coincidence.jpg
10KB, 452x523px
((Lisp)) revolves around parenthesis
>>
>>60748588
>people arent allowed to like my hobby unless they have the same reasoning as me
Theres just as many hacks and skiddies in traditional dev as game dev. And even more in webdev.
>>
>>60748483
that pentesting hate came out of left field, anything on your mind?
>>
>>60747187
/wdg/
>>
>>60747187
/wdg/
>>
>>60748655
I wasn't trying to imply otherwise, I literally just got into it myself, it's just so many of the beginner resources assume you want to create a video game or a phone app or something. Video games are cool but i've never felt any desire to make one, idk. I feel like that'd take all the fun out of it.
>>
test
>>
>>60748712
icle
>>
File: 1493310600988.png (94KB, 300x450px) Image search: [Google]
1493310600988.png
94KB, 300x450px
>>60748624
Learn Fortran instead. It is lightweight, fast and very amicable if you know how to treat a mature lady right.
>>
>>60748588
>Why the fuck do so many people want to make video games?
It's extremely interesting and satisfying programming.
- Audio/visual feedback
- Opportunities to optimize all from high level algorithm choices down to assembly/intrinsic micro optimizations.
- Touches most areas of programming: Low level system code, networking, graphics/gpu programming, audio/dsp, simulation, scripting/interpreter, multi threading, ai, compression/data packing/unpacking, physics/number crunching.
>>
>>60746958
Non-binary cellular automata (you heard right, shitlord!) in Processing.


I took the inspiration from https://en.wikipedia.org/wiki/Rule_110 but I'm expanding it into two dimensions (left-right, up-down) and allowing a variable number of states.
>>
>>60748681
>I feel like that'd take all the fun out of it.
i mean, you lose the kid-magic / smoke and mirrors wonder. But you can appreciate them in other ways.

Stay off of Youtube and shit though, nothing but pajeet trash. Traditional books will almost never assume games unless its in the title.
>>
>>60748769
>>60748588
>It's extremely interesting and satisfying programming.
I think you'd have to describe it as "tedious".
People actually only tend to enjoy the game design aspect.
And that's the answer to why people want to make games. Game design is fun.

Game engine programmers are just like any other systems programmer really. But they don't write gameplay code, so that's not all that tedious.
>>
>>60748650
I don't believe there is any circumstance in which surrounding the same S-expression in multiple pairs of parentheses is useful, though. Surrounding something in parentheses is basically a way of saying "this is a thing", and there isn't any point in saying "this, which is a thing, is a thing".
>>
>>60748911
>But they don't write gameplay code, so that's not all that tedious.
Reminder that 99% of Rollercoaster tycoon 2 is written in x86 assembly.
>>
Is there any reason to 'pick' a language instead of learning many? It seems like learning multiple languages would give a deeper understanding of how a computer operates and what any given program is doing.
>>
>>60749023
becoming good at something requires depth that you might miss out on if you just learn languages without a dedicated use-case for one of them
>>
>>60749023
Most people do the latter but since this is 4chan they like to pick a language like they like to pick a waifu.
>>
>>60748994
Yeah that does sound extremely tedious. But if that's what you're used to why not?
>>
Any of you niggers have experience with RTSP?
>>
>>60749023
>It seems like learning multiple languages would give a deeper understanding of how a computer operates and what any given program is doing.
how would memorizing a bunch of syntax for various languages give you any understanding of how a computer operates
>>
>>60748524

yet another "imperative programmer slowly realizes his problems can only be solved with functional programming but falls just short of naming it as such" talk
>>
>>60749023
Learning multiple languages won't teach you much of anything about how a computer operates. If you want to learn how a computer operates take a logic/microchip course, whether at your local university or online. And take some binary compilation courses. Binary is really just electricity, 1 is an electrical pulse, 0 is no electrical pulse.

Programming languages are built on this.
>>
>>60749187
Retard
>>
>>60748917
> Surrounding something in parentheses is basically a way of saying "this is a thing"
what?
a symbol alone is also a thing
>>
honestly this is probably worse
https://www.youtube.com/watch?v=GRLBLXFNoQw
>>
How do I do a bit-by-bit logic operation (or, and, xor...) on a single std_logic_vector in VHDL?

I wanna check if an std_logic_vector of size WSIZE is zero or not. The only way I can think of this is by doing a nand on all values, but I can't seem to do it. I found out loops work differently in VHDL, so I'm now just clueless. I was trying something like:

c<='0';
for I in 0 to DATA_WIDTH-1 loop
c<= c or aux(I);
end loop;
zero<=not(c);
[\code]
>>
>>60749439
god i love memory leaks
https://www.youtube.com/watch?v=noUxpYQ6jGc
>>
File: wew.jpg (48KB, 530x800px) Image search: [Google]
wew.jpg
48KB, 530x800px
>>60749521
incredibly accurate playback
https://www.youtube.com/watch?v=abh5uHn5HQM
>>
How bad of an idea is this?
array() {
echo "$1" | sed "s/ /\n/g" | sed -n "$2p"
}


This way I can access a space delimited string by it's individual array members.
>>
>>60749644
Pretty bad considering you're using a dogshit language
>>
so I just finished introductory book on java, is there some list of good exercises i recall seeing some on /g/
just made ascii snake that controls itself but i need something better so i get more familiar with the language
>>
>>60749813

Create a hard AI
>>
>>60749515
You can cast it to unsigned
>>
spam program
>>
spam program
>>
spam program
>>
spam program
>>
spam program
>>
>>60749844
fuck, i'm a retard
Thanks senpai
>>
spam program
>>
spam program
>>
This is exciting
>>
I want to play around with a MineSweeper AI. I don't want to have to code the game (mine would look ugly), just to make an AI. So what software/lib out there could I use to monitor the screen?
I don't know what to Google to get this.

I know know how to get the AI to input (clicks) so I don't need help with that
>>
>>60749890
Keep it up, anon. This thread needs to die.
>>
File: eww.jpg (271KB, 916x1280px) Image search: [Google]
eww.jpg
271KB, 916x1280px
>he doesn't program in tickle
>>
File: 1469120072005.jpg (353KB, 1280x720px) Image search: [Google]
1469120072005.jpg
353KB, 1280x720px
>There are people in this thread who don't think that braces are beautiful and elegant
What the fuck is wrong with you people? Do you also enjoy looking at dicks all day?
>>
>>60750018
This
Python master race
>>
File: 1483586202936.png (20KB, 230x328px) Image search: [Google]
1483586202936.png
20KB, 230x328px
>>60750018
begin
end;
masterrace
>>
>>60750018
That's why I use Lisp and Haskell
>>
File: 1491083943662.png (55KB, 211x269px) Image search: [Google]
1491083943662.png
55KB, 211x269px
>>60750018
>Do you also enjoy looking at dicks all day?
I'm on /g/, so of course I do!
>>
>>60750018
Python doesn't have this problem
>>
File: 1491082968792.jpg (77KB, 350x428px) Image search: [Google]
1491082968792.jpg
77KB, 350x428px
>>60750042
>>
>>60750024
No, she meant the opposite
>>
>>60750024
>>60750049
Pythontards confirmed for having no reading comprehension.
>>
File: 1487465031778.jpg (408KB, 600x624px) Image search: [Google]
1487465031778.jpg
408KB, 600x624px
>>60750055
>>
>>60750062
>she
Did you just assume my fucking gender?
>>
>>60750035
Haskleltards confirmed for having no reading comprehension.
>>
test
>>
test
>>
test
>>
test
>>
test
>>
test
>>
test
>>
test
>>
>>60750085
I was replying to

>There are people in this thread who don't think that braces are beautiful and elegant

to say that, because I don't think braces are beautiful and elegant, I use Lisp and Haskell

Physician, heal thyself!
>>
test
>>
>>60750116
Please kill /dpt/, anon
>>
>>60750125
He has my blessing as well
>>
>>60750107
>>60750108
>>60750109
>>60750111
>>60750112
>>60750113
>>60750115
>>60750116
Wtf

>>60750118
Well you're fucking retarded, because I was directly implying that people like you who DON'T think braces are beautiful have shit taste in programming languages, and also probably stare at dicks all day.

Jesus, why does everyone on this board have such bad reading comprehension?
>>
I feel it coming
>>
>>60750085
He was just saying he likes to stare at dicks, what's hard to understand?
>>
Learning D was a mistake. It's so elegant, nice and comfy that each time I try to do similar things in C++ I feel like I'm back to 1990's again.

C++ is a regressive technology
>>
>>60750159
>people like you who DON'T think braces are beautiful have shit taste in programming languages
Taste is subjective, why would I care that yours is different to mine?

>probably stare at dicks all day
You mean you don't? Freak

Hey everyone, get a load of this weirdo who doesn't stare at dicks all day
>>
>>60747853
this. refer to the value in this instance of the object. Not needed but its better for readability I think
>>
>>60750196
D is dead, why did you learn it?
>>
>>60750203
>why would I care that yours is different to mine?
You don't have to care, you just have to know that my taste is objective, and is the ideal.
>>
>>60750228
It's more alive than your git repo
>>
File: Keep_Lurking.png (107KB, 400x593px) Image search: [Google]
Keep_Lurking.png
107KB, 400x593px
>>60750018
Braces are unnecessary, indents are all you need.
>>
File: 11107883.gif (933KB, 343x284px) Image search: [Google]
11107883.gif
933KB, 343x284px
>>60750234
>>
>>60750232
>my taste is objective
nah
>>
>>60750234
kek
>>
>>60750242
When will Python get rid of all line breaks and whitespace? afterall, they're unnecessary.
>>
>>60747853
you're correct, it's just to reduce potential mistakes

'this.' will always refer to the enclosing object while if a parameter name is the same as the field, i'm pretty sure the parameter will take preference in the scope

so you essentially assign nothing if you do 'height = height' if both the parameter name is height and the object's field name is height, just brainlessly adding a 'this.' is to make sure that never happens even in cases where it's obvious it wont
>>
>>60750228
>Being a literal leming
>>
>>60750297
What's a "leming"? French pottery?
>>
File: 1462844195732.jpg (78KB, 884x574px) Image search: [Google]
1462844195732.jpg
78KB, 884x574px
>>60750234
>>
>>60750318
A sheeple
>>
>>60750373
What's a "sheeple"?
>>
>>60750386
A you
>>
>>60750396
What's a "you"?
>>
File: 1496630680642.png (41KB, 573x599px) Image search: [Google]
1496630680642.png
41KB, 573x599px
>His language makes him write (((header files)))
>>
>>60750411
C doesn't make you write header files. Bait better.
>>
>>60750447
But it essentially does
>>
I had a custom 4chan CSS to increase the reply window in size, but it got cleared out, and lost.

can anyone assist?
>>
Does /g/ aggressively small post size limit actually intelligent discussion?
>>
>>60750694
No one wants to read walls of text.
Also, you can quite easily have intelligent discussion with the current limitations.
>>
How do Lisp macros work?
To my understanding, calling a macro is like inserting code wherever the macro is called. But before the insertion, computation is done to determine the code that will be inserted. After the insertion, the code inserted is then evaluated as if it were there all along. A benefit is that we can use variables only available in an arbitrary scope. E. G. If my macro is (defmacro mac () (print whatever), calling mac will be legal under some let or scope with a whatever bounded. Am I wrong?
Also, I'm not sure about the rules of evaluation regarding them.
Lisp oldfags pls respond.
>>
>>60750783
You can't post any code more complicated than a hacker rank submission, and you can forget about adding explanation in order to educate about it AND not split it into 2-4 posts.
>>
>>60750801
* '(print whatever)
>>
>>60750856
No one wants to read your shit code.
Use Pastebin if you really have to.
>>
>>60751013
>Discouraging discussion
Good stuff, my man.
>>
>>60751035
Fuck off
>>
>>60751170
>He's doing it again
It's cool man, no worries. I'll be back in 10 minutes with some more anime and "your language doesn't do X" shitposts.
>>
Watching Scott Meyers and Andrei banter is a fucking a blast to watch. I want a show of them just sitting around talking about various programming topics and such.
>>
>>60751287
Example?
>>
>>60750783
Not really.
>nobody wants to read walls of text.
I do. 2k characters is just ridiculously small for intelligent discussion and leads to a lot of these crappy situations where someone has to make assumptions about the situation you're talking about.

But I'm not too confident that people here could regularly hold intelligent conversation.
>>
>>60750465
Elaborate? Why would you need to write separate declarations in a separate file at all?
>>
twitch tv /naysayer88/v/149604727
New JAI demo. He's really cranking them out now. I like it.
>>
>>60751455
Because otherwise you're going to be rewriting the declarations manually in every source file that calls those functions. Want to use printf, exit, and sqrt? Well now that's three declarations you have to add to main.c. Want another five functions from a module you wrote yourself, now you have to write five more declarations in main.c. And when you have modules depending on modules that depend on libraries, etc, then it can really get out of hand. Especially if some modules are compiled separately and you use the wrong function prototype...then it really gets messy.
>>
Need some help guys. Working on a K&R exercise where they ask you to make a program that remove all comments from a C program.

Here is a snippet of the code. So when state = OUT, c is not added to the string, which is what I want. However, when state = IN, c does not get added to the string.

So for example, if I feed it

 foo /*bar*/ foo


I get

foo

What am I doing wrong?


#include <stdio.h>
#define MAXLINE 1000
#define IN 1
#define OUT 2

void clear(char line[]);

int main()
{
int c, i, j, k, state;
char comm[5];
char s[MAXLINE];

state = IN;

clear(s);
for (j = 4; j > 0; --j)
comm[j] = 0;
j = 0;

for (i = 0; i < MAXLINE-1 && (c=getchar()) != EOF && c!= '\n'; ++i){
if (state == IN)
s[i] = c;
else if (state == OUT)
;
if (c == '/'){
comm[j] = c;
if (comm[j - 1] == '/'){
state = OUT;
s[i - 1] = ' ';
s[i] = ' ';
}
else if (comm[j - 1] == '*'){
state = IN;
for (k = -1; j > k; --j)
comm[j] = 0;
}
++j;
}
if (c == '*'){
comm[j] = c;
if (comm[j - 1] == '/'){
state = OUT;
s[i - 1] = ' ';
s[i] = ' ';
}
++j;
}
}
>>
>>60751535
Just include the C file or put your definitions in your h file, which is more common.
It's true about separate compilation units though. There you ought to separate a lot of stuff into different files.
But there's good header only libraries out there. You never actually need to separate the code from the declarations at file level outside of the translation unit case.
>>
yet another test
>>
>>60750801
There are 3 periods of time significant to a Lisp program: read time, compile time, and runtime. During read time, read macros are expanded, the Lisp reader parses the program, etc. After this, compile time occurs. Regular old defmacro macro expansion occurs here. Afterwards, functions are compiled. Then of course, runtime. If you don't quote your functions inside a macro, they'll get evaluated during this macro expansion period.
Example:
CL-USER> (defmacro foo ()
(print "a"))
FOO
CL-USER> (foo)

"a"
"a"
CL-USER> (defun bar ()
(print "b")
(foo))

"a"
BAR
CL-USER> (bar)

"b"
"a"

You will want to quote or backquote code inside macros for the most part. But a common place where you do not is when you use GENSYM. Peter Seibel covers this: http://www.gigamonkeys.com/book/macros-defining-your-own.html
>>
How often are one-to-two line functions inlined usually when optimizations are turned off. Say I have the following function for example:
static inline int
net_make_sock_reusable(socket_t sock)
{
int yes = 1;
return setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes));
}


Would this NOT get inlined with optimizations completely off (O0)?
>>
>>60752424
Implemention defined
>>
>>60752537
Yes but I'm interested in the general case with the most popular compilers.
>>
Have you noticed something fucky with captcha? It looks like it confused street signs and cars. I figure people rushing through it don't just pick whichever one is most common with out looking at the instructions.
>>
>>60752540
The -S flag is their right now, waiting for you.
>>
>>60752555
Use the legacy captcha.
>>
>>60752558
I can't read assembly.
>>
>>60752573
What a great excuse to start learning, my friend. I look forward to your report that will need 3 posts because we have a 2k character limit.
>>
>>60752605
I'll learn some someday obviously, but its not something I have the time for right now, so I'm afraid that doesn't really help my case. Although, compiling with -S I can see at least that for my case, compiling with and without -O0 gives identical results, so thanks for that.
>>
>>60752626
Compiling without a flag defaults to O0
>>
>>60752173
>Link
Well, I always thought of macros as functions that eval what they return.
No wonder I'm getting erros in mine.
>>
File: 14796642724780.jpg (2MB, 4032x3024px) Image search: [Google]
14796642724780.jpg
2MB, 4032x3024px
C.

I have to create 10000 arrays, 5 types and fill it with random data. Am I doing it right?

for (int i = 0; i < 9999; i++) {
// ...
char arr[5][10000][256]
// ...
arr[1][i][256] = min + (int)(((max - min)) * (0.005 + (((float)rand()) / RAND_MAX)));
printf("%i", arr[1][i][256]);
// ...
}
>>
>>60752767
Oops, char[5][10000][256] was intended to be before loop.
>>
>>60752731
No worries, they just simply generate code, not evaluated. That happens in the later phases. A good rule of thumb to follow is prefer functions over macros if you can. Use MACROEXPAND when editing your macro too to track how it expands.
>>
What I really want is a compiler that compiles java to a native executable with no JVM.

I love the syntax, I love the libraries, it's the perfect language. I just want extra performance.
>>
>>60752859
Expansion time has to expand a lot then, seeing as macros can expand into macros.
>>
I want to write things in C but the problem I have is that there's absolutely nothing in the standard library. No lists, no hash tables, nothing.

There's no way I can write a more efficient hashmap than experts so where do I get these data structures from?
>>
>>60752986
>so where do I get these data structures from?
https://en.wikipedia.org/wiki/C++_Standard_Library
>>
>>60752986
by switching to lisp
>>
>>60752907
>I just want extra performance.
The java way is to have the JVM do its JIT thing.
Most other languages (like C or C++) give you extra performance by giving you control. Implicit in Java is that you're not in control of the native environemtn, you leave that to the JVM. And you configure your JVM to be good for your program if you want performance.

Basically you're not gonna be able to get that much performance because the language doesn't facilitate the kind of thing. Which I think is probably partially why you like it. You could call out to C via the JNI but that's not what you wanted I'm assuming.

I'm a bit prejudice against people and I don't think your average Java user would actually be writing code better than the JIT.

If you're having performance problems deal with those instead rather than hoping that a naively compiled program would perform good enough.
>>60752986
https://github.com/nothings/stb
stb.h is probably what you're looking for. It's a single header library, documentation is in the header. It's very nice.
>>
>>60752847
Let's try it. I'll define a simple greeting function.
CL-USER> (defmacro flet-test (name)
(flet ((hello (n)
(format t "Hello, ~a!~%" n)))
`(hello ,name)))
FLET-TEST
CL-USER> (flet-test "bob")
; Evaluation aborted on #<UNDEFINED-FUNCTION HELLO {1003D6BE93}>.

Let's try something else...note the change in position of the backquote.
CL-USER> (defmacro flet-test (name)
`(flet ((hello (n)
(format t "Hello, ~a!~%" n)))
(hello ,name)))
FLET-TEST
CL-USER> (flet-test "bob")
Hello, bob!
NIL

So what happened here? In the first example, the hello function in the flet is defined and everything is good. However, the macro just outputs (hello "bob"), unevaluated. This is key, because this form does not get evaluated until it is outside of the scope of the flet. In this case, it is in the global space.
Now look at the second example. In this case, the entire thing is backquoted, which means the macro spits the entire thing back out, so the hello function in this case is within the scope of the flet, because the whole chunk got emitted, rather than just a piece of it. Didn't mean to make a giant wall of text, and don't feel terrible if you don't get this yet.
>>60752930
Yes, and nested macros are a complex beast.
>>
Im trying to learn c++ but the problem is idk where to write my code. ive tried using gedit but it doesnt feel that good since it wont auto fill my code. Codeblocks seems alright but wont compile for me, and i dislike java based stuff because of the slowness
>>
I need to read a log that's output from a program in python.
I'm only interested in the last few lines since the last write as the program just appends to the end.

Not quite sure what the best way to do this is or if there's any standard solutions for this. I'm currently thinking of just keeping track of what line I read last, advancing to that point and then continuing from there.

Is that a good solution? It's just an ascii text log.
>>
>>60753021
Thanks for the help, I think I quite understand now.

But, I'm curious why macros aren't how I though they would be (functions that eval what they return)
Is it because it's more complicated this way? It could work, right?
>>
>>60753047
Emacs or vim + g++ in terminal.
>>
>>60753047
>>>/vim/
>>
>>60753047
I use this:
https://atom.io/packages/autocomplete-clang
But if you're concerned about slowness perhaps atom isn't be the best thing because it's notorious for its slowness. I have a fast computer so I haven't noticed though.
>>
>>60753052
>I need to read a log that's output from a program in python.
To be clear, the program that outputs isn't python it's the program I need to write that's python.
>>
>>60753021
This is fun to learn about.
Can't wait until reader macros.
>>
>>60753074
tail -f is your friend. As for doing it in Python, file.seek is your friend.
>>
>>60752995

Maybe you're right, I'm not autistic enough for C and it is kind of a dying language anyway.
>>
>>60753056
Good. Just remove the eval step in your mind and you've pretty much got it. You can think of C++ templates if that helps.
>>60753075
When you feel ready, there is a chapter all about those in On Lisp.
>>
>>60753095
Thanks. I've found a tail -f implementation and tried running that command. Seems very appropriate.
>>
>>60747129
I could do this, but it would take me hours of research. It took me 30 minutes just to write an algorithm for the partition function recurrence.
>>
>>60753058
>>60753057
so vim gets recced i see, how is it for writing stuff that uses a gui and for managing multiple source files at once?

>>60753066
atom seems like they focused on the gui before the internals. for a company built on git they have pretty crappy code themselves
>>
>>60753047
>Codeblocks seems alright but wont compile for me,
wat? just press f9
>>
>>60753056
>>60753106
Forgot about your question. Do you mean eval before the macro outputs? Like if my macro generates the code (+ 1 2 3), return 6 vs. (+ 1 2 3) unevaluated?
>>
>>60753130
>writing multiple files
just open another vim instance.
>>
>>60753130
>seems like they focused on the gui before the internals
A text editor is virtually all about the interface though. I find its fairly good for customizing it to what you need. It's not quite like emacs with its lisp but it's good enough for me.
>>
>>60753137
so every time you want to edit a header or check a header for example you need to run another vim? doesnt it have a project manager?

>>60753135
yeah and it wont compile, it gives some error unrelated to the code or compiler
>>
>>60753136
Nevermind, I realize now it was a stupid question.
>>
>>60752986
>No lists, no hash tables, nothing
This sounds like a nightmare compared to Python. How would you even begin to sum the primes under 2 million?
>>
>>60753158
You can open other buffers.
There are also tabs.
Who edits more than 5 items at a time.
>>
>>60753158
>it gives some error unrelated to the code or compiler
Well I kinda doubt that. Does it start rambling about the jews or what?
>>
>>60753168
>Who edits more than 5 items at a time.
Code monkeys who have built themselves into systems where their code creep into their data.
So probably anon here.
>>
>>60753137
What? I hope you mean buffer/tab.
>>
i wrote a really really """pythonic""" line today
sorted_table = sorted([[x,table.count(x)] for x in set(table)], key=lambda y: y[1], reverse = True)
>>
>>60753161
Eh, not so much. As we saw in my previous posts, you can do evaluation inside a macro, so the lines get blurred. In fact, if you type #.(print "123") in your REPL right now, you just did read time evaluation.
>>
>>60753189
More like """moronic""" amirite :^)
>>
>>60753189
>reverse = True
No, you didn't. No spaces in parameter assignment.
>>
>>60753168
well for some projects i have to. I say learning but im not really learning on a basic level, i write bots that need to be updated so you have to edit a shit load of files

>>60753173
its something not related directly to the compiler but still related

>>60753155
more graphics than functionality focused, even though it has good functionality. atom is slow as fuck for something called atom its more like a supercluster
>>
>>60753256
>its something not related directly to the compiler but still related
So are you gonna say what it is or is it a secret?
>>
>>60753262
i uninstalled it because i couldnt find any help with it and didnt want to waste time
>>
>>60753256
Get a tiling wm that has many virtual desktops.
That way, you can open four items per desktop.
10 * 4 = 40 bot shit files.
>>
>>60753283
You probably just didn't have the compiler set up. You're supposed to use MinGW-w64 or Clang.
>>
I want to make a cross plat(Linux, Win, macOS) image viewer specifically targeted at reading comics from archives and directories. None of the existing options in the space currently satisfy my needs, are no longer developed or are just clunkers of legacy code.

I know some basic C and C++(very basic, like inheritance and polymorphism is the extent of what I know) but have zero experience making anything beyond command line programs.

Where do I start? I'm guessing I'll need to work with something like Qt for the cross platform? I just want something that isn't ancient and can be a modern base.
>>
>>60753300
C + SDL
>>
>>60750278
>so you essentially assign nothing if you do 'height = height' if both the parameter name is height and the object's field name is height, just brainlessly adding a 'this.' is to make sure that never happens even in cases where it's obvious it wont

but any decent ide will you warn you about that, or rather, you can set it up to avoid this particular issue.

"this." is literally never needed unless you use a shit ide. In fact mine automatically marks it as redundant
>>
>>60753300
1. unzip
2. open the first page in whatever image viewer and keep clicking next
Any half-sane person doesn't need a dedicated tool for that. That's why all other cbz readers are no longer developped: because they were only toy projects.
>>
>>60753331
What if I want to see my cp comics, I don't want it to be unzipped into my hard-drive.
>>
>>60753355
Haven't got transparent access into compressed dirs? This isn't Win95 anymore m8
>>
>>60753331
Yeah but I wanted to implement features like 2 page view, scaling, image filtering, customisable, KB+M shortcuts, zoom lens, tabbed views, etc.

Unzipping every single volume of a series to read it is just removes all convenience and most image viewers cannot jump to next directory/archive when a chapter/volume ends or perform image filtering/resampling on the fly.
>>
>>60753355
you set 7zip to unpack it into your ram
>>
>>60753229
thanks for catching that anon.
>>
>>60753290
gcc was already installed and it detected it during set up, asked me to choose it
>>
>>60752381
Kek
Let the thread die already
>>
>>60753481
>gcc
Ah, you're on Linux, probably some ancient version of GCC installed by default then. Still, it's impossible to do anything with non-descriptions of errors.
>>
>>60753483
I agree. Mathematics is a barbaric cult of the number, an evil sigil designed to lead intellectuals to Satan. Programming is a part of this disgusting cult, and was a mistake.
>>
>>60753483
>>60753533

we will not go quietly into the night
>>
>>60747064
Write nested if statements 64 deep, checking against an integer in descending order
>>
New thread: >>60753596
>>
>>60753605
Please delete that thread and make a new one using a programming image.
>>
>>60753614
n.b. this is not a request
>>
>>60749093
DDS is atrocious. I don't know if any other application makes a good use of RTSP.

Go ZeroMQ.
>>
>>60753165

They expect you to write everything from scratch
Thread posts: 315
Thread images: 35


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