i'm having trouble defining some code in scheme. I am trying to create a record for a node in Scheme/Racket, so far my code looks as follows:
(define-record-type node
(make-node v l r)
node?
(v tree-value)
(l tree-left)
(r tree-right))
However - when I try and execute I get the following error:
define-record-type: expected a
mutable',immutable',
parent',protocol',
sealed',opaque',
nongenerative', orparent-rtd' clause in: (make-node v l r)
I understand that you can define field types to be mutable, immutable etc. But I can't see why this needs to be a clause in the constructor - and if so where it should be?
Could someone please explain
1)How to get around this error
2)Why it arises
#!r6rs
, but not with#lang racket
followed by(require srfi/9)
. – uselpastruct
with#lang racket
. Note that#lang scheme
is a legacy setting that isn't meant for use in new code. – Asumu Takikawa