[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y / ] [Home]
4chanarchives logo

/dpt/ - Daily Programming Thread


Thread replies: 336
Thread images: 32

File: 1428780772552.jpg (22KB, 380x286px) Image search: [Google] [Yandex] [Bing]
1428780772552.jpg
22KB, 380x286px
2010 edition

Previous thread at >>52138645

What are you working on, /g/?
>>
Fixing the obamacare website
>>
Reposting in case the thread dies before anyone helps me.

I'm trying to write a method that returns a converted bitmap so I can actually use it.

    class ImageConvert
{
public static ImageSource(string imageToConvert)
{
var bitmap = new System.Drawing.Bitmap(imageToConvert);
BitmapSource convertedImage = Imaging.CreateBitmapSourceFromHBitmap(bitmap.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
return convertedImage;
bitmap.Dispose();

}
}


It refuses to work. I'm not sure how to get it to return "convertedImage". Can't seem to get the return type to take.
>>
File: loU3WSd.webm (2MB, 720x404px) Image search: [Google] [Yandex] [Bing]
loU3WSd.webm
2MB, 720x404px
Ask your beloved programming literate anything.
>>
>>52142773
Why do you love Java so much?
>>
File: mems.jpg (15KB, 389x103px) Image search: [Google] [Yandex] [Bing]
mems.jpg
15KB, 389x103px
nth for I could be doing something to advance humanity, but I'm too deep in the memes
>>
6th for I want to learn graphics programming but vulkan is right around the corner.
>>
>>52142807
just learn opengl fgt
>>
File: java.jpg (47KB, 385x499px) Image search: [Google] [Yandex] [Bing]
java.jpg
47KB, 385x499px
Is this a decent guide for learning Java?
>>
>>52142807
people have been saying this for 1½+ years in /dpt/
>>
RIP Ian Murdock

>>52142851
Any guide that teaches you Java is guaranteed not to be good
>>
>>52142807
Learn it with Mantle or D3D12 then.
>>
>>52142760
I don't think you should dispose of the bitmap AFTER returning something.
>>
>>52142851
probably

>>52142870
epic meme
>>
>>52142795
>python
you're a lost cause
>>
>>52142891
My bad, it's code from elsewhere that I'm copying to use, just haven't worked the rest of it out yet because I can't find a return type that it likes, and actually have the "return convertedImage;" work.
>>
File: 1451440533383.jpg (71KB, 640x640px) Image search: [Google] [Yandex] [Bing]
1451440533383.jpg
71KB, 640x640px
>>52142921
I'm lost in the fit grills lad
>>
>>52142964
4th, bottom row pls
>>
File: mems.jpg (362KB, 1366x768px) Image search: [Google] [Yandex] [Bing]
mems.jpg
362KB, 1366x768px
>>52142978
m8, I decided to offer a bigger selection, which is it again?
>>
>>52142964
>tfw no gf
>>
>>52142986
0,5
>>
File: not_today.webm (1MB, 720x404px) Image search: [Google] [Yandex] [Bing]
not_today.webm
1MB, 720x404px
>>52142791
java has democratized the best of software engineering: oop, design patterns, exceptions, garbage collection, no more pointers (unsafe, messy), no more unsigned types (unsafe, messy), concurrency, interfaces over multiple inheritance (messy), no preprocessor (unsafe, messy), ... java literally revolutionized programming in both enterprise and academia.
>>
>>52142986
what
i mean 2,5
I don't know why I can't think today.
>>
>>52142997
could you flip this horizontally for me?
>>
File: 1451443632205.gif (2MB, 500x557px) Image search: [Google] [Yandex] [Bing]
1451443632205.gif
2MB, 500x557px
>>52142998
>>
File: Bait.png (220KB, 387x545px) Image search: [Google] [Yandex] [Bing]
Bait.png
220KB, 387x545px
@52143016
>>
File: 1451454994687.jpg (82KB, 871x960px) Image search: [Google] [Yandex] [Bing]
1451454994687.jpg
82KB, 871x960px
>>52143017
>>
>>52143047
good lord. thanks.
be back in 41 seconds.
>>
File: temp.jpg (94KB, 640x640px) Image search: [Google] [Yandex] [Bing]
temp.jpg
94KB, 640x640px
>>52143023
did it in mspaint so probably shit compression
>>
>>52143074
thanks, this way it looks like she's taking her top off
>>
>>52143093
nice
>>
File: 1451499561411.jpg (31KB, 460x316px) Image search: [Google] [Yandex] [Bing]
1451499561411.jpg
31KB, 460x316px
>>52143047
Alright, I'm going to stop, we need to keep this on-topic

For reference, here is my code again. You may need to change functions based on python version (I use 2.7), and have requests installed

import urllib,sys,requests,os

board,thread=sys.argv[1:]

url="https://a.4cdn.org/"+board+"/thread/"+thread+".json"

posts=requests.get(url).json()["posts"]

newDir=os.getcwd()+"\\"+board+"\\"+thread

if not os.path.exists(newDir):
os.makedirs(newDir)

for keys in posts:
if "tim" in keys:
urllib.urlretrieve("https://i.4cdn.org/"+board+"/"+str(keys["tim"])
+keys["ext"],newDir+"\\"+str(keys["tim"])+keys["ext"])
>>
>>52142899
Java is a genuinely shitty language m8.
>>
im gonna go shave this massive beard and get paid to do it. working from home is neat.
>>
>>52143118
oh and run the following:
filename.py board threadNumber

or replace board and thread in the code itself and run as normal
>>
File: 084.png (102KB, 300x256px) Image search: [Google] [Yandex] [Bing]
084.png
102KB, 300x256px
>>52143124
>python is good
>lisp is good
>hasklel is good
>C# is good
>java is genuinely shitty
>>
>>52143129
>working from home is neat.
Mabye I should be a cam whore too
>>
>>52143165
python is shit
lisp is shit
haskell is shit
java is shit
>>
>>52143185
and C# is shit? it's pretty similar to java m8
>>
>>52143197
Never before has any voice uttered the words of such bait here in /dpt/
>>
>>52143170
i WISH that were my job.
but at least I can drink beer and smoke while working.
>>
>>52143124
why though? You don't understand it or just haven't tried it?
>inb4 more meme shouting
>>
>>52142701
Could you not find a non-stock photo, OP?
>>
File: 1448506151250.gif (997KB, 500x332px) Image search: [Google] [Yandex] [Bing]
1448506151250.gif
997KB, 500x332px
>>52143016
Nigger you are a fucking retarded
>>
File: 1451370879859.jpg (481KB, 1920x1080px) Image search: [Google] [Yandex] [Bing]
1451370879859.jpg
481KB, 1920x1080px
Why is web development so disgusting?
I installed the emscripten portable sdk, which git clones and builds the latest versions of their toolchain, (nodejs, clang, llvm...) and it takes over 8 hours to build.
The SDK itself is nearly 2 gigabytes, and I still haven't gotten any C code to run reliably in my browser.
>check out autogenerated js file
>13000 lines of boilerplate garbage
>my c program was a simple hello world
>>
>>52143430
explain
>>
>>52143185
haskell is great though. and lisp isn't really a language, rather a natural phenomena from parsing symbols into a tree structure.
>>
>>52143433
>web development so disgusting
>cannot program for shit so he downloads a ton of shit
>>
>>52143118
Do not run, it is a virus.
>>
File: 1445253567568.jpg (11KB, 300x201px) Image search: [Google] [Yandex] [Bing]
1445253567568.jpg
11KB, 300x201px
>>52143458
>he doesnt know C++
>what is c#
>What is democracy
>he doesnt understand CS
>he goes to codecamps
>>
>>52143558
>What is democracy
http://www.merriam-webster.com/dictionary/democratize
": to make (something) available to all people : to make it possible for all people to understand (something)"
>>
>>52143140
>>52143140
OSError: [Errno 13] Permission denied:



do you even test the code before ?
>>
>>52143607
democratize is a different word
>>
Shut the fuck up Austin.
>>
File: 1450657668600.gif (906KB, 500x349px) Image search: [Google] [Yandex] [Bing]
1450657668600.gif
906KB, 500x349px
>>52143607
>he cant understand c++
>being too stupid to learn a non-meme language
>>
>>52143654
i wrote "democratized" (>>52143016)
>>
>>52143614
I did just this code and it still works:
import urllib,sys,requests,os

board,thread=sys.argv[1:]

url="https://a.4cdn.org/"+board+"/thread/"+thread+".json"

posts=requests.get(url).json()["posts"]
title=posts[0]["semantic_url"]

newDir=os.getcwd()+"\\"+board+"\\"+title+" ("+thread+")"

if not os.path.exists(newDir):
os.makedirs(newDir)

for keys in posts:
if "tim" in keys:
urllib.urlretrieve("https://i.4cdn.org/"+board+"/"+str(keys["tim"])
+keys["ext"],newDir+"\\"+str(keys["tim"])+keys["ext"])


You must have changed it so that path.exists doesn't match makedirs
>>
>>52143016
>no more unsigned types (unsafe, messy)
>>
>inheritance-based, nominal OOP
>not row-polymorphic, structural OOP
>>
File: pls.png (123KB, 763x263px) Image search: [Google] [Yandex] [Bing]
pls.png
123KB, 763x263px
>>
>>52143764
...what the hell are you trying to accomplish?
>>
>>52143704
" Quiz any C developer about unsigned, and pretty soon you discover that almost no C developers actually understand what goes on with unsigned, what unsigned arithmetic is. Things like that made C complex. The language part of Java is, I think, pretty simple." -- James Gosling (PhD), Creator of The Java Programming Language.
>>
>>52143730
>OOP
nice meme
>>
>>52143693
thats because you have backslashes
in linux that doesnt work
it must be:
newDir=os.getcwd()+"//"+board+"//"+thread
>>
>>52143764
i want gcc/g++ to know where the jni.h is so i can compile for windows and not just android
>>
>>52143793
Signed types have a signed bit as their most significant bit and unsigned types don't.
By omitting the ability to store negative values, you can store a value twice the size of a signed integer in an unsigned integer type.
>>
>>52143793
and how does that imply unsigned types are unsafe and messy?

Why are Java supporters so fucking stupid?
>>
>>52143793
>Quoting a retarded
>>
>>52143793
Java is simple, yet everyone who uses it is incompetent.
>>
>>52143811
ah had no idea lad, I have yet to get linux on my laptop

i'll add a check for it anyway
>>
>>52143814
You need to feed it .c files, what do you think it is supposed to do with a single -I argument?
>>
>>52143792
>>52143814
basically i want to do

gcc -I/usr/lib/jvm/jdk1.7.0_07/include


but in windows

http://stackoverflow.com/questions/14529720/how-to-make-jni-h-be-found
http://stackoverflow.com/questions/14589971/how-to-make-gcc-accept-spaces-in-path
>>
>>52143433
>using abstraction tools for baby
just code it in javascript anon
>>
>>52143844
it's an I, not a lowercase L
>>
are shells a meme?
>>
>>52143865
>learning javascript
>no static typing
>functions inside of functions
>no classes

nah
>>
>>52143877
everything is a meme, that includes you and me.
>>
>>52143890
meme
e
m
e
>>
>>52143819
what happens when you mix signed and unsigned in expression ?

>>52143820
https://google.github.io/styleguide/cppguide.html#Integer_Types

>>52143821
>>52143831
please, don't bully.
>>
>>52143871
God dammit just hand it some .c files to compile
>>
>tfw wish I knew about the legendary slides to operator before uni so I could impress the lads
>>
>>52143913
Each type has it's applications, you don't mix signed and unsigned types unless you know what you're doing.
In fact, don't use unsigned types if you don't trust yourself to not screw up.
>>
>>52143884
>he doesn't like anonymous functions
Average static typing retard. Lambdas too hard for you?
>>
>>52143966
I still don't know why an anonymous function withing a function would be considered useful.
What good are lambdas?
>>
>>52143884
>>functions inside of functions
this triggers the functional programming fags
>>
File: oops.png (9KB, 555x109px) Image search: [Google] [Yandex] [Bing]
oops.png
9KB, 555x109px
Just finished automating putting tracking numbers into orders for my parent's business. Before, my mom had to check the email every day and put in the numbers into orders. Some of them she missed which resulted in angry customers asking why they didn't ship.

I knew php before, but I used a bunch of skills I am currently learning in community college Computer Science, especially OOP. I made the script check UPS emails, then when I wanted to add emails that were sent directly from a company, it took so little effort to add in, while before without OOP it felt cumbersome adding stuff in.
>>
>>52143913
>This code will never terminate!
That's some pretty retarded shit. The compiler should certainly always notice that bug. I'd be pretty shocked if C# didn't catch this 100% of the time. Though i've never run into a bug like this before.

>Don't use an unsigned type.
Equally retarded. What if you are dealing with image data? How else do you represent the RGB values of a 24-bit pixel except as 3 unsigned bytes? This is some idiotic shit.
>>
>>52143978
functions inside of functions is standard fp
>>
Why doesn't C# support multiple inheritance?
>>
>>52144086
interfaces
>>
>>52144086
Because it's considered messy. You can "inherit" multiple interfaces though.
>>
>>52144020
it's simple for a compiler to check for (uint >= 0) comparisons, but if that 0 is a calculated value from somewhere else that the compiler can't trace then you're fucked.
>>
>>52144086
multiple inheritance is dangerous and mostly for memetic purposes
>>
>>52143976
It lets you quickly make short, non-reusable functions without having to declare them independently.

If you need a callback function for example, or custom logic for a function. Let's say you want to add 5 to each element of an array. With a map() function and an anonymous function:

var myArray = [1,2,3,4,5,6];
myArray.map(function(val) {
return val + 5;
});


This is much concise and clear than having a separate named function just to add 5 to its argument. I know it's a retarded example but for demonstration purposes I think it's good enough.
>>
>>52143918
got it to work now

i added

-I"C:\Program Files\Java\jdk1.7.0_71\include\"


to gcc-opts and g++-opts in my windows32 ant build script :^)
>>
>>52144102
Ok but why doesn't it support both?
>>
>>52144145
Why don't you just add 5 in the same function?
>>
>>52144165
u avin a laugh?
>>
>>52144113
I understand that but I would like to have the possibility to choose...
>>
>>52144172
map takes a function as a parameter
>>
>using C makes me smart
lol
>>
>>52143118
Python is ugly as fuck
>>
>>52144191
Why don't you just make a separate function?
Better yet, why not make it a member function as part of the map object?
>>
>>52144188
>choosing multiple inheritance
>1 or 2 days before 2016
>>
>>52144194
>using python makes me non-retarded
>>
>>52144208
I don't see how
>>
File: anger.jpg (35KB, 467x508px) Image search: [Google] [Yandex] [Bing]
anger.jpg
35KB, 467x508px
>>52144086
>what is the diamond problem?
>What are interfaces?
>>
>>52144118
>but if that 0 is a calculated value from somewhere else that the compiler can't trace then you're fucked.
I struggle to imagine a real code example like that that isn't poorly written.

In any case the usefulness of having unsigned ints far outweighs the chance of creating a bug like this. I don't even know the last time I saw something like i >= 0 is a for loop anywhere, or anything else.

unsigned ints are more type safe and memory efficient. Good luck doing things like image manipulation without unsigned ints.
>>
>>52143976
they support closed variables, which are necessary for event handlers. try doing this type of code in C++:
function configureSomeBs() {
var numberOfClicks = 0;
App.onClick = function(){
++numberOfClicks;
};
App.onClose = function(){
alert("you clicked "+numberOfClicks+" times!");
};
}
>>
>>52144215
Not him
>Why don't you just make a separate function?
Needless, especially for non-reused code

>Better yet, why not make it a member function as part of the map object?
You mean the built-in map function? Add that non-reused code into a map function called from wherever, but only using that code in 1 specific place?
>>
>>52144188
yep. Well, in C# you can't. You will be encouraged to use composition instead.
>>
>>52144215
What are you talking about?

Map is a member function of an array that applies a function to every element in the array and returns the results

e.g. in f#
[|1..10|] |> Array.map ((*) 2)
will give you [|2..20|]
(*) 2 is partial application and could be thought of as the lambda
fun f -> f * 2
>>
>>52144260
Why don't you just write out what map does as part of the function itself instead or trying to make it a member function, especially when it only has to add += 5 once.
>>
>>52143966
I like functional programming and static typing.
>>
>>52144239
Sorry, I'm quite new to programming...
I do know what interfaces are but really, what is the diamond problem?
>>
>>52144287
illustrate in pseudocode what you're talking about

at this point, the only alternative I'm thinking of that you might mean is have map inside this one other function, at which point you still have a non-reused function out there
>>
>>52144317
>The "diamond problem" (sometimes referred to as the "deadly diamond of death") is an ambiguity that arises when two classes B and C inherit from A, and class D inherits from both B and C. If there is a method in A that B and C have overridden, and D does not override it, then which version of the method does D inherit: that of B, or that of C?
>>
>>52144317
you might want to watch Blood Diamond, it'll open up to you the problem we currently experience with diamonds
>>
File: 1046.jpg (52KB, 471x694px) Image search: [Google] [Yandex] [Bing]
1046.jpg
52KB, 471x694px
What the fuck is the difference beetween structure and class in c++?
>>
>>52144318
Write the problem without having to use a lambda function.
It's much cleaner.
>>
>>52144287
I want to double each element of an array
Array.map((*)2)

I want to add 5 to process each element of an array
Array.map(processFunction)


You're saying we should do this instead?

Array.mapTimes2 // function that I will only ever use once
Array.mapProcessfunction // function that I will only ever use once

Every time I want a different map I have to write a new non-generic property for the generic Array class?
>>
>>52144086
Because XNA is built on component pattern, it wouldn't make any sense to be able to inherit drawable, updatable, parent et. al classes, without having to copy-paste implementations again.
>>
>>52144346
replace "to add5 to process" with to process
add5 was a redundant example
>>
>>52144345
map takes a function as an argument though

if you're advocating not using map, which is incredibly useful for what it does, just to avoid using lambdas, then you're off your rockers mate
>>
>>52144267
>Map is a member function of an array that applies a function to every element in the array and returns the results

"map" is a function in the Array *module*, not Type.
>>
>>52144344
Nothing, except struct defaults to public and class defaults to private.

It should really be designed so that struct only allows you to create POD.
>>
>>52144379
In the example the other guy gave it was a member function

Imo it should be a member function too in f#
>>
>>52144338
Oh I see, nice
>>
>>52144378
>>52144346
all those years of writing javascript fried your brain m8
>>
>>52144247
>Good luck doing things like image manipulation without unsigned ints.
easy, java has unsigned right shift (>>>)
>>
I've been solving Codewars katas for a while now, and I had a very simplistic Node.js project to implement and test my solutions (Codewars has an absolutely horrible UI for any amount of actualy work), but the whole process of creating two files for both the solution and the test, and entering the details of the kata manually is too fucking cumbersome.

So I'm writing a Yeoman generator to do the stuff for me. It'll basically ask the slug or ID of the kata, fetch its data from Codewars API and generate everything for you. It'll even tell you the Mocha command to run it directly so you don't have to find it out yourself.
>>
>>52144391
>Imo it should be a member function too in f#
disgusting, no.
>>
I'm going insane because what I thought was sound logic is giving me absurd results.

For collision detection purposes, I need to find the "radius" of a square, or any line from the center of a square to any point on its edge.

My problem is: given a square with sides of length L, and angle [theta] between the radius and the x-axis, find x, the length of the radius.

Mathematically I know the solution should be:

x(cos([theta]) = L/2 (use algebra to solve for x from here)

Yet no matter what I do when I crunch the numbers I keep coming out with a radius greater than L, the length of a side of the square, which should be impossible.

My only thought is that maybe I'm getting a bad [theta] value. Anybody encounter something like this before?
>>
>>52142998
>>52143024
>>52143017
>>52143047
That isn't how coordinates work.
It is (x, y), not (y, x).
>>
>>52144396
What the fuck are you talking about?
You realise this is fucking static and strongly typed, and doesn't lose any performance?

Let me guess, we shouldn't have generics or templates either. We should duplicate as much code as possible.
>>
>>52144396
you haven't been clear in what you've wanted this whole time, illustrate in pseudocode what you want to accomplish

>javascript
never used it
>>
>>52144399
?
>>
>>52144414
I don't want to have to keep typing |> Array.map
>>
>>52144413
in english lad
>>
>>52144425
welcome to the /dpt/, retard.
what is a multidimensional array.
>>
>>52143016
> programming literate
> actually means cargo cult programmer
>>
>>52144437
Illustrate why I would need a lambda function instead of writing it procedurally in the same function, or failing that, utilizing another function or member function of the type i'm working with.
>>
>>52144459
Multidimensional arrays still work in (x, y) idiot.
>>
>>52144425
2d arrays are typically (y, x)

(y, x) as in (row, column)
>>
>>52144490
off yourself you fuckin' sandnigger.
>>
>>52144475
if you're function uses closed variables, then you'd have to pass those variables to every function in the chain. with a lambda you get that for free.

lambdas aren't exactly a controversial subject. you should pick up a CS book sometime, maybe one written in the past 20 years or so...
>>
>>52144448
having it inside every single Array is messy though. Utility methods that transform data types should not be part of that data type. The data types shouldn't have dependencies on the functions that transform them.
>>
>>52144448
>rewrite the map function, but modifying it for purpose for 1 specific instance JUST because you want to avoid anonymous functions

>>52144475
>still hasn't illustrated
have you ever programmed?
>map
>procedural
clearly not

>>52144490
It doesn't you idiot
>>
>>52144475
Illustrate why I would want to use a for loop instead of goto.
Illustrate why I would want to use classes instead of structs with function pointers.
Illustrate why I would want to use C instead of assembly.
>>
>>52144490
        char[][] foo = new char[2][3];
foo[0][0] = 'a';
foo[0][1] = 'b';
foo[0][2] = 'c';
foo[1][0] = 'd';
foo[1][1] = 'e';
foo[1][2] = 'f';
for(char[] line : foo) {
System.out.println(line);
}


abc
def
>>
>>52144518
I'm not him. I'm saying I'd like to be able to use arr.map(function), rather than have to keep writing arr |> Array.map function

alternatively a polymorphic map function would be nice
>>
File: output.png (31KB, 519x391px) Image search: [Google] [Yandex] [Bing]
output.png
31KB, 519x391px
So it looks like all this shit is being generated correctly for the type, but ppx_deriving is fucking up as far as I can tell, so it derives functions for all of the types in Conglomerate.Hide except for `t`. Which then means that the
let to_string = Hide.show_t
and to_json = Hide.t_of_yojson
and of_json = Hide.t_of_yojson

bit ends up with all those functions unbound and it fails to compile. Literally no clue why this is happening, because `t3_of_yojson` exists (for example). No matter what the structure of the top type ("t"), the deriver never uses it.
That said, all the code on my end works so we effectively have a full type provider.
>>
>>52144582
That's F# for you.
>>
>>52144582
Should have mentioned your issue was language-specific to be fair
>>
>>52144596
You can do polymorphism but it's a pain

static member functions can be polymorphic, and you can do other stuff too
>>
>>52144582
you can always do
open Seq

and then do
arr |> map function
>>
>>52144637
Seq.map doesn't work on arrays
>>
>>52144582
>alternatively a polymorphic map function would be nice
Seq.map
>>
>>52144637
Do you even know what "|>" does or are you just cargo culting?

"arr |> map function" is the exact same thing as "map function arr".
>>
lotta homework questions in here lately lads
>>
>>52144657
It does. It works on all collections.
>>
Is there a good Linux distro purely for programming out of the box? My current desktop isn't well suited to natively run Linux (graphics drivers) but it's more than powerful enough to VM it.

I really can't stand programming on Windows, I suppose I'll eventually have to get over it but that day is not today.
>>
>>52144676
probably some kids with last minute cramming
>>
>>52144667
>"arr |> map function" is the exact same thing as "map function arr".
no shit sherlock
>>
>>52144692
there are no good linux distros sorry
>>
>>52144676
Which is strange because it should still be Christmas break in most western countries.
>>
>>52144707
So why the fuck do you keep using it for no reason?
>>
>>52144690
Didn't realise
Does it return a sequence or the same container?
>>
is piping a meme?

If I knew how to use it with python files, it might be useful
>>
I need some form of opinion from someone about my second ever project, I'm a scrub and I need some guidance.

Would anyone at all who knows the first thing about C# and/or WPF mind looking at my project for me and giving me a dressing down about horrendous decisions. At the moment all I do is make it work, which is fine to a point but I don't want to start developing bad habits.
>>
>>52142851
>>52142851
yeah deitel and deitel are good, dunno if its that particular book but the authors r legit
>>
>>52144716
|> is for making code more readable. You can follow the order of data transformation by reading the code left to right, and top to bottom. So the code could be written like this:
[1 .. 10]
|> Seq.map ((+) 1)
|> Seq.map ((**) 2)
|> Seq.sum
|> (+) 20
|> printfn "%i"
>>
>>52144761
I can understand using it in that case but not for a one-liner.
>>
>>52144726
It accepts an IEnumerable and returns an IEnumerable.
>>
>>52144778
Why not?
>>
>>52144805
Because it's pointless and obscures the currying?
>>
>>52144415
x = (L/2)/(cos theta)
or equivalently
x = (L * cos theta)/2
Is this what you're doing?
>>
File: 1451480180582.jpg (409KB, 4288x2848px) Image search: [Google] [Yandex] [Bing]
1451480180582.jpg
409KB, 4288x2848px
>>52143016
OOP IN LOO
>>
>>52144778
It's no harm in the one liner either. It's still nice to write code that reads like:
create a list of numbers from 1 to 10
then map that to a new list with each of those numbers squared.

by writing
[1 .. 10] |> List.map ((**) 2)


In any case, it kind of idiomatic F#. And I find myself adding new steps to that sort of code pretty often, so it's nice to have the |> pattern there to start with. Though it certainly doesn't always make sense and I don't always use it. It's just nice.

>>52144812
>obscures the currying?
?
>>
>>52144415

I haven't encountered anything like it, but I believe you're right. Try manually setting up a theta value and see if it comes out correctly. If it doesn't, then maybe it is something else aside from the equation that is adding onto the value. Is everything contained within its own class? Maybe something is randomly being added on.
>>
>>52144812
If you've got an object like an array
arr |> Array.map f
breaks up the object from the function being applied
>>
>>52144822
>x = (L * cos theta)/2
should obviously be x = L / (2 * cos theta)
>>
>>52144847
Imagine somebody new to F# was writing lots of functions that looked like this:
mapAddOne arr = arr |> Array.map ((+) 1)
filterGreaterThanTwo = arr |> Array.filter ((<) 2)

Without the use of the |> operator it's easy to see that you can eta-reduce. If that's how you write idiomatic F# then that's harmful IMO.

>>52144851
See, this is your problem, you're still thinking too OOP-centrically. That's cargo cult nonsense, it's not improving your code if you're not doing something like >>52144761.
>>
>>52144931
If you use algebraic data types, you're using OOP.
An array is an object, and is still an object in FP.
>>
>>52145041
>If you use algebraic data types, you're using OOP.

wrong

fuck off
>>
>>52145041
>If you use algebraic data types, you're using OOP.
You're categorically not. Algebraic data types have no fields or methods, no encapsulation, no subtyping, and no inheritance.
>>
>>52145074
he is baiting
>>
>>52144931
>Without the use of the |> operator it's easy to see that you can eta-reduce.
I'm not following you. The |> operator makes the currying even more obvious if anything. If you know what |> does, then I'm not sure why you could be confused at all by this.
>>
working on redoing an ios app that i'm selling
>>
>>52145052
>>52145074

>inheritance
not necessary for oop

>subtyping
not necessary for oop

>encapsulation
not necessary for oop

>methods
not necessary for oop

>members
product types are this
>>
>>52145107
I'm not confused. I just can't think of a way to justify using the |> operator in cases like >>52144637 or >>52144847 that aren't a holdover from what feels comfortable and OOP-like.
>>
>>52145131
>I just can't think of a way to justify using the |> operator in cases like >>52144637 (You) or >>52144847 (You)
I explained here why they are used. What do you not understand?

>>52144761
>>52144847
>that aren't a holdover from what feels comfortable and OOP-like.
pretend OOP does not exist, then tell me why the reasons i stated for using |> are bad. In F#, nothing OOP related is happening when using the |> operator.
>>
>>52145131
there's literally nothing wrong with OOP
x |> Array.map f
shows that the right side is the function and the left side is the parameter
>>
>If you define a varying variable in a vertex shader, its value will be interpolated (perspective-correct) over the primitive being rendered and you can access the interpolated value in the fragment shader.
if you just want to render a plain solid color, can you use a shader program with no varying variable to skip the interpolation to improve performance?
>>
>>52145122
Oh, it's the "OOP is the best paradigm because I'm going to redefine OOP to include everything" guy again.

>>52145166
Okay, then, it's bad because it's more typing for the same outcome. And it makes it harder to see chances to do eta-reduction.

>>52145170
Array.map is the function. f and arr are the parameters.
>>
>>52145200
>it's bad because it's more typing for the same outcome. And it makes it harder to see chances to do eta-reduction.
yes anon, those are trade offs. So don't use it if reducing you character count by 10-20% is more important than readability. It's not forced on you, it's just an option. haskell has the same operator.
>>
>>52145200
>>OOP includes everything
object oriented programming
that means programming with objects
not programming with objects that have methods and encapsulation and can inherit"

>more typing for the same outcome
It's clearer.

>ar..
Array.map f is itself a function, and it's the function being applied to arr
That's the whole point.
>>
File: 1383455083293.jpg (35KB, 419x604px) Image search: [Google] [Yandex] [Bing]
1383455083293.jpg
35KB, 419x604px
Aced my school's intro to programming class (it was almost insultingly slow, the codeacademy course covered more), but I'm unsure if I'll be able to keep going to the school for financial reasons.

What are some good learning resources for beginners that know some fundamentals?

As far as long - term goals go, I'm looking more at the software/application engineering/development side of things.

The class was in Python, but I know a smidge of C# due to a few attempts to fumble around in Unity.
>>
>>52144822
>>52144849

Thanks for the feedback guys,

I tried punching in a manual theta of Pi/4 (45 degrees) and I got a consistent hypotenuse, so I have to be getting a wonky theta of some kind.

In Java, I'm trying to use Math.atan2(x,y), where x and y are the coordinates of the center of a square relative to the center of some circle (0,0) it's being checked against for whether or not the two are colliding. If the sum of the circle's radius and the square's "radius" is greater than the actual distance between their centers, then a collision is detected.

The weird part is that I tried using sin() instead of cos() and got the correct "radius" for the square, so maybe the test coordinates I was using had a square that was further up away from the circle than it was to the right of it than I thought.

Anyway thanks again, I guess I'll keep working on it.
>>
>>52145243
>yes anon, those are trade offs
Trade-off implies gain and loss, I'm only seeing losses here.

>haskell has the same operator
That it does, but it's only used in cases like >>52144761, which I already stated I have no problem with.

>>52145244
>that means programming with objects
An object has fields and/or methods. Algebraic data types have neither.

>It's clearer.
Why?

I only ever see it used in that pointless way with F#, which is a functional language with some OOP heritage. So it seems to me like it's just OOP cargo cultism.
>>
>>52145281
learn Haskell
>>
>>52145244
>object oriented programming
>that means programming with objects
>not programming with objects that have methods and encapsulation and can inherit"
no anon, you and me both know that the term "object oriented programming" is meaningless because it has been used in so many contrasting contexts that it has completly lost its meaning

seriously, i'm not even sure anymore how often people on /dpt/ argued the semantics of OOP, which is even more pointless than discussing semantics because there's no definite or even approximately correct answer and people just throw their own definition of OOP as defined by their set of experiences with OOP at others and others throw their pile of shit back

you are all fucking stupid
>>
>>52145299
>I'm only seeing losses here.
read this again >>52144761. You have not made clear why the points I made here not not positive things in your opinion.
>>
>>52145330
I'm talking about the specific cases in >>52144637 and >>52144847. I have already made this clear that I think the usage in >>52144761 is acceptable.
>>
>>52145281
>>52145307
Shouldn't the SICP always be the first recommendation though for anyone who wants to become a real programmer?

https://mitpress.mit.edu/sicp/full-text/book/book.html
>>
>>52145348
I picked up SICP when i first fell for the programming meme, I didn't understand shit.
I know C pretty well now, I still don't understand anything in SICP.
>>
>>52145299
An object has fields.
Product types literally have fields.

I said earlier that it shows that the right side is the function.
Plus, if you've got a match expression or a pattern or something where you can't just use the input binding as the parameter, it shows what's going in to the function.
>>
>>52145345
so what about >>52144847 ? Why do you think there is nothing positive about this?
>>
>>52145322
If you think programming with objects in mind is a poor definition of OOP, that's not my fault
>>
>>52145322
>the term "object oriented programming" is meaningless because it has been used in so many contrasting contexts that it has completly lost its meaning
your assburger is showing
>>
>>52145122
idiot
>>
>>52145371
>Product types literally have fields.
They don't. They have projections, not named fields.

>if you've got a match expression or a pattern or something where you can't just use the input binding as the parameter
What?

>>52145376
Because it's the same fucking thing as
List.map ((**) 2) [1..10]

except it mucks up the order of parameters to make it look like you're calling a "method" of an "object", adds extra typing, and makes eta reduction less obvious.
>>
>>52145384
it is a poor definition because it does not define "object", which suffers this exact issue
fuck off, i don't give a shit about your or one of the other 20,000 definitions for OOP
>>
>>52145409
arguing about something very precise within something very vague is pointless
>>
>>52145368

What people don't tell you is that SICP assumes you have a way of working in Scheme set up and ready to go. That in of itself took me searching for tutorials on just setting up for it.
>>
>>52145436
>except it mucks up the order of parameters to make it look like you're calling a "method" of an "object", adds extra typing, and makes eta reduction less obvious.
Yes you said all that, but I also listed some advantages, which you are claiming are not advantages at all. I'm asking why you think that is so.
>>
>>52145469
I don't know, but it seems like all the advantages except >>52144761 are completely preference-based while all the disadvantages are objective.

This isn't going anywhere, though. If that's "idiomatic F#" then keep doing it because that's what people will expect, I guess.
>>
>>52143793
unsigned is easy (N value bits, mod 2^N-1 on overflow), it's signed that's tricky in C.
>>
>>52145348
>>52145368
>>52145463
Beginner anon here.
I've heard a lot of mixed things about SICP- namely, that it's an incredibly helpful book, but is relatively impenetrable for those who are just getting started.

(I've also found out that MIT themselves replaced the book with something else that teaches Python instead in their own intro prog course.)
>>
Daily reminder that if your language of choice is not on this list you should probably give up and kill yourself:
- C++
- C#
- Lua
- Python
- Elixir
- Haskell
- Bash
- Clojure
- D
>>
>>52145502
>You're using |> because of cargo cultism
>there is no advantage to using them like you do
why do you think that is?
>I don't know
Got it. Thanks for the enlightening conversation anon.
>>
>>52145529
Ok can you recommend any brands of rope
>>
>>52145529
What if my language of choice doesn't exist yet?
>>
>>52145529
i don't see javascript or php on there
>>
>>52145529
>- C++
Over complicated bloated rotting dogshit
>- C#
MS botnet
>- Lua
dynamic typing
>- Python
dynamic typing
>- Elixir
dynamic typing
>- Haskell
unusable cultist bullshit bullshit
>- Bash
lol
>- Clojure
dynamic typing
>- D
abandonware
>>
>>52145586
You put your life on hold.
>>
>>52145586
Then it's not on the list, is it?
>>
>>52145599
>Dynamic typing is always bad
>>
File: watdo.png (6KB, 816x460px) Image search: [Google] [Yandex] [Bing]
watdo.png
6KB, 816x460px
How do I do this shit in Python?
>>
>>52145657
Exclusively dynamic typing is bad. Very bad.
>>
>>52145657
you learn fast anon
>>
>>52145612
It will be on the list when it's done, I promise.
>>
>>52145599
>>- D
>abandonware

LIES! DAMNED LIES
>>
>>52145661
1 write lock 3 read locks
>>
>>52145661
https://docs.python.org/2/library/multiprocessing.html#sharing-state-between-processes
>>
>>52143118
Thanks, stolen and changed it to fit my needs
>>
>>52145695
>systems programming language
>gc by default
>>
>>52145661
A write semaphore and a read semaphore.
>>
>>52145661
https://docs.python.org/2/library/threading.html#condition-objects
>>
>>52145681
Dynamic typing has its purpose, if your writing for speed and/or safety then you shouldn't be using a strictly dynamically typed language anyway, shitting on something for not doing something its not supposed to is retarded
>>
>>52145730
>Dynamic typing has its purpose
It doesn't tho
>>
Is multithreading a meme?
>>
What kind of thread synchronization would you guys recommend for this kind of workload:

Start up N worker threads (N = number of cores)
They start out idle/waiting.
while forever:
main thread says, "ok guys, go do this task"
------ sync point
N threads working...
------ sync point
all finished, display result, keep looping (supposed to be real time, or at least keep displaying things continuously)
>>
>>52145730
What is dynamic typing's purpose?
>>
>>52145754
Yes. Multiple /dpt/ threads should be punishable by death.
>>
>>52145696
>>52145697
>>52145719

Why can't a language implement flagging a variable with something like... state or unscoped or something, and then just make it available for fucking with in any thread.
>>
>>52145767
Try to think about implementing this and you may discover the answers.
>>
>>52145760
Having dynamic types.
>>
>>52145767
multi-processing wasn't part of python's dna to begin with. if you want a language that does look into erlang
>>
>>52145750
>>52145760

nah, your right, instead of quickly prototyping code i should spend ten times the effort fucking around in C only to find out what i want isint practical.
>>
>>52145784
>you can either have dynamic typing or you can have C
Wow.
>>
>>52145767

int x;
auto t = std::thread([&x](){ x++; });
t.join()
>>
>>52145784
c isn't the opposite of dynamically typed 2bh
>>
>>52145791
Did you mean std::atomic<int> x?

>>52145767
You can access the variable from any thread just fine, the problem is that when you have multiple readers/writers, you will run into data race condition, and as such, you need either atomic operations or mutex locking.
>>
>>52145779

On init, pick a location in which memory to store?
Read/Write ops go to that location?
During compile time all references of the variable are set to point to wherever that address is?
>>
>>52145790
C is the defacto goto example for static typing
stop splitting hairs and make a rebuttal or stop posting
>>
>>52145784
Thanks for the non answer.
>>
>>52145806
>2bh
Kill yourself desu
>>
>>52145813
He didn't say a thread safe variable
>>
>>52145820
the answer was prototyping, come on man.
>>
>>52145816
>C is the defacto goto example for static typing
holy shit. Just.. stop man.

>static typing is bad because C is not productive to program in
>>
>>52145816
no, Haskell and Ocaml are the goto examples for static typing
>>
>>52145825
What else could he mean, then? He can access global variables from threaded functions just fine in Python, so I doubt it was his question.
>>
>>52145816
more like C is the only static typed language you know
>>
>>52145813
But with one writer and many readers, for whom it doesn't matter if they miss a few values before they get changed, would I not be fine?
>>
>>52145849
I didn't know, he said "... available for fucking with in any thread.".
>>
>>52145855
In that case yeah, you're fine.
>>
Contracts+dynamic typing are supreme, at least in theory. If you are relaxed about performance enough to use dynamic typing, you wont mind contracts, it simply makes the same check closer to the erroneous bit of code ; it can be made to check even more aggressively than static typing, or not, it's up to you ; it tells you clearly which module fucked up... sorry for shilling Racket, but try it, you'll love it!
>>
Why the hate on dynamic typing?
>>
>>52145834
i didnt say static typing was bad, i didnt say dynamic typing was good, i said: THEY HAVE THEIR OWN PURPOSES.

faggots like >>52145599
are the black and white only shitheads that make this kind of argument even exist

dynamic is awesome for quick little bullshit ex. python

static is awesome for safety and speed ex. C

is compromise something /dpt/ has no concept of?
>>
>>52145880
Anyways, which of the python mods should i use then? Semaphores?
>>
>>52145908
>relaxed about performance
extremely fucking relaxed

plus, contracts exist in many static languages
even C++ is gonna get them
and if you mix that with type inference (like haskell, ocaml or f#) you basically get all the benefits
>>
>>52145922
C isn't safe at all lol
>>
>>52145922
>i didnt say static typing was bad, i didn't say dynamic typing was good
You said dynamic typing has a purpose, it doesn't.

>dynamic is awesome for quick little bullshit ex. python
python is good in spite of being dynamically typed. F# is better than python for everything python is used for.

>static is awesome for safety and speed ex. C
it's useful for everything
>>
>>52145922
>static is awesome for safety... ex. C
dynamic typing advocates everyone
>>
>>52145661
> How do I do this shit in Python?

If that's literally all you need, then you can use a global variable. Alternatively:

class MyThread(Thread):
def __init__(self, var, **kwargs):
self.var = var
Thread.__init__(self, **kwargs)

class Variable(object):
def __init__(self):
self.value = None
def set(self, value):
self.value = value
def get(self):
return self.value

var = Variable()
t1 = MyThread(var)
t2 = MyThread(var)
t3 = MyThread(var)


"var" is an object so that it can be passed to the MyThread constructor by reference rather than by value.

The writer uses the .set() method, the readers use the .get() method.

Or you could just use a one-element list rather than creating a specific class.
>>
>>52145985
>tumblr
shitposters everyone

>>52145959
>dynamic typing has no purpose
>python is good in spite of it
>MicroSoft™ F#™ is better

jesus, the sperg here is amazing
you faggots really will argue about anything
>>
>>52145945
Contracts in C++? I just jizzed! Source?
>>
>>52146061
>MicroSoft™ F#™ is better
shitposters everyone

also F# isn't MS, Visual F# is

fuck off already
>>
>>52146061
You're right. Microsoft F# IS better.
>>
>>52146061
>discussing the virtues of different programming languages makes you a sperg
Go fuck your girlfreind you fucking normie.
>>
>>52146064
... that's what concepts are
they may or may not make it into C++17
>>
>>52146071
>F# isn't MS
I think you'll find it is anon
>>
QUICK; POST HOW TO REVERSE A STRING IN YOUR LANGUAGE OF CHOICE!
>>
>>52146072
अच्छा काम Pajeet , rubles के अपने खाते में प्रस्तुत किया गया है ।
>>
Daily reminder that .NET, C# and F# are open source

Daily reminder that Microsoft and F# have saved programming forever
>>
>>52145922
My personal experience is that dynamic typing does not assist in prototyping. On the contrary, static languages like Haskell are much more flexible when prototyping because the type system lets me make sweeping changes without worry. Python was my first language and it has fantastic syntax but I never use it because I can never tell the type of anything.

Could you provide a specific example where it is easier to formulate an idea in a dynamicly typed language or where static typing gets in the way?
>>
>>52146114
not just open sourced. MIT licenced. Not that those scum GPL licences.
>>
>>52146105
let rev = function
| x :: xs -> rev xs :: x
| [] -> []
>>
>>52146105
char *strrev(char *str)
{
int length = strlen(str) - 1; /* omit \0 */
char *tmp = malloc(length);
int a = length;
int b = 0;
while (a >= 0 && b <= length)
{
strncpy(tmp+b, str+a, sizeof(char));
a--;
b++;
}
return tmp;
}
>>
>>52146156
let rec*
also i had whitespace before the |s but I didn't use
>>
>>52146105
string[::-1]
>>
>>52146136
http://danluu.com/empirical-pl/
>>
>>52146167
Why the fuck does strlen include the terminator?
>>
>>52146167
this is disgusting
>>
>>52146215
> The strlen() function calculates the length of the string s, excluding the terminating null byte ('\0').
anon fucked up
>>
>>52146215
It doesn't.
>>
>>52146215
It doesn't.
I wrote that my first day writing C.
Here's a better one.
void strrev(char *str)
{
int i = strlen(str) - 1;
int j = 0;
register char c;
while (i > j)
{
c = str[i];
str[i] = str[j];
str[j] = c;
j++;
i--;
}
}


>inb4 XOR swap
>>
>>52146196
What was the point of that link anon?
>>
>>52146105
string = string:reverse()
>>
>>52146105
function reverse($str) {
$out = "";
for ($i = strlen($str)-1; $i >= 0; $i--) {
$out .= $str{$i};
}
return $out;
}
>>
>>52146346
disgusting OOP cargo cult horrible worst kill it with fire
>>
>>52146304
Too much superfluous crap.
void strrev(char *str)
{
for (char *ptr = str + strlen(str) - 1; ptr > str; --ptr, ++str) {
char tmp = *str;
*str = *ptr;
*ptr = tmp;
}
}
>>
NEW THREAD

>>52146363
>>
>>52146355
What wrong with it? Why do you keep calling everything you don't like "cargo cult"? At least establish what you don't like about it.
>>
>>52146381
3 1 0
1 # 1
0 1 3
>>
>>52146381
Don't use this thread until the current one is auto saging.

Don't create a new thread if this one doesn't get deleted by that time.
>>
>>52146381
Dumbass
>>
>>52146377
Mine is self-documenting.
Yours looks like code golf.
Plus, you're calling strlen on every iteration of the loop.
If that string is super fucking long, your time complexity just went 3x longer than it should.
>>
>>52146355
>Using standard language features in a conventional way
>Horrible cargo cult programming

...?
>>
>>52146156
>>52146167
Lousy, inefficent and long
>>52146177
Python wins again!
>>
>>52146304
>register

Wow.
>>
>>52146415
>Yours looks like code golf.
Only if you're retarded. It's just using pointer arithmetic instead of array syntax.
>Plus, you're calling strlen on every iteration of the loop.
No, the first part of the for loop is only called once.
>If that string is super fucking long, your time complexity just went 3x longer than it should.
It's still O(n), just like the other.
>>
anyone here capable at reverse engineering

i really just want to be able to find out how to call an internal function in a program through memory, preferably with c#, but finding the address is a fucking bummer
>>
>>52146429
>inefficient
prove it
>>
>>52146105
revstr:
mov al, [esi+ecx-1]
stosb
loop revstr
ret
87code]
actually this one is better.
>>
>>52146448
>It's still O(n)

Algorithm speed doesn't matter if your particular implementation is shit.
>>
>>52146456
Can you run your code inside the program's process and is it a .NET program?

If yes, use Reflection
If no, then this will be extremely complicated
>>
>>52146448
>>52146545

struct reversable_string
{
bool reversed;
std::string string;
}

O(1) reversal
>>
>>52146480
F#
let revString = str.toCharArray() |> Array.rev |> String
>>
>>52146545
What exactly is inefficient about my strrev implementation?
The worst thing it does is a call to strlen, but that's unavoidable for this problem.
>>
>>52146582

He was wrong and now he's memeing. Not to mention a call to strlen in the condition would PROBABLY get hoisted.
>>
>>52146090
I don't consider that to be the case, concepts are statically enforced constraints on type parameters, contracts are runtime-enforced constraints on arguments or return types or variable values. They are a way to easily and efficiently assert some pre- and postconditions. Racket's stdlib mostly uses them as a way to emulate static typing, sadly. Concepts fit C++ better because C++ favors compile time specialisation over run time polymorphism and does it well, whereas dynamic languages do the opposite. C++ class invariants are something to consider too, but here is an example which cross class boundaries:
- stack has push and pop method
- pop's contract : before the call, stack must have length n>0; after call it has length n-1
- push's contract: length goes +1
Here comes client code: push; pop
At runtime, the contract system can: check that push effectively increments length, having done that, infer that pop is safe to call, check pop's behavior, and finally, throw an error is pop is called too many times. Advantages are: it rekts both the class and its user, without the function bodies caring about it, with the minimal amount of checks, and without any undefined behavior. There is a bit of pressure on the runtime, but how convenient during development!
>>
>>52145296
There isn't a single equation to get what you want, you need to check which eighth of the square you're in and use the appropriate equation. Plot x vs theta over 2pi and you'll see the problem. Your equation will fail for theta > pi/4 .
>>
>>52146548
>Can you run your code inside the program's process and is it a .NET program?

i'm assuming that's what i'd have to do anyway by getting a process handle and using writeprocessmemory, its not a .net program though

the progress i've made is that i have to create a set of assembly instructions (i found this by googling) that correspond to setting the parameters to registers and an address to the function (i have a suitable parameter for it i think, i cant actually find the function though), and that i have to write to memory my set of instructions and then call it

i've run the program attached to a debugger, set a breakpoint to hardware write on byte to what i think is the initial point of the function, searched through and found maybe a few addresses that looks like they could be correct, but running my code always crashes the program and i don't know if its either my code that's causing the crash or if im getting the wrong addresses

i've kind of hit a brick wall
>>
File: maybe monad.png (34KB, 738x483px) Image search: [Google] [Yandex] [Bing]
maybe monad.png
34KB, 738x483px
>>52146801

Use monads (or in other languages, match expressions) and higher order functions to wrap the handling you want with the function

the Maybe monad and option types are a great example of this (pic related)
>>
>>52146904
("invalid input" is an example of invalid input, not an error message)
>>
>>52144256
> try doing this type of code in C++
void configureSomeBs()
{
static int numberOfClicks = 0;
App.onClick = [&]() {
++numberOfClicks;
};

App.onQuit = [&]() {
cout << "you clicked " << numberOfClicks << " times!";
};
}


What's the problem?
>>
>>52146801
>>52146904
This can be checked at compile-time without any exceptions, run-time checks, "option types", or memads.
>>52146904
Memads destroy the natural structure of the entire language.
>>
>>52146965
>Memads destroy the natural structure of the entire language.
?
>>
Why can you only pass an fstream to a function through reference in C++? Why doesn't pass by value work?

Not that it matters much. Just wondering.
>>
>>52147677
Because it's not copyable

What would copying a stream do? Open the same file?
>>
>>52147766
Oh, duh. Thanks.
>>
>>52146007
def killyour(self)
>>
>>52145816
no it isn't you tard

java is the best example for static + strong typing
>>
>>52146840
Yeah, I thought atan2() covered all of those cases but it looks like I didn't the details of it close enough.

https://en.wikipedia.org/wiki/Atan2

I guess I'll try going back to line intersecting circles for each side of the square.
Thread replies: 336
Thread images: 32
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y / ] [Home]

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
If a post contains illegal content, please click on its [Report] button and follow the instructions.
This is a 4chan archive - all of the content originated from them. If you need information for a Poster - you need to contact them.
This website shows only archived content and is not affiliated with 4chan in any way.
If you like this website please support us by donating with Bitcoin at 1XVgDnu36zCj97gLdeSwHMdiJaBkqhtMK