chriseyre2000

chriseyre2000

Exploring Graphs with Elixir: Chapter 3 is missing some macros

Exploring Graphs with Elixir by @tonyhammond

I am unsure if the book is intended to be worked through to recreate the library (which is great for learning things).

When the macros are first used it includes use for both Graph and Query.
So far only the Graph using has been defined, and then it only creates the read_graph and write_graph methods.

First Post!

mvellandi

mvellandi

In
p.96 – Ch 3 > Storing Graphs in the Graph Store > Using Macros
the code comment in graph.ex

quote do
   # other (listings, new_graph) functions here
   def read_graph...
   def write_graph...
end

implies the author will define a few more functions later, or WE will add them on our own.

On the following page (97), we’re told we can check out the whole NativeGraph library functions:

iex> NativeGraph.[TAB]
...

which includes ALL the functions it will eventually output when ALL are defined in the using macros in both GraphCommons.Graph and GraphCommons.Query

The author just needs to update this code snippet to correspond with the next paragraph in the book.

Through the end of Ch 3, I see only two more functions used:
list_graphs
list_graphs_dir

which I started defining in the next subsection, where first used:
p.100 – Ch 3 > Storing Graphs in the Graph Store > Listing

NOTE: I just noticed the author didn’t include these two functions in the source code either.

Here’s what I additionally wrote in my GraphCommons.Graph using macro

quote do

      def list_graphs(file_test \\ :exists?) do
         GraphCommons.Graph.list_graphs(unquote(graph_type), file_test)
      end

      def list_graphs_dir(graph_dir) do
         GraphCommons.Graph.list_graphs_dir(graph_dir, unquote(graph_type))
      end

   def read_graph...
   def write_graph...

end

Where Next?

Popular Pragmatic Bookshelf topics Top

abtin
page 20: … protoc command… I had to additionally run the following go get commands in order to be able to compile protobuf code using go...
New
raul
Page 28: It implements io.ReaderAt on the store type. Sorry if it’s a dumb question but was the io.ReaderAt supposed to be io.ReadAt? ...
New
swlaschin
The book has the same “Problem space/Solution space” diagram on page 18 as is on page 17. The correct Problem/Solution space diagrams ar...
New
jskubick
I think I might have found a problem involving SwitchCompat, thumbTint, and trackTint. As entered, the SwitchCompat changes color to hol...
New
adamwoolhether
Is there any place where we can discuss the solutions to some of the exercises? I can figure most of them out, but am having trouble with...
New
AufHe
I’m a newbie to Rails 7 and have hit an issue with the bin/Dev script mentioned on pages 112-113. Iteration A1 - Seeing the list of prod...
New
a.zampa
@mfazio23 I’m following the indications of the book and arriver ad chapter 10, but the app cannot be compiled due to an error in the Bas...
New
bjnord
Hello @herbert ! Trying to get the very first “Hello, Bracket Terminal!" example to run (p. 53). I develop on an Amazon EC2 instance runn...
New
redconfetti
Docker-Machine became part of the Docker Toolbox, which was deprecated in 2020, long after Docker Desktop supported Docker Engine nativel...
New
dachristenson
I just bought this book to learn about Android development, and I’m already running into a major issue in Ch. 1, p. 20: “Update activity...
New

Other popular topics Top

AstonJ
A thread that every forum needs! Simply post a link to a track on YouTube (or SoundCloud or Vimeo amongst others!) on a separate line an...
New
dasdom
No chair. I have a standing desk. This post was split into a dedicated thread from our thread about chairs :slight_smile:
New
PragmaticBookshelf
Learn different ways of writing concurrent code in Elixir and increase your application's performance, without sacrificing scalability or...
New
PragmaticBookshelf
“A Mystical Experience” Hero’s Journey with Paolo Perrotta @nusco Ever wonder how authoring books compares to writing articles?...
New
foxtrottwist
A few weeks ago I started using Warp a terminal written in rust. Though in it’s current state of development there are a few caveats (tab...
New
mafinar
This is going to be a long an frequently posted thread. While talking to a friend of mine who has taken data structure and algorithm cou...
New
New
PragmaticBookshelf
Author Spotlight: Karl Stolley @karlstolley Logic! Rhetoric! Prag! Wow, what a combination. In this spotlight, we sit down with Karl ...
New
PragmaticBookshelf
Author Spotlight: Peter Ullrich @PJUllrich Data is at the core of every business, but it is useless if nobody can access and analyze ...
New
New

Sub Categories: