[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 / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y ] [Search | Home]
4Archive logo
/dpt/ - Daily Programming Thread
If images are not shown try to refresh the page. If you like this website, please disable any AdBlock software!

You are currently reading a thread in /g/ - Technology

Thread replies: 316
Thread images: 28
File: prog.png (486 KB, 473x496) Image search: [iqdb] [SauceNao] [Google]
prog.png
486 KB, 473x496
Old: >>52480962
What are you working on, /g/?
>>
>>52485487
All useful programs are I/O. Yes.

And all useful Functional programs ultimately provide I/O, just with a different conceptualisation of how to represent I/O in the codebase.

>>52485498
It's a function of an I/O of X to an I/O of Y. It is up to the external environment to "perform" those I/O actions.
>>
FP is shit
>>
there is no inherent advantage to FP and FP users are needlessly smug about using it
>>
Imperative programming makes gains when it finds a way to restrict programs (i.e. letting compilers do certain optimizations or safety checks).

Functional programming makes gains when it finds a way to express more programs (i.e. letting programmers work with new effects).
>>
>>52485516
>>52485516
>>52485516
>>
>>52485550
The biggest advantage is when doing highly parallel programming because immutable and thus shareable data.

Also side-effect-free code is far most testable.

It's not like a magic replacement that does things imperative CAN'T do. It just does almost everything better. I say almost because there are a few inherently imperative algorithms, but they are FEW and far between.
>>
>>52485578
yeah right

for games at the very least most algorithms are inherently imperative
>>
>>52485601
>games
I give zero fucks, those are not critical systems and they don't matter.
>>
File: 1430853197680.png (331 KB, 474x432) Image search: [iqdb] [SauceNao] [Google]
1430853197680.png
331 KB, 474x432
>>52485608
ok
>>
>>52485516
>unless the compiler is super clever you're doing a lot of needless data copying
The compiler doesn't need to be super clever to do this when you have linearity.

You're pointing out Haskell's flaws as if they're somehow inherent flaws of FP. Which is something a lot of anti-FP people seem to do. There are lots of horrible, horrible imperative languages but you don't see people talking about Brainfuck as if it somehow reflects on everything else.

>>52485601
Games are basically just state to state functions (not the entire state at once, all the time, mind you), which can be optimized to be mutation with linearity, plus rendering. Which on the application side is just building lists of commands and writing shaders, which are best expressed as pure functions anyways (plus specific effects like image load/store).
>>
File: 1444589415464.jpg (165 KB, 439x550) Image search: [iqdb] [SauceNao] [Google]
1444589415464.jpg
165 KB, 439x550
>>
>>52485532
Kill yourself

You're literally a memetier code monkey
>>
import std.stdio;

void main(string[] args)
{
writeln("D!");
}
>>
>>52485655
and you are such an enlightened atheist for following a particular programming paradigm
>>
>>52485647
What language would you consider the shining paradigm of FP then?
>>
>>52485682
I recognize that all paradigms have their flaws and benefits
>>
damn you faggots are useless
>>
>>52485675
>\n{
You disappoint me anon
>>
>>52485700
No they don't you fucking retard
>hurr durr they're all equal
>>
>>52485693
There isn't one, not yet. Idris has the most potential, but I don't think it's differentiating itself from Haskell enough (and it chose the relatively weak uniqueness over proper linearity).

I'm trying, though.
>>
>>52485700
any possible benefits of FP get wiped away as soon as you wrap too much state as input.

like i said, using functions in your program is okay. basing your entire program around functions is stupid.
>>
File: 1452215124352.gif (208 KB, 354x534) Image search: [iqdb] [SauceNao] [Google]
1452215124352.gif
208 KB, 354x534
semicolons aren't necessary in javascript, right?
>>
>>52485725
I didn't say they are equal. Learn to read.
>>
>>52485693
>>52485737
The relevant pieces are scattered around various academic papers and experimental languages, in any case.
>>
>>52485717
>>\n{

Allman braces are the greatest of all time. Of all time.
>>
>>52485742
right? javascript isn't necessary;
>>
>>52485717
i think it's okay for functions.
>>
>>52485740
Why?
>>
>>52485743
You said they have their own advantages and disadvantages

Prove that, retard
>>
Name a better character for terminating statements than the semicolon
Protip: you can't
>>
>>52485740
>omg monads are so confusing
>I'm a grill btw ;)
>>
>>52485625
I enjoy games as a player. As a programmer, I am not interested in them in the least. They aren't important.
>>
File: 1452465650049.jpg (38 KB, 351x352) Image search: [iqdb] [SauceNao] [Google]
1452465650049.jpg
38 KB, 351x352
>>52485763
what if i want to run code in someone's browser?
>>
>>52485742
The interpreter will attempt to guess where they should if if they are omitted and insert them.

And basically all JS coding standards/conventions use them. Do not omit them.
>>
>>52485780
Why would I waste my time on a rused JavaPajeet?
>>
>>52485774
like in this example: >>52485471
>gameState: Game
you're wrapping pretty much the entire program's state as an input just so you can say that it doesn't have state. it's unnecessary. it's obvious that the game loop would have access to the game's state, it doesn't need to be a function parameter everywhere.
>>
>>52485759
>>52485737
cool - what made you say Haskell is shit? I've been programing in it for a bit and love the semantics. I haven't run into any performance problems, either.
>>
>>52485782

It's impossible to suggest one now, because the semicolon is burned into everyone's mind. As Julian Lennon once said, "It's much too late for goodbye." and so too for the semicolon.

>>52485773

If you're using K&R, then it is. There you use BSD style for functions.

That said, I cannot fucking believe people actually use GNU or Whitesmiths.

I can understand the benefits of Allman & K&R, but GNU and Whitesmiths are fucking diabolically ugly.
>>
>>52485784
>be girl
>write haskell
>imperativefag trolls
>they get associated with my gender

MAKE THIS STOP
>>
>>52485790
ok
>>
>>52485819
>I'm a grill btw :))
>>
>>52485809
All paradigms have their advantages and disadvantages, even Java paradigms
>>
>>52485790
This. So much THIS
>>
>>52485842
Java isn't a paradigm Pajeet
>>
>>52485849
ok
>>
>>52485804
but if it has no effect on speed, why does it matter?

semicolons are just a meme to be fair.
>>
>>52485854
>Java paradigms
>Java the paradigm
Learn to read

You said the paradigms of Java had their advantages and disadvantages. So prove it.
>>
>>52485742
until you spend 16 hours searching for a bug that would have been prevented if you added a ;
>>
>>52485870
Java is good for getting a code monkey job

Java is bad at everything else, basically

This is largely due to the faux-OOP paradigm Java uses
>>
>>52485742
use them please

also use === please

also don't use javascript please
>>
>>52485811
>it doesn't need to be a function parameter everywhere
It isn't a parameter everywhere. It's a parameter at the top level, and then it gets split up when "smaller" subfunctions are called at many levels.

Even in imperative languages, it's good to package up the state into a big structure (and have the update be a state->state function) because of things like fixed timestep with interpolation, delta encoding for networking, buffering between the game thread and render thread, etc.

>>52485815
It's not a bad language, but it's not a good example of the power of functional programming, at least not any more. Forced laziness everywhere is bad for reasoning about performance, and its type system is a bunch of features tacked together haphazardly ending up with "system F-omega modulo everything but dependent types or linearity".
>>
what is your favorite programming language
what about it do you like
>>
>>52485917
Not a JS coder but why not just go all the way and use ====?
>>
>>52485868
Consistency when working with others, clarity, and ensuring that they are placed correctly at all times, and not "guessed wrong" by the interpreter.
>>
>>52485915

>Good for getting a code monkey job
That's not an advantage of the paradigms of Java

Explain to us, oh wise one, what the advantages of every paradigm used in Java are
>>
File: 1452325453364.png (248 KB, 737x583) Image search: [iqdb] [SauceNao] [Google]
1452325453364.png
248 KB, 737x583
>>52485917
>also use === please

what if i want to take advantage of type conversion?

do i have to convert it myself?
>>
>>52485921
java

it's simple and consistent while still being highly expressive and suitable for making large applications
>>
File: utter horror.jpg (91 KB, 1278x720) Image search: [iqdb] [SauceNao] [Google]
utter horror.jpg
91 KB, 1278x720
>>52485996
>what if i want to take advantage of type conversion?
>advantage
>>
>>52485996
then use it obviously

many people starting out don't know about the gotchas involved
>>
>>52485949
That's an advantage you dumb NEET
>>
>OOP
>games
Are we being raided?
>>
>>52485996
>type conversion
>advantage
doopie poopiedy
>>
>>52486024
>FP
>games
are we being raided?
>>
>>52485941
It doesn't guess though, they are placed logically, and if you understand that logic it is not necessary to include semicolons.
>>
>>52486023
>Java
>the paradigms of Java
retard
>>
>>52486038
just write it with proper style and then use a minifier if you need to
>>
>>52486037
fampai, we talk about FP occasionally here, games? nah, what's going on, there's /vg/agdg for that
>>
>>52486054
not him but why not just use google if you want to find out about oop? is there some kind of point you are trying to make?
>>
>tfw I started this FP discussion
>tfw it proved yet again that anti-FP people just don't have any idea what they're talking about
>>
>>52486038
Obviously there are rules and an algorithm. But the kind of person who lazily omits them likely doesn't know the rules.
>>
I am learning FP in Scala

because it's actually useful in industry

how does that make you feel?
>>
working on teaching myself java for stupid AP computer science class >teacher likes to fucking suck the cock of his custom built computer that he doesn't even know the specs of

Working on learning HTML to make that fancy ass custom start page all you cool fags have

Planning on learning some form of C to make my own damn video game like the idea guy I am.
>>
>>52486071
>implying FP isn't pointless
>implying FP has any advantage besides making you feel smug about using it
sure convinced me
>>
>>52486070
He said every paradigm had its advantages and disadvantages

I'm waiting for him to prove it
>>
>>52486082
I think a lot of advantages were brought up
>>
>>52486095
literally what advantages?
>hurr no state
>except for this state right here that i pass as input
>>
https://dorey.github.io/JavaScript-Equality-Table/
only use i've found for == is checking for both null and undefined in one go
if (optional == null) { ... }
>>
>>52486100
>literally
>hurr
>misinformation
>overuse of greentext
>>>/v/
>>
Holy shit the maths involved in machine learning is some shit. Wish I had done more previously but I guess no time like the present.
>>
>>52486115
>sure convinced me
>>
>>52486122
> >
>>
File: 1452037061036.jpg (55 KB, 379x528) Image search: [iqdb] [SauceNao] [Google]
1452037061036.jpg
55 KB, 379x528
>>52486058
honestly though, I hate the "best practices" meme.

just be yourself.
>>
>>52486137
kill yourself weeb
>>
$ cat o.nim 
proc test(n): auto =
if n == 0:
return 0
else:
return 1
echo test(9)
$ nim c o.nim
Hint: system [Processing]
Hint: o [Processing]
o.nim(1, 11) Warning: '(n): auto' has no type. Typeless parameters are deprecated; only allowed for 'template' [TypelessParam]
CC: o
Hint: [Link]
Hint: operation successful (9859 lines compiled; 0.131 sec total; 14.148MB; Debug Build) [SuccessX]
$ ./o
1
$ cat s.nim
proc test(n): auto =
if n == 0:
return 0
else:
return "fuck"
echo test(9)
$ nim c s.nim
Hint: system [Processing]
Hint: s [Processing]
s.nim(1, 11) Warning: '(n): auto' has no type. Typeless parameters are deprecated; only allowed for 'template' [TypelessParam]
s.nim(6, 10) template/generic instantiation from here
s.nim(5, 12) Error: type mismatch: got (string) but expected 'int literal(0)'
$

what is this
Can I not mix return types?
>>
What are some good uses of XOR apart from encrypting and cancelling itself out?
>>
>>52485782
periods or exclamation marks would make sense for terminating statements. historically (before C), semicolons were not for _terminating_ statements, but for continuing to the next one. ALGOL-likes usually used syntax roughly equivalent to the following:
BEGIN
DO_FIRST_THING;
DO_SECOND_THING;
DO_FINAL_THING
END

notice that the final thing has no semicolon, since it is the result of the block. this is more similar to the semicolon's use in human language than what C-like languages use it for.
>>52485737
yeah, my experience working with Idris brings me closer to feeling that it's just trying to clean up Haskell's act, but it's not really creating something totally new. the feeling of programming in Idris is very similar to programming in Haskell, but even if i'm not fully taking advantage of the type system it feels a lot cleaner.
I'm really interested in trying out your language when the time comes because I think you're one of the few people that is interested in making a good general-purpose dependently typed language that isn't just a slightly modified version of Haskell.
>>
>>52486152
>what is static typing
>>
>>52486152
Why the fuck would you be able to mix return types? It's not goddamn python
>>
>>52486158
xor with 1 to flip from 0 to 1 and from 1 to 0
>>
>>52486152
It's got shitty static typing m8
>>
>>52486158
String comp
int cmp(const char *str1, const char *str2)
{
while(*str1 && !(*str1 ^ *str2)) { ++str1; ++str2; }
return !(*str1 ^ *str2);
}
>>
>3+4+5+6*7+8+9
3 4 5 6 7 * 8 9 + + + + +

or
>3+4+5+6*7+8+9
3 4 + 5 + 6 7 * + 8 + 9 +


(I decided to try and write a program to convert to reverse polish notation, but I don't actually know what reverse polish notation is)
>>
>>52486196
oh that's actually cool, will save me some time switching state in chip8 assembly

>>52486213
Oh I was thinking in regards to 0s and 1s, but that's useful too
>>
>>52486158
You can use it to add things together.

101 (5)
010 (2)
= 111 (7)
>>
>>52486175
This is probably something really simple, but then how would something like this be implemented?
http://nedbatchelder.com/blog/200712.html#e20071211T054956
>>
>>52486217
https://en.wikipedia.org/wiki/Shunting-yard_algorithm
>>
>>52486224
>Oh I was thinking in regards to 0s and 1s, but that's useful too
Don't actually use it, it's just something another anon shit out the other day
>>
>>52486230
It doesn't seem to work with all though (5+3 returns 6)
>>
File: 1437719391990.jpg (7 KB, 261x191) Image search: [iqdb] [SauceNao] [Google]
1437719391990.jpg
7 KB, 261x191
>>52486204
>shitty static typing
>>
>>52486247
You need to carry bits over. Look at this to learn more.
https://www.youtube.com/watch?v=VPw9vPN-3ac
>>
>>52486078
Like I hope you're reading Rúnar's book.
>>
>>52486230
yep it's like an add without carry

0 ^ 0 = 0 + 0 = 0
0 ^ 1 = 0 + 1 = 1
1 ^ 1 = (1 + 1) % 2 = 0
>>
>>52486233

Return an option type or an error type
(Not sure what these are in nim, but you could implement them)
An option type:

Some i
(Succeeded, value is int i)
None
(Failed)

Error type:

Success i
(Succeeded, value is int i)
Error "could not parse"
(Failed, error string is "could not parse")
>>
Was reading some lecture notes.
There was a function for determining prime numbers.

bool isPrimeNumber(int x);
typedef enum {false, true} bool;
int i=2;
while(i<=x-1){
if (x %% i != 0) {
return true;
}
else {
i++;
}
return false;
}


for the while statement, wouldn't it be more efficient to do while (i<=x/2) ? because given you are searching for a prime number, there exists no divisor greater half the dividend for a prime number? or am i just crazy and stupid here?
>>
>>52486213
Saw that in a thread a day or so ago and now just wrapped my head around how that function actually works.

Thats pretty neat not gonna lie.
>>
>>52486347
>wouldn't it be more efficient to do while (i<=x/2)
yes

you can check up to as little as sqrt(x)
>>
>>52486255
I've got an add function already, but that's interesting
>>
>>52486347
>, there exists no divisor greater half the dividend for a prime number? or am i just crazy and stupid here?
None greater than the root.
>>
>>52486347
None greater than the root famalam
def isPrime(x):return len(i for i in range(2, int(x ** 0.5) + 1) if not x % i) == 0
>>
>>52486255
nand2tetris had me build something like this, it was pretty fun, though somewhat tedious
>>
>>52485537
>No advantages to immutable data structures
No race conditions
>No advantages for pure functions
No need to implement locks when writing multithreaded programs.
The overhead for locks nullifies the functional programming is inherently slower meme.
By the time you realized, that your code inherently sucks you could have written code that was easier to reason about.
>No advantages to functional programming
K
>>
>>52486530
>immutable data structures are exclusive to FP
TOP KEK
>>
>>52486530
KILL YOURSELF TARD
>>
File: 1451683583776.gif (2 MB, 400x600) Image search: [iqdb] [SauceNao] [Google]
1451683583776.gif
2 MB, 400x600
Stopping Pong in CHIP-8 because I don't like the way I've written conditionals and the way I've repeated lines because I'm ignoring subroutines, as well as touching up my assembler to accommodate labels.

I think I know a way to go about fitting Nokia Snake in chip-8's 4kb ram. Instead of having a byte to store the x and y positions of each node, I just store the relative position of each node using 2 bits. The first is 1 if down, the second is 1 if right, so 10 is down and left. To fill the 2048 pixel screen would only take half the ram, 1/8 if I were to fit 4 2-bits in each byte.

As for drawing, should just be a simple matter of drawing onto the tail to cancel it out and then drawing on the new head, rather than re-drawing everything.

It's going to be a fun project lads
>>
>collaborator on a project recommended I use PyCharm to me.
>philosophy is clearly "OO or fuckoff" and doesn't have navigation for functional heirarchy in the file - you know how the code is actually, physically run.
>line numbers not being on by default should tell you enough.
>the tics are completely useless and wrong, you have to ignore a
>default character limit is 120 instead of 79 which is pep8 standard.
>this in an IDE that has pep8 tics on by default.
>(as far as I can tell) console doesn't allow to run sections/cells of partial code.

I'd be more productive writing code in fucking CLI editor I swear to christ.
>>
>>52486635
what if it's dead-right, ie, there's no up-down component? 2 bits only allows 4 states, and on a 3x3 grid when you're at the center there are 8 other states.
>>
>>52486152
Why would you even need to differentiate between types on return if you didn't actually need to return a particular type?

The nerve of some people!
>>
How do I become the very best programmer in the world ever?
>>
>>52486700
>using any python editor that isn't IDLE

>>52486726
>dead-right
Ah thanks for that, it would be 4 bits then (even if you could squeeze it into 3 bits, I'm not hardcore enough). So assuming up-down-left-right, dead-right would be 0001. I will have to take great care in making sure 11xx or xx11 never happens, but at least now I can fit all my nodes in half a byte rather than 2 bytes (or1.5 bytes if I squeezed it more)
>>
>>52486213
is that like a !contains and concat function?
>>
>>52486748
Well, unless you're adding diagonal, you can still fit it in 2 bits, like an enum for LEFT RIGHT UP and DOWN. You would need an additional way of saying "this is the end of the list" as well, mind.
>>
>>52486738
Anyone who's asked that question has not become the best programmer in the world, so you're off to a bad start
>>
>>52486748
>IDLE
this is trash
Tried using it to write Vapoursynth scripts, and I'm like, "does this thing really only have autocomplete?"
What a trash IDE.

From a guy used to using Visual Studio everything else seems to pale in comparison.
>>
File: i feel so naughty.png (84 KB, 648x857) Image search: [iqdb] [SauceNao] [Google]
i feel so naughty.png
84 KB, 648x857
Sometimes I wonder if D makes using templates too easy
>>
>>52486782
Fuck off please!
>>
>>52486777
>Well, unless you're adding diagonal
not for nokia snake, or for any chip-8 game
>enum
I'd still need an extra bit to show if it's going horizontal or vertical. Even if I keep that information in a separate list, it's still messy and if I can fit something simpler in 4k ram with my code, I'd rather do that.
>>
>>52486700
>79 which is pep8 standard
it's as if everything about python is intentionally retarded
>>
>>52486783
autocomplete is all you need for an IDE, even then if you know the language, it's not really necessary, and sometimes it can bog you down, for example in Notepad++

>VS
seriously hope
>>
>>52486824
kill yourself
>>
>>52486783
>IDLE
>IDE
It's an interactive development and learning environment. It's not trash as long as you use it as designed - a nice REPL with an editor tacked on the side for convenience.

>>52486805
surely you can identify the direction of the segment by looking at the node ahead and behind? If the element before is above, and the element after is right, you need an "L" shaped bit. f it was left and the next is right, you need "-". In any case, there are a lot of solutions.
>>
>>52486838
SHIGGERY DIGGERY DOO
>>
>>52486812
I think 80 is decent, I don't if it's actually 79 that's just what I've been told.

Anything more than 80 is crap though.

Yes, I get that you 6 screens, but it's easier to read stacked columns that are closer together.
>>
>>52486824
enjoy your no integrated debugger, definition peeking, and refactoring
seriously 80% of my gripes is that it has no debugger features.

And if I remember, it doesn't even syntax highlight.
At some point I started copying from IDLE to the Vapoursynth editor just so I could get definitions and syntax highlighting.
>>
>>52486764
Whoops just saw that there was no concatenation, it was just incrementing pointers. Please ignore me.
>>
>>52486700
Holy fuck. This piece of bloatwhare is using 0.7 GiB of RAM.
>>
>>52486914
>the moon lander couldn't run this text editor
>>
>>52486914
still less than google chrome
>>
>>52486987
the memory usage isn't half as annoying as the process count
>>
A generic LL(1) parser in C.
>>
Can /dpt/ average two strings in C?

char* average(char* a, char* b)
{
return ((a+b)/2);
}
>>
>>52486839
>surely you can identify the direction of the segment by looking at the node ahead and behind?
You can't read the screen, and storing the positions of nodes was the original issue using up too much RAM. Even if you were to draw on top of each tile to see if it sets the collision flag, it would not work if a snake node was adjacent to 3 different snake nodes.
>>
>>52487047
ah, fair. I thought you could store them in sort sort of stack.
>>
>>52487088
Oh to add, I remember why I thought 2 bits was a good idea. And it's pretty much your enum idea. I don't know why I thought I'd need an extra bit to see if I'm going horizontal or vertical. If I set it like 00-up, 01-down, 10-left, 11-right, I can do a shift right, and the remaining bit would determine if it's horizontal or vertical and the carry bit would determine if it's going towards upper-left or lower-right
>>
>>52487039
>can /dpt/ do my homework for me
>>
>>52487205
it's a meme you dip
>>
>>52487205
what?
>>
>>52487039
>off by a half
disgusting
>>
void Calculate(){
Calculate();
}
>>
>>52487285
void Calculate()
{
Calculate();
}
>>
>>52487294
ew that looks disgusting
>>
>>52487285
>>52487294
code blocks you animal
>>
>>52487294
void
Calculate(
)
{
Calculate(
);
}
>>
>>52485996
>advantage of type conversion
TRIGGERED
>>
>>52487294
void Calculate() { Calculate(); }
>>
let rec Calculate = Calculate
>>
>>52487389
void
Calculate
(
)
{
Calculate
(
)
;
}
>>
>>52487285
Now we're cooking!
>>
File: mfw.jpg (146 KB, 820x615) Image search: [iqdb] [SauceNao] [Google]
mfw.jpg
146 KB, 820x615
Sometimes I almost don't believe how much of a fucking retard I am
>>
>>52486700
Use whatever you want.
>>
File: lmaodudweed.jpg (62 KB, 500x422) Image search: [iqdb] [SauceNao] [Google]
lmaodudweed.jpg
62 KB, 500x422
ok geniuses. Explain this
>>
>>52487490
Of course I use whatever I want, that doesn't mean I'm not allowed to try or critique other IDEs.
>>
>>52487494
Stupid Americans who can't even line up a projector properly.
Also that image is fake.
>>
> VB and C# code base
> majority logic in forms, rest of it in the database
> internal business forms app
> 200 users

How to migrate from omnipotent forms app to glorious n-tier architecture?
>>
>>52487494
20 / 5 (2 * 2)

Brackets before Division before Multiplication
20 / 5 * 4
Division before multiplication
4 * 4
16
>>
>>52487494
using / as an operator in that sense is extremely ambiguous and mathematically invalid.
>>
>>52487494
real common core would say that the old way is wrong
>>
>>52487524
>>52487526
both of these

real mathematicians just right it out as fractions
>>
>>52487523
>Division before Multiplication
They have the SAME precedence, but are left-associative.
>>
>>52487543
Division has higher precedence
>>
>>52487571
>american education
>>
>>52487571
>This is what Burgerclaps actually believe
Division and multiplication are the same operator. All division can be represented by multiplication and all multiplication can be represented by division.

x / y = x * (1 / y)

It makes no sense for either to have high precedence than the other.
>>
>>52487571
No. Division and Multiplaction have the same precedance, and are done left to right.
>>
>>52487598
>>52487603
>>52487609

British education.
Division before multiplication.

Division and multiplication are not the same operator.
>>
>>52487686
That doesn't make you any less retarded.
I was educated in New Zealand of all fucking places, and they very clearly stated that multiplication and division, as well as addition and subtraction are the same precedence, and is done left to right,
>>
>>52487686
kill yourself you can easily check it for yourself just plug an expression into google or whatever

it doesn't even really matter since you get the same result but it's still left to right. if anything it would be that multiplication takes precedence but they have equal precedence, same with addition and subtraction.

semi-related: http://en.cppreference.com/w/cpp/language/operator_precedence
>>
>>52487686
>These mnemonics may be misleading when written this way,[7] especially if the user is not aware that multiplication and division are of equal precedence, as are addition and subtraction.
https://en.wikipedia.org/wiki/Order_of_operations
>>
>>52486792
The dark side of the force can be more seductive, but it is not more powerful.
>>
So does anyone else agree with me about the problem?
>>
>>52487733
mnemonics are usually shit the concepts should just stick in your brain with your own mental model of how it works if you aren't retarded
>>
>>52487740
what problem?
>>
>>52487494
>infix notation
lel, peasants.
>>
>>52487755
You know.
>>
>>52487713
>>52487726

It is a custom, division before multiplication is how we do it. There's no "mathematical truth" to one way or the other, it's just a matter of syntax and convention.

One of the reasons we do it this way is because of how it looks when it's actually written. We don't write 1 / 2 we write ½.
>>
>>52487746
Apparently you can't read. This is the important part
>multiplication and division are of equal precedence, as are addition and subtraction
>>
>>52487765
>>52487686
>British education
>>
>>52487762
Needs a better logo
>>
>>52487765
So, to detractors, does

½ * 2 equal 1, or 1/4?
>>
>>52487765
>It is a custom
No, it's just incorrect. Being retarded isn't a reason to continue being retarded.
>>
>>52487765
god damnit you fucking tard

if it's written like this:
  1
____
5*5


you do 5*5 first so it's 1/(5*5)

½*(4*4) is the same as (1/2)*(4*4) so in that case you do divide first
>>
>>52487772
HOW FUCKING RETARDED CAN YOU GET

I FUCKING KNOW THAT AND I READ IT

MNEMONICS ARE STILL SHIT WITH YOUR SOHCAHTOA AND GAY SHIT FUCKING MURRICANS
>>
>>52487778
That will always and forever be one
>>52487805
Calm down faggot
>>
>>52487778
FUCK FUCK FUCKING RETARD I'LL RAPE YOU IN THE ASS

MULTIPLICATION AND DIVISION HAVE EQUAL PRECEDENCE AND IT GOES LEFT TO RIGHT SO OF COURSE IT'S 1 YOU FUCKING RETARD IT HAS NOTHING TO DO WITH 1/2 VS ½

PLUG IT INTO GOOGLE AND THERE'S YOUR ANSWER
>>
20 5 / 2 2 * *

there
perfectly unambiguous
>>
ONLY A FUCKING SPERG WOULD RATHER LEARN A STUPID FUCKING WORD THAN ACTUALLY UNDERSTAND THE MATH CONCEPT SO YOU DON'T HAVE TO "DECRYPT" THE MNEMONIC EVERY TIME BEFORE YOU USE IT
>>
To all the fags arguing over this

Left to right same precedence
and
division before multiplication

ARE THE SAME THING AND ALWAYS HAVE THE SAME RESULTS

jesus christ
>>
Congratulations /dpt/ you're as bad as /b/.
>>
>>52486530
>No race conditions

L
M
F
A
O
>>
why is the idris compiler so slow holy shit
>>
>>52487872
I KNOW THEY HAVE THE SAME RESULT (SEE >>52487726) BUT WHEN WRITTEN OUT IT'S LEFT TO RIGHT WITH EQUAL PRECEDENCE AND IT'S WHAT EVERY NON-TARD HAS AGREED UPON

ENTER A MATH EXPRESSION ON GOOGLE OR WOLFRAMALPHA OR WHATEVER AND YOU'LL SEE
>>
>>52487824
>>52487860
>>52487897
>being this physically upset
>>
>>52487897
>I KNOW A AND B ARE THE SAME
>BUT LET ME TELL YOU WHY A IS RIGHT AND B IS WRONG
ok man
>>
File: 1418782931646.jpg (50 KB, 500x500) Image search: [iqdb] [SauceNao] [Google]
1418782931646.jpg
50 KB, 500x500
>tfw bf wakes you up with sex

now that I'm awake I'm working on finalising the design for my toy language :3
>>
>>52487915
>>
Addition: A + B
Subtraction: A - B
Multiplication: A x B
Division: A / B
Exponentiation: A ^ B

Logarithm: Log B of A
Root: Root B of A

Why are these backwards?
Why don't they get symbols?
>>
>>52487954
Logs and roots are functions.
>>
>>52487980
>British Education
>>
>>52487954
Root B of A can be represented as A**(1/B) in some languages. So in that regard it does have a symbol.
>>
>>52487916
kill yourself, degenerate
>>
File: 1411940731193.jpg (13 KB, 400x449) Image search: [iqdb] [SauceNao] [Google]
1411940731193.jpg
13 KB, 400x449
>>52487995
>I'm American
ok
>>
>>52487916
That's gay
>>
>>52487997
same as A^(1/B)

and logx and ln are kinda symbols too just not a single character in length

>>52487980
also this
>>
>>52487997
But why do you have to say (1/B)
Why does the written version go
B (radical) A
>>
>>52487980
Everything is functions. What's your point?
>>
>>52488024
nigga this is basic math

2^2=4
2^1=2
2^0.5=sqrt(2)
2^0=1
2^-1=1/2
2^-2=1/4
>>
>>52488047
I know that shit you absolute fucking retarded cunt

You apparently don't fucking realise there's a goddamn symbol called the radical fucking symbol, I guess it's too fucking radical and cool for you you stupid autistic piece of shit

a√b = b^(1/a)

holy
fucking
shit

what i'm asking you, you son of a bitch, is why the symbol is fucking backwards and why there isn't one for logarithms

thanks
>>
>>52488063
WHAT THE FUCK YOU FUCKING TARD

of course i know the radical fucking symbol

how is the symbol "backwards", what the fuck?

log, ln works perfectly fine
>>
File: USo7bEN.png (120 KB, 1541x719) Image search: [iqdb] [SauceNao] [Google]
USo7bEN.png
120 KB, 1541x719
shit gettin real bois
>>
>>52488063
>a√b = b^(1/a)
no it doesn't, a√b = √a*a*b
>>
>>52488074
>>52488063
Anons stop, we're getting worried
>>
>>52488090
he's talking about the ath root, not a*sqrt(b)
>>
>>52488090
i meant [sup]a[/sup] but there's no [sup]
>>
There is a very booty-bothered anon in our midst
>>
>>52487872
>division before multiplication
Only if the identity rule applies.
>>
>>52488105
You just answered your own question as to why there's no operators for sqrt or log. It gets convoluted really quickly when you try to shoehorn every operator into a character set. Just include the basic arithmetic as single character operators and use sqrt(), log(), for more complicated operations.
>>
Programming test for employment to write a script that combines CSV files.

I coded it up procedurally, but I'm wondering if I should OOP instead.

What does /dpt/ think? Written in PHP.
>>
>>52488128
Your code is very compact.
>>
>>52488127
No I didn't
That's like saying that the argument earlier is proof that / should be a function and not an operator
>>
>>52488128
Did you remember to check the file exists?
>>
>>52488141
S P E R G
P
E
R
G
>>
Holy fuck you guys, not being Asian is suffering right?

kill yourselves
>>
>>52488141
You could argue that / should be implemented as a function and not as an operator. Too bad for you the ASCII character set is already established and '/' was included.
>>
your education sucks apparently or you're dumb as shit

these get special symbols:

https://en.wikipedia.org/wiki/Elementary_arithmetic
>>
>>52488171
b-but, every esoteric math function should get its own symbol on the keyboard. simplicity be damned!
>>
What does 'i' get a key but sqrt doesn't? Makes no sense.
>>
File: primfuns_432x391.gif (74 KB, 432x391) Image search: [iqdb] [SauceNao] [Google]
primfuns_432x391.gif
74 KB, 432x391
>2016
>not using APL
>>
Have you ever made a starry night simulation with random shooting stars and shit, /dpt/? Seems like it would be a fun, easy project.
>>
>>52488223
What are stars?
>>
>>52488228
taytay is a star
>>
why is there no one talking about programming here
>>
>>52488182
>>52488198

>root - esoteric
>log - esoteric

t. 3 year old
>>
>>52488223
i haven't but it would be a cool thing to make using opengl
>>
>>52488240
it's /dpt/
>>
>>52488228
A fixed luminous point in the night sky which is a large, remote incandescent body like the sun.
>>
File: dpt in a nutshell.jpg (236 KB, 1624x626) Image search: [iqdb] [SauceNao] [Google]
dpt in a nutshell.jpg
236 KB, 1624x626
>>52488201
best language
>>
>>
File: dynamic.png (593 KB, 1281x644) Image search: [iqdb] [SauceNao] [Google]
dynamic.png
593 KB, 1281x644
Why would anyone want dynamic typing?
I don't see any reason to want dynamic typing other than "I am lazy and don't want to cast all the time" or "I am an artist and my variables should be as abstract as my paintings, casting detracts from my artistic direction"
>>
>>52488241
How often does the average person use log?
>>
>>52488261
It's all ones and zeroes anyway. The only difference is how it gets interpreted.
>>
>>52488261
if you want to write masculine code
>>
>>52488240
code monkeys go to wdg
>>
>>52488261
Why do you presume a variable wants to be an int or a char? Check your privilege.
>>
File: 1369359761327.jpg (25 KB, 221x221) Image search: [iqdb] [SauceNao] [Google]
1369359761327.jpg
25 KB, 221x221
>>52488282
I'm so sorry, I hadn't realized.
My privilege is now fully checked.
>>
>>52488261
because they're stupid as shit and too lazy to learn programming
>>
>>52488262
The average person takes a log twice a day
>>
>>52488297
>average

Where on earth is that average?
>>
>>52488307
In India, on the streets.

Everywhere else has the luxury of owning porcelain thrones in every home. Such decadence.
>>
>>52488278
Anon, stop shilling your shit thread. Web dev is welcome here, /wdg/ should not exist.
>>
>>52488317
>racism
did you even read the code of conduct
>>
>>52488307
https://www.youtube.com/watch?v=_peUxE_BKcU
>>
>>52488331
t. Pajeet
>>
>>52488332
Why do you presume I can read English? Stop trying to force your white languages on me.
>>
>>52488341
Everyone is welcome here as long as you are white or Japanese, so please go away.
>>
>>52488261
more expressive
>>
>>52488360
what
>>
>>52488353
so you're not welcome here then
>>
>>52488360
How is dynamic typing more expressive?
>>
>>52488375
The variable gets to pick what it wants to be after it's mature enough to do so.
>>
>>52488353
>traps
>weebs
>furfags
>bronies
are not welcome
>>
>>52488353
Are Koreans welcome?
>>
>>52488370
But 23andme says I'm 100% European.
>>
>>52488387
Yes, I already said Japanese are welcome.
>>
>>52488387
If you bring at least 1.01 women each
>>
>>52488387
only if they're qt girls with frugal pussies
>>
>>52488392
ok rafael
>>
>>52488392
23 is a prime.
>>
>>52488387
arr rook same.
>>
>>52488387
Only North Koreans.
>>
File: dfdisk.png (17 KB, 676x342) Image search: [iqdb] [SauceNao] [Google]
dfdisk.png
17 KB, 676x342
Working on a small disk image partition tool/formatter. Currently got titlebars and selection.

Though being super convoluted, modifying the console is surprisingly easy.
>>
>>52488438
Oh by the way, does anyone know how to change the colour of individual characters?? I want the numbers to be in white, but I don't want to have to change the colour of the entire buffer.
>>
how the fuck do people "enjoy coding".
is that just something they say just to look cool or let people think that what they're doing is "so fun and awesome" even though it's not?
>>
>>52488451
only hipster fags enjoy coding
real people enjoy programming
>>
>>52488451
I enjoy programming. It's really fun to make something.

'coding' is for illiterate faggots.
>>
>>52488451
It's problem solving and creativity mixed together, requiring intense amounts of focus.
I find programming incredibly fun to do, and ridiculously boring to watch.
>>
>>52488460
>>52488463
what the fuck is the difference
>>
>>52488473
dialect

one group of people does things a certain way and says a particular word
another group of people does things a different way and says a different word

means the same thing in the Oxford dictionary but fuck if you were to compare the two you'd start a riot

learn some basic linguistics you fag, saves you some stupid questions
>>
>>52488473
'Coding' is what idiots who write (only) HTML say. Programming is the correct term. Code is just the thing used to make programs.
It's like a carpenter saying that he's "Wooding".
>>
File: typ.png (24 KB, 713x673) Image search: [iqdb] [SauceNao] [Google]
typ.png
24 KB, 713x673
>>52488363
>>52488375
have you ever learn computer science at all ? a static type system must be decidable, if not, the compiler would hung forever or the type correctness of you program would not be guaranteed canceling the benefits of using such type systems. all valid programs are not necessary decidable.
>>
Learning Scheme and Prolog ASAP
>>
>>52488492
>putting bounds on an infinitely expandable system
>>
>>52488449
printNumber num =
setSGRCode [SetColor Foreground BoldIntensity White] ++
show num ++
setSGRCode [SetColor Foreground NormalIntensity White]


Something like this?
>>
>>52488492
>all valid programs are not necessary decidable

Programs which are not decidable are useless. Is this going to turn into a halting problem argument? Pls no.
>>
File: 1432860473790.jpg (59 KB, 643x546) Image search: [iqdb] [SauceNao] [Google]
1432860473790.jpg
59 KB, 643x546
>>52488516
>Programs which are not decidable are useless
>Parsing C++ is undecidable
>All C++ programs are useless
I agree with this notion.
>>
>>52488473
'Coding' is understood as the act of typing syntax into some editor window.
'Programming' is used synonymous with 'designing, implementing and debugging software'.
>>
>>52488516
>Programs which are not decidable are useless
are you really this retarded ? please don't be this retarded.

any program having a loop which ends according to the user actions is undecidable, your internet browser is an undecidable program, same for your operating system, for your video games, ...
>>
>>52488534
>writing programs that depend on user input
>>
>>52488451
the people who "enjoy coding" are normies that watched some tv show or someshit and decided to join in on the trend because DUDE GAMES DUDE APPS DUDE WEBSHIT

programming (developing programs) is enjoyable as you are taking on a challenge of your choice and solving it in some clever way. it's intellectually stimulating.
>>
>>52488534
It's not the job of the compiler to decide if a loop will exit or not when depending on external input.
>>
>>52488540
>writing programs that are essentially glorified math expressions
>>
NEW THREAD!

>>52488565
>>52488565
>>
>>52488223
I'm currently learning OpenGL (pic related), this is actually a good idea. Better than the one I had...

>>52488242
>>52488256
This is noice.
>>
>>52488795

Stop being so edgy mate, i would not be proud if i were you. Stupid cunt.
>>
>>52488137
>>52488150

I did check if the file exists, but I didn't error out if it doesn't.

Code now attached.
>>
>>52488150
Only noobs do that.
>>
>>52490563
Not using dreamweaver for php. What are you doing anon?
>>
>>52490788

>Dreamweaver
I had to Google that because my mind could not comprehend someone was suggesting the Dreamweaver that I remember being complete shit ~10 years ago.
>>
>>52490563
why are your comments in all caps?
>>
>>52490914
PHP don't deserve something better than dreamweaver.
>>
>>52485700
Except for FP, right?
>>
>>52485792
Why would you want to do that?
>>
>>52491054

No good reason honestly. I'll change that.
>>
/gd/ spillover here. What's the easiest language to learn that's good for a wide variety of things.
>>
>>52491296

Imagine someone asking you that same question about spoken languages. How could you answer that?

English is widely used and many great works of literature have been made with it, but is it the easiest?
Mandarin has been around for centuries and many great works works have been made using it as well, is it the most useful?
There are French words that have no literal English translation; does that make an English speaker less capable to relay ideas?

Pick just about any modern language and learn it and you will know if it is for you. And when you know it's not, pick a new one cause you're going to need more than one to make any money doing this anyway.

tl;dr - JavaScript
>>
>>52487603
Addition and subtraction are actually the same operator, all addition can be represented by subtraction and all subtraction can be represented by addition.
What's your fucking point?
>>
>>52487916
Please leave.
>>
>>52491296
Java
Thread replies: 316
Thread images: 28
Thread DB ID: 435762



[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 / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y] [Search | Home]

[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 / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y] [Search | 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.
This is a 4chan archive - all of the shown content originated from that site. This means that 4Archive shows their content, archived. If you need information for a Poster - contact them.
If a post contains personal/copyrighted/illegal content, then use the post's [Report] link! If a post is not removed within 24h contact me at [email protected] with the post's information.