Web devs

>web devs

Attached: web.png (900x495, 163K)

Other urls found in this thread:

docs.python.org/3/library/functools.html
twitter.com/NSFWRedditGif

source?

yeah, well, welcome to the future. people who think that reading hacker news articles represents deep knowledge of a given topic. copy and paste from stack overflow. abstraction is "complex code". webpack babel react to make a hello world side is sick dude. lol npm install boilerplate.

nottudisbaituagain.jpg

functional programming means using functions as syntactic sugar

>functions as syntactic sugar
What did he mean by this?

...

*SCROT*

Attached: This one is going in my cringe folder.png (800x800, 413K)

Foreach and map is not syntax sugar though at least not in real functional languages

For loops are ugly. Foreach is clearer in its intention. Map makes sense if you wish to map your collection to another collection. What is the controversy?

Probably really stupid to nitpick about such insignificant parts of program design also
>can you teach me on that
>they look ugly

Is there a good video or article that expands on this?

Yeah the book functional programming in scala and the coursera course has a lot of stuff on map and foreach and how they can be used functionally.

I believe it. A guy at my last job submitted a bug fix to an open source python project. It was literally rejected for having a for loop, which made it "not pythonic". He didn't fix it, closed the PR and never touched python again.

link to pr?

TOOWTDI

>for loops are ugly
he's actually correct here

for (let i = 0; i < myArr.length; i++) { myArr[i].doStuff() }

for (let obj of myArr) { obj.doStuff() }

myArr.forEach( obj => obj.doStuff() );

I usually do the second even though it's slightly slower than a regular for. Bite me.

list.forEach(Meme::doStuff);

i find a way to cobble together a convoluted lodash oneliner no matter what

>meanwhile Jow Forums argues about curly braces

Did we mention we arent brainlets like pajeet yet? Pajeets brain could never comprehend such important issues as curly brace design and pointer syntax

While we're on the topic, what are some common, basic higher-order functions to understand how to use?

>map
>filter
>reduce/fold

what else?

console.log([].__proto__)

Larvascript wasnt allowed in this thread. Gross

Personally I appreciate people like this, they make me look smarter in comparison.

looks neat, thanks

most of those aren't higher-order though

>For loops are ugly.
Only in ugly languages haha

>split
>join

i'm learning for loops help me understand

numbers = [1, 3, 4, 5, 7]
for number in numbers:
if number > 6:
print number
else:
print("oops")

I expected 7 to get printed by why does my string also get printed?

I hope you are just a troll

no i just started

To be fair, higher order functions hella beats the shit out of messes of loops and other common structures.
Not that non-functional languages really get higher order functions right pretty much ever.
Not even Ruby, although Ruby comes close.

That said, this dude is more retarded than people who can't understand the superiority of higher order functions like map.

>and never touched python again
he got out while he could
python is cancer

>no i just retarded
Fixed

you're below pajeets, a complete waste of air

You go over each element and check if its greater than 7. If it isnt you print a string. This happens 5 times (until it iterates over the whole list), 4 out of which you if clause is false, hence a string is printed.

You are probably a troll but whatever.

Attached: 60edbb03d34421f6ecc903a66df496bff0726ed7e92b2a16e111c16a7e9a8f7a-tech.jpg (256x192, 76K)

I do the first because I can't be bothered to learn which keyword doesn't iterate over object properties as well and I can't be bothered to remember which new stuff is supported by IE. Except I use var instead of let, for the same reason.

Oh good one. Because standard for loops don't look essentially the same in most languages

list.parallelStream.forEach(Meme::doStuff)

Why can't everything be java

std::for_each(std::begin(list), std::end(list), std::mem_fn(&Meme::do_stuff));
I'm shocked how well compilers optimize this

In many cases for loops are the less elegant solution. JS engines might render forEach/map/reduce into code that is the same speed as the for loop, anyway. Even if not, there are very few use cases in which the difference would matter. You might as well complain about people who use recursion.

I stick with for loops because I know what to expect, I can do anything to them, and I find them easier to read. I hate other loops

docs.python.org/3/library/functools.html

>never touched python again.
good for/on him
Python is basically PHP with a nicer looking syntax minus the ability to improve

considering the amount of compile time they better do

If you are struggling with this shit you might as well quit now.

Should have used list comprehension