chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] Creating new types and their representation in the REPL


From: Jack Trades
Subject: [Chicken-users] Creating new types and their representation in the REPL
Date: Wed, 7 Jul 2010 13:45:39 -0500

I'm sure this is a simple question but I can't quite figure it out.  Is there a way to get (define-record ...) to print out something other than the tag of the record?

Example of current behavior:

(define-record point x y)
(define p (make-point 5 10))
p
===> #<point>


Example of desired behavior:

(define-record point x y)
(define p (make-point 5 10))
p
===> (5 10)
-- or --
===> (point 5 10)


Or is there a better way to create new types that allows for the representation of those types in the REPL to be customized?  I guess what I'm looking for here is something like python's repr and str.

I came across SRFI-9-Plus for PLT which kind-of does what I'm looking for, if not with a slightly awkward syntax.  http://www.neilvandyke.org/srfi-9-plus/

Jack Trades

reply via email to

[Prev in Thread] Current Thread [Next in Thread]