From 14538b7aa172f8b8d943d0d2703ca46052b0d9fc Mon Sep 17 00:00:00 2001 From: Linus Date: Sat, 9 Jul 2022 13:29:05 +0200 Subject: [PATCH] Tiny improvements to explore livebooks (#1266) * Tiny improvement in explanation of pattern matching * remove reference to `Kino.Ecto` --- .../notebook/explore/distributed_portals_with_elixir.livemd | 4 ++-- lib/livebook/notebook/explore/kino/intro_to_kino.livemd | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/livebook/notebook/explore/distributed_portals_with_elixir.livemd b/lib/livebook/notebook/explore/distributed_portals_with_elixir.livemd index 6ffc0a23e..8db647da2 100644 --- a/lib/livebook/notebook/explore/distributed_portals_with_elixir.livemd +++ b/lib/livebook/notebook/explore/distributed_portals_with_elixir.livemd @@ -197,7 +197,7 @@ if the date is valid or not? We can use `case` to pattern match on the different tuples: ```elixir -# Give a random date as input +# Give an invalid date as input input = "2020-02-30" # And then match on the return value @@ -214,7 +214,7 @@ In this example, we are using `case` to pattern match on the different outcomes of the `Date.from_iso8601`. We say the `case` above has two clauses, one matching on `{:ok, date}` and another on `{:error, reason}`. Now try changing the `input` variable above and reevaluate the cell -accordingly. What happens when you give it an invalid date? +accordingly. What happens when you give it a valid date? Finally, we can also pattern match on maps. This is used to extract the values for the given keys: diff --git a/lib/livebook/notebook/explore/kino/intro_to_kino.livemd b/lib/livebook/notebook/explore/kino/intro_to_kino.livemd index 749b9f2de..ac4cd5c41 100644 --- a/lib/livebook/notebook/explore/kino/intro_to_kino.livemd +++ b/lib/livebook/notebook/explore/kino/intro_to_kino.livemd @@ -141,8 +141,6 @@ end Having the rows inserted, click on the "Refetch" icon in the table output above to see them. -Similar functionality is available for database queries via [Ecto](https://github.com/elixir-ecto/ecto) and the [`Kino.Ecto`](https://hexdocs.pm/kino/Kino.Ecto.html) module. - ## Kino.render/1