Re:Swift and the Legacy of Functional Programming
by pklausler on Monday November 21, 2016 @12:37PM
(#13007214)
is even better, if your programming language has comprehensions.
[ Parent
| on HN ]
Re:Swift and the Legacy of Functional Programming
by aninhumer on Monday November 21, 2016 @01:44PM
(#13007929)
Eh, maybe for more complicated examples, but I think that comprehension is a lot more complicated than:
filter isValid (map peopleNamed names)
Re:Swift and the Legacy of Functional Programming
by pklausler on Tuesday November 22, 2016 @12:56PM
(#13015925)
Except that doesn't support multiple people with the same name.
Re:Swift and the Legacy of Functional Programming
by aninhumer on Tuesday November 22, 2016 @01:40PM
(#13016342)
Well I was basing mine on the original. If peopleNamed in fact returns a list, then I'm not really sure what it's doing to create that? (I assumed your example was Haskell, in which case I don't think it can do anything particularly useful)
In any case, all you'd need to add is something like concat.