Having a problem with an example (shift a point)

7 views
Skip to first unread message

Eyal Golan

unread,
Mar 15, 2019, 11:40:30 AM3/15/19
to fp-oo
Hi,
I ran the following definitions in the REPL:

(def Point (fn [x y] {:x x :y y :__class_symbol__ 'Point}))
(def class-of :__class_symbol__)

Then I tried to set the shift method, as described in P.55 :
(def shift (fn [this xinc yinc] (Point (+ (x this) xinc) (+ (y this) yinc))))

I get the following exception in the REPL:
Syntax error compiling at (REPL:1:61).
Unable to resolve symbol: y in this context

I tried different ways, but always have the same problem.

What did I miss?

Thanks

Brian Marick

unread,
Jun 7, 2019, 6:12:59 PM6/7/19
to fp...@googlegroups.com
Sorry not to respond in any useful time.

The definition of `shift` assumes that you’ve defined the `x` and `y` functions as described at the end of the preceding section (3.2):



--
You received this message because you are subscribed to the Google Groups "fp-oo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fp-oo+un...@googlegroups.com.
To post to this group, send email to fp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fp-oo/1758a2e0-5756-4fb8-8607-d0bd866ed79f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages