We often deal with collections that we know can never be empty, yet we use arrays to model them. Using the ideas from our last episode on algebraic data types, we develop a generic `NonEmpty` type that is compiler proven to always contain a value. https://www.pointfree.co/episodes/ep20-nonempty …pic.twitter.com/TE8UPVfhTY
-
-
True, but the real reason to write a full implementation was so that we could show how easy it is to strengthen it with NonEmpty, and very little change to the implementation.
ধন্যবাদ। আপনার সময়রেখাকে আরো ভালো করে তুলতে টুইটার এটিকে ব্যবহার করবে। পূর্বাবস্থায়পূর্বাবস্থায়
-
-
-
I find it so sad that Apple has not provided a variant that takes a KeyPath rather than a closure :'(
-
Better than a new API would be if Swift allowed any `KeyPath<A, B>` to be used in place of a function `(A) -> B`.
@stephencelis floated a proposal for this and it had a pretty warm reception:https://forums.swift.org/t/key-path-getter-promotion/11185 … -
Until then you can easily cook up a function `get: (KeyPath<A, B>) -> (A) -> B` so that you can do things like: users .map(get(\.name)) users.groupBy(get(\.name.first)) You could even use a prefix operator: users .map(^\.name) users.groupBy(^\.name.first)
কথা-বার্তা শেষ
নতুন কথা-বার্তা -
লোড হতে বেশ কিছুক্ষণ সময় নিচ্ছে।
টুইটার তার ক্ষমতার বাইরে চলে গেছে বা কোনো সাময়িক সমস্যার সম্মুখীন হয়েছে আবার চেষ্টা করুন বা আরও তথ্যের জন্য টুইটারের স্থিতি দেখুন।