TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Swift and the Legacy of Functional Programming

91 pointsby ckuroseover 8 years ago

6 comments

seanalltogetherover 8 years ago
I&#x27;m curious, does every else find this<p><pre><code> let persons = names .map(Person.init) .filter { $0.isValid } </code></pre> easier to read than this?<p><pre><code> var persons: [Person] = [] for name in names { let person = Person(name: name) if person.isValid { persons.append(person) } } </code></pre> I understand and appreciate the value of compact code, but I find the first one harder to read. A lot of inferred&#x2F;token based coding is harder for me to mentally parse.
评论 #13007289 未加载
评论 #13008170 未加载
评论 #13008353 未加载
评论 #13007278 未加载
评论 #13007833 未加载
评论 #13008417 未加载
评论 #13007352 未加载
评论 #13007405 未加载
评论 #13007914 未加载
评论 #13007214 未加载
评论 #13007257 未加载
评论 #13007331 未加载
评论 #13007381 未加载
评论 #13007260 未加载
评论 #13008026 未加载
评论 #13007216 未加载
评论 #13008067 未加载
评论 #13008164 未加载
评论 #13007223 未加载
评论 #13009601 未加载
评论 #13007218 未加载
评论 #13007239 未加载
评论 #13007641 未加载
评论 #13008030 未加载
评论 #13007328 未加载
评论 #13007433 未加载
评论 #13008247 未加载
评论 #13007752 未加载
评论 #13009703 未加载
评论 #13010945 未加载
评论 #13008355 未加载
评论 #13009003 未加载
评论 #13008629 未加载
jonathanstrangeover 8 years ago
Yo, would be nice to have some functional programming language with decent syntax to program apple machines. Let&#x27;s call it Dylan to honor the most recent winner of the Nobel prize for literature.<p>Just kidding. The bottomline of this page and talk is that <i>Swift is still not functional.</i> But you can do cool things with it.
评论 #13008531 未加载
评论 #13006830 未加载
grabcocqueover 8 years ago
Ask five programmers to define functional programming, get fifteen different answers.
评论 #13007077 未加载
评论 #13007524 未加载
评论 #13007094 未加载
评论 #13006898 未加载
评论 #13008229 未加载
评论 #13007226 未加载
评论 #13007482 未加载
评论 #13007262 未加载
评论 #13006907 未加载
评论 #13006981 未加载
mellingover 8 years ago
The talk discusses how you can incorporate a few functional techniques (map, filter) but the speaker&#x27;s main goal seems that he wants Swift to be changed to allow for a couple of other functional ideas to be brought into the language.<p>Where&#x27;s the Swift proposal for the enhancements? Product and Sum support? Algebraic data types?
delegateover 8 years ago
I enjoyed the talk, thank you.<p>The part about &quot;lifting&quot; a type was an &#x27;aha&#x27; moment for me and now I understand!*.<p>I mean, I did this intuitively, but now I know the name of the technique, which is really good.<p>Thank you, I&#x27;ve learned something new today!
zmmmmmover 8 years ago
There seem to be a lot of &quot;pretend&quot; functional languages around these days. I have recently been engaging with Scala. Having heard and read so much about how it embraces functional style I was kind of shocked to find the number of limitations and practical impediments to actually using it that way. I am starting to wonder if functional programming has finally fallen victim to the same problem that has afflicted all other methodologies - becoming too popular, part of the hype cycle and getting misinterpreted and misapplied everywhere as a consequence.
评论 #13007393 未加载
评论 #13007439 未加载