HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
mythz
swift-linq-examples
Swift2014–2020
mythz / swift-linq-examples

swift-linq-examples

C#'s 101 LINQ Samples translated to Swift

2Distinct people
8Mentions
0Explicit recommenders
249GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

C#'s 101 LINQ Samples translated to Swift

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 5:04:57 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year8 dated mentions

Observed mentions: 2014-06-09 21:04:23 UTC to 2020-01-29 02:58:44 UTC.

01232014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 3 mentions; 1 submissions, 2 comments20142015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments20172018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2020

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC312
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC101
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC000
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC211
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC101
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC000
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC101

What Hacker News says

8 sources
As LINQ has been positioned as one of C#/.NET's biggest strengths their 101 LINQ Examples are a nice set of simple code examples to compare how well different languages fare against each other: - Swift https://github.com/mythz/swift-linq-examples - Kotlin https://github.com/mythz/kotlin-linq-examples - Java https://github.com/mythz/java-linq-examples (Java 1.7) - Clojure https://github.com/mythz/clojure-linq-examples - Dart https://github.com/mythz/dart-linq-examples - #Script LISP https://sharpscript.net/linq/restriction-operators?lang=lisp (Interactive, .NET Lisp) - #Script Code https://sharpscript.net/linq/restriction-operators?lang=code (Interactive, .NET JS-Like) - Elixir https://github.com/omnibs/elixir-linq-examples - Python https://github.com/rogerwcpt/python-linq-samples - Groovy https://gitlab.com/svkj/groovy-linq-samples Most l
Read the rest
anguages fare well in both verbosity and readability so I don't view LINQ as a major strength of C# anymore, it's just a well designed, typed query language with the USP of being able to capture and traverse an expression's AST which different LINQ providers can take advantage of by translating the intent of the query into a different DSL, most commonly used by ORMs to convert to SQL and execute the typed C# Expression logic on the RDBMS Server.
In LInQer – C# Integrated Queries ported to Javascript
Many other languages offer similar functional APIs for querying collections, here is C#'s 101 LINQ Examples rewritten in different languages: https://github.com/mythz/swift-linq-examples https://github.com/mythz/kotlin-linq-examples https://github.com/mythz/clojure-linq-examples https://github.com/mythz/java-linq-examples https://github.com/mythz/dart-linq-examples https://github.com/omnibs/elixir-linq-examples http://templates.servicestack.net/linq/ Java 8+ has since improved with their Streams API. The primary benefit that differentiates LINQ apart is that you can easily capture the Expression tree of the LINQ expression and rewrite its intent to apply to other sources, commonly used in LINQ -> SQL to provide a Typed Expression API for generating equivalent SQL to run on an RDBMS.
In How generics were added to .NET
Java's one of the worst language examples of using FP collections I've seen. Even with hindsight I still find this to be uglier and unnecessarily more verbose than it needs to be. E.g. same Example in Dart: class Article { String title; String author; List<String> tags; Article(this.title, this.author, this.tags); } Article getFirstJavaArticle() => articles.firstWhere((x) => x.tags.contains("Java")); List<Article> getAllJavaArticles() => articles.where((x) => x.tags.contains("Java")); List<String> getDistinctTags() => articles.expand((x) => x.tags).toSet().toList(); Can even be shorter without the Optional typing, but it's more readable to be explicit to have them. Dart benefits from having Collection and Stream mixins so you always get a rich API on Dart's collecti
Read the rest
ons. If anyone's interested to comparing FP collections in different languages, I've ported C# 101 LINQ examples in: - Swift https://github.com/mythz/swift-linq-examples - Clojure https://github.com/mythz/clojure-linq-examples - Dart https://github.com/dartist/101LinqSamples
In Java 8: No more loops
You can add your own operator overloading of different number types to mitigate the casting required see: https://github.com/jquave/EasyCast You can also add your own String extension for length and index character at in a String with: extension String { var length: Int { return countElements(self) } subscript (i: Int) -> String { return String(Array(self)[i]) } } Which will now let you use `.length` on strings, e.g: "Cat".length; //3 And get the character at index with: "Cat"[1]; //a I've more useful extensions at: https://github.com/mythz/swift-linq-examples/blob/master/src... Which enables LINQ-like querying in Swift: https://github.com/mythz/swift-linq-examples
In Swift Blog
The main thing I miss from Swift is its extensibility letting you extend primitive types like Arrays or Strings, this lets you easily add LINQ-like capabilities even tho Swift doesn't ship with many, see: https://github.com/mythz/swift-linq-examples Dart comes with a rich functional and Stream API's on collections so most of the time you wont need to extend it (same LINQ examples in Dart: https://github.com/dartist/101LinqSamples), but unfortunately you can't extend built-in (or external) types which means you need to use top-level methods which can break-up the flow of your beautiful expression flows. Extensions is also important for minimizing unnecessary abstraction and maximizing re-usability since you can extend without being forced to create foreign wrapper API's. IMO Extensions are one of the most important traits for keeping a min
Read the rest
imal friction-free language, something I see Go and Swift benefiting a lot from. Dart does have powerful mixins (https://www.dartlang.org/articles/mixins/) but you can only mixin into classes you define (i.e. not built-in or external types). But otherwise I find Dart's optional-typing a tonne more productive than Swift's strict type inference / generic enforcement, Dart also has a rich consistent library, integrated package manager, static analyzer and overall better development experience. Although there's little overlap as Swift is mainly for creating iOS/OSX desktop apps and Dart is focused on rich Web Apps. Basically the only times when you'd be able to choose one or the other is in command-line scripts, I'd still prefer to use Dart for.
In Dart 1.5

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.