Skip to content

Commit 7140a0a

Browse files
Magnus SmithMagnusSmith
Magnus Smith
authored andcommitted
first draft of recursion, thunks and trampolines
1 parent 0494369 commit 7140a0a

10 files changed

+425
-1
lines changed

_posts/2025-01-20-algebraic-data-types-with-java.md

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ This is the first post in a series exploring types and type systems. Other pos
3434

3535
- [Higher-Kinded Types with Java and Scala]({{site.baseurl}}/2025/04/11/higher-kinded-types-with-java-and-scala.html)
3636

37+
- [Recursion, Thunks and Trampolines with Java and Scala]({{site.baseurl}}/2025/04/11/recursion-thunks-trampolines-with-java-and-scala.html)
38+
3739
When we develop an application, we frequently need to model some aspect of business to describe and solve a business problem. We do this by creating a conceptual representation of the real-world problem that we are trying to solve. This allows us to understand the "domain" where our software operates.
3840

3941
## Domain Modelling

_posts/2025-02-17-variance-in-java-and-scala.md

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ This is the second post in a series exploring types and type systems. Other po
2525

2626
- [Higher-Kinded Types with Java and Scala]({{site.baseurl}}/2025/04/11/higher-kinded-types-with-java-and-scala.html)
2727

28+
- [Recursion, Thunks and Trampolines with Java and Scala]({{site.baseurl}}/2025/04/11/recursion-thunks-trampolines-with-java-and-scala.html)
29+
2830
## Variance in Generics
2931

3032
Generics are a fundamental pillar of modern type-safe programming languages. They allow us to write reusable code that can work with different types without sacrificing type safety. But when you dive deeper into the world of generics, you encounter the intriguing concepts of *covariance* and *contravariance*. These concepts, often perceived as complex, are crucial for understanding how type hierarchies and subtyping interact with generic types.

_posts/2025-03-05-intersection-and-union-types-with-java-and-scala.md

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ This is the third post in a series exploring types and type systems. Other pos
2525

2626
- [Higher-Kinded Types with Java and Scala]({{site.baseurl}}/2025/04/11/higher-kinded-types-with-java-and-scala.html)
2727

28+
- [Recursion, Thunks and Trampolines with Java and Scala]({{site.baseurl}}/2025/04/11/recursion-thunks-trampolines-with-java-and-scala.html)
29+
2830
## Intersection and Union Types with Java and Scala
2931

3032
One of the difficult things for modern programming languages to get right is around providing flexibility when it comes to expressing complex relationships. As languages evolve, they need to give us tools to model the nuances of real world problems more accurately in our code.

_posts/2025-03-31-functors-monads-with-java-and-scala.md

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ This is the fourth post in a series exploring types and type systems. Other pos
2424

2525
- [Higher-Kinded Types with Java and Scala]({{site.baseurl}}/2025/04/11/higher-kinded-types-with-java-and-scala.html)
2626

27+
- [Recursion, Thunks and Trampolines with Java and Scala]({{site.baseurl}}/2025/04/11/recursion-thunks-trampolines-with-java-and-scala.html)
28+
2729

2830
In this post we will combine some ideas from functional programming with strong typing to produce robust expressive code that is more reusable.
2931

_posts/2025-04-11-higher-kinded-types-with-java-and-scala.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ This is the fifth post in a series exploring types and type systems. Other post
2323

2424
- [Functors and Monads with Java and Scala]({{site.baseurl}}/2025/03/31/functors-monads-with-java-and-scala.html)
2525

26+
- [Recursion, Thunks and Trampolines with Java and Scala]({{site.baseurl}}/2025/04/11/recursion-thunks-trampolines-with-java-and-scala.html)
2627

2728
In this post we will build upon our knowledge of `Functors` and `Monads` from the previous post to open up the next level of abstraction.
2829

@@ -540,4 +541,4 @@ This native approach makes functional patterns based on HKTs feel like a natural
540541

541542
## Next time
542543

543-
Next time we conclude this series on type systems by looking at __Thunks__ and __Trampolines__ and how they can help solve problems when working with recursion where it can pay to be lazy.
544+
Next time we conclude this series on type systems by looking at [__Thunks__ and __Trampolines__]({{site.baseurl}}/2025/04/11/recursion-thunks-trampolines-with-java-and-scala.html) and how they can help solve problems when working with recursion where it can pay to be lazy.

_posts/2025-04-11-recursion-thunks-trampolines-with-java-and-scala.md

+415
Large diffs are not rendered by default.
15.7 KB
Loading

magnussmith/assets/recursion.png

824 KB
Loading
Binary file not shown.

magnussmith/assets/trampoline.png

39.6 KB
Loading

0 commit comments

Comments
 (0)