Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options user 3965

Functional programming is a paradigm which attempts to solve computational problems by the chained evaluation of functions whose output is determined by their inputs rather than the programme state. In this style of programming, side effects and mutable data are deprecated and usually strictly isolated.

1
vote
map has other advantages, the largest two being that for loops don't have return types and can't be part of a lazily-evaluated pipeline. The first advantage means the compiler will help point out mor …
answered Aug 17 '17 by Karl Bielefeldt
13
votes
What you want to read more about is lazy evaluation. This basically means waiting until the last possible minute to do some work. So if you have the following Haskell code: takeWhile (<= 10) $ ma …
answered Feb 20 '18 by Karl Bielefeldt
7
votes
To put it simply, the restrictions mean there are fewer correct ways to put things together, and first-class functions make it easier to factor out things like loop structures. Take the loop from thi …
answered Nov 20 '14 by Karl Bielefeldt
6
votes
It's more of a design exercise than a general recommendation. You aren't usually going to put a queue between all your direct function calls. That would be ridiculous. However, if you don't design …
answered Apr 14 '16 by Karl Bielefeldt
20
votes
Functional programs handle state very well, but require a different way of looking at it. For your position example, one thing to consider is having your position be a function of time instead of a f …
answered Jun 9 '14 by Karl Bielefeldt
9
votes
People throw around the term "easier to reason about," but never explain what that means. Consider the following example: result1 = foo("bar", 12) // 100 lines of code result2 = foo("bar", 12) Are …
answered Nov 13 '16 by Karl Bielefeldt
3
votes
It's not enough for a language to have a nice feature, it also needs a compelling application. For example, functional programming languages didn't really take hold commercially until the growth of b …
answered Aug 16 '16 by Karl Bielefeldt
3
votes
Aside from potential issues with thread safety, you also typically lose a lot of type safety. Imperative loops have a return type of Unit and can take pretty much any expression for inputs. Higher-o …
answered Feb 15 '17 by Karl Bielefeldt
2
votes
Most people would strictly define "understanding category theory" as "I can understand a lecture on category theory given by a mathematician who doesn't know how to code." However, a lot of aspects of …
answered Feb 11 by Karl Bielefeldt
6
votes
It may surprise you to learn that pattern matching is not considered the most idiomatic way to work with Options. See the documentation of Scala's Options for more about that. I'm not sure why so ma …
answered Jun 22 '15 by Karl Bielefeldt
7
votes
This is where the monadic properties of Eithers come in handy (although you don't have to understand monads to take advantage of them). Most functional programming languages have a way to easily writ …
answered Jul 29 '16 by Karl Bielefeldt
1
vote
There's really no reason to convert away from degrees. Just do a simple comparison: if abs(lat1 - lat2) < lat_threshold and abs(long1 - long2) < long_threshold: The trick is in setting appropriate …
answered Jun 2 '15 by Karl Bielefeldt
6
votes
A Map is precisely the right base data structure here. I'm not sure why it would make you uneasy. It has good lookup and update times, it's dynamic in size, and it's very easy to create derivative d …
answered Jun 15 '16 by Karl Bielefeldt
6
votes
It's fine to use constants (including references to other functions) from the outer scope. If you copy your function to another file and those symbols aren't defined, you'll get a compiler error, the …
answered Jan 26 '17 by Karl Bielefeldt
15
votes
There is a common misconception about nested functions, named or anonymous, where people think that because the function is declared inside another function, that the compiler must recompile it every …
answered Jan 12 '18 by Karl Bielefeldt

15 30 50 per page