
imeraj
Advanced Functional Programming with Elixir: Problem Running Code Example
I am reading this book with great enthusiasm.
So far the code works great but while running the examples in Predicates That Span Contexts
section I am encountering some function arity errors as below -
iex(13)> FunPark.Ride.eligible?(alice, tea_cup)
** (FunctionClauseError) no function clause matching in FunPark.Monoid.FunPark.Monoid.PredAll.wrap/2
The following arguments were given to FunPark.Monoid.FunPark.Monoid.PredAll.wrap/2:
# 1
%FunPark.Monoid.PredAll{
value: &FunPark.Monoid.PredAll.default_pred?/1
}
# 2
#Function<1.2796843/2 in FunPark.Ride.tall_enough?>
Attempted function clauses (showing 1 out of 1):
def wrap(%FunPark.Monoid.PredAll{}, value) when is_function(value, 1)
Apparently, we are passing two arguments instead of one here -
def eligible?(%Patron{} = patron, %__MODULE__{} = ride),
do: p_all([&tall_enough?/2, &old_enough?/2]).(patron, ride)
I ran the book’s sample code and it works fine. But it has code with curry.
I am wondering if the example code from this section is supposed to run without curry as I am typing in the code as I go.
Thanks!
Popular Pragmatic Bookshelf topics

Running the examples in chapter 5 c under pytest 5.4.1 causes an AttributeError: ‘module’ object has no attribute ‘config’.
In particula...
New

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 Brian,
I have some problems with running the code in your book. I like the style of the book very much and I have learnt a lot as...
New

On the page xv there is an instruction to run bin/setup from the main folder. I downloaded the source code today (12/03/21) and can’t see...
New

When trying to run tox in parallel as explained on page 151, I got the following error:
tox: error: argument -p/–parallel: expected one...
New

When running tox for the first time, I got the following error:
ERROR: InterpreterNotFound: python3.10
I realised that I was running ...
New

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

It seems the second code snippet is missing the code to set the current_user:
current_user: Accounts.get_user_by_session_token(session["...
New

Hi, I need some help, I’m new to rust and was learning through your book. but I got stuck at the last stage of distribution. Whenever I t...
New

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

I know that these benchmarks might not be the exact picture of real-world scenario, but still I expect a Rust web framework performing a ...
New

New

New
New

Crystal recently reached version 1. I had been following it for awhile but never got to really learn it. Most languages I picked up out o...
New

Author Spotlight
Jamis Buck
@jamis
This month, we have the pleasure of spotlighting author Jamis Buck, who has written Mazes for Prog...
New

I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New

Author Spotlight
Mike Riley
@mriley
This month, we turn the spotlight on Mike Riley, author of Portable Python Projects. Mike’s book ...
New
New

Curious what kind of results others are getting, I think actually prefer the 7B model to the 32B model, not only is it faster but the qua...
New
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /ruby
- /wasm
- /erlang
- /phoenix
- /keyboards
- /rails
- /python
- /js
- /security
- /go
- /swift
- /vim
- /clojure
- /emacs
- /haskell
- /java
- /onivim
- /typescript
- /svelte
- /c-plus-plus
- /crystal
- /kotlin
- /tailwind
- /react
- /gleam
- /ocaml
- /elm
- /flutter
- /vscode
- /ash
- /opensuse
- /html
- /centos
- /php
- /deepseek
- /zig
- /scala
- /lisp
- /textmate
- /sublime-text
- /nixos
- /debian
- /react-native
- /agda
- /kubuntu
- /arch-linux
- /django
- /revery
- /ubuntu
- /spring
- /manjaro
- /nodejs
- /diversity
- /lua
- /deno
- /julia
- /slackware
- /c