from Hacker News

Show HN: Dollar and Cent – A functional tool belt for Swift

by agp2572 on 6/30/14, 7:44 PM with 24 comments

  • by GuiA on 6/30/14, 9:29 PM

    first Returns the first element in the array and terminated the chain

    second Returns the second element in the array and terminated the chain

    third Returns the third element in the array and terminated the chain

    fourth Returns the fourth element in the array and terminated the chain

    fifth Returns the fifth element in the array and terminated the chain

    sixth Returns the sixth element in the array and terminated the chain

    seventh Returns the seventh element in the array and terminated the chain

    eighth Returns the eighth element in the array and terminated the chain

    ninth Returns the ninth element in the array and terminated the chain

    tenth Returns the tenth element in the array and terminated the chain

    ... is this a joke?

  • by agp2572 on 6/30/14, 7:44 PM

    Dollar is a Swift library that provides useful functional programming helper methods without extending any built in objects. It is similar to Lo-Dash or Underscore in Javascript.

    Cent is a library that extends certain Swift object types using the extension feature like ActiceSupport in ruby and gives its two cents to Swift language.

  • by randomguy7788 on 6/30/14, 8:33 PM

    its unfortunate that it repeats the same mistakes that underscore and lodash does (imo) and makes it very hard to do composition (data comes in first instead of the predicate/function)
  • by lsdafjklsd on 7/1/14, 3:35 AM

    Not so much functional as just useful methods for working with arrays / maps. It would be functional to include a compose method... also currying is going to be painful because of how the arguments are structured (data first).
  • by vilya on 6/30/14, 9:57 PM

    I don't understand why every result is stored into the same class-level variable. What's the aim behind that? It just seems like it would introduce unexpected behaviour without any gain, but I don't really know swift yet so maybe there's something I'm missing?
  • by MrGando on 6/30/14, 8:35 PM

    Hate this stuff, Swift != Javascript.