The following program has a little bug.
------- foo.spad ----------
)abbrev package CONDOC ConstructorDocumentation
ConstructorDocumentation: with
getConstructors: () -> CONSTRUCTORS
== add
getConstructors(): CONSTRUCTORS ==
cs: CONSTRUCTORS == empty()
f: TextFile := open(filename("", "abbrev", "list"), "input")
while not endOfFile? f repeat
l: List String := split(readLine! f, char " ")
cs(l.5) := [l.1, l.2, l.3, l.4]
close! f
cs
-----------------------------
****** comp fails at level 5 with expression: ******
error in function getConstructors
(SEQ
(LET (|:| |l| (|List| (|String|)))
(|split| (|readLine!| |f|) (|char| " ")))
(|exit| 1
(LET (|cs| (|l| 5))
(|construct| (|l| 1) (|l| 2) (|l| 3) (|l| 4)))))
****** level 5 ******
$x:= cs
$m:= (XHashTable (String) (Record (: fn (String)) (: srcpos (String)) (:
fkind (String)) (: abbrev (String))))
$f:=
((((|l| # #) (|last| #) (|rest| #) (|first| #) ...)))
>> Apparent user error:
Cannot coerce cs
of mode (Mapping (XHashTable (String) (Record (: fn (String)) (:
srcpos (String)) (: fkind (String)) (: abbrev (String)))))
to mode (List (String))
It took me quite some time to extract from that error message that I hat
mistakingly written
cs: CONSTRUCTORS == empty()
instead of putting ":=" there.
I couldn't understand where the "Mapping" in the error message was
coming from and thought it was because of "cs(l.5)" which made me look
for the actual error position at quite the wrong place. :-(
I hope, someone finds this useful.
Ralf
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.