# Exploring Graphs with Elixir: service contexts p.92-93

**URL:** <https://forum.devtalk.com/t/exploring-graphs-with-elixir-service-contexts-p-92-93/10283>\
**Category:** PragProg Customers\
**Tags:** book-exploring-graphs-with-elixir, errata\
**Created:** [7 June 2021 12:08 UTC](https://forum.devtalk.com/t/exploring-graphs-with-elixir-service-contexts-p-92-93/10283 "2021-06-07T12:08:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shotleybuilder](https://forum.devtalk.com/user_avatar/forum.devtalk.com/shotleybuilder/32/2895_2.png) [@shotleybuilder](https://forum.devtalk.com/u/shotleybuilder)\
**Post date:** [7 June 2021 12:08 UTC](https://forum.devtalk.com/t/exploring-graphs-with-elixir-service-contexts-p-92-93/10283/1 "2021-06-07T12:08:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![shotleybuilder](https://forum.devtalk.com/user_avatar/forum.devtalk.com/shotleybuilder/32/2895_2.png) [@shotleybuilder](https://forum.devtalk.com/u/shotleybuilder)\
**Post date:** [15 June 2021 15:47 UTC](https://forum.devtalk.com/t/exploring-graphs-with-elixir-service-contexts-p-92-93/10283/2 "2021-06-15T15:47:12Z")

</div>

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
