[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: 380
Thread images: 44

File: 1450727871328.jpg (46KB, 306x523px) Image search: [Google]
1450727871328.jpg
46KB, 306x523px
Previous thread: >>52649919

OBJECT-ORIENTED PROGRAMMING ÜBERMENSCH

NO MULTIPLE CLASS INHERITANCE

STATIC TYPING

RESTRICTED TYPE INFERENCE

NO USER-DEFINED OPERATOR OVERLOADING

PASS-BY-VALUE ONLY

JAVA ÜBER ALLES

SIEG HEIL
>>
Daily reminder that mutable variables are just a function of time

a pure function
>>
J A V A
A
V
A
>>
Threadly reminder that OCaml is the only good programming language.
>>
File: 1443623959566.jpg (39KB, 510x624px) Image search: [Google]
1443623959566.jpg
39KB, 510x624px
>>52652503
>NO USER-DEFINED OPERATOR OVERLOADING

That was always dumb. Just make your own function and leave the operators alone.
>>
>>52652503
import faggot
print op is a faggot
goto kill you're self
>>
>>52652561

>user defined operators are bad
user defined functions are fine<
>>
>>52652519
That's deep
>>
>>52652593
>unused import
>print doesn't work
>gotos in python
>kill
>you're self
>>
dpt help I need a word that means 'in order' or 'front to back'. Like the opposite of 'reversed'

Its for an option I have on a list. The list can be normal or reversed... dunno what to call the two options though
>>
>>52652620
>only python has import and print
>>
>>52652624
1.) faggot
2.) straight
>>
>>52652503
>single inheritance
>static typing
>potato-powered inference
>no overloading
>pass-by-value

>literally the sum of everything that is wrong in ALGOL-family "OOP languages
>mfw Common Lisp Master Race
>muh CLOS
>muh multiple inheritance
>muh dynamic typing
>muh inferences
>muh generic functions
>muh references

COMMON LISP ÜBER ALLES, DU LUMPENPROLETAR
>>
>>52652646
yes.
>>
>>52652624
Sorted
>>
>>52652624
monotonic is probably not what you're looking for but i thought i'd mention it anyway
>>
File: mfw.jpg (11KB, 200x200px) Image search: [Google]
mfw.jpg
11KB, 200x200px
>>52652624
>crossword puzzles literally make you a better programmer
>>
import classname as c

i fucking hate when people do this, especially when the original classname was something short and simple

we're not typing on mechanical keyboards that need ten pounds of pressure per keypress anymore, you don't need to shorten everything
>>
>>52652624
ascending vs descending?
>>
>>52652713
>not knowing that one guy that thinks mechanical keyboards are better
>>
>>52652503
img soruce?
>>
>>52652653
>literally the sum of everything that is wrong in smalltalk-family "OOP languages
>mfw OCaml Master Race
>muh Object
>muh multiple inheritance
>muh static, capability-based typing
>muh inferences
>muh row polymorphism AND column polyphormism
>muh references
>>
>>52652503
Fuck... Now that's a real woman... 10/10 would marry.
>>
>>52652561
>can't + vectors because some babbies might abuse them
>>
>>52652738
could you pls explain what row and column polymorphism are for us lesser plebs
>>
So why isn't it spelled like JΛVΛ?

Because no one who made java is that creative
>>
Why do people argue about inane languages differences? Don't you guys have better uses of your time like learning new languages or things?

Just use whatever is best for the job.
>>
>>52652738
>claims Common Lisp has everything wrong
>proceeds to list almost all of the capabilities of Common Lisp as right

dat column polimorphism tho
>>
>>52652808
>not arguing about programming on the internet

get a life loser
>>
>>52652766
Row polymorphism is when any class with the same minimal set of requirements implemented can be used. For example, if you call some_instance.x, then if the inferred type is of the form Class{x : some_type; ...}, that's row polymorphism.

Column polymorphism is "classical" polymorphism. If class X is a descendent of class Y, then class X can be used anywhere class Y is required.
>>
>>52652808
>static vs dynamic typing
>inane
kill yourself
>>
>Pass by value only
>Java
But in Java, objects are passed by pointer. You can invoke a method on an object parameter that would mutate the object, and have that mutation stay after the end of the function call. In C++, you have explicit control over whether objects are copied, passed by reference, or by immutable reference. Rust is the same way, but we don't call it object oriented.
>>
>>52652807
√∧∨∧
>>
>>52652834
the reference is the value
>>
Why can't I into OOP? Should I just switch to C++
>>
>>52652827
thank you

when C++ gets concepts it'll get row polymorphism (well in a more formal way than just guessing)
>>
>>52652808
Because they have nothing else to do.
Certainly not stuff like actually programming
>>
>>52652834
As expected of a tripfag: being retarded is the only thing they know to do.
>>
Can we just take a moment to appreciate how absolutely perfect the women in the OP is
>>
>>52652848
see https://archive.rebeccablacktech.com/g/thread/S52476540#p52479462
>>
>>52652847

So Java can't say it passes objects by value. It passes object pointers by value.
>>
>>52652894
pointers are objects
>>
>>52652894
there is no object variable. the variables are object references. you pass those as values, you don't pass a reference to the object reference.

http://javadude.com/articles/passbyvalue.htm
>>
Is functional programming a meme?
>>
>>52652938
Programming is a meme
>>
File: maxresdefault.jpg (74KB, 1440x1080px) Image search: [Google]
maxresdefault.jpg
74KB, 1440x1080px
>>52652873
>can only isolate code in OOP
>>
for example

Nigger nigger = new BitchNigger();
Nigger bitchNigger = nigger;
kill(nigger);
assert(nigger == bitchNigger);
>>
>>52652925

>There is no object variable
The problem with Java in a nutshell.
>>
>>52652519
What happens at a certain time in the future is not deterministic.
>>
>>52652716
Yeah I like that
thanks anon
>>
>>52652938
You're a meme.
>>
>>52652977
Prove it, faggot
>>
File: thiskillsthekiko.jpg (4KB, 125x124px) Image search: [Google]
thiskillsthekiko.jpg
4KB, 125x124px
Let me preface this by saying I'm a complete and utter dingus.

I do have a Neopets-tier understanding of html, but that's about it.

I have an idea for a website, but I'm not really sure where to start.

I want to make one of those charity websites with the one click to donate button, but have one button donate for multiple causes.

That, and have it so petitions are way easier to fill out and require less datamining and no spam emails.

pls no bully
>>
>>52652938
yes

pure FP fags will tell you that state isn't state if you pass it as function I/O
>>
>>52652998
GET THE FUCK OUT YOU FUCKING WEB DEV WANNABE
REEEEEEEEEEEEEEEEEEEEEEEEEE
>>
>>52652998
>>>/g/wdg
>>
>>52652503
Why wont this code replace every line starting with "var"???

a = a.replaceAll("^var", "");
>>
>>52652998
Use OCaml.
>>
>>52653020
>>52653035
Sorry, wrong thread.

>>52653100
I'll take a look at it, thanks for the recommendation!
>>
Guys, if I wanted to make something like a synth, what should I know?
I'm thinking about using this as an opportunity to learn C++, anyone knows any good resources for writing synths?
>>
>>52652690
>it take longer to think of a decent function name than it does to write the function
Just
>>
relatively speaking how hard is it to maintain/setup a server on a raspberry pi?
>>
>>52653176
for music theory i can recommend the video series
>TTC - How Music and Mathematics Relate

a few of the videos were somewhat off-topic for what i wanted but still a bit interesting

i'm also interested in synthesizing music and i haven't been able to find much useful information

you can try taking a pure sine wave and multiplying it with a square wave of half the frequency or a saw wave of the same frequency to get a very basic sound using ring modulation. listen to it and plot the spectrum of the recording in audacity to check out the harmonic frequencies
>>
>>52653204
Ask your SJW overlords on >>>/reddit/
>>
Where would I find the regular unix lint tool? There's splint but I don't want to litter my code /*@@*/ all over the place.
>>
>>52653237
>harmonic frequencies
harmonic overtones i mean
>>
>>52652525
>>52651139
Try interfacing with libs made in any other fucking language.

Char is (in a sane language) unsigned so you can make full use of ASCII or whatever encoding you like for byte buffers.

The lack of such a F U N D A M E N T A L feature in Java to makes things "simpler" means you are forced to fucking bitshift and cast on a per byte basis, exactly the kind of thing you want to avoid in a high level language.
This isn't just a case of "muh memory" and using smaller types to save space, the JNI doesn't give you a fucking choice in the matter, block data is moved around in byte buffers. SIGNED byte buffers, whether you want them or not.
>>
Array1=(int*)malloc(5*sizeof(int));

i get an error when i free(Array1), however it doesnt happen if i change 5 to 10 or something else why does this happen?
>>
>>52653344
just use a native ByteBuffer (literally a pointer to a malloced buffer), you shouldn't need to operate on a buffer in java anyway, you can just use a JNI method for that
>>
>>52653365
Please learn how to ask questions. It'll do you a lot of good.
>>
>>52653344
>char
>unsigned
>in sane languages
Guess C is insane then. Well, not like it ain't but.
>>
>>52653237
I know a fair bit of music theory, but how does it help in making a synth?
For example, how would I go for making just a sine wave? Should I write something that returns me samples continuously? And how to make these numbers into sound? And what about things like filters? I'd like to know if there was something to guide me there
>>
>>52653420
>JNI
Nobody wants an aneurism. Do you?
>>
>>52653365
'code is kill'
'no'
>>
>>52653365
>not ocaml
Found your problem!
>>
>>52652950
but it is the most sane way to do it
>>
>>52653449
>>52653466
My question is fine.
After doing the malloc I posted, at some point I do free(Array1); and I get crash on run.
If I change that 5 on malloc to something like 10 or 9 or whatever, there's no problem on run.
>>
>>52653420
>you shouldn't need to operate on a buffer in java anyway

Who are you to tell people what they should or shouldn't need to use?

>just use a native ByteBuffer
That's literally what I said I've been doing, the problem is java has no fucking way to store 8-bit values unsigned.
You have to bitshift and cast everything up into an int array.

Then if you want to send anything back to the native lib, you're gonna do the same thing in reverse.

Making things "simple" by lacking basic features and forcing people to do menial tasks by hand is not actually simple, its retarded.

>>52653452
It can default to unsigned, implementation dependant. If you know you're gonna use values <0 or >127 you have to specify signed or unsigned.
>>
>>52653527
'what is crash?'
'no'
>>
>>52653533
Well you don't """have""" to, but enjoy your undefined behaviour if you don't.
>>
>>52653237
scratch that

for a 440 Hz sound use a 220 Hz sine * 220 Hz square or 440 Hz sine * 440 Hz sawtooth

>>52653457
use the sin function or a sine wave table lookup function. like if you have a 44100 Hz sample rate, if you increment t by 0.01/(2*pi) for each sample then sin(t)*volume will give you a 441 sine wave. use something like opensl so you have something to write samples to.
>>
>>52653533
lol k tard i'm not here to tend to your silly little issues
>>
>>52653344
http://stackoverflow.com/questions/16809009/using-char-as-an-unsigned-16-bit-value-in-java
>>
>>52653578
>Accessing block data from native language through JNI
>"""Silly little issue"""

>>52653660
Yes you can use bitmasks, but isn't Java supposed to jest werk™?

All these fluff helper methods, but something as simple as accessing native memory is made convoluted because "nobody needs unsigned bytes".
>>
>>52653713
how is it remotely difficult to do (b & 0xFF)? are you the same butthurt retarded faggot that's been whining about this for literally like a year or more?
>>
>>52653204
Shitty idea in terms of maintainance because bumping into it could dislodge the AC cable.
>>
>>52653732
>>52653713
what are you even using the bytes for and if you're already getting the bytes from JNI why can't you use JNI to process them?
>>
>>52653750
>>52653713
you have to admit that this is really an edgy use case and the solution is simple.

high-level languages don't need unsigned bytes if they have two's complement signed bytes.
>>
File: CoputerSC.png (546KB, 873x573px) Image search: [Google]
CoputerSC.png
546KB, 873x573px
https://www.youtube.com/watch?v=5jmN_tBS0t4

what do you think of this /g/ ?

tl;dw:
computer science is boring but you need to major in it for the money
>>
>>52653793
fucktards, fucktards everywhere
>>
>>52653793
>computer science is boring
Not to everyone.

Admittedly, it is boring to the average male, and even more boring to the average female,
>>
>>52652653
>ALGOL-family "OOP languages
OOP in ALGOL-family languages is primarily about coroutines and message-passing concurrency (Simula, BETA, Ada).

Lisp shills can't seem to understand concurrency. It reminds me of the time when they read up on the Actor model, which is all about concurrency, and created Scheme, which has no concurrency at all.
>>
>>52653793
>bitch so dumb, she think CS is programming
Ayo
>>
>>52653793
Retarded, if you find it boring and only do it for the money gtfo
>>
>>52653839
>scheme
>no concurrency
>actor model
>related to scheme
>lisp
>not the paragon of proper concurrency
You're hilarious, kiddo.
>>
>>52653309
kill yourself idiot. you need to mask off individual bytes anyway, just that the compiler does it for you implicitly. and the bit representation is exactly the same.
>>
Can anyone help me to install the SDL- and SDL_mixer libraries and use them?
>>
>>52653843
i don't. i'm still in high school and CS subjects are already my favourite
>>52653793
also says CS doesn't require math
>>
>>52653793
everyone please downvote this fucktarded video
>>
>>52653732
It's not difficult, but it's low level. Everything else has a layer of abstraction, so why not this?

>>52653750
>>52653779
>this is really an edgy use case
So what, the only argument I've seen for Java not having unsigned types is "nobody needs them". Clearly people do on the odd occasion, so why restrict them?
>>
File: 134257380020.jpg (34KB, 288x499px) Image search: [Google]
134257380020.jpg
34KB, 288x499px
>Making something
>Want to use a JSON API
>It's JSONP
>That's fine, I can work with that
>No documentation
>>
>>52653968
It's Javafags' arguments for everything
>Why doesn't Java gave X
>lol who needs X
>>
>>52653865
>Java is a high level language :^)
>Except when it makes you go low level due to baseless restrictions
>>
>>52654015
*have
>>
>>52653985
Fuck it, I'm done with this project, good job IMDb API.

Go fuck yourself.
>>
>>52653968
TELL ME YOUR USE CASE RETARD I BET IT'S RETARDED AS SHIT AND TOP KEK AT BEING TOO LAZY TO TYPE (b & 0xFF) AND YOU *ARE* IN FACT DOING A "LOW LEVEL" PART OF JAVA BY USING JNI SO FUCKING KILL YOURSELF RETARD

>>52654017
>& 0xFF is too difficult to me and a high level language should cater to my specific needs and create a whole type just for me which i don't even need but i demand it because i'm special

OK I'M SURE THE JAVA DESIGNERS WILL HEED YOUR REQUEST... NOT

AHAHAHAHAHA RETARD
>>
>>52652503
>OOP masterrace
functional is better
>Java
kek , no
>sieg heil

yes
>>
>>52654051
What problems are you having?

What's so hard about reading JSON into data objects?
>>
>>52654148
>No documentation

They want me to sit here reverse engineering a URL construction method and then guessing what data I'll be served from different queries to then create a data object for each type of query.

For an application that is only for the practice, I don't have any plans to actually use the damn thing even.
>>
>tfw finally got around to vimtutor
God damn, I can see why people love vim so much. Any recommended extensions, specifically for C++?
>>
File: djNzA2Q.png (72KB, 732x841px) Image search: [Google]
djNzA2Q.png
72KB, 732x841px
>>52654198
Have you considered using http://www.omdbapi.com/ instead?
>>
>>52654221
The only plugin I really use is ctrlp. https://github.com/ctrlpvim/ctrlp.vim
>>
>>52654251
Yeah but the whole "We're in beta give us money if you want to request posters" thing put me off, mainly because the posters thing was what I was most interested in.
>>
File: convex_or_concave.webm (1MB, 720x720px) Image search: [Google]
convex_or_concave.webm
1MB, 720x720px
Ask your favorite programming literate anything.

>>52654126
oop and functional are not exclusive to each other
>>
People that can't program always blame the language.
>>
>>52654287
i can't program and i never blame the language desu but i know what you mean
>>
>>52654287
yes like this insufferable faggot: >>52653968

he literally doesn't need unsigned bytes when he has two's complement signed bytes with the exact same bit representation, and he can always operate on the native buffer with his native unsigned chars in native code anyway.
>>
What's the best modern C resource to learn from, if I already know how to program?
>K&R is boring and slow
>>
>>52654071
In the first post I explained that I was bitmasking (and casting) to get around the issue.
I've repeated multiple times that I already have the "solution" to the problem, but that it seems like a dirty hack and really there should be an layer of abstraction around this.
Instead, all you faggots can reply with is "HURR JUST USE & 0xFF".

Use case doesn't really matter, byte buffer comes in, java thinks it's signed but it's not, data needs to be offset (absolute and scaled) and then put back on another byte buffer.
Oh, and the only fucking reason we have Java doing this instead of the original native lib is because libusb and Java do not play together nicely on Android.

>& 0xFF is too difficult to me
Projecting this hard. Bitmasking is the least of my worries trying to mangle C and Java together with the abomination of the JNI.

The point is, are there any actual arguments as to why Java SHOULDN'T support unsigned types, like the large fucking majority of languages?

>B-but nobody needs it!
>Your use case is silly!
>Do it the Java™ way :^)
>>
http://www.ffconsultancy.com/ocaml/ray_tracer/languages.html
Why haven't you switched to ocaml yet? It's slower than C++ but it is significantly faster to develop in and is significantly faster than other options.
>>
Should I a Scala?
>>
>>52654492
My gf uses Scala, you shouldn't
>>
>>52654285
If I continue to use C# will my penis gradually increase in size?
>>
>>52654539
no, use D for that
>>
>>52654539
Yes.
>>
File: 1364902899779.jpg (35KB, 640x480px) Image search: [Google]
1364902899779.jpg
35KB, 640x480px
>>52654562
>>
>>52654418
a high-level language doesn't need unsigned bytes

java has two's complement signed bytes which have exactly the same bit representation as unsigned bytes

java also has chars which are unsigned

>Use case doesn't really matter, byte buffer comes in, java thinks it's signed but it's not, data needs to be offset (absolute and scaled) and then put back on another byte buffer.
the use case does matter you fucking retard because i'm pretty sure you're "solving" it in a retarded and inefficient way

>libusb and Java do not play together nicely on Android
l2jni retard
>>
So if I have an Nth-Order Markov chain, I have N different datasets, right?

So let's I have an input of X length.

After updating all X > 0 chains, do I pull from the X-order chain exclusively? Or do I consult the X-1, X-2, etc chains also? If so, how do I choose between them?

I'm self taught and haven't taken math above a high school level, so everything online on the subject is super confusing to me.
>>
File: le jacksonvillian reaction man.gif (2MB, 236x224px) Image search: [Google]
le jacksonvillian reaction man.gif
2MB, 236x224px
http://web.cs.ucla.edu/classes/winter16/cs35L/assign/assign4.html

>this is my assignment
>>
>>52654539
No, only if you use OCaml.
>>
>>52654667
This is an absolutely fantastic assignment, because it's just as retarded as real world tasks are, and sounds like something that might actually have happened somewhere at some point.
>>
>>52654667
tl:dr;?
>>
>>52654592
>I don't need unsigned bytes so nobody does :^)

>java has two's complement signed bytes which have exactly the same bit representation as unsigned bytes
Woks great for simple addition/subtraction, not so great for multiplication/division scaling.

>java also has chars which are unsigned
So I can bitmask and and cast to chars instead of ints, great

>the use case does matter you fucking retard because i'm pretty sure you're "solving" it in a retarded and inefficient way
I'm not giving you the details because they're going to go way over yoru fucking head, as evidenced by your last sentence.
Java reads from USB device, needs to mangle the bytes, then put them into native memory.
Yes, what I'm doing is inefficient, because Java does not have an efficient way of fucking doing this shit.

>l2jni retard
You've never actually tried have you? The way file descriptors (and permissions) are handled in Android is completely fucking incompatible.
If your lib requires libusb, it won't work with Android, end of story.
>>
>>52654715
yeah but then you get all the "muh GNU" "muh emacs" stuff so it ends up being annoying

I had trusted /g/ and thought CS classes at university were easy stuff that wasn't relevant :(
>>
>>52654667
Glad to see they're still teaching useless garbage in school
>>
File: 3mLydMU.png (70KB, 243x200px) Image search: [Google]
3mLydMU.png
70KB, 243x200px
>>52654747
KILL YOURSELF RETARD YOU ARE BAD AND YOU SHOULD FEEL BAD

JUST MANGLE THE BYTES ON THE NATIVE SIDE THAT'S THE PERFECTLY LOGICAL SOLUTION
>>
Or you could just use a better language than Java a.k.a. D
>>
>>52654667
enjoy being tens of thousands of dollars in debt and having wasted years of your limited time on this planet to "learn" this fucking useless garbage
>>
>>52654847
>2016
>paying for university
>not getting a full ride because you're poor
>>
>>52654872
i just assumed you were an average american pleb

if you're poor then going to college is a good shot at improving your economic status if you work hard desu senpai
>>
>>52654915
in the US if you can't actually pay you won't have to assuming you're not going to one of those ITT Tech or University of Phoenix style schools (those are the ones that build up useless debt for most people)

im fine with this program because the average starting salary is $95k or something like that which isn't that bad
>>
>>52654452
>but it is significantly faster to develop in
[citation needed]
>>
>>52654747
Why won't you just describe what you're doing?
>>
>>52652918
pointers most certainly are not objects.
>>
>>52654960
It's all in the source.
>>
>>52655040
Where?
>>
I only know C.
Give me a project to do, I'm sick of doing hackerrank-style tutorial shit.
>>
>>52655027
he's been insufferably buttblasted about this "issue" for like more than a year, i don't think he'll ever spill the beans

but really if he's reading from a USB device in java, mangling the bytes, storing them on the native side, he should really be doing the mangling on the native side too
>>
>>52654452
>and is significantly faster than other options.

http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=ocaml&lang2=go
http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=ocaml&lang2=rust
http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=ocaml&lang2=gnat
http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=ocaml&lang2=clojure
>>
>>52655065
Teach me how to get variables from a website.
>>
>>52655134
download the json and parse it
>>
>>52655069
I don't get what mangling the bytes means. I'm assuming he gets some data Java-side as bytes... then you send them C-side (heh) via JNI.

Then, if you want, you can cast them to unsigned chars... whether or not thats okay depends on what the values of the bytes from Java actually mean I think
>>
>>52655102
>4.02.1
>>
>>52654823
>>52655069
>What are checksums?
>What is validation checking?

It's reading from a USB connection. Maybe the data needs to be checked before it's merrily passed along as garbage.

Why the fuck would I give all the details to a bunch of NEETs on a Mongolian cave painting messenger service who don't even understands how the fuck USB connections "work" on Android?

Java is fine if all you do is Java and you never interface with other languages. It's a fucking shitstorm if you actually want to do something useful, unless you feel like rewriting numerous libraries because of subtle incompatibilities.
>>
>>52655245
>still beats the languages listed
>>
>>52655253
k tard
>>
>>52654452
Yes, a standard library and a package ecosystem stuck in 1990 really boost productivity.
>>
>>52655253
HERE'S HOW YOU DO IT YOU FUCKING TARD

PASS THE JAVA ARRAY TO NATIVE

YOU CAN DO IT WITHOUT EVEN COPYING THE DATA (IT'S JUST NOT GUARANTEED THAT IT WON'T COPY DEPENDING ON THE IMPLEMENTATION) SO THERE IS NO APPRECIABLE OVERHEAD INVOLVED, ESPECIALLY COMPARED TO THE CRAP YOU'RE DOING

DO THE CHECKING SHIT AND EVERYTHING ELSE IN NATIVE

SIMPLE AS THAT

FUCKING TARD
>>
>>52655314
>unironically trying to use compiler-only tools to build programs
>blames the language
There you have it, folks: OCaml comes with a retard filter built in. Does YOUR language?
>>
>>52654452
>no multicore
>dying community
>>
>>52655419
>https://github.com/ocamllabs/ocaml-multicore
>increasing community
>>
>>52655347
>modify the functionality of native library so it no longer works on other platforms
How about no?

What you're suggesting is to break the loose coupling, making a library that used to just take in clean data now have to worry about error checking.

I think I should just stop replying to CAPS CONTROL IS CRUISE CONTROL FOR COOL, clearly you're the best java guru™ here and cannot explain things at my level of understanding.
>>
>>52655370
Can you please stop? If you want to shill Ocaml, please post intesting code instead of shoehorning into every concersation.
>>
>>52655509
God this

I'm a FP fanatic and this guy makes me want to write fucking Java
>>
>>52655493
>compiling a shared object to 3-4 archs is hard
>>
>>52655509
>>52655535
I see the imperative shills are getting scared. OCaml stronk!
>>
>>52655493
I fail to see what any of this has to do with Java and signed bytes. You are being so confusing and when anyone asks you to clarify you just get mad and dismiss everything
>>
>>52655578
this. you're literally the only person i've ever seen who has expressed even the slightest buttmad about java not having unsigned bytes.
>>
>>52655596
Thank you pajeesh. Your 100 rupees have been deposited in your account.

Oracle. Make India Great Again. (tm)
>>
How do you get the accerelometer sensor data on Android emulator?

SensorSimulator seems to be out of development since 2014.
>>
>>52655628
Don't be a retard and use the SDK.
>>
>>52655624
you're the one being a ridiculously incompetent code monkey. if you want loose coupling just make a separate native method or an entirely different shared object to clean up the data
>>
>>52655572
No interesting code, then?
>>
>>52655649
I'm sorry Pajeesh, but we are all out of bonus Rupee. But don't worry, if you work hard, I'm sure you'll get a raise!

Oracle. Make India Great Again. (tm)
>>
File: 1453653438710.gif (101KB, 940x613px) Image search: [Google]
1453653438710.gif
101KB, 940x613px
It's been an incredibly fruitful day lads. As shown by the highlighted text, I've added python-like multi-var assignments on a single line, as well as multiple operations to 1 variable on a line

Additionally, I pretty much finished my entire gameplay algorithms at work today. All that's left is to detect if all goal spots are filled and go to win screen if they are.

I haven't taken full advantage of sound functionality either so I'll probably have that played upon pushing a box.

I'm also going to touch up my snake code so it fits my new high-level language as well as juice it with fireworks and fanfare when you win.
>>
>>52655624
You're so incredibly angry and refuse to listen to reason or explain your problem

It shouldn't matter that Java has signed bytes; all that matters is what the thing you are reading data from wants the bytes to be interpreted as.

Once you get to C-land you can just cast your byte buffer to signed or unsigned as you see fit and interpret the data however it should be interpreted.

If you have to do anything to do the data before you can 'read' it the way you want, thats probably the fault of the usb device for being weird.
>>
>>52655676
epic meme. i guess next year we'll have this same "discussion" yet again?
>>
>>52655648
Sorry, I don't understand?
>>
>>52655628
get a real device imo it doesn't have to be overly expensive
>>
File: 1447080353574.jpg (101KB, 513x486px) Image search: [Google]
1447080353574.jpg
101KB, 513x486px
>>52655676
I can understand being mad because JNI is really fucking horrible and exhausting to use but you're just acting like a straight up baby.
>>
>>52655473
ocaml multicore is only for the c interpreter. it has no support at all, there were just 2 guys working on it as a experimental project. it's dead and unusable.
>>increasing community
most of swiss banks have moved to haskell or f#
ocaml mailing list is dead
it's rare to see new libraries on opam
there are already more job offerings for f# than ocaml
the project for compiling ocaml to javascript is dead
>>
>>52655678
Sorry about last night. I was brutally raped and the bastards stole my poutine, so I tried to hitchhike back but I got kidnapped. I managed to escape because I'm skinny and ropes generally don't hold me for very long and I ran away as fast as I could. I found a local diner but they refused to serve me because I had no shirt, they just kept saying "no shirt no shoes no service", when clearly I had 1 out of 2 of those items. I angrily and hungrily left and tried the hitchhiking thing, but my reflective vest was torn off of me and I was hit by the first car I saw... They didn't stop. I started walking in the direction I thought was the correct way by following the stars, but it turns out I don't know anything about geology. Or terminology. I eventually found an abandoned greyhound tour bus parked in front of a museum so I sto-- made it unabandoned and drove until I found a highway. Some "onstar" bullshit started talking to me, I assume because I upset the geology gods, so I punched it until it stopped. I followed the signs and eventually made it back home.

Anyway, raincheck on the beers?
>>
>>52655578
>>52655596
Being used to unsigned data types is like being used to prefix and postfix increments.
It's not the biggest thing in the world to just manually increment with +=1 instead, but it's also such a well used feature you'd wonder why the fuck it's not just built in.

Yes there are workarounds, yes they are not actually very complicated, but they require you to think on a much lower level than you would if it jest werked™ like Java generally advertises.

>>52655624
>>52655676
Obvious shitposts are obvious
>>
>>52655739
Please don't talk out of your ass this much, the amount of nonsense you spout might rupture your anus.
>>
>>52655747
It's getting warm you cock. I can't keep the fridge on all night
>>
>>52655749
it's literally this one (RETARDED) use case where this is a "problem". not having unsigned bytes eliminates the shitfest that can occur when you have both signed and unsigned types at the same time.
>>
>>52655678
>Additionally, I pretty much finished my entire gameplay algorithms at work today
Tell me your secret.
>>
>>52655712
I do have a real device, but I also want to make a video of the app that uses accelerator data.

I guess I could use some phone screen recording software.
>>
How can I declare double space in C?
if (c == doublespace)
>>
File: 1451754656606.png (17KB, 418x359px) Image search: [Google]
1451754656606.png
17KB, 418x359px
>>52655792
m8 I'm only contracted, and I've got this target to finish 4 epos upgrades a day

some days I do 8 or 10, so I have all this dev time
>>
>>52655816
perhaps try recording the accerelometer data from the device and then play it back on the emulator?
>>
>>52655787
Default to signed, like you would anyway to not break existing code.
Make people use supr sekrit handshakes to activate the unsigned beast, I don't give a shit, just don't disable it completely because some people can't into unsigned.

Maybe it's more of a flaw with the JNI than Java itself, either way it shows that enterprise™ code isn't really that great for making high level wrappers for low level shit.
I was under the impression that was kinda the appeal to Java?
>>
>>52655774
>can't keep the fridge on all night
What kind of a poorfag are you?
>>
>>52655817
if c[i] == space && c[i+1] == space) {
}
>>
>>52655881
It's broken lad, now hurry the fuck over here
>>
>>52655874
you're the one who's flawed, not java or JNI in this case
>>
>>52655852
<.< ummm that sounds a bit too high for my current skill level, just being honest
>>
>>52655874
>>52655900
also this is some very obscure android+usb device shit you have to realize this. it's not a typical "enterprise" application.
>>
>>52655916
I don't think anyone is going to give you any sort of credibility unless you can actually explain what the problem is
>>
>>52655764
are you 12yo or something ?
>>
>>52655774
I'm not >>52655881 but that was pretty much my thought too.
Just unplug it, fridges are only meant for beer anyway, so plug it back in 20 minutes before you want a drink.
Better yet, just wrap your beer in a wet paper towel and put it in the freeze for 5 minutes. Ice cold beer.

Usually I just bring a couple in my room and put them in the window since I live in Canada where -40 temperatures isn't uncommon, but it's like +5c here right now, no idea who the fuck broke Canada. I blame refugees.
>>
>>52655896
>>52656011
forgot to clarify, but because it's broken, it goes incredibly cold, the fridge is almost like a freezer

those are good beer ideas though, thanks, and yes, chill out on the refugees
>>
>>52655825
So I assume you keep your GitHub account a secret.
>>
>>52656116
not at all, you can steal my code if you want:
https://github.com/vinheim3
>>
>>52656077
>chill out on the refugees
no.
>>
>>52655916
It's literally one small example of a lack of abstraction in what claims to be a high level language.

I'm not even going to bother talking about the real horrors of the JNI, like implementing C structs and unions (specifically anonymous unions).
Maybe you can blame that partially on C, but even so it's a fucking nightmare.

>>52655961
There isn't a problem, I never said there was a problem. Everyone has been asking for details to solve a "problem" that doesn't fucking exist, because the interface already works, just horribly inefficiently.
My point was that a lack of unsigned types means resorting to low level shit in what would otherwise be 100% high level code, with the JNI managing all the low level stuff for you.
I just expected the JVM would do a much better job internally than manually bitmasking in a for loop over an array. Obviously I expected too much.

>hurr just do it native
Sure, but that still doesn't get around the point that Java is really struggling to perform a quite simple task without its hand being held.
Also the component it's meant to be replacing did all of this stuff just fine, so it would have been nice to have a 1-to-1 replacement, rather than 2 half-baked components.
>>
>>52655961
the problem is that he's too much of a baby to have a certain part of the code together with his other native code and he's also uncomfortable with writing (b & 0xFF) or u(b).

>>52656244
java keeps a fairly "minimalist" approach for being a high-level language. if you want countless high-level features then maybe C# or python is for you. you can use C# with xamarin.

>I just expected the JVM would do a much better job internally than manually bitmasking in a for loop over an array.
that's what compilers in other languages do anyway, at least on architectures that don't have single byte registers.

>Sure, but that still doesn't get around the point that Java is really struggling to perform a quite simple task without its hand being held.
literal asperger's

kill yourself.
>>
A rather lazy script for applying stack obfuscation and some jmp shuffling to fasm sources

i.e.
; Allocate scratch space
push 629
mov [esp+-248], 0x40
lea esp, [esp-240]
mov [esp+-492], 0x1000
mov [esp+-496], VM_SCRATCH_SIZE
push 6561
mov [esp+-504], 0
lea esp, [esp+508] ; reset
vm_virtualalloc_patch_location_1: ;control flow
push 7399
lea esp, [esp+4] ; reset
call dword [VirtualAlloc] ;control flow
push eax
push 3332



Super easy to clean up or just look past, but at least it generates different signatures
>>
File: 1453686234461.jpg (18KB, 251x242px) Image search: [Google]
1453686234461.jpg
18KB, 251x242px
>>52656448
>java keeps a fairly "minimalist" approach for being a high-level language.
>>
File: 1405149485604.gif (947KB, 345x502px) Image search: [Google]
1405149485604.gif
947KB, 345x502px
Beginner here. Why am I shit, where can I improve?

class StringReverse {

public static void main(String args[]){

String word = "Speghetti";
int len = word.length() - 1;
System.out.println(word);
int i = -1;
int c = 0;
String word2 = "";
while (i < len){
char cur = word.charAt(len);
word2 += cur;
//System.out.println("len = " + len + "\nc = " + c + "\nletter = " + cur + "\n");
len -= 1;
c += 1;
}
System.out.println(word2);
}

}
>>
How viable is freelancing? Anyone here does it professionally (instead of doing it when the opportunity arises)
>>
>>52656567
>Why am I shit
you're using a meme language
>>
>>52656567
"This is now your porno"?
>>
File: 1345661034056.gif (2MB, 316x213px) Image search: [Google]
1345661034056.gif
2MB, 316x213px
>text editor replaces all white-space-only lines with empty lines
>not sure if I like it better this way
>>
>>52656546
>hurr java "lacks" these and those "features"
>durr java isn't "minimalist"
java is actually every simple and elegant you retarded fucking memer. everything has been designed with great care and unnecessary features have been omitted. the syntax is consistent and clean.
>>
>>52652525
C++
+
+
>>
File: 1453681228232.jpg (18KB, 251x242px) Image search: [Google]
1453681228232.jpg
18KB, 251x242px
>>52656655
>java
>simple and elegant
>>
>>52656652
Unless you start using an editor that can't bring auto indent to the right level when you modify blank lines, why would you want white-space only lines ever?
>>
File: agdg wisdom on coding.png (94KB, 809x651px) Image search: [Google]
agdg wisdom on coding.png
94KB, 809x651px
>>
>>52656694
epic
>>
File: 1451792175635.png (44KB, 253x271px) Image search: [Google]
1451792175635.png
44KB, 253x271px
>>52654646
Please respond
>>
>>52656708
It could save me a second or two if I want to add some code to an existing pseudo-blank line. Otherwise i have to either add spaces to it or delete it, go to the previous line and then hit enter.

Either way, the benefits/drawbacks are so minuscule I'm not even sure why I'm so torn over it. Autism, I guess.
>>
>>52656448
>if you want countless high-level features then maybe C# or python is for you

I thought it was quite obvious I wasn't using Java because I wanted to, but more of a requirement of porting to Android.
>>
File: 1405428184845.gif (1MB, 306x177px) Image search: [Google]
1405428184845.gif
1MB, 306x177px
>>52656650
I dunno what she be saying.
>>52656600
what you recommend anon? I'm learning two memes at the moment. python and java. Would like to know everything from assembler to javascript but ya gotta start somewhere right?

I changed it to a function.

class StringReverse {

public static String wordReverse(String wordie){
String word = wordie;
int len = word.length() - 1;
System.out.println(word);
int i = -1;
int c = 0;
String word2 = "";
while (i < len){
char cur = word.charAt(len);
word2 += cur;
len -= 1;
c += 1;
}
return word2;
}
public static void main(String args[]){
System.out.println(wordReverse("Spegetti"));

}
}
>>
>>52656782
>what is xamarin
literally all the same android SDK shit just you get to use your even more retarded code monkeyer shit language with it
>>
>>52653004
>pure FP fags will tell you that state isn't state if you pass it as function I/O
nobody who properly understands pure FP would say that. the idea is about controlling the state/io/side effects, not about removing them from your program. by making their use an explicit part of the type of a function you make it clear how the function will or won't interact with the world or other data, makes it easier to understand what a function does just by looking at its type signature (which means the actual function can be inferred), and can aid immensely in optimization (for memoization/lookup tables, partial evaluation, inlining, removing dead code, changing order of function calls, etc.). better yet, with a dependent type system, types that show side effects tell the compiler that theorems can't necessarily be proved there, so a compiler can choose to insert runtime checks or make the user prove that they're handling all possible input (by use of total functions). while there's benefit to not using state or IO in general (easier to reason about how the code will run), pure FP is less about that than its other advantages
>>
>>52656777
If the editor is smart enough to wipe blank lines, it should be able to bring the cursor to the right spot if you hit "end".
I know jetbrains does this at least.
>>
>>52656786
Use an even memier language

reverse l =  rev l []
where
rev [] a = a
rev (x:xs) a = rev xs (x:a)
>>
>>52656837
>can aid immensely in optimization
>compiler can choose to insert runtime checks or make the user prove that they're handling all possible input (by use of total functions)
>[in theory]
>>
>>52656843
Tried it. Turns out hitting tab once will fill in all the spaces to align it.

Still feels like my code is going to be tied too much to the editor even though that doesn't really make sense.
>>
File: 1406974982907.jpg (82KB, 500x647px) Image search: [Google]
1406974982907.jpg
82KB, 500x647px
>>52656863
lol. i've only been learning for about a month but i think i'm getting the hang of it. is that python?
>>
>>52656988
no that's hasklel
>>
File: donkey kong development.gif (2MB, 289x400px) Image search: [Google]
donkey kong development.gif
2MB, 289x400px
My python is getting half-decent, so I'm thinking of learning a second language that would complement it.

I know a bit of SQL already for work, but I think I'd prefer to focus on something more building-focused than analytics-focused (so R doesn't interest me that much, for example).

I'm thinking of something like C, because I've heard it's ultra-versatile, and that if I know a high-level language like Python, I'd be better off learning something like C than another high-level one like Ruby.

Any thoughts?
>>
>>52657064
C is definitely the right choice. Python is a great supplement for external tools that aid your C programs. Additionally, you can make Python even more useful for your own needs by extending it with C
>>
>>52656894
An editor from this century, sure.
>>
>>52654452
note that this is very old and the performance gains will be pretty significant with flambda (and multicore, once that's out)
>>52655739
there are 3 popular, stable, and actively developed OCaml to JS compilers
F#'s popularity is still bigger on the web, but definitely not banking
new libraries get added to OPAM pretty much daily and multicore is coming with the next release
not saying OCaml is great, just please don't talk out of your ass about it (or any other language, for that matter)
>>52655535
same. any time I've mentioned something negative about OCaml he's fucking sperged out and yet I've never once seen him post a piece of code
>>52656880
I will admit optimization isn't quite up to par on many of these languages, although Haskell does extremely well for a lazy language. Hopefully Idris will get even bigger performance gains since it's strict
F* already inserts checks at runtime for code that interacts with IO, and nearly every dependently typed language has totality checking and enforced verification that values will match proofs in IO-facing code. ATS isn't a functionally pure language, but it uses dependent typing to improve on even (naive) C performance by using proofs as types
>>
>>52656593
>>
File: lerekt.gif (2MB, 250x180px) Image search: [Google]
lerekt.gif
2MB, 250x180px
>>52657064
I started on python and I'm finding learning Java is expanding on the basic concepts a lot. But I'm sure that would be the case for something like C as well. Being said, interested to hear other peoples responses as I'm pretty nubsta myself.
>>
>>52656567
Just


word = word[::-1]

>>
>>52657175
oh yeah. now that's python
>>
>>52657150
>has used ocaml for 3 seconds
>thinks he's an expert on the subject
LMAO
ocaml is slow as fuck and dead as fuck. haskell is more popular in banking. Stop pretending you're not >>52655370
>types exactly the same way
>thinks nobody will notice
L
M
A
O
>>
Does anyone know any beginner guides or where to look at for concurrency control mechanism using mySQL and java?
>>
>>52656802
Oh? What language is better than C# for app development?
>>
File: 1430616732404.jpg (69KB, 800x770px) Image search: [Google]
1430616732404.jpg
69KB, 800x770px
What's the difference between C, C++ and C#?

I don't get it
>>
File: J4D4lNr.png (721KB, 1608x926px) Image search: [Google]
J4D4lNr.png
721KB, 1608x926px
modified some old mandelbrot code I wrote before to render using pickover stalks
>>
>>52657347
C# is the "best" since it has muh unsigned bytes and all the "features" you could reasonably imagine
>>
>>52657369
They're 3 completely different languages.
There is nothing more to it than that.
>>
File: 3CZDePF.png (1021KB, 1608x926px) Image search: [Google]
3CZDePF.png
1021KB, 1608x926px
color pic
>>
>>52657380
unsigned bytes and other features of C# are good things. Do you actually think they aren't?
>>
>>52657369
>C
very simple, minimalist language that could be described as "portable assembly". almost only used for performance-critical applications such as real-time systems, embedded systems and hardware device drivers

>C++
C evolved

>java
C++ evolved

>C#
bastardized version of java
>>
>>52657414
>bastardized version of java
more like Java is a bastardised version of Java. And yes, I know Java came first.
>>
>>52657414
I'm this guy >>52657064

Any advice on which to go for?
>>
>>52657411
why bother with frankly unnecessary features like unsigned types, structs, raw pointers etc when you get as bad performance as java anyway? just use java and/or C++
>>
>>52657414
so C# is the bastardized version of the bastardized version of C++ then? makes sense
>>
>>52657162
Probably viable if you're not a poo in the loo or a slav. You might think you can't compete with $3/hour streetshitters but many people will gladly pay a lot more to hire a white guy in a Western country that has decent English and communication skills.
>>
>>52657443
>unnecessary features like unsigned types, structs, raw pointers
Because Prajeet, those are useful features.
>>
>>52657442
definitely start with java. then once you've become decently proficient in java you can move on to C++.

https://docs.oracle.com/javase/tutorial/
http://en.cppreference.com/
>>
>>52657414
>portable assembly
>C evolved
>C++ evolved
Could you cram any more memes into your post?
>>
>>52657228
did I mention Haskell other than the one time I said it did a good job at optimization?
and okay, let's see your experience with OCaml, or even Haskell for that matter.
i haven't posted on /dpt/ without a tripcode for like 3 months but whatever kid
>>
File: langspeed.png (63KB, 1024x693px) Image search: [Google]
langspeed.png
63KB, 1024x693px
>>52657228
>ocaml is slow as fuck

http://roscidus.com/blog/blog/2013/06/09/choosing-a-python-replacement-for-0install/#speed-and-size
>>
>>52657469
then use C++
>>
>>52656655
simple and elegant compared to the obamacare bill maybe
>>
>>52657414
just look at this collection of memes
>>
>>52657490
>move from one meme language to another meme language
I told you faggots to stop sharing the slides to operator, look at all the pajeets you've invited
>>
>>52657414
>C++ evolved
>C++
>evolved

windmill of friendship to you my friend
>>
>>52657470
Cheers m8, I'll give it a look
>>
>>52657490
over complicated custerfuck, less safe.
C# has every advantage of Java except some advantages of C++ too. There's no reason to use Java.
>>
How do I use javascript to display a div element for me?

There's a browser game I'm playing and I'd like to write a script(javascript or pyton idc) that displays that number for me without me having to look for it.

>trying to grab a number from browser and convert it into a quick percentage instead of having to do it in my head every time

is this possible? I inspected the element and it's there in between a <div></div>

Sorry if I worded this poorly.
>>
File: all me.jpg (11KB, 355x44px) Image search: [Google]
all me.jpg
11KB, 355x44px
>>
@52657574
pajeets out
>>
>>52657482
>d-d-d-d-d-damage control!
Tripfags are fucking hilarious!
>>
File: creativelivejoeysturgis.jpg (499KB, 887x720px) Image search: [Google]
creativelivejoeysturgis.jpg
499KB, 887x720px
>>52657544
>c# better than c++
>>
>>52657487
>comparing shitty, slow languages (and ATS) to ocaml
Wow, how fair!
>>
>>52657611
god damn dude you can stop shitposting now
you've been so consistent for so many threads it's incredible
>>
>>52657664
fuck off, ocaml shill.
>>
you like movies, anon?
>>
>>52657760
it's Shilldance.
>>
>>52657760
no, I like films
>>
File: smirk.jpg (14KB, 464x464px) Image search: [Google]
smirk.jpg
14KB, 464x464px
>>52657414
>>java
>C++ evolved
>>
>have to write a straight forward regular expression program for class
>write it and turn in
>professor accuses me of cheating
>ask him why
>he tells me it looks like everyone else
>I tell him it's a trivial problem so of course my regex will look similar to others
>ignores me
>have a meeting with dean next week to discuss the implications of cheating.

fuck this gay world
>>
>>52657821
Maybe horribly mutated?
>>
>>52657898
lol. I feel for you anon
>>
THE FUCK IS THIS SHIT
>>
>>52657949
Why the hell are you posting your shit in the programming thread?
>>
Why do I keep seeing Nazi imagery all over 4chan? Is this a hot new meme I'm not privy to?
>>
>>52657898
sorry but KEK

maybe ask for advice on academia stackexchange
>>
>>52657973
>>52657949
>>>/reddit/
>>
>>52657963
when was this ever a programming thread
>>
>>52657898
is the dean gonna make you fizzbuzz or what lol
>>
>>52657980
>shitposts instead of answering the question
You do know the quality of posts is important to our fine community at boards.4chan.org/g/ right?
>>
>>52658074
Not him, but you're right

So I hope you improve the quality of your posts by posting /dpt/-relevant posts on /dpt/
>>
>>52657973
newfriend pls, go back to Friendface
>>
>>52658074
Right, your non-programming related shit is definitely increasing the quality of the programming thread.
>>
ALL OF YOU

FIZZBUZZ RIGHT FUCKING NOW
>>
What's the best text book for teaching myself C?

I already have programming experience with Python, but my knowledge of low-level programming is nul.
>>
>>52658138
for i in range(1,101):
if i%3==0 and i%5!=0:
print('Fizz')
elif i%5==0 and i%3!=0:
print('Buzz')
elif i%3==0 and i%5==0:
print('FizzBuzz')
else:
print(i)
>>
File: ookbuzz.jpg (576KB, 1349x539px) Image search: [Google]
ookbuzz.jpg
576KB, 1349x539px
>>52658138
>>
>>52658138
class FizzBuzz {
public static void main(String[] args) {
for(int i = 1; i <= 100; ++i) {
System.out.println(i % 15 == 0 ? "fizzbuzz" : i % 3 == 0 ? "fizz" : i % 5 == 0 ? "buzz" : i);
}
}
}
>>
>>52658155
K&R
>>
>>52658138

Yes, captain. Right away, captain.

Enumerable.Range(1, 100).Select(Fizzer);
>>
>>52658138
1..100 |> Enum.each(fn(x) ->
case {rem(x, 3), rem(x, 5)} do
{0, 0} -> "FizzBuzz"
{_, 0} -> "Buzz"
{0, _} -> "Fizz"
{_, _} -> x
end |> IO.puts
end)
>>
>>52658138
YES CHEF
[1 .. 100] 
|> Seq.map (fun i ->
match i % 3, i % 5 with
| 0, 0 -> "FizzBuzz"
| 0, _ -> "Fizz"
| _, 0 -> "Buzz"
| _, _ -> string i)
|> Seq.iter (printfn "%s")
>>
>>52658204
language?
>>
File: 1417645820345.jpg (10KB, 225x225px) Image search: [Google]
1417645820345.jpg
10KB, 225x225px
>>52658138
import fizzbuzz
print('fizzbuzz')


Here you go chef
>>
>>52658229
Elixir
>>
>>52655253
>Mongolian cave painting messenger service

I hate this fucking meme.
>>
File: hqdefault.jpg (23KB, 480x360px) Image search: [Google]
hqdefault.jpg
23KB, 480x360px
>>52658233
ITS FUCKING RRRRRRAAAAAAAWWWWW
>>
>C# doesn't allow extensions on static classes

Damn it all to hell
>>
>>52658138
for(int i=1;i<=100;++i){
if(i%15==0)printf("FizzBuzz");
else if(i%3==0)printf("Fizz");
else if(i%5==0)printf("Buzz");
else printf("%i", i);
}
>>
File: 3.jpg (225KB, 993x957px) Image search: [Google]
3.jpg
225KB, 993x957px
>>52658366
>java does
>>
>>52658426

Java has extension methods?
>>
>>52658426
comparing java to c# is like comparing Hitler to Hirohito
>>
File: thumbs.gif (545KB, 256x199px) Image search: [Google]
thumbs.gif
545KB, 256x199px
>>52658194
Made me giggle.
Here, have a (you)
>>
>>52658138
>python, java, muh functional, and finally C

>>52658455
hitler was right
>>
>>52658366
What's the point of static classes, amyway?
>>
>>52658453
>Extension methods are a special kind of static method, but they are called as if they were instance methods on the extended type.
the hell is this crap?

i thought you meant subclassing a static class
>>
""""""""""""""""""""""""""""""""efficient and readable""""""""""""""""""""""""""""""""
>>
>>52658366
pls post more black ladies, need to fill my folder.
>>
File: 288591_1252508602860_450_338.jpg (15KB, 450x338px) Image search: [Google]
288591_1252508602860_450_338.jpg
15KB, 450x338px
Hey everyone, I need to know which is better with making mobile apps on ios and android, Python or C# ? Or if you can tell me which language is best with making apps for ios and android that'd be great.

Thanks in advance
>>
File: codebehind.gif (62KB, 500x375px) Image search: [Google]
codebehind.gif
62KB, 500x375px
>>52658511
fuck my ass
>>
>>52658521
java, and C++ if you want godmode

java + JNI for android and java through robovm + objective-C++ for iOS
>>
>>52658521
C# by a factor of about 100
>>
>>52658266
It's about the only pseudo-original maymay around.

It also means I can copy and paste my shitposting between sites without rustling too many jimmies.
>>
>>52658138
let fizzbuzz n = match (n mod 3, n mod 5) with
| 0, 0 -> "FizzBuzz"
| 0, _ -> "Fizz"
| _, 0 -> "Buzz"
| _, _ -> Int.to_string n

List.(map (range 0 100) ~f:fizzbuzz) |> String.concat "\n" |> print_endline
>>
>>52658366
Extension methods are for instances only. What are you even trying to produce out of a class without an instance? If it accesses something else for data, maybe it makes sense to extend THAT instead?
>>
>>52658559
What is god mode ?

>>52658572
>by a factor of 100

I'm sorry, but what do you mean by this.
>>
>>52658624
disgusting

>>52658635
I mean C# is about 100 times better than python for iOS and Android development.
>>
>>52658635
java in combination with C++ is godly
>>
>>52658655
butthurt
>>
>>52658673
>not just C++
Enjoy no portability AND anemic syntax of Java.
>>
>>52658677
get on my level ocamlfag >>52658207

Does ocaml even have |> built in, or do you have to define it yourself?
>>
>>52658673
>java in combination with C++ is godly
>Using the JNI is godly
no one is this retarded. At least I hope not.
>>
>>52658697
>no portability
u wot
enjoy making android apps in pure C++
>>
>>52658714
a perilous journey awaits

but in the end, you will transcend
>>
>>52658719
Many people do. Since you use C++, you lose that "compile once run everywhere" gimmick.
>>
File: anime pic.jpg (71KB, 400x465px) Image search: [Google]
anime pic.jpg
71KB, 400x465px
>>52658673
>java in combination with C++ is godly
Gotta love that fucking name mangling and JNI, right?
>>
>>52658735
Why would you mix C++ with Java for mobile app development?
>>
>>52658739
look, i hate disgusting script shitters as much as anyone else. but java is comfy af

>>52658745
it's not that hard especially if you use jnigen but i don't even use that any more
>>
>>52658138
main :: IO ()
main :: IO ()
main =
mapM_ (putStrLn . fizzbuzz) [0..100]
where
fizzbuzz n =
case (mod n 3, mod n 5) of
(0, 0) -> "FizzBuzz"
(0, _) -> "Fizz"
(_, 0) -> "Buzz"
_ -> show n
>>
>>52658756
java for UI shit and simple tasks

C++ for performance
>>
>>52658735
The only thing waiting for you at the end of that journey is a fatal aneurysm.
>>
>C++
>trying to use a class's method as a comparator for std::sort
>compilation error with a hilariously useless message
Eventually I remembered that methods in C++ are actually just functions with a hidden this argument, this shit is just saddening in 2016.
>>
>>52658789
epin xd
>>
>>52658799
>OOP
>>
>>52658799
and these fegs are implying you should write mobile apps in 100% sepples
>>
>>52658764
>jnigen
The only thing worse than currycode, is auto-generated currycode.

It comes out so fucking incomprehensible you can't even tell if it's doing something stupid or not
>>
>>52658820
Still not as bad as Java.
>>
So I guess it's fair to say c# is good for mobile app development ? Would I need to know any other language before I dig in ?
>>
>>52658831
>>52658837
absolutely epic

it's really not hard to understand JNI

i realize that there are literally no tutorials for it and setting up your workspace and dependencies is ridiculously hard

but once you've gotten it figured out it's as simple as anything else
>>
NEW THREAD

>>52658863
>>52658863
>>52658863
>>
>>52658837
Well no, it's worse.
Part of the complaint about Java is that getting anything else to work with it is by far the biggest pain in the ass.
So just trying to reuse existing code becomes painful to the point you even consider rewriting stuff in pure java.
>>
>>52658864
It's not about JNI. It's about that Java is a bad language.
>>
>>52658849
sure go ahead with your xamarin shit
>>
>>52658782
so what kind of thing would you write in C++?
>>
>>52658884
>xamarin shit
Xamarin is good what are you talking about
>>
>>52658864
>it's really not hard to understand JNI
the JNI is easy to understand. Painful as shit to work with. Probably one of the most damning examples of C# being Java done right.
>>
>>52658919
i meant shit as in synonym for stuff, it's neutral
>>
>>52658864
Did you read my post?
I'd much rather do it myself than have some "optimised™" codegen make a slowpoke interface for me.

Actually the first time I was meant to use a currygen I basically just did it myself because it wanted me to install mavern with a fuckton of dependencies.
Somebody else ran the codegen and the output class structure was almost identical, but there was extra fluff methods and the object naming was fucking horrific.
>>
>>52658899
like graphics stuff (opengl es rendering) and audio rendering (opensl es), game logic
>>
File: Spike_Spiegel_No_Background.png (768KB, 1920x1080px) Image search: [Google]
Spike_Spiegel_No_Background.png
768KB, 1920x1080px
>>52658966
oh ok anon

Have a good time !
>>
>>52658633
>Extension methods are for instances only.

Obviously, but it would be pretty clever to be able to add ""extensions"" to static classes. Something like Enumerable.Between(begin, end) would be nice, and it's not part of Enumerable as-is.
>>
let's say i'm playing a game and I have a 51% chance of winning each game. If I win, I get +1 points and if I lose, I get -1 points. How long on average will it take to get a score of +16 points?

Mathematically I believe it's 16 / [1(.51) - 1(.49)] = 800 games

I'm trying to make a short program to predict how many games it will take, but this shit is giving me anything from 70 games to 2500 games. What am I doing wrong? Shouldn't I bet getting around 800 most of the time?

int main()
{
int gamesPlayed = 0;
int score = 0;
srand(static_cast<unsigned int>(time(0)));

while(score != 16){
int result = rand() % 100 + 1;
if(result <= 51){
gamesPlayed += 1;
score += 1;
}
else {
gamesPlayed += 1;
score -= 1;
}
}

cout << "You have played " << gamesPlayed << " games." << endl;
}
>>
>>52659018
think about it

if you win every game in a row you only need 16 games

so 70 sometimes is reasonable

and if you lose every game in a row you'll have to win many games after that to get up to 60 so 2500 is reasonable

but
>int result = rand() % 100 + 1;
use a better random number extraction method

think about it
if you have a random number source in for example a range of 0 to 119, then 1-20 are going to be twice as likely as other numbers using your method

that's an extreme example but you can still improve it
>>
>>52659016
wouldn't subclassing the static class and adding methods be basically the same thing?
>>
>>52658702
Of course it's builtin, pleb.
>>52658207
>mixing sideeffects with sideeffect-free code
JUST

Seq.map -> List.map
[1 .. 100] -> List.range 1 100
string -> Int.to_string
Seq.iter -> List.iter
printfn "%s" -> printf
>>
>>52659079
Different name.
>>52659016
You can "using static StaticClassName;" now. Just make your own static class for extensions and use both it and enumerable.
>>
Anyone here make any apps using Xamarin? Can you show me what you've made ?
>>
>>52659105
>>52659154
>>52659177
>>52659211

>>52659199
i do anon. I cannot.
>>
>>52659154
>You can "using static StaticClassName;" now.

Hmm, I forgot about static using. I'll have to consider that.
>>
>>52659078
>think about it
>if you have a random number source in for example a range of 0 to 119, then 1-20 are going to be twice as likely as other numbers using your method

Forgive me, but can you explain why 1-20 will be twice as likely as other numbers?
>>
>>52659236
Would that be considered advertisement ? is that against the rules ?
>>
>>52659344
No, i'm just not willing to post anything i worked on on 4chan. Turns out 4chan is not a very professional site to be associated with.
>>
>>52652754
kek
>>
like this
.
>>
>>52652503
I'd stick my Tannish looking dick in her ass and choke her and impregnate her with culture.
>>
>>52659275
10 mod 100 is 10
110 mod 100 is 10

30 mod 100 is 30
there is no 130 if the range is to 119 like in the example
>>
>>52659275
Modulo bias. The possible results look something like
>1 2 3 4 5 6 7 8 9 10 1 2
Hope that's clear enough.
>>
>>52659425
>>52659421
You're right I was being an idiot, thanks
>>
>>52658129
>>52658100
Oh we're going to play that game. OK whatever.
>>
anyone know if in the definitions sections of a lex/flex file can you use a definition in a definition?
specifically I'm trying to write a patter for a comment that starts with a "/*" and ends with "*/"
does this look correct?
 "/*"[0-9]*[a-Z]*[_]*"*/"
Thread posts: 380
Thread images: 44


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