[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

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

Thread replies: 255
Thread images: 22
File: K&R himegoto waifux2.png (1 MB, 1000x1400) Image search: [Google]
K&R himegoto waifux2.png
1 MB, 1000x1400
old thread: >>52175128

What are you working on, /g/?
>>
>>52178500
TOO EARLY
>>
Threadly reminder that you should not refer to the act of programming as coding. It is improper and makes you look like a 15 year old

You are a programmer, not a coder
>>
>>52178449
>>52178465
http://pastebin.com/xtX3zHiJ
http://pastebin.com/q2chx244

When doing boardDl, sometimes images or threads will fail to download, so at the end of the program, it will give you a script you can copy to re-download them. If you keep doing that and one thread just doesn't download, check if it was deleted.
>>
Daily reminder that if your language of choice is not on this list you should probably give up and kill yourself:
- C++
- C#
- Lua
- Python
- Elixir
- Haskell
- Bash
- Clojure
- D
>>
>>52178500
>early
>>
>>52178526
Actually, I'm not a programmer either. So coding is accurate.
>>
>>52178547
>>
Threadly reminder that C code +inline asm will produce the fastest code possible. Instead of wasting your time learning other languages, why not get faster at writing C?
>>
Daily reminder that Go is a systems programming language.
>>
>>52178541
BUT MAH CALLBACKS
>>
>>52178566
Because the only feasible way of programming NVIDIA GPGPUs is through CUDA, that's why.
>>
>>52178526
Never fucking reply to me again unless you're contributing to the thread.
>>
>>52178519
>>52178547
you were too late

you need to post at 290 so we don't get fag threads like this
>>
feelio when no anime gf
>>
File: doushio!.png (292 KB, 686x720) Image search: [Google]
doushio!.png
292 KB, 686x720
Why is C so comfy?
>>
Reminder that this is the worst and most redundant general in all of /g/

Same rehashed copy pastas, same stupid arguments, same stupid people.
>>
>>52178605
python is comfier
>>
>>52178566
Daily reminder that C can't average two ints
>>
>>52178607
They don't even program, just do shitty scripts on shitty languages like JS or Python.

This thread is cancer.
>>
>>52178604
feelio when downloading all images from /a/ without opening a browser
>>
>>52178607
NEETs and IT fags gotta get their fizzbuzz on somewhere. Let them do it here where we can all filter them out easily.

First for /g/ is full of faggots that couldn't code something actually useful if their life depended on it.
>>
>>52178625
>no scope braces or semicolons
>literally letting arbitrary amounts of whitespace dictate your logical structures
no thanks
>>
Friendly reminder that Haskell programmers will refuse to do any kind of IO because IO is impure.
>>
File: 1451551029327.png (402 KB, 1024x768) Image search: [Google]
1451551029327.png
402 KB, 1024x768
>>52178500
daily reminder C can't fizzbuzz of the Christ
>>
>>52178639
But asm can.
>>
@52178681
Wrong on both counts, but I'm now realizing that "Haskell isn't pure" is a meme that is used to further propagate the "Haskell is useless" meme so I won't be replying any more.
>>
>>52178607
All other generals are just /v/ shit.
>battlestations
>guts
>smartphones
You're just mad because you can't program.
>>
>>52178677
>braces and semicolons
>comfy
u wot m8

>le FOIC meme
Like you don't indent your code when you write C, right?
>>
>>52178677
If you're telling me you use whitespace in a vastly different way so that it's misaligned if it was done in Python, you have shitty design

If you're saying extra braces everywhere is comfy, you have awful taste
>>
>>52178686
s/Christ/reddit/
https://www.reddit.com/r/learnpython/comments/1akenh/fizzbuzz_oneliner
>>
>>52178690
*"I/O isn't pure"
>>
Can anyone point me in the direction of a good resource to learn features and design best practices for .NET? Microsoft's documentation is frustratingly terrible.
>>
>>52178686
>using two lines for a one liner
>devine code
pick one
>>
>>52178721
For good practices in any language, google "language idioms" and "language anti-patterns" replacing language with the language of your choice

>>52178728
It is a one-liner, it's just formatted so the rest of the code doesn't fade into jesus
>>
>>52178500
Please stop this programming trap meme.
Thanks.
>>
>>52178696
>because you can't program.

This is irrelevant to the discussion. Nothing useful ever gets discussed on here, you don't even try to freshen it up, it's always

>Hurr C sucks
>Muh haskell and lisp one liners
>Can you fizbuzz? xD
>ur a code monkey if you don't use these languages no one in 2016 uses.
>Traps and anime autists competing against each other to make early threads to repeat the same stupid cycle

Maybe it's cause most of you are students out of school and fizzbuzz is all you really know how to do well.
>>
>>52178707
I like to write short and trivial while loops on 1 line.
C lets me do this without brackets so long as the statements fit on 1 line.
>>
>>52178690
Friendly reminder that Haskell fags are too scared to actually respond to posts because they might get contradicted.
>>
>>52178539
Thank you based Anon.
>>
>>52178784
for i in range(100): print "you're a faggot"

j = 0
while j < 100: print "You can even do multiple things"; j += 1
>>
>>52178814
how the fuck does the compiler know where the scope of the for loop ends?
>>
>>52178784
You can do short and trivial while loops on 1 line in python. You can even do multiple statements in a while loop in one line. You can even continue it on another line with no whitespace rules if it takes up too much space. Have you tried python or are you just shitposting?
>>
>>52178823
The scope ends on the newline character(s), you idiot.

Also
>compiler
Do you know anything about Python at all, or are you just parroting what you've read on 4chan?
>>
Man, I'm trying to implement something cool but everything's done already.
Tell me something interesting I should read about.
>>
>>52178785
>In computer programming, a function may be considered a pure function if both of the following statements about the function hold:
>* The function always evaluates the same result value given the same argument value(s). The function result value cannot depend on any hidden information or state that may change while program execution proceeds or between different executions of the program, nor can it depend on any external input from I/O devices (usually—see below).
>* Evaluation of the result does not cause any semantically observable side effect or output, such as mutation of mutable objects or output to I/O devices (usually—see below).

>A function can perform input or output and still be pure if
>* the sequence of operations on the relevant I/O devices is modeled explicitly as both an argument and a result, and
>* I/O operations are taken to fail when the input sequence does not describe the operations actually taken since the program began execution.
>The second point ensures that the only sequence usable as an argument must change with each I/O action; the first allows different calls to an I/O-performing function to return different results on account of the sequence arguments having changed.
https://en.wikipedia.org/wiki/Pure_function

Also
http://chris-taylor.github.io/blog/2013/02/09/io-is-not-a-side-effect/
>>
>>52178772
I don't think you understand the point of /dpt/. You shouldn't be here if you are super serious. It's a place to goof off in a programming related fashion.
You're just mad because you feel left out.
>>
>>52178853
interpreted languages are still compiled you tard
>>
I am a C programmer.
I do not recognize interpreted languages as valid software engineering tools.
All programs should be compiled and linked to the target processor for optimal performance.
>>
>>52178639
This meme isn't fun anymore.

unsigned int average = (a / 2) + (b / 2) + (a & b & 1);
>>
>>52178753
>For good practices in any language, google "language idioms" and "language anti-patterns" replacing language with the language of your choice
Thanks, but I'm looking more for best use cases of similar features in the framework since I'm finding it too massive to learn as I go.
>>
>>52178823
>this entire post
These are the kinds of anti-python C programmers that browse this general. I like programming in C too, but unnecessary braces and new lines are NOT as comfy as what python offers
>>
>>52178876

If you say so buddy
>>
>>52178873
>functional programming fanbois actually have lengthy discussion whether or not IO is impure or not

Definite proof that FP is nothing but a academic curiosity and a huge circle jerk... When will this cancer finally die?
>>
@52178915
damn i got troled hard xd better just use java instead i guess
>>
File: from_me_for_you.jpg (74 KB, 1280x720) Image search: [Google]
from_me_for_you.jpg
74 KB, 1280x720
>>52178899
>double trouble
Have an anime image buddy. It's the first day of 2016 and you're already mad. Cheer up senpai.
>>
>>52178879
>all programs should be compiled and linked to the target processor for optimal performance.

Then just go for Assembly.
>>
>>52178893
>(a & b & 1);
This doesn't do what you think it does.

>>52178877
Don't weasel your way out of this. You can do 1-liners in Python, what's your excuse for not knowing this?

>>52178879
>I do not recognize interpreted languages as valid software engineering tools.
So what kind of build system do you use then? Hard coded file names in a C program that is compiled and ran?
>>
>>52178941

k
>>
Is data-flow analysis even necessary with a language that has first class proofs, constant folding, and inlining?
>>
>>52178978
I never claimed that I didn't know this.

Why are there so many mad pyfags itt
>>
Anyone skilled with Lisp (Lispworks)? Trying to define system to compile some files like this:

 
(defsystem system ()
:members ("package" "copy-instance-class" "vect")
:rules ((:load :all
(:requires (:load :previous)))))

(compile-system 'system t)


but copy-instace-class contains definition of metaclass used in vect and defclass macro just can't find this metaclass. Anyone?
>>
If your program isn't written in OCaml, it's SHIT!
>>
>>52178935
You know I'm right though

Haskellfags spend a lot more time shitting on other "impure" languages and making useless fibonacci number generators than actually implementing anything useful.
>>
>>52178978
>This doesn't do what you think it does.

Will you really keep this shitposting? This solution is well known already for every C programmer deserving that title.

Also:
en.wikipedia.org/wiki/Bitwise_operation#AND

Good reading.
>>
File: asperger.gif (871 KB, 200x224) Image search: [Google]
asperger.gif
871 KB, 200x224
>>52179021
>more back-pedalling
>>
>>52179042
Hakkin and slaying pussy like mister robot minus the boring
>>
>>52179065
This has nothing to do with backpedaling, stop being retarded.
>>
>>52179021
Not him, but you clearly didn't know it lmao. I've worked with languages using braces and semicolons for around 9-10 years, and I've never found those to benefit me in any way that it would be better with them than without.
>>
>>52179042
Maybe in the /dpt/, but how exactly does that differ from any other language?
>>
File: dojo-photos-1.jpg (99 KB, 480x360) Image search: [Google]
dojo-photos-1.jpg
99 KB, 480x360
pyfags will go to the end of the earth "esoteric" syntax and indentation.

stay mad pyfags

pic related, your typical pyfag CODE CRUNCH
>>
>>52179062
>a = -4, b = -5 --> avg = -5
>a = -5, b = -4 --> avg = -4
>>
>>52179081
Whatever amateur. Did you buy a hoodie for $250
>>
>>52179095
Just compare the quality and extensiveness of haskell libraries v.s. those of any other language. It's not limited to /dpt/.
>>
File: shitposting.png (180 KB, 625x626) Image search: [Google]
shitposting.png
180 KB, 625x626
>>52179113
>unsigned int
>-4
>>
>>52179081
I'm not even >>52178823

I interjected after I reading >>52178853
where he was clearly being a retard.
>>
>>52179042
>>52179095
Also, the fibonacci is usually brought up in response to "fibonacci can only be done O(n^2) recursively"

>>52179131
What exactly do you mean by this?
>>
>>52179106
>will go to the end of the earth
As far as I've seen, it's only been in response to people shitting on indentation when they've clearly never tried it

>>52179115
No, but accurately enough, I did recently buy a dress suit for £250
>>
>>52178893
>>52179141
>unsigned

The average of two ints is not an unsigned int though.
>>
>>52179145
>i'm totally not samefagging you guise
>i'm totally a big dick python playa
>>
>>52179152
The haskell library ecosystem is composed almost exclusively of small, toy-like, low-quality libraries while everyone else's language's library ecosystem is composed for the most part with large, multi-manyear libraries, as well as a healthy amount of medium and small-sized libraries; almost all of which are usually well-tested and well-tuned for best performance using the language.
>>
>>52179156
You misspelled pantsuit.
>>
>>52179167
I provided the solution for two unsigned ints. But fine, if you're that autistic, here's for signed ints:

int average = (a/2) + (b/2) + (a%2 + b%2) /2
>>
>>52179152
>Also, the fibonacci is usually brought up in response to "fibonacci can only be done O(n^2) recursively"
Increasing the space complexity in order to reduce the runtime complexity is not really a solution though, although FP fanbois do have this fetish of doiing deep copies of everything everywhere because MUH IMMUTABILITY
>>
>>52179240
don't think you know how misspellings work
>>
>>52179254
>I have literally no clue how immutability works and you can't stop me!
>>
>>52179281
Thanks for describing your IQ to the class.
And remember kids, python: not even once!
>>
>>52179252
>post wrong solution
>"but this is wrong"
>HURR DURR YOU'RE AUTISTIC DURRRRRRRR
this is why we can't have nice things

>a = 4, b = 3 --> avg = 3
>a = -4, b = -3 --> avg = -4

Shouldn't you round the same way?
>>
>>52179282
>shitposting and replying to the irrelevant part of my post because you can't actually answer the issue brought up in the relevant part of my post
>>
>>52179281
Yea but I ducking kill it in tux racer
>>
>>52179308
inb4 you start yelling "autism" again, there is no need to get upset
>>
>>52179254
(define (fib n)
(define (fib* a b n)
(if (= n 0)
b
(fib* b (+ a b) (1- n))))
(fib 0 1 n))

What now, tard?
>>
>>52179327
No! You are so brain dead that it is impossible to communicate with you. Don't limit me with your blindness. Are you 14?
>>
>>52179293
lmao the lengths someone will go just because they got told. Next time don't copy shit you saw on 4chan and use that in your arguments

>>52179338
imploring I wouldn't have showed you up anyway given my muskels
>>
>>52179369
>no ur stoopid
Quality post anon.
>>
>>52179308
>Shouldn't you round the same way?
What compiler are using? mine's using C99 std and works fine for each of the provided cases

Also:
>using the "hurt durr insert something here" brainless comeback
You're better than that, jimmy.
>>
>>52179254
>Increasing the space complexity in order to reduce the runtime complexity is not really a solution though
See >>52179360, and also it's not often that you need a single Nth fibonacci number instead of a whole sequence
>>
>tfw my cousin wants to program naked with me
what language should I teach her?
>>
>>52178873
>The function result value cannot depend on any hidden information or state that may change while program execution proceeds or between different executions of the program
removing side effects does not make a language pure, all 'pure' functional programming languages have an environment, this environment is mutable because it is assigned values. you can continue to assign values in this environment using the same name as old values because this environment maintains an immutable record, the actually names that values hold means nothing and is just syntactic sugar. you could create a Haskell program where every variable has the same name, this does not affect the underlying environment. the only programming language that is truely pure is the lambda calculus because the lambda calculus has no environment and even the concept of a number has to be implemented as function calls
>>
>>52179348
Not upset at all, and no Im already bored of playing the captain obvious.
>>
>>52179405
>What compiler are using? mine's using C99 std and works fine for each of the provided cases
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.2.0
Thread model: posix


I get the same answers in Python, -3 and -4 yields -4, while 3 and 4 yields 3.

>You're better than that, jimmy.
Hey, I was just responding to you crying "autism" for pointing out that the answer was supposed to be signed.
>>
>>52179444
what anime is she from?
>>
>>52179432
>it's not often that you need a single Nth fibonacci number instead of a whole sequence
Are we making excuses now?
>>
>>52179360
int fib(int n)
{
int a = 0;
int b = 1;
while (n-- > 0)
a = (b += a) - a;
return a;
}

What now, autist?
>>
>>52179479
RealLife
>>
>>52179512
You should use a real language then. Like Python.
>>
>>52179448
I haven't read a post this retarded in YEARS!
>>
>>52179528
Sweet, I hope my scripts turn her on, thanks lad
>>
>>52179510
>not using the dedicated Slide operator
>not using the poo in var operator
>being saltier than the dead sea
0/10 would not program with.
>>
>>52179510
>a = (b += a) - a;
Is this well-defined?
>>
>>52179444
D
>>
>>52179512
There's only one valid answer to that and you know it. Give here the D!
>>
Is this how to be a Pythonista?

names = f.readline().lower().strip().split(',')
>>
>>52179555
As well-defined as
a = ++b - a;
.
>>
>>52179555
b is set to b+a
a is set to b+a-a or b
in short:
a, b = b, a+b

Which is the standard fibonacci sequence incrementor, which is well-defined
>>
>>52179578
>>52179572
Okay, thanks
>>
>>52179510
« → N
« N
IF DUP 3 >
THEN 1 2 3 4 ROLL
START DUP ROT +
NEXT SWAP DROP
END
»
»
>>
>>52179593
which meme language is this?
>>
>>52178593
iirc cuda is not a programming language but an API, also you should look into OpenCL.
>>
>>52179465
I have zero knowledge in python, so can't answer on this part.

Im compiling it with gcc using C99, at least it yields -3, 3.
>>
>>52179532
see >>52178785
>>
>>52179604
RPL
>>
>>52179605
>iirc cuda is not a programming language but an API,
It's more a C++ dialect (as in it's a subset of C++ plus keywords and stuff)

>also you should look into OpenCL.
There's literally no reason to, I work exclusively with NVIDIA GPUs
>>
>>52179480
No, because there's a recursive fibonacci that uses O(1) space like the iterative one. Every iterative solution has an equivalent recursive solution. Always. They're identical in power, it's just that one may be more appropriate than the other.

But the metric is still pretty shit.
>>
>>52178541
There is nothing wrong with python.
>>
>>52179684
>O(1) space
What a pedantic way to say constant.
>>
>>52179605
CUDA is a programming language. CUDA programs are compiled using nvcc, or 3rd party compilers like google's CUDA compiler.
>>
File: 1446805684332.jpg (146 KB, 907x880) Image search: [Google]
1446805684332.jpg
146 KB, 907x880
How do I learn javascript coming from C?
Every resource I look at assumes I'm retarded and goes into what a variable is.
>>
>>52179713
s/nothing/everything/
Not sure how I made that typo, sorry guys.
>>
>>52179745
>Every resource I look at assumes I'm retarded
That's because you're trying to learn Javascript.
>>
>>52178541
>no ASM, no software cracking

Are you one of these "fuck piracy" cucks?
>>
void badSort(thingy sorting_target[], int elements){
for (int i=0; i<elements;i++){
for(int j=i; j<elements;j++){
if(sorting_target[i].returnAge() != sorting_target[j].returnAge()){
if (sorting_target[i].returnAge() > sorting_target[j].returnAge()){
swap(sorting_target[i], sorting_target[j]);
}
}
else{
if (sorting_target[i].returnName() > sorting_target[j].returnName()){
swap(sorting_target[i], sorting_target[j]);
//gay bytes with hats on
}
}
}
}
}

Which sorting method is this? Bubble?
>>
>>52179745
Javascript: The Definitive Guide (the js bible)
Javascript Enlightenment
Speaking Javascript
Functional Javascript
>>
>>52179769
>cracking
>development
Choose one, inbred.
>>
>>52179745
When you learn a new language it's always like that. Follow that tutorial even if boring, otherwise you will miss important things. But you must do it quickly.
>>
>>52179745
JS: The Good Parts ofc
>>
>>52179798
I didn't know "language of choice" implied development only.
>>
>>52179803
I don't remember K&R spending 10 chapters explaining what variables are for, just how to to to instantiate them.
>>
>>52179833
It was the old time, where only true developers wanted to learn to develop. Things have change and tutorial must adapt.
>>
Have you used the elevator operator today?

int i = 100;
while(i-- \\
\\
\\
) { \\
printf("Elevator\n");
}
>>
>>52179866
int i = 100;
while(i-- \\
\\
\\
) { \\
printf("Elevator\n");
}


Damn formatting
>>
File: yeahno.png (40 KB, 540x566) Image search: [Google]
yeahno.png
40 KB, 540x566
Why is Python so shit?
>>
>>52179859
if programming books didn't teach fundamentals, then where did they learn that stuff?
>>
>>52179866
>no stop condition
>>
>>52179897
(i--) == (i-- != 0)
>>
>>52179891
Nobody knows. All we know is that it is shit. Not knowing why python is shit is not itself proof that there is a God. It simply means it's something we don't know yet.

Christfags BTFO
>>
>>52179891
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
https://en.wikipedia.org/wiki/Floating_point
http://floating-point-gui.de/
>>
File: げみ-396769Y-カイ-8.jpg (294 KB, 1000x708) Image search: [Google]
げみ-396769Y-カイ-8.jpg
294 KB, 1000x708
>>52178566
because C will not get you a job or money

>inb4 it's not about money

it's about money
>>
>>52179891
That's a property of floating point numbers, not meme-snake.
>>
>>52179897
When it reaches zero, idiot.
>>
>>52179924
my bad, lad, elevator operator is looking pretty tight then
>>
>>52179892
It was the old time, people learn from other people. The K&R book was a book for developers, not for noobs.
>>
>>52178677
>preferring one arbitrary delimiter to another
>2015 was yesterday
>>
>>52179945
fuck off, it's midnight, my brain is off
>>
>>52179931
>because C will not get you a job or money

Where do you live? Swaziland? C is one the most request languages for a position of respect.
>>
File: python.png (5 KB, 259x282) Image search: [Google]
python.png
5 KB, 259x282
>>52179891
Apart from the first result, everything looks normal.
>>
>>52179962
It's 1pm though.
>>
>>52179931
>it's about money
the whole point of working is earning just enough to live comfortably
it's not about the money
>>
>>52179962
>being retarded webdev
>>
>>52179745

Don't JavaScript have an official documentation or anything similar?
>>
>>52179976
I'm in london lad, you in aus?

>>52179984
I've never done web anything
>>
>>52179952
>people learn from other people
but who taught the teachers?
>>
>>52179962
It's 23:51

It's not midnight anywhere on planet Earth, you stupid fuck. Are you daydreaming about your chinese cartoons again?
>>
>>52179881
I know you wanted to be funny and stuff but as opposed to the other two "operators", yours doesn't even compile at all while the other two work fine.
>>
File: げみ-396769Y-カイ-1.jpg (182 KB, 800x800) Image search: [Google]
げみ-396769Y-カイ-1.jpg
182 KB, 800x800
>>52179970
>C
>Useful for anything other than drivers and loonix

People want C#, Java, SQL, and web languages. Nobody wants C anymore.

>>52179983
>Just enough to live comfortably

My soviet radar is going insane here, comrade.
>>
>>52179999
Their teachers.
>>
>>52179970
LMAO
>cmen are THIS deluded
>>
>>52180013
and who taught their teachers?
>>
>>52179999
Hermes Trismegistus.
>>
>>52180000
>being this autistic about exact time
>2015 was yesterday
>>
>>52179999
Those who learn by themselves were the true genius, Pascal and Turing.
>>
>>52179995
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference
>>
>>52179999
Checked em.
>>
>>52179933
no, just shitty python. F#:
[1.0 - 0.9; 0.9; 0.2; 0.3; 0.2 - 0.1]
|> Seq.map (printfn "%f")

outputs:
0.100000
0.900000
0.200000
0.300000
0.100000
>>
>>52180036
programming languages didn't even exist in their time
>>
>>52180031
Their teachers. Are you dumb?
>>
>>52180010
That's because I mixed up my // and \\, but it's fine otherwise
>>
>>52180040
>just shitty python
I feel like this is coming from someone whose only languages were Python and F# kek
>>
>>52180050
No but algorithm was already a thing.
>>
>>52180040
>print
python does that too
>>> for n in range(10):
... i += 0.1
... print(i)
...
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1.0
>>>
>>
>>52179891
You can just use the decimal package if you really want to avoid float representations that badly.
>>
>>52180052
How back does this go?
I've already gone back 3 generations, who was teaching for loops in the 1800s?
>>
Are you good enough to write code that is valid in 6 languages /dpt/?
http://www.retas.de/thomas/computer/programs/useless/misc/polyglot/c.html
>>
>>52180057
No?
>>
>>52180011
I thought I mentioned a position of respect, not a fucking clueless webdev trainee. I'm in UK btw, are things that shitty in US? (Assuming your american)
>>
>>52180011

>programming embedded systems with C# java and web languages
>>
>>52179933
no, just shitty python. F#:
[1.0 - 0.9; 0.9; 0.2; 0.3; 0.2 - 0.1]
|> Seq.map (printfn "%g")


outputs:
0.1
0.9
0.2
0.3
0.1


>>52180040
[edit]

>>52180075
That's not the same thing, so why did you bother posting it?

>>52180060
>I feel like this is coming from someone whose only languages were Python and F# kek
You're feelings mislead you anon. Learn not to trust them.
>>
>>52180040
anon, I have bad news for you
>>> ["%f" % n for n in [1.0 - 0.9, 0.9, 0.2, 0.3, 0.2 - 0.1]]
['0.100000', '0.900000', '0.200000', '0.300000', '0.100000']
>>
>>52180083
Their teachers, of course. Are you retarded?
>>
>>52180040
And what does 0.0999999999999978 round to with only 6 decimal places?
>>
>>52180116
not the same as >>52179891
The shittyness is caused by pythons numeric weak typing.
>>
>>52180090
Yes? It's not inside a function, if that's what you're complaining about, but it's valid C syntax if you replace all the \\ with //
>>
>>52180113
>You're feelings mislead you anon
Then you need to actually try doing floating-point arithmetic in other languages before you claim it happens only in Python, you dumbshit
>>
>>52180113
>>> i = 0.1 + 0.2
>>> i
0.30000000000000004
>>> print(i)
0.3
>>
>>52178978
Autotools.
>>
>>52180134
0.1, like F# is smart enough to do by default unlike other shitty languages.
>>
>>52180096
>Yuropoor
that explains why you're advocating using 46 year old technology. Here in 2016, we've got more advanced technology. Don't worry, American universities will donate all our old textbooks to you in a decade or so, once we've translated them to your 3rd world pig latin
>>
>>52180037
Thanks. And by the looks of it, it should be enough for an experienced programmer to get into this language basics. But that's just how I like to learn.
>>
>>52180111
>embedded systems

Oh, so by "position of respect" you meant "programming simple IO for cars". You're one step above a grease monkey, you trade school dropout.
>>
>>52180141
>>52180116 is however the same as >>52180040
>The shittyness is caused by pythons numeric weak typing.
jesus christ
>>
>>52180146
>before you claim it happens only in Python, you dumbshit
>claiming i said things I never said
It's okay anon. Reading is hard. Don't feel too bad about it okay?
>>
>>52180074
And so they were 2000 years BC. Your point?
>>
>this fucking F# idiot again
>>
>>52180187
I'd suggest eloquent javascript, btw
>>
>>52180193
> >>52180116 is however the same as >>52180040 (Me)
I don't have a problem with >>52180116
>>
>>52180075
>>52179933
OCAML STRONK
1.0 -. 0.9;;
- : float = 0.1
0.9;;
- : float = 0.9
0.2;;
- : float = 0.2
0.3;;
- : float = 0.3
0.2 -. 0.1;;
- : float = 0.1
>>
>>52180207
Don't be salty anon.
>>
>>52180194
>That's a property of floating point numbers, not meme-snake.
>no, just shitty python.
Maybe you should learn your english, but you see were it says that the innaccuracy (which still prints accurately) is only for floating-point arithmetic? When you said, no only in shitty python, it means you think it isn't a property of floating-point arithmetic, but just the way python works. I'm so sorry Python is more popular than your meme language
>>
File: thor20 blaze it.gif (2 MB, 500x375) Image search: [Google]
thor20 blaze it.gif
2 MB, 500x375
Someone mentioned project euler a bit back

are you supposed to solve these problems with unlimited processor time or such that you can execute your program and compute the answer from scratch in a few seconds?
>>
File: Capture.png (22 KB, 695x738) Image search: [Google]
Capture.png
22 KB, 695x738
Finally did that circle of life
won't post code since i'm honestly ashamed of it, it's shit
>>
>>52180238
Project Euler guy says somewhere it should all be possible in under a minute, if it takes longer, consider altering your algorithm
>>
File: PSicon.png (126 KB, 900x900) Image search: [Google]
PSicon.png
126 KB, 900x900
I mostly work on back end web-dev, but as part of my thesis for Uni my project includes doing a lot of front end work. So I thought I should make some mockups of the website in Photoshop. but I've never really used Photoshop before. how hard is it to create a PSD of a website in photoshop? are there easier ways? I was consider just drawing the fucking thing and scanning it to put into my thesis.
>>
>>52180238
They're challenges, not demands.
Part of the fun is thinking up better algorithms.
>>
>>52180251
that's the fruit of life of you absolute melt
>>
>>52180200
I was proving something.
>>
>>52180238
You're not supposed to brute force it, no.

Here's one:

(((((7)^7)^7)^7)...)^7

etc., where there are 1000 exponents. What is the final digit of the resultant number?
>>
>>> from decimal import Decimal
>>> i = Decimal('0.1')
>>> n = Decimal('0.2')
>>> i + n
Decimal('0.3')
>>> float(i + n) == 0.3
True
>>>
>>
>>52178500
why is Java the retarded step brother of C++?
does it have any redeeming factors to make it useful in the workplace?
I'm a senior in Highschool, and in my third year of our CompSci course, and all we've learned is Java. I've dabbled in C++ and PHP in my free time, but as I use Java every day in class, I am much better at it.
>>
>>52180270
7
>>
>>52180270
easy 7
>>
>>52180280
It's accurate without anyway. The temporary innacuracy is a remnant of C programming
>>> 0.1 + 0.2
0.30000000000000004
>>> print _
0.3
>>>
>>
>>52180234
>but you see were it says that the accuracy
I never said it was not accurate, it's just annoyingly long. And while python does this because it's shitty, it's not the only shitty language out there. My apologies if I led you to think this.

Honestly it's a little subjective, but I feel by default huge print outs like that showing tiny rounding errors should not be default.

>I'm so sorry Python is more popular than your meme language
LOL. The best thing about python you can think of to make me feel jealous is that it's popular. I'll grant you that, that is by far the best thing about python.
>>
>>52180174
>yuropoor
Typical American answer. I'd like you to check which of our currencies is more valuable. Google that. Have fun confirming your own stupidity.

> 46 year old technology
Weird how this 46 years old tech does things faster than your "advanced technology" adapted for teenagers to work with.

Again typical Amerifat defending with senseless shitposting. What's next? Youre going to appeal to the "m-muh freedoms" meme? Good to have a laugh at.
>>
So apparently Rust is very bitchy about what it does and does not allow for "return statement without explicit return keyword". I have thus decided that if I am to further explore this language, I will just use an explicit return statement for everything, just as I would in C.

fn average(a: i32, b: i32) -> i32 {
// If a and b are not the same sign, we can safely add without overflow.
if (a < 0) != (b < 0) {
return (a + b) / 2;
}

// Otherwise, we take advantage of a particularly useful mathematical
// property: (a + b) / 2 is the same as (a/2) + (b/2). We will use a
// modulus to account for averaging two odd numbers.
return (a/2) + (b/2) + (((a%2) + (b%2)) / 2);
}

fn main() {
for i in -10..11 {
for j in -10..11 {
println!("Average of {} and {} is {}", i, j, average(i, j));
}
}
}
>>
>>52180304
Actually, the reason why python prints like that is because it uses a limited precision + rounding in the print routine whereas it shows the actual value in the repl print.
>>
>>52180283
it's much faster and easier to develop a program using java than C++
>>
>>52180304
print rounds it
>>> 0.1 + 0.2
0.30000000000000004
>>> print 0.1 + 0.2
0.3
>>> print 0.1 + 0.2 == 0.3
False
>>>

http://stackoverflow.com/questions/3481289/converting-a-python-float-to-a-string-without-losing-precision
>>
>>52180314
>My currency is strong in terms of unit to unit conversions. We must be wealthy! Gotta spend 100 japanese yen to buy a british the queens sterling pound, the japanese must be poor as fuck LOL!
No wonder you guys lost your empire.
>>
>>52180305
>I never said it was not accurate
Clearly you dumbfuck, if you kept track of what you were shitposting, you'd know the first line wasn't your post, but the post you were quoting
>>
>>52180266
idgaf

>>52180251
if you're wondering what's wrong with it, it has no caching. Basically it works by drawing a hexagon and for each point drawing a circle then adding it to a list. I then go through the list and for each point, draw another hexagon, draw the circles for that. These hexagons are invisible of course.

Problem is it goes through the list each time. So for a 2 deep hexagon it takes 36 + 6 tries (6^2, 6 being the sides in a hexagon). Next time its 6 + 36 + 36*6 tries... etc. Should be simple enough to make it not loop though, speeding it up loads
>>
>>52180314
Why is it that people come from all over the entire world to work in CS in the United States?

because all the greatest companies are in the USA. Name one tech giant from England.

>protip:
impossible. Go throw some shrimp on the barbie and fuck a koala, mate.
>>
>>52180380

GCHQ
>>
>>52180380
Isis.
>>
Hi guys, /wdg/ here! I was wondering if there's an easy way for me to transfer my knowledge of css/html/javascript to a "real" programming language to become a GUI experience artisan. Could anyone recommend me some books?
>>
>>52180393
Literally never heard of it. Is that like a down-under version of the NSA?
>>
Are USAcucks still mad UK is considered as having the number 1 economy by the UN still?
>>
>>52180397
But isis is musli oh
>>
>>52180414
download this
http://electron.atom.io/

just wrap your js around a browser instance and your program is ready to ship
>>
>>52180380
>>52180426
>shrimp on the barbie
>koala
>down-under
>this is what ameripoors are taught europe is like
>>
>>52179891
All there replies, pyfags so mad
>>
>>52180437
Your economy won't be worth shit once the rest of the world cuts off the UK from the internet because all packets passing through it get stripped of their SSL to please david cameron.
>>
>>52180350
>can't defend himself properly
Well no wonder your country got so polluted with all the Latino shit. Still, we have a higher per capita income as well, if that satisfies your ignorant ass.

Besides, nice way of escaping a valid discussion on the topic by appealing to the personal attacks
>>
>>52180478
yes I'm sure this is a thing that will happen

lmao stay peanut butter and jelly, we'll be a number 1 for a much longer time
>>
>>52180353
>you'd know the first line wasn't your post, but the post you were quoting
... huh?
>>
>>52180510
I never said you ever said it was innacurate, the only way you could have inferred that was if you thought the first line I greentexted was your post, or you are just too dumb to follow an argument
>>
>>52180380

>Name one tech giant from England
ARM Holdings.
>>
>>52180492
I'm not the amerifat you were responding to.

>Still, we have a higher per capita income as well, if that satisfies your ignorant ass.
https://en.wikipedia.org/wiki/List_of_countries_by_GDP_(PPP)_per_capita

got a source for that?

>Besides, nice way of escaping a valid discussion on the topic by appealing to the personal attacks
C is generally retarded as it's hugely unproductive for the vast majority of programming problems today. For embedded stuff and high performance drivers etc, it's good. but not much else.
>>
#!/usr/bin/env python2

import turtle

length = 500
level = 5

def side (level, length):
if level > 0:
side (level - 1, length / 3)
turtle.left (60)
side (level - 1, length / 3)
turtle.right (120)
side (level - 1, length / 3)
turtle.left (60)
side (level - 1, length / 3)
else:
turtle.forward (length)

for i in range (0, 3):
side (level, length)
turtle.right (120)

turtle.done ()
>>
>>52178963
That misses the point of C. C is supposed to be a high level version of assembly where you get the power of assembly, such as memory management, whilst allowing you to write programs in an abstract way such that you can compile the same C code on many different CPU architectures without having to rewrite the whole code.
>>
>>52180603
You should probably link him the page for higher per capita income, you absolute sponge
>amerifools in charge of reading comprehension
>>
File: 640_wilson-prize.jpg (315 KB, 640x426) Image search: [Google]
640_wilson-prize.jpg
315 KB, 640x426
>>52180538
>brit tranny writes ARM instruction set
>UK's greatest tech achievement
>>
>>52180646
>You should probably link him the page for higher per capita income, you absolute sponge
I'm not exactly sure what you mean.

I'm not american.
>>
>>52180682
>higher per capita income
>links GDP per capita
>>
File: Capture.png (11 KB, 842x677) Image search: [Google]
Capture.png
11 KB, 842x677
>>52180632
screenie for you guys since op was too lazy to post one
>>
Trying to make a game of life program in Java
Hit a bit of a snag when I realized that SWT and multiple shells aren't the best thing for what I'm doing

Next time, what library should I use for display? SWT seems to be pretty dated.
>>
What's a good casual filter so I can prove I'm gitting gud
Thread replies: 255
Thread images: 22

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

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.