chore: sync content to repo (#9721)

Co-authored-by: kamranahmedse <4921183+kamranahmedse@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2026-03-13 15:35:46 +01:00
committed by GitHub
co-authored by kamranahmedse
parent 18456dc5fa
commit 278ca7309f
107 changed files with 846 additions and 0 deletions
@@ -0,0 +1,11 @@
# Akka / Pekko
Akka and Pekko are toolkits for building concurrent, distributed, and resilient applications on the JVM using Scala. Akka, originally developed by Lightbend, introduced an actor model for managing concurrency, inspired by Erlang. It provides abstractions for building scalable and fault-tolerant systems. Pekko is an open-source fork of Akka, created after Akka's licensing changes, and continues to provide similar functionality under the Apache License. Both toolkits support the actor model, which simplifies the development of highly concurrent and distributed applications. They also offer additional modules for HTTP, streaming, clustering, and persistence, making them suitable for a wide range of applications, from microservices to large-scale distributed systems.
Resources
Visit the following resources to learn more:
- [@official@Apache Pekko Official Website](https://pekko.apache.org/)
- [@course@Akka/Pekko Essentials Course on Rock the JVM](https://rockthejvm.com/courses/akka-apache-pekko-essentials-with-scala)
- [@article@Akka Documentation on Wikipedia](https://en.wikipedia.org/wiki/Akka_(toolkit))
- [@article@Introduction to Apache Pekko on Baeldung](https://www.baeldung.com/scala/apache-pekko)
@@ -0,0 +1,9 @@
# Anonymous Functions / Lambdas
Anonymous functions, also known as lambdas, are functions without names. You define them inline where you need them, typically to pass them as arguments to other functions. They're essentially a concise way to represent small, single-expression functions. Scala uses a special syntax to define them, making it easy to create functions on the fly.
Visit the following resources to learn more:
- [@official@Anonymous Functions | Scala 3 - Book | Scala Documentation](https://docs.scala-lang.org/scala3/book/fun-anonymous-functions.html)
- [@article@Lambda Expressions in Scala | Baeldung on Scala](https://www.baeldung.com/scala/lambda-expressions)
- [@article@Anonymous Functions in Scala: How to Use Lambda Functions Effectively](https://www.developerindian.com/articles/anonymous-functions-in-scala-how-to-use-lambda-functions-effectively)
@@ -0,0 +1,9 @@
# The apply method
The apply function is a so-called smart constructor. It's the most popular way in Scala to create new instances of data types. It's more flexible than a standard constructor because it allows for running certain logic before deciding whether an instance should be created, and, if yes, it can create an instance of a certain subtype while returning it as an instance of a supertype.
Visit the following resources to learn more:
- [@official@Universal Apply Methods](https://docs.scala-lang.org/scala3/reference/other-new-features/creator-applications.html)
- [@article@What is the apply function in Scala? - Stack Overflow](https://stackoverflow.com/questions/9737352/what-is-the-apply-function-in-scala)
- [@article@Apply Method in Scala | Baeldung on Scala](https://www.baeldung.com/scala/apply-method)
@@ -0,0 +1,8 @@
# Array
An array is a fixed-size data structure that stores elements of the same data type. Arrays in Scala are mutable, meaning their elements can be updated. Arrays provide fast and constant-time access to elements based on their indices.
Visit the following resources to learn more:
- [@official@Arrays | Collections (Scala 2.8 - 2.12) | Scala Documentation](https://docs.scala-lang.org/overviews/collections/arrays.html)
- [@article@Guide to Arrays in Scala | Baeldung on Scala](https://www.baeldung.com/scala/arrays-guide)
@@ -0,0 +1,3 @@
# Books
Books offer a structured and comprehensive way to learn a new programming language. They typically cover fundamental concepts in detail, building upon previous knowledge to provide a solid understanding. Good books often include examples, exercises, and practice problems that allow you to reinforce what you've learned and apply it to real-world scenarios. They're often curated and reviewed, providing reliable and accurate information.
@@ -0,0 +1,3 @@
# Booleans
Booleans represent truth values: either `true` or `false`. They are fundamental for decision-making in programs, allowing you to control the flow of execution based on conditions. You use booleans with logical operators like `&&` (and), `||` (or), and `!` (not) to create more complex expressions that evaluate to either `true` or `false`. These are often used in conditional statements (like `if` and `else`) and loops.
@@ -0,0 +1,3 @@
# Build Tools
Build tools automate tasks like compiling code, running tests, and packaging applications. They streamline the development process and ensure consistency across projects. In the Scala ecosystem, popular build tools include `scalacli`, a newer option emphasizing simplicity and speed, `sbt`, a widely used and powerful tool with a large plugin ecosystem, and `mill`, known for its fast builds and reliance on Scala itself for configuration.
@@ -0,0 +1,9 @@
# By-name parameters
By-name parameters are defined using the => symbol before the parameter type. Such a parameter will be evaluated only when it is used inside the method's body. You can think of it as syntactic sugar over a zero-parameter function passed to a method.
Visit the following resources to learn more:
- [@official@By-name Parameters | Tour of Scala | Scala Documentation](https://docs.scala-lang.org/tour/by-name-parameters.html)
- [@article@How to Use By-Name Parameters in Scala | alvinalexander.com](https://alvinalexander.com/scala/fp-book/how-to-use-by-name-parameters-scala-functions/)
- [@article@By-Name Parameters in Scala](https://tpolecat.github.io/2014/06/26/call-by-name.html)
@@ -0,0 +1,7 @@
# Capabilities
Scala 3 introduces a new feature called "capabilities" as an alternative way to model effects. In short, a capability is an implicit function passed as a parameter. The function that requires a capability as a parameter declares in this way, that it will only work if in its scope is a capability to perform a certain task.
Visit the following resources to learn more:
- [@article@https://nrinaudo.github.io/articles/capabilities.html](https://nrinaudo.github.io/articles/capabilities.html)
@@ -0,0 +1,9 @@
# Capture checking
Capture Checking is an experimental feature in Scala that allows you to track which designated values are captured (i.e., stored as references) by arbitrary other values. This tracking happens at compile time and is currently an opt-in mechanism that can be enabled via an import. Capture checking helps ensure resource safety and prevent capability leakage by verifying at compile-time that capabilities (representing resources, effects, or permissions) are properly managed and do not escape their intended scope.
Visit the following resources to learn more:
- [@official@Capture Checking](https://docs.scala-lang.org/scala3/reference/experimental/cc.html)
- [@article@Understanding Capture Checking in Scala | SoftwareMill](https://softwaremill.com/understanding-capture-checking-in-scala/)
- [@article@Capture Checking Basics](https://nightly.scala-lang.org/docs/reference/experimental/capture-checking/basics.html)
@@ -0,0 +1,9 @@
# Case classes
Case classes are a special type of class that is particularly useful for modeling immutable data. They provide several conveniences over regular classes, including immutability, several synthetic methods like toString, equals, and copy, as well as synthetic apply and unapply methods, which make case classes very useful for pattern matching.
Visit the following resources to learn more:
- [@official@Case Classes | Tour of Scala | Scala Documentation](https://docs.scala-lang.org/tour/case-classes.html)
- [@official@Case Classes | Scala Book | Scala Documentation](https://docs.scala-lang.org/overviews/scala-book/case-classes.html)
- [@article@Difference Between Class and Case Class in Scala | Baeldung on Scala](https://www.baeldung.com/scala/case-class)
@@ -0,0 +1,9 @@
# Case Objects
Case objects are similar to regular Scala objects but with additional features that they share with case classes - immutable and with synthetic methods. They are often used for creating singleton objects and are particularly useful in pattern matching and message passing.
Visit the following resources to learn more:
- [@official@Case Objects | Scala Book | Scala Documentation](https://docs.scala-lang.org/overviews/scala-book/case-objects.html)
- [@article@Difference between case object and object - Stack Overflow](https://stackoverflow.com/questions/5270752/difference-between-case-object-and-object)
- [@article@Difference Between Case Object and Object | Baeldung on Scala](https://www.baeldung.com/scala/case-object-vs-object)
@@ -0,0 +1,7 @@
# Category Theory
Category Theory is a branch of mathematics that deals with structures and relationships between them. In the context of Scala and functional programming, Category Theory provides a framework for understanding and designing functional programs. Key concepts include categories, functors, monads, and natural transformations, which are essential for writing maintainable functional code.
Visit the following resources to learn more:
- [@article@"Category Theory for Programmers" by Bartosz Milewski](https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/)
@@ -0,0 +1,11 @@
# Cats
Cats provides core abstractions for functional programming in Scala. It aims to be modular, approachable, and efficient, while providing a foundation for an ecosystem of pure, typeful libraries. Cats Effect, a part of the Cats ecosystem, offers a pure asynchronous runtime for Scala, enabling developers to build scalable and resilient applications. The ecosystem includes libraries for streaming frameworks, database layers, HTTP servers and clients, and more.
Resources
Visit the following resources to learn more:
- [@official@Cats Effect Documentation](https://typelevel.org/cats-effect/)
- [@opensource@Cats GitHub Repository](https://github.com/typelevel/cats)
- [@course@Cats Course on Rock the JVM](https://rockthejvm.com/courses/cats)
- [@article@Cats Tutorial on Baeldung](https://www.baeldung.com/scala/cats-intro)
@@ -0,0 +1,9 @@
# Class
A class is a blueprint for creating objects. Classes can contain methods, values, variables, types, objects, and traits. The primary constructor is defined in the class signature. Classes are defined using the class keyword followed by the class name.
Visit the following resources to learn more:
- [@official@Classes | Tour of Scala | Scala Documentation](https://docs.scala-lang.org/tour/classes.html)
- [@article@Scala - Classes & Objects](https://www.tutorialspoint.com/scala/scala_classes_objects.htm)
- [@article@Classes and Objects in Scala | Baeldung on Scala](https://www.baeldung.com/scala/classes-objects)
@@ -0,0 +1,9 @@
# collect / collectFirst
The collect and collectFirst methods are used to apply a partial function to elements of a collection. The collect method takes a partial function as its parameter and applies it to all the elements in the collection to create a new collection. The new collection contains only those elements that were successfully mapped by the partial function. The collectFirst method applies the partial function to the first element in the collection for which the function is defined and returns its result wrapped with Some, or None if the function is not defined for any element in the collection.
Visit the following resources to learn more:
- [@article@Scala Tutorial - Collect Function](https://allaboutscala.com/tutorials/chapter-8-beginner-tutorial-using-scala-collection-functions/scala-collect-function/)
- [@article@collect vs collectFirst - why the return values are of different type - Scala - Stack Overflow](https://stackoverflow.com/questions/40773529/collect-vs-collectfirst-why-the-return-values-are-of-different-type-scala)
- [@article@tech: Scala : collectFirst example](http://thushw.blogspot.com/2015/09/scala-collectfirst-example.html)
@@ -0,0 +1,10 @@
# Conditionals
Conditional statements are primarily handled using if/else and match/case constructs. The if/else construct is straightforward and similar to other programming languages, allowing for simple conditional branching. The match/case construct is more powerful and can handle multiple conditions, pattern matching, and even include guards (additional conditions using if expressions within each case).
Resources
Visit the following resources to learn more:
- [@official@match Expressions | Scala Book | Scala Documentation](https://docs.scala-lang.org/overviews/scala-book/match-expressions.html)
- [@article@Mastering Conditional Statements in Scala: If-Else and Match Explained](https://www.developerindian.com/articles/mastering-conditional-statements-in-scala-if-else-and-match-explained)
- [@article@Scala: How to add ‘if’ expressions (guards) to match/case expressions](https://alvinalexander.com/scala/how-to-use-if-then-expressions-guards-in-case-statements-scala/)
@@ -0,0 +1,9 @@
# Context bounds
Context Bounds in Scala is a feature that provides a shorthand syntax for expressing the common pattern of a context parameter that depends on a type parameter. Context bounds are used to simplify the code for generic types and are particularly useful in the context of type classes.
Visit the following resources to learn more:
- [@official@Context Bounds | Scala 3 - Book | Scala Documentation](https://docs.scala-lang.org/scala3/book/ca-context-bounds.html)
- [@article@Demystifying View and Context Bounds | Baeldung on Scala](https://www.baeldung.com/scala/view-context-bounds)
- [@article@Context Bounds - Scala 3 - EPFL](https://dotty.epfl.ch/docs/reference/contextual/context-bounds.html)
@@ -0,0 +1,8 @@
# Conversions
Implicit conversions allow the compiler to automatically convert one type to another in certain situations. In Scala 3, implicit conversions are defined by a given instance of type scala.Conversion[S, T], where S is the source type and T is the target type. In Scala 3.8+, the into keyword is used to mark types that can be implicitly converted. If the expected type of an expression is into[T], then an implicit conversion to that type can be inserted without the need for a language import.
Visit the following resources to learn more:
- [@official@Implicit Conversions | Tour of Scala | Scala Documentation](https://docs.scala-lang.org/tour/implicit-conversions.html)
- [@official@Implicit Conversions | Scala 3 - Book | Scala Documentation](https://docs.scala-lang.org/scala3/book/ca-implicit-conversions.html)
- [@article@Implicit Conversions | Baeldung on Scala](https://www.baeldung.com/scala/implicit-conversions)
@@ -0,0 +1,3 @@
# Courses
Courses offer a structured learning path, typically designed by experts, that guides you through the fundamentals to advanced concepts. They often include hands-on exercises, projects, and assessments to reinforce learning and provide practical experience. Courses come in various formats, like online videos, interactive tutorials, and in-person workshops, catering to different learning preferences and schedules. They can be a great way to stay motivated, track your progress, and gain a recognized credential upon completion.
@@ -0,0 +1,3 @@
# Data Structures: Class, Trait, and Object
Scala provides three fundamental building blocks for structuring data and behavior: classes, traits, and objects. A class is a blueprint for creating objects, encapsulating data (fields) and behavior (methods). A trait is similar to an interface but can also contain concrete methods and fields, allowing for code reuse through mixins. An object is a singleton instance of a class, useful for creating utility classes or entry points to applications. Together, these structures enable the creation of well-organized and maintainable code.
@@ -0,0 +1,3 @@
# Docs
Scala's official documentation is a fantastic place to start learning the language and its features. It provides comprehensive guides, tutorials, and API references that cover everything from basic syntax to advanced concepts. You can find clear explanations, practical examples, and detailed descriptions, making it easy to understand how different parts of Scala work and how to use them effectively.
@@ -0,0 +1,7 @@
# Early returns
This topic brings together several concepts you have already encountered: pattern matching, partial functions, the apply and unapply methods, and lazy collections. Its purpose is to let you see how they work together.
Visit the following resources to learn more:
- [@article@Many Happy Early Returns](https://makingthematrix.wordpress.com/2021/03/09/many-happy-early-returns/)
@@ -0,0 +1,3 @@
# Know your ecosystem
Ecosystems in Scala are groups of frameworks and libraries that work well together and are often maintained and developed by the same organization. While nothing is stopping you from choosing any framework or library from the wide spectrum of Scala open-source projects, it often makes sense to stick to those that belong to the same ecosystem unless you have a good reason to pick another. Of course, you’re also free to use one ecosystem in one project and another in a different project.
@@ -0,0 +1,9 @@
# Either
The Either class in Scala is used to represent a value of one of two possible types (a disjoint union). An instance of Either is either an instance of scala.util.Left or scala.util.Right.
Visit the following resources to learn more:
- [@official@Scala Standard Library 2.13.6 - scala.util.Either](https://www.scala-lang.org/api/2.13.6/scala/util/Either.html)
- [@article@Scala - Either class | by zeesh.arif | Medium](https://zeesh-arif.medium.com/scala-either-class-ca6cb44c3643)
- [@article@A Scala Either, Left, and Right example (like Option, Some, and None) | alvinalexander.com](https://alvinalexander.com/scala/scala-either-left-right-example-option-some-none-null/)
@@ -0,0 +1,8 @@
# Emacs
Emacs is a highly extensible and customizable text editor known for its features and flexibility. When equipped with the Metals plugin, Emacs becomes a robust environment for Scala development, offering features like code completion, refactoring, and debugging.
Visit the following resources to learn more:
- [@official@Emacs Main Page](https://www.gnu.org/software/emacs/)
- [@official@Emacs | Scalameta](https://scalameta.org/metals/docs/editors/emacs/)
@@ -0,0 +1,9 @@
# Enums
In Scala 3, enums are used to define a type consisting of a set of named values. They provide a more concise and safer way to define enumerations compared to the traditional Enumeration class in Scala 2.
Visit the following resources to learn more:
- [@official@Enumerations | Scala documentation](https://docs.scala-lang.org/scala3/reference/enums/enums.html)
- [@article@Enums in Scala 3: Quickly Explained | Rock the JVM](https://rockthejvm.com/articles/enums-in-scala-3)
- [@article@Guide to Scala Enumerations | Baeldung on Scala](https://www.baeldung.com/scala/enumerations)
@@ -0,0 +1,9 @@
# Error handling
Scala offers multiple ways to handle errors, including try/catch/finally blocks, Option, Either, and Try. These methods allow developers to handle exceptions and errors in a functional and composable way.
Visit the following resources to learn more:
- [@official@Functional Error Handling in Scala | Scala Book | Scala Documentation](https://docs.scala-lang.org/overviews/scala-book/functional-error-handling.html)
- [@official@Error Handling in Scala](https://docs.scala-lang.org/overviews/scala-book/functional-error-handling.html)
- [@article@Idiomatic Error Handling in Scala | Rock the JVM](https://rockthejvm.com/articles/idiomatic-error-handling-in-scala)
@@ -0,0 +1,8 @@
# Filter
The `filter` method in Scala collections lets you pick out the elements you want based on a condition. You give it a function that takes an element and returns `true` if you want to keep it, and `false` if you want to discard it. The `filter` method then returns a new collection containing only the elements for which the function returned `true`.
Visit the following resources to learn more:
- [@official@Collections Methods | Scala 3 - Book | Scala Documentation](https://docs.scala-lang.org/scala3/book/collections-methods.html)
- [@article@Different Ways to Filter Elements From a Scala Collection | Baeldung on Scala](https://www.baeldung.com/scala/filter-collections)
@@ -0,0 +1,8 @@
# find
The `find` method is used on collections (like Lists, Sets, or Maps) to locate the first element that satisfies a given condition. You provide `find` with a function that checks each element, and if the function returns `true` for an element, `find` immediately returns `Some(element)`. If no element matches the condition, it returns `None`. Think of it as a targeted search that stops as soon as it finds a match.
Visit the following resources to learn more:
- [@official@Collections Methods | Scala 3 - Book | Scala Documentation](https://docs.scala-lang.org/scala3/book/collections-methods.html)
- [@article@Scala Collections Filter | Tutorials Point](https://www.tutorialspoint.com/scala_collections/scala_collections_filter.htm)
@@ -0,0 +1,9 @@
# flatMap
The flatMap method is used to apply a function to each element of a collection and then flatten the results into a new collection. It is essentially a combination of the map method followed by the flatten method, but this seemingly very simple property makes it fundamental for Functional Programming.
Visit the following resources to learn more:
- [@article@A collection of Scala 'flatMap' examples](https://alvinalexander.com/scala/collection-scala-flatmap-examples-map-flatten/)
- [@article@Scala Tutorial - FlatMap Function](https://allaboutscala.com/tutorials/chapter-8-beginner-tutorial-using-scala-collection-functions/scala-flatmap-function/)
- [@article@Difference Between map() and flatMap() in Scala](https://www.baeldung.com/scala/map-vs-flatmap)
@@ -0,0 +1,3 @@
# Float
Floats in Scala are used to represent numbers with decimal points. They are like regular numbers but can have a fractional part, such as 3.14 or -2.7. A float uses 32 bits of memory and can store values with a certain level of precision. Because they are stored in binary format with a limited number of bits, they can sometimes have slight inaccuracies when representing certain decimal numbers.
@@ -0,0 +1,9 @@
# foldLeft
The foldLeft method is used to produce a single result by "folding" all the elements of a collection. The algorithm starts with a "zero" element which is paired with the first element of the collection to create an intermediate result element. Then that intermediate result is paired with the second element of the collection to create a new intermediate result, and so on, until the algorithm reaches the end of the collection. Then the final result is returned.
Visit the following resources to learn more:
- [@article@Scala Collections - FoldLeft Method](https://www.tutorialspoint.com/scala_collections/scala_collections_foldleft.htm)
- [@article@Folding Lists in Scala | Baeldung on Scala](https://www.baeldung.com/scala/folding-lists)
- [@article@Scala Tutorial - FoldLeft Function Example](https://allaboutscala.com/tutorials/chapter-8-beginner-tutorial-using-scala-collection-functions/scala-foldleft-example/)
@@ -0,0 +1,9 @@
# for-comprehensions
For-comprehensions in Scala are used to evaluate expressions and return a sequence of values. They have the form for (enumerators) yield e, where enumerators refer to a list of enumerators. They are basically syntax sugar over flatMap but they help a lot in making your code both safe and.
Visit the following resources to learn more:
- [@official@For Comprehensions | Tour of Scala | Scala Documentation](https://docs.scala-lang.org/tour/for-comprehensions.html)
- [@article@A Comprehensive Guide to For-Comprehension in Scala | Baeldung on Scala](https://www.baeldung.com/scala/for-comprehension)
- [@article@Scala: comprehending the for-comprehension | by Linas Medžiūnas | Wix Engineering | Medium](https://medium.com/wix-engineering/scala-comprehending-the-for-comprehension-67c9f7953655)
@@ -0,0 +1,9 @@
# foreach
The foreach method is used to apply a function to each element of a collection for its side effects. Unlike methods like map or filter, foreach does not return a value; it is used primarily for operations that have side effects, such as printing elements or modifying external state.
Visit the following resources to learn more:
- [@official@for Loops | Scala Book | Scala Documentation](https://docs.scala-lang.org/overviews/scala-book/for-loops.html)
- [@article@Scala Tutorial - Foreach Function Example](https://allaboutscala.com/tutorials/chapter-8-beginner-tutorial-using-scala-collection-functions/scala-foreach-example/)
- [@article@Using foreach() Method in Scala Collections | Baeldung on Scala](https://www.baeldung.com/scala/foreach-collections)
@@ -0,0 +1,10 @@
# Functions returning functions
In Scala, functions can return other functions. Currying is the process of converting a function with multiple arguments into a sequence of functions that take one argument each. Function composition is the process of combining two or more functions to create a new function.
Resources
Visit the following resources to learn more:
- [@article@Currying in Scala | Baeldung on Scala](https://www.baeldung.com/scala/currying)
- [@article@Currying Functions in Scala](https://www.tutorialspoint.com/scala/currying_functions.htm)
- [@article@Partially Applied Functions and Currying](https://www.scalamatters.io/post/partially-applied-functions-and-currying)
@@ -0,0 +1,9 @@
# Functions & Methods
Functions and methods are fundamental building blocks for organizing and reusing code. A function is essentially a block of code that performs a specific task. You give it some input (arguments), and it returns an output (return value). A method is very similar to a function, but it's associated with an object or class. It operates on the data within that object or class. In practice, the distinction between functions and methods in Scala is often blurred, but the key is they both allow you to break down complex problems into smaller, manageable pieces.
Visit the following resources to learn more:
- [@official@Functions](https://docs.scala-lang.org/tour/basics.html#functions)
- [@official@Methods](https://docs.scala-lang.org/tour/basics.html#methods)
- [@article@Functions and Methods in Scala](https://www.baeldung.com/scala/functions-methods)
@@ -0,0 +1,11 @@
# Gradle
Gradle is widely used for building, testing, publishing, and deploying software packages. It is known for its flexibility and efficiency in managing dependencies and resolving version conflicts. Gradle uses a Groovy-based Domain Specific Language (DSL) for writing build scripts, making it more flexible and readable compared to XML-based build tools like Maven. Gradle supports incremental builds and build caching, which can significantly speed up the build process. It is commonly used for Java, Kotlin, and Android projects but can also be used for Scala.
Resources
Visit the following resources to learn more:
- [@official@Gradle Guides](https://gradle.org/guides/)
- [@official@Gradle User Manual](https://docs.gradle.org/current/userguide/userguide.html)
- [@course@Gradle Fundamentals on Udemy](https://www.udemy.com/course/gradle-fundamentals/)
- [@article@Gradle Tutorial on TutorialsPoint](https://www.tutorialspoint.com/gradle/index.htm)
@@ -0,0 +1,9 @@
# Implicit parameters
Implicit parameters are passed to functions without having to explicitly specify them at the call site. This can make your code more concise and readable, especially when dealing with common or boilerplate code. In Scala 2, they were declared with the implicit keyword. In Scala 3, we use keywords given and using. The given keyword is used to define instances of implicit values, and the using keyword is used to declare context parameters.
Visit the following resources to learn more:
- [@official@Using Clauses | Scala documentation](https://docs.scala-lang.org/scala3/reference/contextual/using-clauses.html)
- [@article@Scala 3: Given and Using Clauses | Rock the JVM](https://rockthejvm.com/articles/scala-3-given-and-using-clauses)
- [@article@Scala 3: Using Term Inference with Given and Using (and extension methods) | alvinalexander.com](https://alvinalexander.com/scala/scala-3-given-using-term-inference-context/)
@@ -0,0 +1,3 @@
# Integers
Integers are whole numbers, meaning they don't have any fractional or decimal parts. In Scala, integers can be positive (like 5), negative (like -10), or zero (0). They are used for counting and performing arithmetic calculations that involve only whole numbers. Scala provides several integer types, each with a different range of values they can represent, allowing you to choose the most appropriate type based on the size of the numbers you need to work with.
@@ -0,0 +1,8 @@
# IntelliJ IDEA
IntelliJ IDEA is a popular integrated development environment (IDE) that offers support for Scala through its Scala Plugin. This plugin provides essential features for Scala development, including code completion, refactoring, debugging, and seamless integration with build tools like sbt and Maven.
Visit the following resources to learn more:
- [@official@Scala IDE | The Landing Page](https://www.jetbrains.com/pages/scala/)
- [@official@Get Started With Scala | IntelliJ IDEA Documentation](https://www.jetbrains.com/help/idea/get-started-with-scala.html#new-scala-project)
@@ -0,0 +1,3 @@
# Introduction
Scala is a programming language that blends object-oriented and functional programming ideas. It runs on the Java Virtual Machine (JVM) and can also be compiled to JavaScript. This makes it possible to use Scala for a wide variety of tasks, from building large-scale systems to writing web applications and scripts. It is designed to be concise, elegant, and type-safe, aiming to provide developers with powerful tools for creating robust and scalable applications.
@@ -0,0 +1,8 @@
# Iterators
An iterator is a mechanism to access a collection's elements sequentially in a performant way. They are often used in loops. On the other hand, they are mutable, and careless use can lead to non-trivial bugs.
Visit the following resources to learn more:
- [@official@Iterators | Collections (Scala 2.8 - 2.12) | Scala Documentation](https://docs.scala-lang.org/overviews/collections/iterators.html)
- [@article@Scala - Iterators](https://www.tutorialspoint.com/scala/scala_iterators.htm)
@@ -0,0 +1,9 @@
# JVM
Scala's primary platform is the Java Virtual Machine (JVM). Scala code is compiled into Java bytecode, allowing it to run on any device with a JVM, independent of the underlying machine configuration. This setup ensures compatibility with Java libraries and tools, making Scala a versatile choice for developers familiar with the Java ecosystem. The JVM's backward compatibility ensures that Scala code compiled on older versions can run on newer JVMs without issues.
Visit the following resources to learn more:
- [@official@Scala Documentation on JDK Compatibility](https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html)
- [@article@TutorialsPoint: Understanding Java JDK, JRE, and JVM](https://www.tutorialspoint.com/java/java-jdk-jre-jvm.htm)
- [@article@Scala and JVM Basics on Toptal](https://www.toptal.com/scala/scala-bytecode-and-the-jvm)
@@ -0,0 +1,9 @@
# Laziness
Laziness is a feature that allows you to defer the evaluation of an expression until it is needed. This can be useful for optimizing performance and avoiding unnecessary computations.
Visit the following resources to learn more:
- [@official@Let Them Be Lazy! | The Scala Programming Language](https://www.scala-lang.org/blog/2017/11/28/view-based-collections.html)
- [@article@Understand and implement laziness with examples in Scala, JavaScript, Swift and Racket](https://matt.might.net/articles/implementing-laziness/)
- [@article@Laziness in Scala | InfoWorld](https://www.infoworld.com/article/2072680/laziness-in-scala.html)
@@ -0,0 +1,7 @@
# Lazy collections
Lazy collections are used to describe successive transformation operations without evaluating intermediate transformations. They are particularly useful for creating infinite collections without blowing the memory.
Visit the following resources to learn more:
- [@official@Let Them Be Lazy!](https://www.scala-lang.org/blog/2017/11/28/view-based-collections.html)
@@ -0,0 +1,9 @@
# Lazy vals
Lazy vals are used to defer the initialization of a variable until it is accessed for the first time. This can be useful for optimizing performance and avoiding unnecessary computations.
Visit the following resources to learn more:
- [@official@Lazy Vals Initialization](https://docs.scala-lang.org/scala3/reference/changed-features/lazy-vals-init.html)
- [@article@Guide to lazy val in Scala | Baeldung on Scala](https://www.baeldung.com/scala/lazy-val)
- [@article@scala - What does a lazy val do? - Stack Overflow](https://stackoverflow.com/questions/7484928/what-does-a-lazy-val-do)
@@ -0,0 +1,9 @@
# LazyList
A lazy list is an immutable linked list that computes its elements only when they are needed. Elements are memoized, meaning the value of each element is computed at most once.
Visit the following resources to learn more:
- [@official@Scala Standard Library 2.13.4 - scala.collection.immutable.LazyList](https://www.scala-lang.org/api/2.13.4/scala/collection/immutable/LazyList.html)
- [@article@LazyList - Scala 3 - EPFL](https://dotty.epfl.ch/api/scala/collection/immutable/LazyList.html)
- [@article@LazyList in Scala | Baeldung on Scala](https://www.baeldung.com/scala/lazylist)
@@ -0,0 +1,10 @@
# Li Haoyi
The Li Haoyi ecosystem is centered around making Scala easy to use and productive. It includes libraries like Ammonite REPL, Mill Build Tool, os-lib, uPickle, Cask, and Scalatags. This ecosystem emphasizes executable pseudocode, ease of use, and productivity. It is designed to allow developers to write Scala in a way that is easy and productive, delivering real business value. The ecosystem is maintained by Li Haoyi and is known for its simplicity and practicality.
Visit the following resources to learn more:
- [@official@Li Haoyi's Programming Blog](http://www.lihaoyi.com/)
- [@opensource@com-lihaoyi GitHub Repository](https://github.com/com-lihaoyi)
- [@article@12 Years of the com.lihaoyi Scala Platform](https://www.lihaoyi.com/post/12yearsofthecomlihaoyiScalaPlatform.html)
- [@article@Hands-on Scala Programming](https://www.handsonscala.com/)
@@ -0,0 +1,9 @@
# List
Lists are ordered, immutable collections of elements of the same type. Once a list is created, you can't change its elements directly; instead, you create a new list with the desired modifications. They're useful for storing sequences of items where the order matters, like a to-do list or a series of events. Common operations include adding elements to the beginning of the list (using `::`), accessing elements by index, and iterating through the list.
Visit the following resources to learn more:
- [@official@Collection Types - Lists](https://docs.scala-lang.org/scala3/book/collections-classes.html#list)
- [@official@List](https://www.scala-lang.org/api/3.x/scala/collection/immutable/List.html)
- [@article@Scala - Lists](https://www.tutorialspoint.com/scala/scala_lists.htm)
@@ -0,0 +1,9 @@
# Loops
Loops are used to execute a block of code repeatedly. Scala supports the following types of loops. **while loop**: Repeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop body. **for loop**: Used to iterate over collections or ranges. It is often used for its readability and conciseness. **do-while loop**: Deprecated in Scala 3. Similar to the while loop, but the condition is tested at the end of the loop body, ensuring that the loop body is executed at least once.
Visit the following resources to learn more:
- [@official@for loops | Scala Book | Scala Documentation](https://docs.scala-lang.org/overviews/scala-book/for-loops.html)
- [@official@Scala - while loop](https://docs.scala-lang.org/overviews/scala-book/for-loops.html)
- [@article@Scala | Loops (while, do..while, for, nested loops)](https://www.geeksforgeeks.org/scala/scala-loopswhile-do-while-for-nested-loops/)
@@ -0,0 +1,10 @@
# Macros
Macros enable advanced metaprogramming capabilities, such as code generation, optimizations, and the creation of domain-specific languages (DSLs). Scala 3 macros were redesigned to be more intuitive and flexible than the previous version.
Visit the following resources to learn more:
- [@official@Scala 3 Macros | Macros in Scala 3 | Scala Documentation](https://docs.scala-lang.org/scala3/guides/macros/macros.html)
- [@official@Tutorial | Macros in Scala 3 | Scala Documentation](https://docs.scala-lang.org/scala3/guides/macros/)
- [@article@Scala 3 macros tips & tricks | SoftwareMill Blog](https://softwaremill.com/scala-3-macros-tips-and-tricks/)
- [@article@Guide to Scala 3 Macros | Rock the JVM](https://rockthejvm.com/articles/scala-3-macros-comprehensive-guide)
@@ -0,0 +1,8 @@
# Map
A Map is a collection that holds key-value pairs. Think of it like a dictionary where each key is associated with a specific value. Keys are unique within a map, and you use a key to quickly retrieve its corresponding value. Maps are useful for storing and accessing data based on a unique identifier.
Visit the following resources to learn more:
- [@official@Maps | Collections (Scala 2.8 - 2.12) | Scala Documentation](https://docs.scala-lang.org/overviews/collections-2.13/maps.html)
- [@article@Scala - Maps](https://www.tutorialspoint.com/scala/scala_maps.htm)
@@ -0,0 +1,10 @@
# map
The map method is used to apply a function to each element of a collection and create a new collection with the same number of elements, where each element is the result of applying that function to the original element.
Resources
Visit the following resources to learn more:
- [@official@Write Your Own map Method | Scala 3 - Book | Scala Documentation](https://docs.scala-lang.org/scala3/book/fun-write-map-function.html)
- [@official@A Guide to Scala Maps | Baeldung on Scala](https://docs.scala-lang.org/scala3/book/fun-write-map-function.html)
- [@article@How to Write a 'map' Function in Scala](https://www.baeldung.com/scala/maps-guide)
@@ -0,0 +1,10 @@
# Maven
Maven is a build automation and dependency management tool primarily used for Java projects. It simplifies the build process by using a Project Object Model (POM) file, typically named pom.xml, which centralizes project configuration and manages dependencies. Maven follows best practices and conventions to ensure consistent project setups, making it easier for developers to understand and manage projects. It integrates well with other tools like IDEs (Eclipse, IntelliJ IDEA) and version control systems (Git). Maven's key features include dependency management, build automation, and a large repository of libraries and metadata.
Visit the following resources to learn more:
- [@official@Maven in 5 Minutes](https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html)
- [@article@Maven Tutorial on TutorialsPoint](https://www.tutorialspoint.com/maven/index.htm)
- [@article@Apache Maven Tutorial on Baeldung](https://www.baeldung.com/maven)
- [@article@Maven Complete Tutorial for Beginners on DEV Community](https://dev.to/saiupadhyayula/maven-complete-tutorial-for-beginners-1jek)
@@ -0,0 +1,9 @@
# Method calls
Method calls can be made using different syntaxes and conventions. Methods can be called using the standard dot notation (e.g., obj.method(params)) or using the infix notation (e.g., obj method params). Scala also allows the omission of parentheses on methods of arity-0 (no arguments), but this syntax should only be used when the method in question has no side effects. Additionally, Scala supports named parameters, which can be used to make method calls more readable.
Visit the following resources to learn more:
- [@official@Method Invocation | Style Guide | Scala Documentation](https://docs.scala-lang.org/style/method-invocation.html)
- [@article@Functions and Methods in Scala | Baeldung on Scala](https://www.baeldung.com/scala/functions-methods)
- [@article@Scala - method call syntax - Stack Overflow](https://stackoverflow.com/questions/11899177/scala-method-call-syntax)
@@ -0,0 +1,7 @@
# Mill
Mill is a build tool designed for Java, Scala, and Kotlin projects. It focuses on speed and efficiency by automatically caching and parallelizing build tasks and tests. Mill uses a long-lived daemon to keep the JVM warm, which helps in maintaining fast build times. It also supports selective test execution to shorten CI times. Mill is designed to be simple and intuitive, making it a good choice for both small and medium-sized projects.
Visit the following resources to learn more:
- [@article@Mill Official Documentation](https://mill-build.org/mill/index.html)
@@ -0,0 +1,9 @@
# Monads
Monads in Scala are constructs that augment a value with additional features, known as effects. These effects can include managing the nullability of a variable or handling the asynchronicity of its computation. In Scala, common monads include Option[T], Future[T], Either, List, and more. A monad adds an effect to a value by wrapping it around a context. The key functions a monad must implement are unit (which lifts a value into the monadic context) and flatMap (which allows for chaining operations within the monadic context).
Visit the following resources to learn more:
- [@article@Monads in Scala | Baeldung on Scala](https://www.baeldung.com/scala/monads)
- [@article@An Introduction to Monads in Scala | Rock the JVM](https://rockthejvm.com/articles/an-introduction-to-monads-in-scala)
- [@article@Demystifying the Monad in Scala](https://medium.com/free-code-camp/demystifying-the-monad-in-scala-cc716bb6f534)
@@ -0,0 +1,10 @@
# Mutable collections
Mutable collections are used when you need collections that can be updated or extended in place, usually for better performance. After the computations are done, you can transform it to its immutable counterpart. Scala provides several mutable collection classes, including ArrayBuffer, ListBuffer, HashSet, and HashMap.
Resources
Visit the following resources to learn more:
- [@official@Concrete Mutable Collection Classes | Collections (Scala 2.8 - 2.12) | Scala Documentation](https://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html)
- [@official@Concrete Mutable Collection Classes | Collections | Scala Documentation](https://docs.scala-lang.org/overviews/collections-2.13/concrete-mutable-collection-classes.html)
- [@article@Scala mutable collections on waitingforcode.com - articles about Scala collections](https://www.waitingforcode.com/scala-collections/scala-mutable-collections/read)
@@ -0,0 +1,3 @@
# No ecosystem
The Scala open-source landscape outside of the major ecosystems often focuses on niche use cases or innovative ideas that may not be covered by the larger frameworks. Projects in this space can range from specialized tools for data science, machine learning, and web development to unique solutions for testing, build management, and database connectivity. These projects are frequently driven by individual developers or small communities.
@@ -0,0 +1,3 @@
# Nothing
`Nothing` is a special type in Scala that sits at the bottom of the type hierarchy. It's a subtype of every other type, meaning it can be used anywhere any other type is expected. However, `Nothing` has no instances (no actual values), which essentially means that a function returning `Nothing` will never return normally; it either throws an exception, enters an infinite loop, or the program exits. You can think of it as a "dead end" type that signals a point of no return in your code.
@@ -0,0 +1,9 @@
# Object
The object keyword is used to create a singleton object. A singleton object is a class that has only one instance. Singleton objects are often used to define methods and values that are not specific to instances of a class, similar to static methods in Java.
Visit the following resources to learn more:
- [@official@Singleton Objects | Tour of Scala | Scala Documentation](https://docs.scala-lang.org/tour/singleton-objects.html)
- [@article@Scala - Classes & Objects | Tutorials Point](https://www.tutorialspoint.com/scala/scala_classes_objects.htm)
- [@article@Classes and Objects in Scala | Baeldung on Scala](https://www.baeldung.com/scala/classes-objects)
@@ -0,0 +1,10 @@
# Standard operators
Operators are methods that can be used in a more readable and intuitive way. Scala supports standard arithmetic operators (+, -, *, /), relational operators (==, !=, >, <, >=, <=), and logical operators (&&, ||, !). Additionally, Scala has specific operators like the arrow (->) and fat arrow (=>). The arrow operator (->) is used to create tuples, which are pairs of values. For example, 1 -> 2 creates a tuple (1, 2). The fat arrow (=>) is used in function definitions and pattern matching.
Resources
Visit the following resources to learn more:
- [@article@Introduction to Scala Operators | Baeldung on Scala](https://www.baeldung.com/scala/operators-intro)
- [@article@What do all of Scala's symbolic operators mean? - Stack Overflow](https://stackoverflow.com/questions/7888944/what-do-all-of-scalas-symbolic-operators-mean)
- [@article@Working with Arrows in Scala](https://blog.ssanj.net/posts/2017-07-02-working-with-arrows-in-scala.html)
@@ -0,0 +1,8 @@
# Option
The Option class in Scala is used to represent optional values. It is a carrier of single or no element for a stated type, and is particularly useful for handling cases where a value might be null.
Visit the following resources to learn more:
- [@official@Scala Standard Library 2.13.3 - scala.Option](https://www.scala-lang.org/api/2.13.3/scala/Option.html)
- [@article@The Option Type in Scala | Baeldung on Scala](https://www.baeldung.com/scala/option-type)
@@ -0,0 +1,9 @@
# package
The package keyword is used to create namespaces that can contain entities such as classes, objects, and other packages. In Scala 2, package objects allow defining functions, variables, and types that are accessible to all members of a package. In Scala 3, it's possible to define all those elements at the top-level, so there is no longer any need to declare package objects.
Visit the following resources to learn more:
- [@official@Top Level Definitions in Packages | Tour of Scala | Scala Documentation](https://docs.scala-lang.org/tour/package-objects.html)
- [@article@Packaging, Importing and Package Objects in Scala | Baeldung on Scala](https://www.baeldung.com/scala/package-import)
- [@article@Scala Package Objects](https://www.tutorialspoint.com/scala/scala_package_objects.htm)
@@ -0,0 +1,8 @@
# Pattern Matching
Pattern matching is a way to check a value against a set of patterns. Think of it like a more powerful `switch` statement. You provide a value and then define different "cases" or patterns that the value might match. When a match is found, the code associated with that pattern is executed. It's often used to deconstruct data structures or identify specific conditions within your code.
Visit the following resources to learn more:
- [@official@Pattern Matching | Tour of Scala | Scala Documentation](https://docs.scala-lang.org/tour/pattern-matching.html)
- [@article@Pattern Matching in Scala | Baeldung on Scala](https://www.baeldung.com/scala/pattern-matching)
@@ -0,0 +1,3 @@
# Know your platform
A platform is a runtime environment in which code is compiled and executed. Scala is primarily known as a JVM language, alongside Java and Kotlin. Scala code is compiled into the same bytecode as these languages and runs in the Java Runtime Environment (JRE), which provides independence from specific machine configurations and features such as garbage collection. However, there are at least two other platforms where Scala code can be run: Scala Native, which aims to compile Scala directly to machine code, bypassing the JRE, and Scala.js, which transpiles Scala code to JavaScript, allowing it to run in web browsers.
@@ -0,0 +1,9 @@
# private / protected
The private and protected keywords are used to control the visibility of members (variables and methods) in classes, objects, or packages. If no access modifier is specified, the default access level is public.
Visit the following resources to learn more:
- [@article@Understanding Scala Access Modifiers](https://www.tutorialspoint.com/scala/scala_access_modifiers.htm)
- [@article@How to control Scala method scope with private, package, and more](https://alvinalexander.com/scala/how-to-control-scala-method-scope-object-private-package/)
- [@article@Scala access modifiers and qualifiers in detail](https://www.jesperdj.com/2016/01/08/scala-access-modifiers-and-qualifiers-in-detail/)
@@ -0,0 +1,10 @@
# Pure functions
Pure functions in Scala are functions that always return the same output for the same input and do not have any side effects. They are fundamental to functional programming and provide predictability and reliability.
Visit the following resources to learn more:
- [@official@Pure Functions - Scala 3 Documentation](https://docs.scala-lang.org/scala3/book/fp-pure-functions.html)
- [@article@Pure Function vs Referential Transparency](https://edward-huang.com/functional-programming/tech/programming/scala/2020/01/30/pure-function-vs-referential-transparency/)
- [@article@Referential Transparency in Scala Pt. I - Pure functions](https://rafaelvindelamor.dev/posts/referential-transparency-in-scala-pt-i-pure-functions/)
- [@article@Scala best practice: Create methods that have no side effects (pure functions)](https://alvinalexander.com/scala/how-to-create-scala-methods-no-side-effects-pure-functions/)
@@ -0,0 +1,8 @@
# Range
A `Range` in Scala represents an ordered sequence of integers (or other numeric types) with a consistent step size. You define a range by specifying its start, end (inclusive or exclusive), and the increment between elements. Ranges are memory-efficient because they don't store all the numbers; instead, they calculate each element on demand, making them ideal for iterating over large sequences or generating arithmetic progressions without the overhead of storing every single value.
Visit the following resources to learn more:
- [@official@Range](https://www.scala-lang.org/api/3.x/scala/collection/immutable/Range.html)
- [@article@Range in Scala](https://www.baeldung.com/scala/range)
@@ -0,0 +1,9 @@
# Recursion basics
Recursion is a fundamental concept in computer science and mathematics where a function or process calls itself as part of its execution. This approach is particularly useful for tasks that can be defined in terms of similar subtasks, such as traversing tree structures, calculating factorials, or solving problems that exhibit self-similarity. In Scala, recursion is supported on many levels. It is possible for a function to recursively call itself. Additionally, the Scala compiler uses tail recursion to rewrite a subset of recursive functions into flat loops, and the Scala standard library contains "trampolines" - a mechanism to simulate recursion without the risk of stack overflow. On top of that, Scala pattern matching helps to write recursive functions in a readable way, and implicit parameters help to keep the code concise.
Visit the following resources to learn more:
- [@article@Scala Recursion Functions](https://www.tutorialspoint.com/scala/recursion_functions.htm)
- [@article@Simple Scala recursion examples (recursive programming) | alvinalexander.com](https://alvinalexander.com/scala/scala-recursion-examples-recursive-programming/)
- [@article@Scala Tutorial | Tail Recursion](https://www.scala-exercises.org/scala_tutorial/tail_recursion)
@@ -0,0 +1,11 @@
# Referential Transparency
Referential transparency is a fundamental concept in functional programming where an expression can be replaced by its value without changing the behavior of the program. In Scala, this concept is closely tied to pure functions, which always return the same output for the same input and do not have any side effects.
Visit the following resources to learn more:
- [@book@Scala Functional Programming Patterns book](https://www.oreilly.com/library/view/scala-functional-programming/9781783985845/ch01s05.html)
- [@article@Scala Best Practices - Referential transparency](https://nrinaudo.github.io/scala-best-practices/definitions/referential_transparency.html)
- [@article@Referential Transparency in Scala - liveBook by Manning](https://livebook.manning.com/concept/scala/referential-transparency)
- [@article@Referential Transparency - Learning Journal](https://www.learningjournal.guru/article/scala/functional-programming/referential-transparency/)
- [@article@Scala Tutorials Part #21 - Referential transparency](https://madusudanan.com/blog/scala-tutorials-part-21-referential-transparency/)
@@ -0,0 +1,9 @@
# Regex
Regular expressions are supported through the Regex class in the scala.util.matching package. Regular expressions (regex) are patterns used to match character combinations in strings. They are useful for text processing, pattern matching, and data validation.
Resources
Visit the following resources to learn more:
- [@official@Regular Expression Patterns | Tour of Scala | Scala Documentation](https://docs.scala-lang.org/tour/regular-expression-patterns.html)
- [@official@Regular Expressions in Scala | Baeldung on Scala](https://docs.scala-lang.org/tour/regular-expression-patterns.html)
- [@article@Scala Regular Expressions | Tutorials Point](https://www.tutorialspoint.com/scala/scala_regular_expressions.htm)
@@ -0,0 +1,10 @@
# sbt
sbt (Scala Build Tool) is a build tool designed for Scala and Java projects. It allows developers to define tasks in Scala and run them in parallel from an interactive shell. sbt is known for its incremental compilation feature, which updates only the parts of the project that have changed, saving time and improving efficiency. It supports a wide range of plugins for tasks like packaging, releasing, and deploying software. sbt is highly configurable and extensible, making it suitable for projects of all sizes, from small applications to large, complex systems.
Visit the following resources to learn more:
- [@official@sbt Official Documentation](https://www.scala-sbt.org/learn.html)
- [@official@Scala Book: sbt Overview](https://docs.scala-lang.org/overviews/scala-book/scala-build-tool-sbt.html)
- [@book@sbt in Action Book](https://www.manning.com/books/sbt-in-action)
- [@article@Introduction to SBT on Baeldung](https://www.baeldung.com/scala/sbt-intro)
@@ -0,0 +1,10 @@
# Scala Native
Scala Native is an optimizing ahead-of-time compiler and lightweight managed runtime designed specifically for Scala. By leveraging LLVM, Scala Native compiles Scala code directly to native executables, eliminating the need for a Java Virtual Machine (JVM). This results in faster startup times and smaller memory footprints, making it suitable for environments where performance and resource efficiency are critical. Scala Native also offers interoperability with C libraries, allowing developers to integrate with existing native libraries seamlessly. The compilation process involves converting Scala code to an intermediate format called Native Intermediate Representation (NIR), which is then transformed into an LLVM IR file for execution. The project is supported by the École polytechnique fédérale de Lausanne (EPFL) and has a growing community of contributors.
Visit the following resources to learn more:
- [@official@Scala Native Documentation](https://scala-native.org/)
- [@opensource@Scala Native GitHub Repository](https://github.com/scala-native/scala-native)
- [@article@Getting Started with Scala Native: A Comprehensive Guide for Beginners](https://medium.com/@diehardankush/getting-started-with-scala-native-a-comprehensive-guide-for-beginners-dedafeed7f25)
- [@article@Building Native Applications in Scala Using Scala Native | Baeldung on Scala](https://www.baeldung.com/scala/native-apps-scala-native)
@@ -0,0 +1,11 @@
# ScalaCLI
ScalaCLI is a command-line tool designed to simplify the process of learning and using Scala. It is optimized for speed and ease of use, making it ideal for scripts, playgrounds, and single-module projects. ScalaCLI manages its own dependencies and supports features like incremental compilation and dependency resolution. It does not require a configuration file, and all configurations can be provided through directives embedded in Scala files or via command-line arguments.
Resources
Visit the following resources to learn more:
- [@official@Scala CLI Official Documentation](https://scala-cli.virtuslab.org/)
- [@official@Getting Started with Scala CLI](https://scala-cli.virtuslab.org/docs/getting_started/)
- [@opensource@Scala CLI GitHub Repository](https://github.com/VirtusLab/scala-cli)
- [@article@Introduction to Scala-CLI on Baeldung](https://www.baeldung.com/scala/scala-cli-intro)
@@ -0,0 +1,10 @@
# Scala.js
Scala.js is a Scala compiler that compiles Scala code to JavaScript, enabling Scala programs to run in web browsers or Node.js. It optimizes Scala code into highly efficient JavaScript, ensuring fast turnaround times with incremental compilation. Scala.js provides strong typing, which catches typos and type errors immediately, making the development process more reliable and efficient. It also offers seamless interoperability with JavaScript libraries, allowing developers to use popular libraries like React and AngularJS directly from their Scala.js code. This makes it easier to leverage existing JavaScript ecosystems while benefiting from Scala's type system and tooling. Additionally, Scala.js supports full-stack development by allowing code to be shared between the frontend and backend, ensuring consistency and reducing the risk of mismatches.
Visit the following resources to learn more:
- [@official@Scala.js Official Website](https://www.scala-js.org/)
- [@article@Hands-on Scala.js](https://www.lihaoyi.com/hands-on-scala-js/)
- [@article@Introduction to Scala.js | Baeldung on Scala](https://www.baeldung.com/scala/scala-js)
- [@article@The importance of Scala.js](https://www.scalawilliam.com/importance-scalajs/)
@@ -0,0 +1,3 @@
# Scope & Visibility
Scope and visibility in Scala determine where variables, methods, and classes can be accessed within your code. Scope defines the region of code where a variable is valid and accessible, while visibility controls whether a member (variable or method) of a class or object can be accessed from outside that class or object. Understanding these concepts is crucial for writing well-structured, maintainable, and secure Scala programs.
@@ -0,0 +1,8 @@
# Sealed traits
Sealed traits are used to define closed hierarchies where all possible subclasses are known. They can be extended only in the same file as their declaration, allowing the compiler to perform exhaustiveness checking. This feature is particularly useful for pattern matching.
Visit the following resources to learn more:
- [@article@What is a sealed trait? - Stack Overflow](https://stackoverflow.com/questions/11203268/what-is-a-sealed-trait)
- [@article@Sealed Keyword in Scala | Baeldung on Scala](https://www.baeldung.com/scala/sealed-keyword)
@@ -0,0 +1,8 @@
# Seq
A `Seq` in Scala represents an ordered collection of elements. Think of it like a list where the order in which you add items matters. You can access elements by their position (index), and `Seq` offers a variety of methods for manipulating the sequence, such as adding, removing, and searching for items. It's a fundamental data structure in Scala for working with ordered data.
Visit the following resources to learn more:
- [@official@Seq](https://www.scala-lang.org/api/current/scala/collection/Seq.html)
- [@video@Linear Collections in Scala: Seq, List, Array, Vector, Set, Range](https://www.youtube.com/watch?v=UvUkpduo6uE)
@@ -0,0 +1,9 @@
# Set
A Set in Scala is a collection that holds unique elements. This means no duplicates are allowed. Sets are useful when you need to ensure that each item is only present once, like a group of unique user IDs or distinct product names. Scala provides both mutable and immutable Set implementations, allowing you to choose the behavior that best fits your needs.
Visit the following resources to learn more:
- [@official@Sets](https://docs.scala-lang.org/overviews/collections-2.13/sets.html)
- [@article@Scala - Sets](https://www.tutorialspoint.com/scala/scala_sets.htm)
- [@article@Scala: Whats the difference between "Map" vs "Set"? - Stack Overflow](https://stackoverflow.com/questions/45133364/scala-whats-the-difference-between-map-vs-set)
@@ -0,0 +1,3 @@
# Setting Up Scala
Setting up Scala involves installing the Scala compiler and build tools on your system. This allows you to write, compile, and run Scala programs. Typically, this includes downloading the Scala SDK, which contains the compiler and essential libraries, and often using a build tool like sbt (Simple Build Tool) to manage dependencies and build projects. The setup also frequently involves configuring your Integrated Development Environment (IDE) for Scala development, providing features like code completion and debugging.
@@ -0,0 +1,3 @@
# Strings
Strings represent sequences of characters. They're used to store and manipulate text. You create them by enclosing characters within double quotes, like `"Hello, world!"`. Strings are immutable, meaning you can't change them directly; operations on strings produce new strings. Scala provides a rich set of methods for string manipulation, including concatenation, substring extraction, searching, and replacement.
@@ -0,0 +1,9 @@
# Sublime Text
Sublime Text is a sophisticated text editor known for its speed, ease of use, and features. It supports a wide range of programming languages, including Scala, through plugins and packages. Sublime Text offers features like multiple selections, a command palette, and extensive customization options, making it a popular choice for developers. With the Metals plugin, Sublime Text provides intelligent code completion, diagnostics, and refactoring capabilities for Scala.
Resources
Visit the following resources to learn more:
- [@official@Sublime Text](https://www.sublimetext.com/)
- [@official@Sublime Text | Scalameta](https://scalameta.org/metals/docs/editors/sublime/)
@@ -0,0 +1,9 @@
# Tail recursion
Tail recursion is a special form of recursion where the recursive call is the last operation in the function. This allows the Scala compiler to optimize the recursion to prevent stack overflow and improve performance.
Visit the following resources to learn more:
- [@article@Tail Recursion in Scala | Baeldung on Scala](https://www.baeldung.com/scala/tail-recursion)
- [@article@Scala Tutorial | Tail Recursion](https://www.scala-exercises.org/scala_tutorial/tail_recursion)
- [@article@Writing Tail-Recursive Algorithms in Scala (and the tailrec annotation) | alvinalexander.com](https://alvinalexander.com/scala/fp-book/tail-recursive-algorithms/)
@@ -0,0 +1,3 @@
# Testing
Testing is the process of checking if a piece of software works as expected. It involves running the software with different inputs and conditions to find any errors, bugs, or unexpected behavior. The goal is to make sure the software is reliable, stable, and meets the requirements it was designed for.
@@ -0,0 +1,10 @@
# Total / partial functions
A total function is a function that is defined for every possible input value it can be given. In contrast, a partial function is a function that is only defined for a subset of possible input values. Partial functions can be used with collection methods like collect and collectFirst to manipulate and transform data.
Resources
Visit the following resources to learn more:
- [@article@Partial Functions in Scala | Baeldung on Scala](https://www.baeldung.com/scala/partial-functions)
- [@article@How to create and use partial functions in Scala | alvinalexander.com](https://alvinalexander.com/scala/how-to-define-use-partial-functions-in-scala-syntax-examples/)
- [@article@Scala Partial Function - Ways to Define Partial Functions in Scala - DataFlair](https://data-flair.training/blogs/scala-partial-function/)
@@ -0,0 +1,9 @@
# trait
A trait is a type that defines a contract of fields and methods, which can be either abstract (unimplemented) or concrete (implemented). Traits are used to share behavior across classes, enabling code reuse without relying on single inheritance. Traits are similar to Java 8’s interfaces. Classes and objects can extend traits using the extends keyword, but traits cannot be instantiated and therefore have no parameters.
Visit the following resources to learn more:
- [@official@Traits | Tour of Scala | Scala Documentation](https://docs.scala-lang.org/tour/traits.html)
- [@article@Scala - Traits](https://www.tutorialspoint.com/scala/scala_traits.htm)
- [@article@Introduction to Traits in Scala | Baeldung on Scala](https://www.baeldung.com/scala/traits)
@@ -0,0 +1,9 @@
# Trampolines
Trampolines in Scala are used to avoid stack overflow errors in deep recursion by moving the computation from the stack to the heap. The TailRec class is part of the scala.util.control.TailCalls are used to implement trampolining.
Visit the following resources to learn more:
- [@article@Recursion and Trampolines in Scala · GitHub](https://gist.github.com/eamelink/4466932a11d8d92a6b76e80364062250)
- [@article@Tail calls, @tailrec and trampolines](https://rd.nz/2009/04/tail-calls-tailrec-and-trampolines.html)
- [@article@How Trampoline Works in Scala](https://free.cofree.io/2017/08/24/trampoline/)
@@ -0,0 +1,9 @@
# Try
The Try class in Scala represents a computation that may fail during evaluation by raising an exception. It holds either a successfully computed value or the exception that was thrown.
Visit the following resources to learn more:
- [@official@Scala Standard Library 2.13.6 - scala.util.Try](https://www.scala-lang.org/api/2.13.6/scala/util/Try.html)
- [@article@A Scala Try, Success, and Failure example | alvinalexander.com](https://alvinalexander.com/source-code/scala/scala-try-success-and-failure-example/)
- [@article@Handling Exceptions using Try/Catch/Finally in Scala | ScalaJobs.com](https://scalajobs.com/blog/handling-exceptions-using-try-catch-finally-in-scala)
@@ -0,0 +1,8 @@
# Try/catch
Exception handling is done using the try/catch/finally construct, similar to Java. The try block contains code that might throw an exception, the catch block handles the exception, and the finally block is used for cleanup or other operations that must be performed regardless of whether an exception was thrown. Scala also encourages the use of functional error handling with monads like Try, Option, and Either, which provide a more composable and functional way to handle errors and exceptional cases.
Visit the following resources to learn more:
- [@official@try/catch/finally Expressions | Scala Book | Scala Documentation](https://docs.scala-lang.org/overviews/scala-book/try-catch-finally.html)
- [@article@Handling Exceptions using Try/Catch/Finally in Scala | ScalaJobs.com](https://scalajobs.com/blog/handling-exceptions-using-try-catch-finally-in-scala)
@@ -0,0 +1,9 @@
# Type hierarchy
Generic types allow you to write code that can work with different types while maintaining type safety. Generic classes and traits take a type as a parameter within square brackets. For example, Stack[A] is a generic class that can be used to create stacks of any type A. Scala's type hierarchy is unified, with Any as the top type, which is the supertype of all types, and Nothing as the bottom type, which is the subtype of all types.
Visit the following resources to learn more:
- [@official@Generic Classes | Tour of Scala | Scala Documentation](https://docs.scala-lang.org/tour/generic-classes.html)
- [@official@Generics | Scala 3 - Book | Scala Documentation](https://docs.scala-lang.org/scala3/book/types-generics.html)
- [@article@Basics of Generics in Scala | Baeldung on Scala](https://www.baeldung.com/scala/generics-basics)
@@ -0,0 +1,9 @@
# Type parameters
Type parameters are used to create generic classes, traits, and methods. Type parameters are enclosed in square brackets and can be used to define methods and classes that work with different types while maintaining type safety.
Visit the following resources to learn more:
- [@official@Polymorphic Methods | Tour of Scala | Scala Documentation](https://docs.scala-lang.org/tour/polymorphic-methods.html)
- [@official@Generic Classes | Tour of Scala | Scala Documentation](https://docs.scala-lang.org/tour/generic-classes.html)
- [@article@Basics of Generics in Scala | Baeldung on Scala](https://www.baeldung.com/scala/generics-basics)
@@ -0,0 +1,9 @@
# Type system
The Scala type system supports both object-oriented and functional programming paradigms. It is designed to be expressive and flexible, allowing developers to write concise and type-safe code. The type system includes features such as type inference, generics, variance annotations, type bounds, abstract types, higher-kinded types, type classes, and implicit resolutions. It is one of the most sophisticated type systems in any programming language, combining comprehensive ideas from both functional programming and object-oriented programming.
Visit the following resources to learn more:
- [@official@Types and the Type System | Scala 3 - Book | Scala Documentation](https://docs.scala-lang.org/scala3/book/types-introduction.html)
- [@article@Type Hierarchies in Scala | Baeldung on Scala](https://www.baeldung.com/scala/type-hierarchies)
- [@article@Chapter 6. The Type System · Scala in Depth](https://livebook.manning.com/book/scala-in-depth/chapter-6)
@@ -0,0 +1,10 @@
# Typeclasses
Typeclasses are a concept used in functional programming to achieve ad-hoc polymorphism. They define a set of functions that can be implemented for a type fulfilling certain requirements, providing a way to add functionality to existing types without modifying their source code. Typeclasses are not natively supported in Scala but can be implemented using traits and implicit classes.
Visit the following resources to learn more:
- [@official@Type Classes | Scala 3 - Book | Scala Documentation](https://docs.scala-lang.org/scala3/book/ca-type-classes.html)
- [@article@Type classes in Scala - Ad-hoc polymorphism - Scalac.io](https://scalac.io/blog/typeclasses-in-scala/)
- [@article@Demystifying Type Classes in Scala: A Simple Guide | by Remis Haroon | Medium](https://medium.com/@remisharoon/demystifying-type-classes-in-scala-a-simple-guide-3a4766a59818)
- [@article@Type Classes in Scala | Baeldung on Scala](https://www.baeldung.com/scala/type-classes)
@@ -0,0 +1,10 @@
# The unapply method
The unapply method is used to deconstruct instances through pattern matching. It is often used in extractor objects to extract data values compacted in objects.
Resources
Visit the following resources to learn more:
- [@official@Extractor Objects | Tour of Scala | Scala Documentation](https://docs.scala-lang.org/tour/extractor-objects.html)
- [@article@Understand how to use apply and unapply - Stack Overflow](https://stackoverflow.com/questions/18468786/understand-how-to-use-apply-and-unapply)
- [@article@Scala pattern matching: apply the unapply | by Linas Medžiūnas | Wix Engineering | Medium](https://medium.com/wix-engineering/scala-pattern-matching-apply-the-unapply-7237f8c30b41)
@@ -0,0 +1,3 @@
# Unit
Unit is a data type in Scala that represents a placeholder when no meaningful value needs to be returned. It's similar to `void` in languages like Java or C. The unit type has only one possible value, written as `()`. You'll often see it used as the return type of functions that perform side effects but don't produce a result, or when a function is required to return a value but there's no logical value to return.
@@ -0,0 +1,9 @@
# Variables & Constants
Variables are named storage locations that hold data, and their values can be changed during the program's execution. In Scala, variables are declared using the `var` keyword. On the other hand, constants are also named storage locations, but their values cannot be modified once they are assigned. Constants are declared using the `val` keyword in Scala, making them immutable. Choosing between `var` and `val` depends on whether you need to change the value of a data item during the program's runtime.
Visit the following resources to learn more:
- [@official@Two Types of Variables | Scala Book | Scala Documentation](https://docs.scala-lang.org/overviews/scala-book/two-types-variables.html)
- [@article@Def, Var & Val in Scala | Baeldung on Scala](https://www.baeldung.com/scala/def-var-val)
- [@article@Difference between var, val, and def in Scala? Examples | Java67](https://www.java67.com/2017/05/difference-between-var-val-and-def-in-Scala.html)
@@ -0,0 +1,9 @@
# Context bounds
Context Bounds in Scala is a feature that provides a shorthand syntax for expressing the common pattern of a context parameter that depends on a type parameter. Context bounds are used to simplify the code for generic types and are particularly useful in the context of type classes.
Visit the following resources to learn more:
- [@official@Context Bounds | Scala 3 - Book | Scala Documentation](https://docs.scala-lang.org/scala3/book/ca-context-bounds.html)
- [@article@Demystifying View and Context Bounds | Baeldung on Scala](https://www.baeldung.com/scala/view-context-bounds)
- [@article@Context Bounds - Scala 3 - EPFL](https://dotty.epfl.ch/docs/reference/contextual/context-bounds.html)
@@ -0,0 +1,8 @@
# Vector
Vectors in Scala are indexed, immutable sequences. Think of them as similar to arrays, but with the key advantage of being immutable – meaning their contents cannot be changed after creation. This makes them very useful in concurrent programming and for data structures where you want to guarantee that data isn't accidentally modified. Vectors provide fast access to elements by index (like arrays), making them efficient for lookups and various data manipulations.
Visit the following resources to learn more:
- [@article@Collection types - Vector](https://docs.scala-lang.org/scala3/book/collections-classes.html#vector)
- [@article@Benefits of Using Vector in Scala](https://www.baeldung.com/scala/vector-benefits)

Some files were not shown because too many files have changed in this diff Show More