Edge case removed: for i=0 to 10 {print(a[i])} vs for x in a {print(x)} With functional programming it gets even better: a.filter {}.map{print} Pseudo code, of course. I list several “functional“ examples in Swift here: https://github.com/melling/SwiftCookBook/blob/master/functio... Functional programming is also a higher level language. map, reduce,filter, flatten, flapMap, drop, take, zip, ... Learn the concepts in…
The general value of typed functional programming lies in leaving no edge cases
11–20 of 172 posts
Re: The general value of typed functional programming lies in leaving no edge cases
#12The goal of software development should be about reducing the number of edge cases to the absolute minimum. If a tool makes it easier to keep track of all edge cases, it is bound to encourage developers to write code which contains more edge cases. But fundamentally, it still reduces code quality. Code with more edge cases is less flexible and not good at handling changing requirements. I've seen this over and over i…
Re: The general value of typed functional programming lies in leaving no edge cases
#13Edge case removed: for i=0 to 10 {print(a[i])} vs for x in a {print(x)} With functional programming it gets even better: a.filter {}.map{print} Pseudo code, of course. I list several “functional“ examples in Swift here: https://github.com/melling/SwiftCookBook/blob/master/functio... Functional programming is also a higher level language. map, reduce,filter, flatten, flapMap, drop, take, zip, ... Learn the concepts in…
Re: The general value of typed functional programming lies in leaving no edge cases
#14Forget the performance or the fancy memory management stuff, this is one of the best things about Rust: it makes you deal with edge cases by default (while allowing you to write code in a largely imperative or functional-lite style). It's why I think it competes for market share with some of what is currently Java/C# and similar languages. A lot of people who use those languages care about correctness, and Rust is bi…
Re: The general value of typed functional programming lies in leaving no edge cases
#15Earlier quoted context omitted.
Isn't this akin to saying I don't like wearing seatbelts because it makes me more complacent in my driving?
It could actually be the case that seat-belts make drivers more complacent but the key difference in the case of coding is that you won't die if you make a typo in your code. If designed correctly, your tests will catch it anyway.
Re: The general value of typed functional programming lies in leaving no edge cases
#16Edge case removed: for i=0 to 10 {print(a[i])} vs for x in a {print(x)} With functional programming it gets even better: a.filter {}.map{print} Pseudo code, of course. I list several “functional“ examples in Swift here: https://github.com/melling/SwiftCookBook/blob/master/functio... Functional programming is also a higher level language. map, reduce,filter, flatten, flapMap, drop, take, zip, ... Learn the concepts in…
The problem in my domain, games, is the frequent boxing and unboxing of values when using functional iterator interfaces in languages common to the industry, particulalry C#. It just thrashes the heap and forces often too-frequent gc.
Re: The general value of typed functional programming lies in leaving no edge cases
#17Edge case removed: for i=0 to 10 {print(a[i])} vs for x in a {print(x)} With functional programming it gets even better: a.filter {}.map{print} Pseudo code, of course. I list several “functional“ examples in Swift here: https://github.com/melling/SwiftCookBook/blob/master/functio... Functional programming is also a higher level language. map, reduce,filter, flatten, flapMap, drop, take, zip, ... Learn the concepts in…
Re: The general value of typed functional programming lies in leaving no edge cases
#18Earlier quoted context omitted.
Isn't this akin to saying I don't like wearing seatbelts because it makes me more complacent in my driving?
It could actually be the case that seat-belts make drivers more complacent but the key difference in the case of coding is that you won't die if you make a typo in your code. If designed correctly, your tests will catch it anyway.
In the mean time I will just keep using my strongly typed language and, of course, also automated tests. Thank you very much.
Re: The general value of typed functional programming lies in leaving no edge cases
#19Forget the performance or the fancy memory management stuff, this is one of the best things about Rust: it makes you deal with edge cases by default (while allowing you to write code in a largely imperative or functional-lite style). It's why I think it competes for market share with some of what is currently Java/C# and similar languages. A lot of people who use those languages care about correctness, and Rust is bi…
You can use a functional style in those languages as well. Or do you mean with Rust's borrow checker you have less mutability to worry about?
But from my understanding, this is not directly related to the borrow checker, which tracks who owns a reference and is allowed to modify it or not.
(That being said if you had a "default" case earlier, the compiler won't complain)
Re: The general value of typed functional programming lies in leaving no edge cases
#20Forget the performance or the fancy memory management stuff, this is one of the best things about Rust: it makes you deal with edge cases by default (while allowing you to write code in a largely imperative or functional-lite style). It's why I think it competes for market share with some of what is currently Java/C# and similar languages. A lot of people who use those languages care about correctness, and Rust is bi…
You can use a functional style in those languages as well. Or do you mean with Rust's borrow checker you have less mutability to worry about?