
shotleybuilder
Exploring Graphs with Elixir: service contexts p.92-93
The book states “define the function graph_service/0 within the body of the using/1 macro
in the GraphCommons.Graph module”
The code download shows this:
defmacro using(opts) do
graph_type = Keyword.get(opts, :graph_type)
graph_module = Keyword.get(opts, :graph_module)quote do # other (listings, new_graph) functions here def read_graph(graph_file), do: GraphCommons.Graph.read_graph(graph_file, unquote(graph_type)) def write_graph(graph_data, graph_file), do: GraphCommons.Graph.write_graph(graph_data, graph_file, unquote(graph_type)) end
end
def graph_service(), do: unquote(graph_module)
def gs() do
graph_service()
graph_info()
end
I’ve not been able to work through the error here and obtain the result shown in the book, namely:
iex> graph_service PropertyGraph
PropertyGraph
So, no solution from me, but I sense there’s more than a one problem here
First Post!

shotleybuilder
Okay, this was simply a case of moving
def graph_service(), do: unquote(graph_module)
into the macro.
The error is in the code download
Popular Pragmatic Bookshelf topics

Hi Brian,
Looks like the api for tinydb has changed a little. Noticed while working on chapter 7 that the .purge() call to the db throws...
New

Hello! On page xix of the preface, it says there is a community forum "… for help if your’re stuck on one of the exercises in this book… ...
New

The generated iex result below should list products instead of product for the metadata. (page 67)
iex> product = %Product{}
%Pento....
New

Hi, I have just acquired Michael Fazio’s “Kotlin and Android Development” to learn about game programming for Android. I have a game in p...
New

Title: Build a Weather Station with Elixir and Nerves: Problem connecting to Postgres with Grafana on (page 64)
If you follow the defau...
New

Is the book’s epub format available to read on Google Play Books?
New

Hey there,
I’m enjoying this book and have learned a few things alredayd. However, in Chapter 4 I believe we are meant to see the “>...
New

Docker-Machine became part of the Docker Toolbox, which was deprecated in 2020, long after Docker Desktop supported Docker Engine nativel...
New

Hello faithful readers! If you have tried to follow along in the book, you are asked to start up the dev environment via dx/build and ar...
New

Getting an error when installing the dependencies at the start of this chapter:
could not compile dependency :exla, "mix compile" failed...
New
Other popular topics

Reading something? Working on something? Planning something? Changing jobs even!?
If you’re up for sharing, please let us know what you’...
New

Algorithms and data structures are much more than abstract concepts. Mastering them enables you to write code that runs faster and more e...
New

@AstonJ prompted me to open this topic after I mentioned in the lockdown thread how I started to do a lot more for my fitness.
https://f...
New

I’ve been really enjoying obsidian.md:
It is very snappy (even though it is based on Electron). I love that it is all local by defaul...
New

Learn different ways of writing concurrent code in Elixir and increase your application's performance, without sacrificing scalability or...
New

The File System Access API with Origin Private File System.
WebKit supports new API that makes it possible for web apps to create, open,...
New

Author Spotlight:
David Bryant Copeland
@davetron5000
We’re so happy to bring you another Author Spotlight, a series where we sit dow...
New

Programming Ruby is the most complete book on Ruby, covering both the language itself and the standard library as well as commonly used t...
New

Author Spotlight:
Karl Stolley
@karlstolley
Logic! Rhetoric! Prag! Wow, what a combination. In this spotlight, we sit down with Karl ...
New

This is cool!
DEEPSEEK-V3 ON M4 MAC: BLAZING FAST INFERENCE ON APPLE SILICON
We just witnessed something incredible: the largest open-s...
New
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /rails
- /js
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /emacs
- /haskell
- /java
- /onivim
- /svelte
- /typescript
- /crystal
- /kotlin
- /c-plus-plus
- /tailwind
- /gleam
- /ocaml
- /react
- /flutter
- /elm
- /vscode
- /ash
- /opensuse
- /centos
- /html
- /php
- /deepseek
- /zig
- /scala
- /sublime-text
- /textmate
- /lisp
- /nixos
- /debian
- /react-native
- /agda
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /django
- /spring
- /manjaro
- /nodejs
- /diversity
- /lua
- /julia
- /slackware
- /c
- /markdown