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

File: sicp_anime_girl.jpg (2MB, 1920x3272px) Image search: [Google]
sicp_anime_girl.jpg
2MB, 1920x3272px
Let's be productive edition.

Previous thread: >>62083699

What are you working on /g/?
>>
First for C.
>>
File: anime97.png (143KB, 800x1000px) Image search: [Google]
anime97.png
143KB, 800x1000px
Fucking finally finished my bubblesort script
#takes an unsorted list, and sorts it using the bubblesort method
interim = 0
unsorted = [5, 1, 6, 4, 3, 9, 0, 8, 2, 7]
first = 0
second = 1
loop_value = 0
success = False
while not success:
for i in unsorted:
try:
if unsorted[first] > unsorted[second]:
interim = unsorted[first]
unsorted[first] = unsorted[second]
unsorted[second] = interim
first += 1
second += 1
elif unsorted[first] < unsorted[second]:
first += 1
second += 1
if loop_value > len(unsorted):
success = True
continue
except IndexError:
first = 0
second = 1
loop_value += 1

print(unsorted)

tell me how inefficient my code is daddy
>>
>>62088982
>What are you working on /g/?
Learning what are cgroups and namespaces.
I want to reach the next step in security.
>>
Writing a toy kernel for amd64 in C++. So far I can get memory map and allocate physical pages with higher half remapping. I already have a heap ready for as soon as I'm done doing the virtual allocator.
>>
>>62089019
That looks disgusting. Using an exception error for an algorithm?
>>
File: help.png (51KB, 617x1023px) Image search: [Google]
help.png
51KB, 617x1023px
>>62088626
pic related.
(for VS2017:) Go to the installer, go to the individual component tab and find Help Viewer. (A)
Go to Visual Studio, Help Menu -> Add/Remove Help Content. (B)
In the help viewer, under Manage Content, select the help sections you want.
Back in VS: Help Menu -> Set Help Preference -> Launch in Help Viewer (C)
Now F1 (and related help shortcuts) will use the Help Viewer.

2015 and 2013 is similar, but it should be pre-installed with it.
2010 is maybe a separate download, VS6 to 2008 have it on the cd if you have the MSDN version

(sorry for the delay, was working on something)
If you're using more up-to-date stuff (C#, .NET, etc), you can check out Zeal. ( https://zealdocs.org/ ). But they don't have the Win32 API stuff, so..
>>
File: anime63.jpg (63KB, 256x256px) Image search: [Google]
anime63.jpg
63KB, 256x256px
>>62089046
I used the picture above for a reason
I couldnt figure out how to not raise an index error, so I just used an exception.
>>
>>62089046
python encourages exceptions for flow control.
just like dpts darling ocaml.
>>
>>62089123
Difference is OCaml actually has the efficient implementation to back it up
>>
>>62089119
Why do you have an infinite loop? Just use two for loops and you won't have to deal with incrementing the first and second variable. This program is just a cluster fuck.
>>
>>62089119
>how to not raise an index error
You "algorithm" isn't supposed to raise any sort of error. It's a sort, the size and data is known ahead of time and already allocated.
>>
      INTEGER A,B,C
READ(5,501) A,B,C
501 FORMAT(3I5)
IF(A.EQ.0 .OR. B.EQ.0 .OR. C.EQ.0) STOP 1
S = (A + B + C) / 2.0
AREA = SQRT( S * (S - A) * (S - B) * (S - C) )
WRITE(6,601) A,B,C,AREA
601 FORMAT(4H A= ,I5,5H B= ,I5,5H C= ,I5,8H AREA= ,F10.2,
$13H SQUARE UNITS)
STOP
END
>>
>>62089160
Almost looks like "Fortran with labels"
>>
>>62089046
>>62089123
This, it's considered idiomatic. I actually think it's a reasonable approach. It's a little bit of a perf hit if you reach the exception block often but you're not using Python to write super CPU efficient code anyway.
>>
>>62089160
what language is that?
>>
>>62089188
I looks like fortran.
>>
>>62089157
>You "algorithm" isn't supposed to raise any sort of error.

The program doesn't raise an error, it encounters an exception condition and handles it as opposed to letting it bubble further. There's nothing wrong with that.
>>
>>62089149
>use two for loops
how so?
>>
>>62089188
FORTRAN II
>>
I'm writing a C compiler in C. It's taking ages

Lexer was pretty easy. Still got directives to do though.
Ast is coming along. Using unions heavily here. Recursive descent parsing since that's the easiest way.
No work on CFG yet but I'm going to try and build it so that the CFG builder can produce dot graphs for debugging.
Typechecker is going to the really fun part imo.

Target language is x86-64 machine code
>>
>>62089298
will your compiler be able to compile itself?
>>
I have dozens of acronyms, stored in a array, that should become an string. Like, an "cm" acronym should become "Cloudy Morning". There's any way to do this without making 20 or 30 if statements, checking what acronym the index stores and assign the corresponding string?
>>
>>62089409
use a better data structure, like an associative array
>>
>>62089236
for i in range(len(unsorted)):
for j in range(i+1, len(unsorted)):
>>
>>62089409
you need an AA/hashmap, lad.
>>
>>62089409
hashmap/dictionary/keyvaluepair
>>
>>62089439
>>62089449
>>62089454

fuck, right, didn't even thought about that
thanks y'all
>>
Tried golfing in python. it takes a rock/paper/scissors input and automatically makes you lose every time. With input handling as well
import sys
m,s=[-2,-2],{1:"rock",2:"paper",3:"scissors"}
while m[0]!=-1:
while m[0]<1 or m[0]>3:
try:m[0]=int(input("\n1. Rock\n2. Paper\n3. Scissors\n-1. Quit\n"))
except ValueError:continue
if m[0]==-1:sys.exit(0)
elif m[0]<1 or m[0]>3:continue
m[1]={1:2,2:3,3:1}[m[0]]
print("You drew {} against {}. Failure!".format(s[m[0]],s[m[1]]))
m[0]=-2
>>
>>62089476
from that description..
>makes you lose every time.
nope = input("\n1. Rock\n2. Paper\n3. Scissors\n-1. Quit\n")
print("you lose")

think smarter, not harder. :^)
>>
>>62089500
good point
>>
>>62089382
after it's compiled why wouldn't it?
>>
I'm hoping one of you boyos can help me with a math issue I'm having in C#.

I'm trying to draw a rectangle on the screen that will work as an "area selector". It's a screen capture program that works a lot like the snipping tool, to give you an idea. So I want to be able to highlight an area of the screen so I can get coordinates to be captured later. This is what I have so far

g.FillRectangle(b, new Rectangle(startpos.X, startpos.Y, sizex, sizey));


sizex and sizey are my issue. startpos is simply the point where the cursor initially is clicked, as a reference. Now I need some math to calculate the difference between the start point and the end point so I can have the rectangle synced with the cursor. This way I can select an area that will be captured. I know this should be pretty easy but I really can't figure it out. Any help would be greatly appreciated. Or better yet if you have any other recommendations than this (for a newb), please let me know. Thanks
>>
Am I too dumb for programming if I need to look up how to do shit during an exercise
>>
>>62089511
it's not a good point. you're not writing that program because you're in vital need of a program that prints "you lose", you're doing it for practice
>>
>>62089476
also i have no idea why i made the input and answer different elements of the same list instead of separate variables. that just takes up more space.
>>
Why does /dpt/ hate garbage collection EXCEPT when it's in Haskell?
>>
>>62089554
You never stop looking up basic shit.
Even decade-long kernel contributors still look up basic STD functions.
>>
will sicp make me a better programmer?
>>
File: anime93.jpg (89KB, 620x579px) Image search: [Google]
anime93.jpg
89KB, 620x579px
>>62089447
How does the logic work behind that?
I know it works, I just want to know why it works.
>>
>>62089599
1. All GC are the same
2. All GC are java's so theyre all bad
3. Its still 1997 and GC's are slow
4.I can't have a GC because i do extensive embedded work on my thinkpad and gaming machine
>>
>>62089604
The for loop iterates through the range of values. So when you use a for loop on range(10) it will iterate through 0..9 (10 values). If you give it another argument it will start at that position. So range(4, 10) will iterate through 4..9
>>
>>62089599
Nobody likes that academic meme language. Only 2 or 3 spergs that appear along the Rust shills.
>>
>>62089542
>Now I need some math to calculate the difference between the start point and the end point
EndPoint - StartPoint?
>>
File: kot3.png (358KB, 492x482px) Image search: [Google]
kot3.png
358KB, 492x482px
>>62089603
TAOCP is better
>>
>>62089603
Lisp will make you a worse programmer.
>>
>>62089505
Are you grabbing the startpos from a mouse button click event? If you are, then you can likewise grab your endpos from a mouse button release event.
>>
>>62089685
I'm apparently literally retarded. I was really overthinking that one. Thank you

>>62089704
I'm setting the startpos on mousedown
>>
Thoughts on Brainfuck?
>>
>>62089744
We need an esolang where you draw ascii art.
>>
>>62089744
I wrote an interpreter for it once. Really nice language.
>>
>>62089603
Understanding how the hardware runs the assembly, and also understanding what assembly the compiler turns your code into, makes you a better programmer.
The reason we use high level languages is because it's easier and faster, simple as that.
>>
>>62089123
It really does.
>>62089187
>reasonable approach
You have to be very careful with exceptions. In this case it's fine because there's nothing risky in the try catch blocks and it's just a toy example but as you'll find if you read C++ literature (like Scott Meyers Effective Modern C++, covers exceptions very well) exceptions are just incredibly complicated. They shouldn't be used willy nilly like this in general.
>>
>>62089638
>range iterates
Perhaps I'm not in the know anymore but isn't the whole point of xrange that it iterates (as you'd expect in say a C for loop). Meanwhile range() creates a list of elements and then iterates through that list in order.
>>
>>62089828
They changed it in Python 3. range now returns an iterator and they removed xrange.
>>
>tfw writing in lua
https://www.youtube.com/watch?v=lwUV1Xw-86k
>>
>>62089628
>1.
They all share the issues people care about. Had some fuck that said Go's GC was guaranteed to finish in a certain time (1ms). Which would be impressive. But I haven't found anything that seems to indicate that is true.
>they're all javas so they're bad
Javas GC is pretty much the best GC I've seen.
>can't have GC because embedded
Normally the issues is with predictable execution time. You can't write any real time demanding software using GC. if you're just looking at average runtime and not max runtime i think you'd be OK with GC but I'd also say you're overestimating what it gets you most likely.
If you're writing an efficient program you're saving yourself maybe a dozen or so allocs and deallocs. And you're risking to end up with horrible GC performance like Minecraft has (inadvertently they pretty much destroyed the well performing game notch had made by having a different coding style which started allocating hundreds of megabytes per frame in the worst case. And the devs wouldn't even admit it. So now it still requires very good computers to run smoothly. Despite being a 2012 game.
>>
File: wolfram.png (169KB, 917x620px) Image search: [Google]
wolfram.png
169KB, 917x620px
>he hasn't written wolfram
>>
>>62089916
lad i really hope you know that post was a joke.
But can you even tell Java's GC to stop and go as you please?
>>
>>62089887
Watched your video and there wasn't even a single mention of sopa do macaco, so you got the lua experience all wrong
>>
>>62089950
Exhibit B:

https://www.youtube.com/watch?v=9JDzlhW3XTM
>>
>>62089916
indeed 1ms is very impressive when a modern cpu runs at around 0.25ns per cycle. which means the gc collect only takes 4 million cycles to complete...
>>
>>62089806
What exactly is "incredibly complicated" about exceptions? You throw, generate a stack trace, and unwind the stack until caught. There are usually some subtleties if you want to re-throw an exception but I hardly think that justifies calling the institution of exceptions "extremely complicated".
>>
>>62089946
>stop and go
You mean to never fire unless you tell it to? I'm not sure. I don't consider that a necessary feature for good GC.
GC isn't for applications that can't handle pauses so the only reason to do this would be because you have a very good judgment on when you should do GC passes yourself. You rarely do in a GC environment
>>
>>62090040
Keeping gc passes small and frequent prevents many issues, like hard stops for large cleanups.
And maybe you want to do some GC-less work and dont want it to bother you at the time?
>>
What's the best modern Fortran resource?
>>
>>62090074
The automatic GC in Java already have a concept of minor and major (and full) GC passes. It's a fairly good strategy.
The reason you can't realistically give users full control is because how do you handle the out of memory issues you might face? The GC way is to jump to cleanup and recover. In managed systems you ensure that never happens (or accept that it will).

But I don't see why you'd think it a problem that the GC 'bothers' you. It's not a system fit for realtime constraints.
>>
>>62089984
People write books on this. As mentioned. I believe the Scott Meyers book I mentioned have 3 rather large dedicated to exception safe code.
>>
>>62089946
Also,
>joke
This is an attitude I see a lot for real. People still think GC is a magic solution.
>>
>>62090131
>how do you handle the out of memory issues you might face?
Not assume the user is a retard and can figure through problems like that.
>>
>>62089984
"generate a stack trace"
can you give some code for doing this?
what about when you're forced to use SEH? will your DWARF unwinding also work with that?
>>
File: 1468452274128.webm (3MB, 600x398px) Image search: [Google]
1468452274128.webm
3MB, 600x398px
Why haven't you programmed your own personal robot yet, dpt?
>>
>>62090170
The goal of GC is to have the user not care about memory to this detail.
But yes. Having your GC just crash when out of memory is an option.
>>
>>62090191
If D can manage a manual GC of sorts, any other language can.
I really dont see the downside of allowing more control.
>>
>>62090167
The real joke is people thinking GC is a plague
>>
>>62090215
both C++ and Rust have "manual" GC too. where ownership denotes when resources should be created and destroyed.

(refcounting is still garbage collection)
>>
>>62090177
How difficult/time consuming would this be to program?

https://www.youtube.com/watch?v=rVlhMGQgDkY
>>
>>62089916
M8 even game engines use automatic management nowadays (see for instance UE's game object model). Also using a manual memory allocator can take a lot of time too compared to automatic schemes such as object pools. The only downside of GC is they require more memory really
>>
>>62090248
>refcounting is still garbage collection
It's actually not because it doesn't guarantee freeing resources, see circular references. Python uses some hack to make it work but in its usual form (like you would see with shared ownership) it's not even a garbage collection scheme since it doesn't actually work.
>>
>>62090313
that's not correct
>>
>>62090328
I mentioned a documented example of why it is
>>
>>62090375
stop being stupid
>>
>>62090150
>People write books on this
You've read the book and formed an opinion you believe to be true from it. Can you perhaps tell me your reasons for believing exceptions are incredibly complicated?

>>62090173
>can you give some code for doing this?
I mean it's obviously it's language dependent. Is your thesis here that it can't be written or simply that it's lengthy?

To be clear I'm not saying that implementing exceptions in a language is simple, I'm saying the use of exceptions is not inherently complicated, especially in languages like Python (what spawned this) where exceptions aren't tied into the type checker. As a programmer in a high level language I'm not particularly concerned with what hoops my runtime has to hop through to gather debug information, as long as it can do it correctly (empirically everyone does) it doesn't require any great level of finesse to use.

>what about when you're forced to use SEH? will your DWARF unwinding also work with that?
I don't see why it wouldn't. You might have to maintain additional data somewhere to represent your exception handling structure but this seems like not a lot more than bookkeeping.
>>
>>62090428
Nice arguments m8. Ref counting doesn't collect all garbage, that's a fact. Now you can either keep being ignorant and try to spend 20 mins on google to see why before you click "post" next time.
>>
>>62090500
and how does that make RC not a GC, again?
(the whole point of this dumb shitflinging, that RC is GC -- but not a good one)
>>
Using windows. Can someone write me a script to make a folder and put 25 photos into that newly made folder then repeat? I don't know how to write scripts at all.
Have 1000s of photos that I need to change the exif data on manually, they are all in the same folder. exiftoolgui has a bug where if you try to edit more than ~25 photos then the exif data won't save. Instead of manually making folders and and putting in 25 photos with mouse I think it'd be easier with a script. But I don't know anything about scripting.

new folder 1, new folder 2, .... etc (each folder needs 25 photos in it)
IMG_XXXX.JPG is the file name pattern.
>>
>>62090248
>>62090512
Garbage collection is defined as automatic memory management. Refcounting is a method that can be found in garbage collection, but refcounting existing does not mean that garbage collection is present. "Manual automatic memory management" should be enough to let you know you were being silly.
>>
File: nase.jpg (102KB, 1920x1080px) Image search: [Google]
nase.jpg
102KB, 1920x1080px
>>62089123
>python encourages exceptions for flow control
>>
>>62090546
it's like you have a brain injury or something
>>
>>62090576
Do you even into logic?
>>
>>62090576
Stop posting dude
>>
>>62090546
again, how is RC not automatic memory management?
where and whom defines RC not as a GC?
(because 'The Garbage Collection Handbook' definitely defines RC as a form of GC.)
>>
Im pretty appalled there are people that think ocaml is actually liked here.
>>
>>62090586
>>62090588
if i build a scooter that doesn't work in every situation, e.g. a gravel rode, is it not a scooter? no, it's still a scooter. i feel like i lost brain cells having to explain this to you
>>
>>62090602
You can't lose what you don't have.
>>
>>62090313
GC doesn't guarantee freeing resources in concept. It'd be considered a problem in GC but it's still GC.
>>62090269
>even game engines
Only game engines that don't aim for maximum performance (see Unreal engine, unity).
>using manual memory allocator
Who mentioned that? That's not good manual memory management.
I wouldn't critique GC by saying that you can make a bad GC.
In fact you could make a GC so bad it doesn't complete in trivial circumstances (circular references). But that's not a point against GC.
>The only downside
The downsides are:
Memory is not managed by a human who knows the context. So alignment will have to be stricter at all times, sometimes to the programs detriment.
The typical GC allocation encourages a lack of care for use and reuse of memory. You don't have free lists in normal GC systems.
With manual memory management you don't need a costly GC pass that walks the tree of all your allocations. It's a constant expected overhead for soft-realtime applications. Basically if your worst case GC time is 1ms (which is considered impressive, and it is. Because it's not an easy problem) you're gonna have to pretend every instance of the GC call takes 1ms. Because that's the only way to avoid a hickup.
Garbage collection doesn't know the working context of the memory. So you essentially have an unmanaged CPU cache. Beyond any automatic memory layout measures. You never hear anyone talk about that because it's currently just an accepted deficiency.

And of course. To any of these you can say 'but you can write GCd code that deals with that'. The problem is that if you for instance use a free list you've taken on the manual memory management under a GC system. It makes NO sense to do.

There's one type of 'GC' I accept as entirely legitimate. It's a temporal store system for working memory. Think of it as a pool allocator that's reinitialised at predictable places in the code. That allows for very fast allocation and is very clean
>>
>>62090648
And I should add. Temporal stores are usually considered a MMM system. And I can see why. But I disagree it's much more in line with GC. It's just that all of the memory is declared garbage by simply changing a size value/pointer. In use its as manual as you'd have with most GC systems. As opposed to the more common MMM equivalents.

Also. Additional memory use from GC is usually negligible. I wouldn't count it against GC systems.
>>
>>62090648
>use GC avoid having to bother about freeing allocated resource
>resources don't get freed
>program crashes because can't allocate more memory
I guess you're like the other anon who'd call a bike a scooter even though you have to pedal to move forward.
>>
>>62090546
still waiting, but while you continue to be wrong. check out some papers:
>George E. Collins. A method for overlapping and erasure of lists. Communications of the ACM, 3(12):655-657, December 1960.
>John McCarthy. Recursive functions of symbolic expressions and their computation by machine, Part I. Communications of the ACM, 3(4):184-195, April 1960.
these two created the term (and field of) garbage collection. they found two forms: referencing counting and tracing. (you'll also notice that these two papers are the foundations of LISP.)

and recently, at OOPSLA a paper was published on unifying what was thought to be two separate ideas of GC: (and how they are duals of each other -- and how every high-performance (generational , deferred reference counting, etc) GC is actually both a tracing GC and a RC GC)
>David F. Bacon, Perry Cheng, and V. T. Rajan. A Unified Theory of Garbage Collection In OOPSLA 2004 [OOPSLA04], 2004, pages 50-68

now, tell me how RC isn't a GC. (also, as an advisory I'm not the guy calling you a brainlet. but am generally curious how someone could think RC isn't GC)
>>
62090530
>Using windows.
Stopped reading right there
>>
>>62090576
>>62090602
Squares have straight lines. If you have a polygon with straight lines, is it always a square? I feel like I lost brain cells having to explain this to you.
>>
>>62090592
>>62090745
Where is the collector in C?
>>
>>62090866
that's not a valid argument. a square does not just have straight lines, it has more criteria than that. garbage collection is defined as automatic memory cleanup, and reference counting meets that criteria. garbage collection is not defined as perfect garbage colelction. brainlet
>>
File: 1497978638847.png (250KB, 972x902px) Image search: [Google]
1497978638847.png
250KB, 972x902px
>>62089638
you misunderstand me.
I know how range's work, but why are you iterating through a range that is the length of my list unsorted. rather than just the unsorted list itself?
furthermore, what does the second for loop accomplish?
sorry, I'm not very good at reading and understand logic yet.
>>
Idiot undergrad making an interpreted language reporting in
>>
File: 1502357646102.jpg (178KB, 709x821px) Image search: [Google]
1502357646102.jpg
178KB, 709x821px
Rust is for trap-loving degenerates.
>>
>>62090872
#include <gc.h>

if you wanna use Boehm–Demers–Weiser
>>
Does /dpt/ understand the importance of chunking?
>>
>>62091175
i prefer smooth
>>
>>62091133
The language itself is ok but the community is infested with SJWs.
>>
>>62091161
Not standard library obviously
>>
>>62091187
If you have to run on the JVM where you can only get good performance using primitive arrays then you pretty much have to chunk.
>>
>>62091246
obviously.
but its the most commonly used "off the shelf" GC for C. which means there's probably dozens of people using it :^)
>>
>>62091003
It's very much a valid argument. Just because you don't like it doesn't mean it's not one. You have to show where the logic is wrong, which you did not do.

>a square does not just have straight lines, it has more criteria than that.
Exactly. It has to meet all the criteria to be a square. The fact that a single aspect of a square exists does not mean that it is a square.

>garbage collection is defined as automatic memory cleanup, and reference counting meets that criteria.
Garbage collection does not just have reference counting. It has more criteria than that. It has to meet all of the criteria to be garbage collection.

Stop being bent out of shape out of my single statement. All I did was point out why you can't use that logic to claim C++ has GC.
>>
Why the fuck did /g/ choose C to implement their disaster browser idea?
>>
>>62091354
Because C is the "reinventing the wheel" language.
>>
Reminder that the "this" keyword makes sure that Java uses the values of LOCAL variables as given inside the METHOD that the "this" is used in...
in case you have the same variables outside the method (but inside the MAIN function)- and in that case Java will use the first set of values that it comes across... if you don't want to use those (old) values of the variables BUT want to use the (new) values in the new method, use "THIS".

Still confused? consider a clock that shows time for different Time zones --- You would have the main time's Variables(Hour,min,sec) set as GMT time first.. then you'd have a method for German time where you'd add/subtract a couple of hours and minutes and print it ... while printing - the THIS.HOUR,this.minute, and this.second will be used (else the clock would show the main method's GMT time while printing)
>>
>>62091398
why are you telling us this?
surely people know what the "this pointer" is.
(this refers to current instance -- all you need to know. none of your youtube tutorial stuff)
>>
File: 1460330305439.jpg (25KB, 680x383px) Image search: [Google]
1460330305439.jpg
25KB, 680x383px
>>62089019
Even Obama knows that bubble sort isn't the way to go
>>
>>62091354
What would you use? COBOL?
>>
>>62091456
CL
>>
>>62091289
>Garbage collection does not just have reference counting.
no shit? apparently you're too stupid to be able to read also
>>
RC is a kind of garbage collection.
>>
>>62091472
What's the matter, getting butthurt that I keep throwing your own words back at you to show you how stupid you are? Or are you too stupid to be able to read to notice that's what I've been doing.
>>
>>62091505
i never said that RC is the only type of garbage collection you idiot, i said that it IS a type of garbage collection. just fuck off, you're too stupid to have a discussion with
>>
Thoughts?

public class tuna {
private int hour;
private int minute;
private int second;

public tuna(){
this(0,0,0);
}
public tuna(int h){
this(h,0,0);
}
public tuna(int h, int m){
this(h,m,0);
}
public tuna(int h, int m, int s){
setTime(h,m,s);
}
public void setTime(int h, int m, int s){
setHour(h);
setMinute(m);
setSecond(s);
}
public void setHour(int h){
hour = ((h>=0 && h<24)?h:0);
}
public void setMinute(int m){
minute = ((m>=0 && m<60)?m:0);
}
public void setSecond(int s){
second = ((s>=0 && s<60)?s:0);
}
public int getHour(){
return hour;
}
public int getMinute(){
return minute;
}
public int getSecond(){
return second;
}
public String toMilitary(){
return String.format("%02d:%02d:%02d", getHour(), getMinute(), getSecond());
}
}
>>
>>62091548
Reference Counting can exist without being part of garbage collection. Therefore it CAN be a type of garbage collection, but it doesn't always have to be.

You can't into basic logic and you're getting butthurt about it.
>>
>>62089599

I hate garbage collection in systems programming languages. I tolerate it in dynamic languages.

>>62091354

Actually, it appears Netrunner is written in C++. Same language Firefox and Chrome are written in (although I think Mozilla wants to transition Firefox to Rust).
>>
>>62091566
>Reference Counting can exist without being part of garbage collection.
was obviously referring to the type of garbage collection known as reference counting. now you're literally just pretending to not understand terms being used in a discussion you so desperately want to be part of
>>
"Ignoring efficiency in the small is an overreaction to abuses by some programmers. A 12% improvement, easily obtained, is never considered marginal."
Who am I paraphrasing (its very close)?
>>
File: settings.png (348KB, 640x1136px) Image search: [Google]
settings.png
348KB, 640x1136px
W-will you remove the ads, a-anon kun?
>>
>>62091698
That's not a language, that's an American flag
>>
>>62091698
>language
>United states
So Spanish with some English?
I find this very confusing.
>>
File: p-please.png (129KB, 640x1136px) Image search: [Google]
p-please.png
129KB, 640x1136px
>>62091698
It's just $0.99!
>>
>>62091708
No, it's US + 0.99
>>
>>62091703
>>62091706
United States english
>>
File: meh.png (97KB, 640x1136px) Image search: [Google]
meh.png
97KB, 640x1136px
>>62091715
fixed!
>>
>>62090177
what the fuck
>>
>>62091757
>0.99 U Suck Dick
>>
>>62091708
>>62091757

>Paying money to block ads in one application
>Not just blocking all ads across all applications using the hosts file
>>
>>62091769
>his sexbot doesn't have the GNUOpenVehicles™® plugin
>>
>>62091013
Well, bubble sort works by gong through each element and bubbling it up through the list until it finds the correct spots. You use range to get the indexes instead of having to iterate it yourself. Applying the for loop onto the list only iterates through the values of the list and not the indexes, the indexes are important as you need to know where to swap to. Read this. I just found it and it looks good. It can help you understand bubble sort better. http://interactivepython.org/runestone/static/pythonds/SortSearch/TheBubbleSort.html
>>
>>62091803
Thankfully iOS is very profitable on that matter.
>>
>>62091757
allow the option to grind for in-game shekels to buy the no-ad.
>>
>>62090803
>>62090530
>>
File: 1476275623456.gif (2MB, 500x281px) Image search: [Google]
1476275623456.gif
2MB, 500x281px
>>62088982
Made a /pol/ tantrum simulator to get familiar to OOP. Realized that I should have used polymorphism
https://ideone.com/V6vv3E
>>
File: textbook.png (153KB, 2016x920px) Image search: [Google]
textbook.png
153KB, 2016x920px
trying to learn xamarin forms in vs2017 with c#
but good ole M$ has seemingly NOT used the same version in the tutorial as got released.

any help would be appreciated.
>>
>>62091803
Ruby, what programs have you written in Ruby? Have you written in automation tools? I made a tool in Ruby which automatically applies for jobs. ;-)
>>
>>62091854
That's a good idea tbqh

999999999999999999 game shekels to unlock this option
>>
>>62091912
i honestly dont know why more people dont do it.
It's so simple, makes you more money, and also gets rid of micro-transactions making more people happy.
>>
What does dpt thing of Xamarin Studio?
>>
>>62091910
ruby jobs tho?
>>
>>62091896
kek
>>
>>62088982
That's a very fuckable figure.
>>
>>62091931
the named program of which you speak is deprecated.
now it is 'visual studio 2017' for pc or 'visual studio for mac' for mac
>>
File: add-item.png (35KB, 941x653px) Image search: [Google]
add-item.png
35KB, 941x653px
>>62091901
the add item templates are based on the type of project you made
(this is vs2017, with a random winforms project)
>>
>>62091910

I wrote a brainfuck compiler in Ruby. Mostly I use it for one off scripts to do random things like automatically generating a cmake project. I actually have a small Ruby script that just copies the % character to my clipboard. The reason being is that my 5 key no longer works (if I want to type 5, I use my numeric keypad).
>>
>>62091953
12
GIGABYTES
>>
>>62091976
Have you used auto_click before for Ruby? I am thinking about using it for a project and am wondering if it is any good.
>>
>>62091964
thanks. your answer wasn't an answer, but it somehow sparked me to think MAYBE i didn't right-click on the correct part of the 'solution'

in fact, my sc was after ricght clicking on the solution as a whole and yet i found "interface" after right clicking on the c#app(portable)

you must be a muse ;)
>>
File: 1502236902222.png (32KB, 292x154px) Image search: [Google]
1502236902222.png
32KB, 292x154px
Great I finished learning "Common" C++.
I want Rust back. But I don't like GTK.
>>
File: semi1.jpg (59KB, 500x500px) Image search: [Google]
semi1.jpg
59KB, 500x500px
>>
>>62092061
seiba!
>>
>>62092068
t. pajeet formatter
>>
>>62092068
>hide and seek championship
Is the idea here that these are disappearing or what?
Because I never have issues finding semicolons. They're probably the most consistent thing available.
>>
>>62092206
its a normie meme about removing one of those characters in someone's code and watching them struggle to get it working.
>>
>>62091987

I actually ported auto_click to MRuby. It's an alright gem, but it only works on Windows.
>>
Can someone hit me up with the himegoto webms.

Especially the one where she gets evalulated
>>
>>62092325
>>>/lgbt/
Go away, faggot.
>>
>>62092227
Then semicolon is probably the loser here.

The worst is whitespace. or greaterthan&lessthan
>>
>>62092331

But they can't program
>>
Alright Dee Pee Tee, what is the best build system, and why is it Cmake?
>>
>>62092348
CMake is fucking garbage.
I've recently tried Meson, and I think it's way fucking better.
>>
>>62092348
>what is the best build system

Whatever the director says. You are way better installing Visual Studio in 1 hour instead of teaching cmake to your team for a month.
>>
>>62091896
>random_device
Doesn't work on GNU/NT.
>>
>>62092348
Nix
>>
>>62092360

>teaching cmake to your team
You only need one person to maintain the CMakeLists.txt. Maybe one or two extras for the bus factor. Anyways, Visual Studio's build system is an incomprehensible mess.
>>
>>62092348
cmake is the best because its the least worst.
but that doesn't make it good. as long as you ignore all the stuff from pre 3.5, and have a huge collection of cmake modules (*cough* edgecases) it can "just work" without much ceremony.
but on the other hand, have you tried to compile cmake from source? it takes longer than the linux kernel does..

meson as >>62092350 mentions might be a good approach, but its still the evolution of waf/scons/look-at-muh-python
>>
>>62092348
>>62092350
>>62092360
>>62092368
>>62092377
>>62092384
Nix
>>
>>62092384
>but its still the evolution of waf/scons/look-at-muh-python
Sure, meson is written in Python, but it's not used at all for writing your actual build system.

It's also lightning fast. I somewhat recently converted from CMake to Meson for one of my projects, and it must have been like 5 times faster.
>>
>>62092366
BASED
I'll use this in every single projects
>>
>>62092396
do you even know what nix does? it seems like you don't, but elucidate us on how nix can handle cross-platform builds, with remote libraries, with multiple build configurations and multiple build targets with multiple compilers?

a simple project: show me how to build a subsystem:windows program that uses boost (non-b2 compiled) on linux-aarch64 with mingw64 and running gtest?
>>
https://dirtyhandscoding.wordpress.com/2017/08/25/performance-comparison-linear-search-vs-binary-search/
>>
>>62092377
>implying the entire universe won't conspire and make you need a last minute change and that one person in a critical moment and you won't have it and then you regret not making something absolutely retard proof in all aspects
>>
>>62092384

You're not wrong.

>>62092396

I looked up "Nix build system", but was directed to a package manager. I'm not looking for a package manager; I'm looking for a build system. A build system should either build a program according to specifications listed in a configuration file, or it should generate a build script from specifications listed in a configuration file.

If Google is failing me, and there is actually a build system called Nix, could you please provide a link so I can check it out?
>>
>>62092425
If people are using other platforms then they're doing it wrong.
>>
>>62091896
you should probably make the MT static.. its extremely expensive to create, btw. (the random_device may or may not be static, it depends on whether you can tolerate it blocking..). you shouldn't also be using % on the MT, but rather something like
std::uniform_real_distribution


not that it matters for this, but for large code -- or any multithreaded code you'll soon run into _huge_ performance issues with your setup.
>>
>>62092451
nix still won't help there, though. its a package manager and not a build system. someone randomly yelling "Nix" when someone asks "how can I build my code?" is rather ignorant.
its literally saying: why even build your programs? just use others people stuff from a repository.

now nix can help with managing dependencies (instead of relying on git remotes, if you use git ofcourse), but that will won't call gcc for you..
>>
>>62092439

There aren't too many last minute changes that require an alteration to a CMakeLists.txt. At this point, you're either adding a new library (takes a one line change), adding support for a new compiler or target OS (try doing this with Microsoft's build system), or in some other way making a structural change to the project, rather than just adding or removing a file.
>>
>>62092481
Nix
>>
>>62092486
cmake is also nice because it can generate msbuild (old-style, and the new msbuild (opensource)) things for you, like it can generate ninja files.
also microsoft is pushing cmake pretty heavily with its integration with VS and the "open folder" solution-less part of the IDE, now.
and with vcpkg they provide a cmake module for helping external dependencies for various targets (triplets: x86-windows-static, etc)

but yes, msbuild is cancer. its barely a front-end for nmake .. which can use bad-old-makefiles..
>>
int x=-INT_MIN;
>>
>>62092348
How do I start learning CMake or Make?
>>
>>62092639
oh shit anon
>>
>>62092649
they're two entirely different things
if you're not building on different platforms and will only be managing your own projects, learn make, it's simpler and you probably don't need CMake
>>
any IDE for GNU/Linux recommend me, thanks
>>
>>62092673
geany
>>
>>62092673
qtcreator or kdevelop
>>
>>62092649

To learn either, read the official documentation, observe some example files, and tinker around until you've figured out how it works. Actually, that's really just how I learn anything personally. I have no idea if this learning method works for other people.

Regardless, go learn regular Make first. It's piss easy. Everything's just a list of
target: dependencies
command that makes target from dependencies


At least for the most part. There's also some variable assigning and built-in functions you can do. It's technically a turing complete language on its own right, but you'll likely never use it for that purpose.
>>
File: AndroidPIT-android-O-Oreo-2065.jpg (776KB, 3200x1800px) Image search: [Google]
AndroidPIT-android-O-Oreo-2065.jpg
776KB, 3200x1800px
Can anyone here recommend a good Android app tutorial? Something intermediate and in-depth, I already figured out the basics by myself.
>>
>>62092572

msbuild is unreadable garbage. A .sln file could just as easily be a binary standard, and it would not significantly decrease its ability to be parsed by humans. Similarly, .csproj and their ilk are so verbose that no sane human being would want to edit them. And yet I have done so in the past, because somehow updating my .NET Core version broke my Monty Hall F# program, and so I had to manually edit the .fsproj file to get it working. Granted, that's a small file, but I've looked into the possibility of porting some existing .NET libraries over to .NET Core, but the process of converting the .csproj files looks like a fucking nightmare.

>>62092673

Qt Creator. Alternatively, don't use an IDE. You probably don't need one.
>>
>>62092662
>>62092726
So, they are basically scripts to build a program?
>>
>>62092790
more than that
if thats all it were it wouldn't be so meaningful
Make only executes targets' scripts for whomst's dependencies are newer than the target
ie you only rebuild the parts that need rebuilding
a 5 second recompile instead of a 20-30 minute one
this is also why most projects are split over many, many C/CPP files
smaller files, shorter rebuilds (at the cost of more complex Makefiles)
>>
>>62092673
What language?
>>
>>62092782
its honestly not that unreadable. its just xml that defines includes, build flags, libs, etc (what you'd expect a compiler to want) for different configurations/platforms.(csproj, vsxproj, etc).
although it is bloated, the newer version (meant for .net core, but works with any vs2017+ sln and *proj) has removed some of the cruft.
it also uses $(macros) everywhere, but thats no less readable than garbage like $@ $<

>>62092790
make basically lets you define how you want to run a program with what inputs.
cmake does all kinds of environment setup/inspection/code generation to do similar, but is tailored for configurable builds. not just "run gcc with these files, run ld with those files"
>>
>>62092790

If you are talking about Make... kind of.

It's not like a shell script where you just list the commands to build the program. It's a little smarter than that. Rather, you describe how a piece is built, and you describe how the target is built from the pieces, and the build system automatically figures out what pieces need to be built, which ones are up to date, and then constructs the target once all of its dependencies have been built.

CMake goes a step further. It can automatically detect some dependencies if you just tell it where to find your source files, and where to find your headers and such. It then can generate a Makefile. Or, it can generate an MS Build file or a Ninja file (Ninja is another build system like Make, but faster), or some other type of build configuration file. And beyond that, it can change how it generates the Makefile depending on what compiler you're using or what platform you're targeting.

Make is like a declarative program for building programs.
CMake is like a metaprogramming language for producing declarative programs that build programs.
>>
>>62092758
derek banas
barry burd
thenewboston
>>
>>62092657
I'm so wild I know.
>>
>>62092929
>thenewboston
I watched those in high school.
Are you certain you wanna recommend 'ancient' material?
>>
Is it possible to use bit operations to convert an unsigned integer into a signed one?
>>
>>62088982
how am I supposed to instance Read of a left-associating data type in haskell?
I'm trying to read identifiers directly as opposed to reading a constructor first, and read the minus symbol as a separator for the other constructor:

data Group =
Group String
GroupDiff Group Group

instance Read Group where -- right-associating implementation works fine
readPrec = Tx.choice
[ do
Tx.Ident g <- Tx.lexP
return (Group g)
, Tx.prec 6 $ do
g <- Tx.step readPrec
Tx.Symbol "-" <- Tx.lexP
g' <- readPrec
return $ GroupDiff g g'
]

>>> read "asd" :: Group
Group "asd"

>>> read "g1 - g2" :: Group
GroupDiff (Group "g1") (Group "g2")

>>> read "g1 - g2 - g3" :: Group
(g1 - (g2 - g3) -- right-associating


But no matter what I change, I can't get the parser to properly do left-associativity:

instance Read Group where
readPrec = Tx.choice
[ do
Tx.Ident g <- Tx.lexP
return (Group g)
, Tx.prec 6 $ do
g <- readPrec
Tx.Symbol "-" <- Tx.lexP
g' <- Tx.step readPrec
return $ GroupDiff g g'
]

>>> read "g1 - g2" :: Group
******NEVER RETURNS**** and hogs ram like a mofo

any clue? I've been investigating for hours, and I can't find an example anywhere
>>
>>62092954
..why not use a cast?
>>
Is int 32 or 64 bits?
>>
>>62092954
Yes
>>
>>62092954
No
>>
>>62092954
It's wiser to use a cast but yes you can.
>>
>>62092975
Depends on environment
>>
>>62092975
Do sizeof(int) on your platform to get the number of bytes.
It's platform dependent.
>>
>>62092954

A bag of bits is both a signed and an unsigned integer at the same time. It just matters how you look at it.
>>
>>62092975
most ints are 32,and theyll either have int64 or long.
Or if youre using a language for brainlets, long long
>>
File: incest_pornography.gif (367KB, 960x664px) Image search: [Google]
incest_pornography.gif
367KB, 960x664px
>>62093010
Do you have an older sister? Do you have incest thoughts about her?
>>
>>62092975
in what language? in c++ its _at least_ 16 bits, but in c it only states that sizeof(int) >= sizeof(short). it also states a min range, but not how its encoded (2s compliment, 1s complient, magnitude/sign)

>>62093001
(just to note a byte isn't always 8 bits)
>>
>>62093027
>byte isn't always 8 bits
>2017
>>
Hey dudes,
I'm a computational physicist. Decent at modelling (python), but I've never done any programming proper. Any suggestions for a few weekend projects I could potentially tackle?
>>
>>62093022

I have multiple older sisters.
I do not think about any of them in that way.
>>
File: image.jpg (4KB, 300x57px) Image search: [Google]
image.jpg
4KB, 300x57px
>>62093052
>multiple older sisters
i think i read somewhere once that this increases the likelihood of homosexuality
>>
File: sad_boy.jpg (74KB, 640x640px) Image search: [Google]
sad_boy.jpg
74KB, 640x640px
>>62093052
>ynw have multiple older sisters who will bully you and sexually tease you until you can't take it anymore, giving them your cummies to sip
>>
>>62093052
Did you make this program Ruby?
https://pastebin.com/V01R9whR
>>
>>62093086
lmfao
>>
>>62093044
https://en.wikipedia.org/wiki/Unisys_2200_Series_system_architecture

>>62093066
I was only raised around one of them. The rest are half sisters.
>>
>>62090150
>>62089806
> C++ exceptions literature applying to python
>>
What are some things I can make after learning Java so that I have something to put on my resume
>>
>>62093150
CRUD app, ezpz
>>
>>62093108
So sex with them is not incest? Lucky.
>>
>>62091950
She is not for fugging, just for loving and cuddling.
>>
File: 2017-08-25_23-16-43.png (6KB, 296x182px) Image search: [Google]
2017-08-25_23-16-43.png
6KB, 296x182px
Learning to use Tk and SQLite with Python. So far everything is working, although I'm shit at making UIs.
>>
File: 306607.jpg (29KB, 225x350px) Image search: [Google]
306607.jpg
29KB, 225x350px
You all realize C++ is the best, most efficient language right?
>>
>>62093259
don't worry. tk is shit at display UIs
>>
This is the proposed wording for a unified call syntax based on the idea that f(x,y) can invoke a member function, x.f(y), if there are no f(x,y). The inverse transformation, from x.f(y) to f(x,y) is not proposed."

They were considering 6 alternatives and chose the worst...
https://isocpp.org/files/papers/P0251R0.pdf
>>
>>62093275
Good luck finding work with a meme language
>>
>>62093379
Personally, I find this proposal for C++ to be laughable. It's like hitch hiking from New York to California, and only getting as far as Texas and calling it good.

The great thing about D's UFCS is the left-to-right chaining of algorithms.
x.map!(...).filter!(...).reduce!(...)

It beats the Hell out of...
reduce!(...)(filter!(...)(map!(...)(x)))

This proposal will encourage non member functions, which is good, but will never reach the "aha" moment D had which gave us UFCS chaining.

>>62093398
C++ is not a meme language
>>
>>62093379
>sepples will never have good UFCS

>
void f(B& b)
{
b.h(); // OK (as ever)
h(b); // OK: b.h();
b.k(); // error (as ever)
k(b); // error: Try b.k(), but k() requires an argument
A::h(b); // error: Qualified name, so no transformation to b.h()
A::k(b); // OK (as ever)
}
>>
>>62093398
>finding work with a meme language
Spoken like a true unemployed retard.
>>
>>62093423
Its why people should never underestimate context intuition. Having both the cons and period doing similar kinds of things is a huge mistake when one or the other can do both.
>>
>>62093423
Functional programming was a mistake.
>>
>>62093543
hurr durr both *address and *pointer does different things so they should have different symbols
>>
File: xavier-leroy-chapo_vignette.jpg (61KB, 260x195px) Image search: [Google]
xavier-leroy-chapo_vignette.jpg
61KB, 260x195px
>>62093564
Say that to my face faggot not online and see what happens
>>
>>62093583
>implying this literally who even lifts
>>
>>62093564
Its actually pretty intuitive.
Especially if you do it pipe style
x.map!(...)
//then
.filter!(...)
//then
.reduce!(...)


Some people read scope better as top-down.
>>
>>62093612
>this literally who
spotted the retard
>>
>>62093574
tradition != objective
>>
File: 1503318320348.gif (4MB, 334x251px) Image search: [Google]
1503318320348.gif
4MB, 334x251px
>>62093621
>!
No.
>>
>>62093654
Well those are only templates.
Many primitives have their own native functions you can call so you its a regular .thing()
>>
>>62093564
While functional programming follows the second Unix philosophy to the word, it does not follow the first one. All in all, FP is very good if you and your compiler are smart
>>
>>62093621
>map
iterable = [fn(x) for x in iterable]

>filter
iterable = [x for x in iterable if condition(iterable)]

>reduce
wtf even is this

Anyway, it's trash, since I can't do it in C and had to resort to Python, a brainlet language. Literally shows that functional paradigm is Python-tier.
>>
Why do pytoddler try so hard to fit in?
>>
>>62093709
>since I can't do it in C
how is not being able to do something good in a shit language a detriment of the good language.

And its basically a reversed fold.
>all that extra typing
disgusting
>>
>>62093709
Actually, let me try again.

>map
void map(size_t n, int *arr, void (*f)(int)) {
for (size_t i = 0; i < n; ++i) arr[i] = f(i);
}


>filter
void filter(size_t *n, int *arr, _Bool (*f)(int)) {
size_t newN = 0;
for (size_t i = 0; i < *n; ++i) {
if (f(arr[i]) {
arr[newN++] = arr[i];
}
}
*n = newN;
}


still trash
>>
>>62093684
But compilers aren't smart
>>
>>62093709
Now do transversal, transpose, zip, enumerate, predswitch, recurrence, group, chunkby, lockstep, padleft, padright, retro and 50 other shit you can't do in C.
>>
>>62093766
in the map example it should return int, my bad
>>
>>62093789
That's where you come in
>>
>>62093766
now make it templatable
template map(fun...)
if (fun.length >= 1)
{
auto map(Range)(Range r) if (isInputRange!(Unqual!Range))
{
import std.meta : AliasSeq, staticMap;

alias RE = ElementType!(Range);
static if (fun.length > 1)
{
import std.functional : adjoin;
import std.meta : staticIndexOf;

alias _funs = staticMap!(unaryFun, fun);
alias _fun = adjoin!_funs;

// Once DMD issue #5710 is fixed, this validation loop can be moved into a template.
foreach (f; _funs)
{
static assert(!is(typeof(f(RE.init)) == void),
"Mapping function(s) must not return void: " ~ _funs.stringof);
}
}
else
{
alias _fun = unaryFun!fun;
alias _funs = AliasSeq!(_fun);

// Do the validation separately for single parameters due to DMD issue #15777.
static assert(!is(typeof(_fun(RE.init)) == void),
"Mapping function(s) must not return void: " ~ _funs.stringof);
}

return MapResult!(_fun, Range)(r);
}
}
>>
>>62093709
>C
>Python
You are really a "simple minded" person aren't you. I hope you took special classes, big boy.
>>
This is very frustrating.
https://youtu.be/d1DpVR0tw0U?t=2308
It takes this man (through no fault of his own imo) 4 minutes to explain to a non-rookie crowd the concept of NOT calling destructors when deallocating memory.

RAII has damaged people so bad. It's ridiculous.
>>
I have a very unfinished Build-like game engine and a very unfinished kernel.

How do I find time for both of them
>>
>>62093826
>Writing clear, easy to understand and maintain, production-quality code is "simple-minded"
Stay jobless with your esoteric language.

You're like your fellow lispfags who think that implementing a for loop using recursion is somehow fucking superior, when it's just plain idiotic.
>>
>>62089554
If you don't innately and intrinsically know something the very first time you see it or any time after that, then you are too dumb to live and for all intents and purposes you should quickly kill yourself.
>>
>>62093850
>C
>Clear
>Easy to maintain
wew lad
>>
>>62093850
>t. assflustered brainlet
No wonder you use python
>>
>>62091597
>Mozilla wants to transition
Sounds typical
>>
>>62093862
You must be very stupid.
>>
>>62093804
But does it ever matter if compiler is not going to be smart?
It means, FP is not going to be very good because we can't satisfy the condition of the smart compiler.
>>
>>62093887
>"smart" pointer
Just use GC
>>
>>62093887
>we can't satisfy the condition of the smart compiler.
What, yes we can?
Many languages already have really nice compiler messages.
>>
>>62093873
>>
>>62093908
Are you so stupid that you can't even read C declarations?
Really though, real code never loops like that. It's EXTREMELY rare for function pointers to go more than a level deep, and if they ever do, a typedef is almost always used to reduce the complexity.
Any language with types you can make recursively is able to produce abominations.
>>
>>62093925
This problem does not exist if your language has trailing return syntax.

Even C++ has this kek
>>
>>62093908
Meanwhile, the same thing in other languages:
let f: &[fn() -> fn() -> ()];
>>
>>62093925
>have to look back at all your typedefs and piece them together step by step.
Just one of the many fundamental problems with C.
>>
>>62093862
If you're not a brainlet, that is.
>>62093866
Production wise Python is much faster.
>>62093873
Indeed, he's a function-tard.

>>62093800
Memes aside, I am really interested in functional programming to get a "different perspective" for approaching problems. Is there a language that could gently introduce to these, I'll admit, slightly more elegant and less verbose functions compared to plain and simple imperative programming, in expense of the programmer having to be familiar with each an individual of them, without forcing me to do idiosyncrasies like implementing a recursive function every time I want to do a loop? There's no way I'm using that language for real stuff, so I'm only interested in the bits I can apply to Python (slow-helper), C (fast-production) and Lua (slow-production).
>>
>>62093937
>C++ has 50 different ways to declare the same thing
I don't know why you're presenting that as a good thing.
>>
>>62093961
That's C++'s problem. Rust has trailing return syntax by default
>>
File: 1502820322331.png (6KB, 321x321px) Image search: [Google]
1502820322331.png
6KB, 321x321px
>>62093958
>Python
>C
>LOOah
Jesus christ fuck off brainlet
>>
>>62093942
>having to break down a complex problems into simpler ones
Holy shit, it's like the whole programming field has this problem.
>>
>>62093958
>I got owned: the post
>>
>>62093976
>can't even comprehend c declarations
>can't into pointers
>no productions apps
>thinks he is in position of calling anyone a brainlet
>posts a mongrel picture
>>
>>62093978
not to the level of C though, when any functionality has to be nig-rigged with typedefs
>>
>>62093986
>can't into pointers
OH BOY HERE WE GO, LET'S PRETEND POINTER IS HARD AND SHOW OFF E-PEENS
>>
>>62093993
What? How do you "rig functionality" with typedefs?
It's just some fucking alias for a type. It doesn't declare anything new.
>>
>>62093986
>muh ``production``
>muh `` appz``
>muh pointer arithmetic
Things a double digit IQ monkey would spew every now and then
>>
>>62093993
Yeah, and in return you get simplicity and speed. If you want productivity and speed you choose a scripting language. Different tools for different tasks.

>>62094000
Why then Haskell and Lisp can't into pointers?
>>
>>62093940
C utterly BTFO
>>
>>62094008
>muh zip
>muh lambda
>muh filter
>muh map
the ramblings of a basement-dweller neet
>>
>>62094009
I use neither use or advocate any of them, dumb ctard fuck off
>>
>>62094009
>Why then Haskell and Lisp can't into pointers?
pointers go against purity and the functional way, m8.
both are shit though.
>>
>>62094015
Enjoy writing 400 lines of boilerplate and updating those header files and the CMakeLists, brainlet
No wonder C is dying
>>
>>62094015
All of them are very useful if you are working with real problems such as data structures instead of masturbating on pointers and bitwise ops
>>
>>62094028
Meanwhile functional programming was never alive to begin with.
>>
>>62094028
>No wonder C is dying
People have been saying that for 20 years, and it's still nowhere near dead.
>CMakeLists
Disgusting. C has nothing to do with that garbage.
>>
>>62094045
JS is more popular than C
kek
>>
File: 1491081808903.jpg (56KB, 945x482px) Image search: [Google]
1491081808903.jpg
56KB, 945x482px
>>62094051
>and it's still nowhere near dead.
>>
>>62094045
All newer languages are embracing FP paradigm, you are living under a rock.
>>
so i have something i create ever second, but i want to delete something is older than 10 seconds
how do i do this lads? I am thinking of an array then after every m iterations i relocate this array into a new, fresh, and fit array
c++ btw
>>
>>62094045
>functional programming was never alive to begin with.
functional langs are actually replacing JS as we speak.
More people are using hasklet for their backends.
Clojure is pretty relevant.
Rust (though shit) made huge strides in pushing FP.
Its the future, desu, you can get on it or fight it.
>>
>>62094062
>Having map and filter makes a language functional
God damn, you people are fucking retarded.
>>
>>62094079
I'm not the one who started on ``FP is evil`` argument
>>
File: 1503523860389.png (460KB, 720x780px) Image search: [Google]
1503523860389.png
460KB, 720x780px
>follow every threadsafety rule on the libcurl website
>even do the dumb openssl workk around even though im not even using https at all
>still get random double frees 1/5 times my program runs

aaAAAAAAaaaa
>>
>>62094062
That's why I said I was interested in those filter, map, zip and so on, but still no-one gave a link neither to a language, nor to a list of those. Functional programming is like a spice that should be sprinkled on a primarily OOP and imperative codebase to make it prettier, but you should never be on its own.
>>
>>62094103
You clearly have no idea what functional programming is about.
>>
File: 1487847340360.jpg (112KB, 675x949px) Image search: [Google]
1487847340360.jpg
112KB, 675x949px
>>62094098
You wouldn't have this problem if you just had used Rust, senpai
>>
>>62094114
Not him but I will consider Rust once it reaches v2.0
>>
>>62094119
Why v2?
>>
>>62094140
Standard library too small. Where is chrono? Where is bigint?
>>
File: 2017-08-26-104033_1366x768_scrot.png (218KB, 1366x768px) Image search: [Google]
2017-08-26-104033_1366x768_scrot.png
218KB, 1366x768px
>>62094075
>the most widely deployed fp lang is emacs-lisp, a language of an obsolete ide that has it's core written in C
>>
New thread:
>>62094155
>>62094155
>>62094155
>>62094155
>>62094155
>>
>>62094157
>stackoverflow
Into the trash
>>
>>62094140
Not him but I'm using Rust and there's still a lot of stuff missing, even on nightly. For example even if you're doing pattern matching and your patterns are exhaustive (e.g. you have a 0..255 range for an u8 variable) you still have to add an _ => unreachable!() clause, otherwise the code won't compile. There are a lot of patterns missing (e.g. array patterns, though they are in nightly), you can't put annotations on if expressions, lifetimes aren't always automatically calculated even though they could...
It's an excellent language but far from being done.
>>
>>62094183
All functional programming languages are more to the right, that is, they're more asked about and not actually *used*.
>>
Is this the comprehensive summary of functional programming?

https://github.com/magnars/dash.el
>>
>>62093027
I was gonna mention that but anon clearly isn't the kind of person that'd like to have that knowledge.
Thread posts: 321
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.