I just got a taste of some pattern matching in Scala. It was not really like what I had scene in Elixir or Haskell, but seems straight forward enough. In this case we match on some String attributes:
What made it slightly awkward, I guess, was the have to explicitly use the "match" keyword to say "I'm going to match here", but use the full class name and attributes. I guess it is just a bit "weird" to my eyes. There very well may be slicker ways to do this when I get into the more "hard core" FP techniques that I assume I will see in this book (or another).
All in all, I'm still enjoying Scala and this is just another thing to file away in the Scala portion of my brain.
Perils of a newbie player
I first encountered disc golf back in 2017. I played a little bit and then for reasons I don't remember, I kind of walked away. Skip...
Subscribe to:
Post Comments (Atom)
-
My meetup to learn Haskell was a success in the sense of meeting new people. There have been a core 5-6 that have shown up with varying leve...
-
Since my last post, I have spent a fair amount of time getting familiar with Elixir. I did a little work through The Daily Drip . That did...
-
A long time ago, I read Gary Taube's book Bad Calories, Good Calories . I found it a bit difficult to get through and totally understa...
No comments:
Post a Comment