Revert the list changes introduced in 0.7.

The children of a non-empty list should be the head element and the tail, which is a list. The empty list has no children.

Generic term deconstruction should result in “Cons” and two children, or “Nil” and no children. Vice versa for term construction.

The generic term traversal primitives all(s), one(s) and some(s) should be defined in terms of Cons/Nil: all(s) must not traverse a list.

Note that the ATerm list can still be used. The introduction of this representation accompanied by the semantics changes in 0.7.

Small generic term (de)construction test that might be useful:
————————————————
module foo
imports list-cons tuple-cons io

strategies

main =
[1, 2]
; []
; ([], [1,2])
; (“Cons”, [1,[]])
; (“Nil”, [])

deconstruct =
?l
; ?f#(xs)
; say(!“———————————–”)
; <debug(!"List : ")> l
; <debug(!"Deconstructed : ")> (f, xs)

construct =
?(f, xs)
; !f#(xs)
; ?l
; say(!“———————————–”)
; <debug(!"Deconstructed : ")> (f, xs)
; <debug(!"Constructed : ")> l
—————————————————-

Submitted on 11 April 2004 at 21:57


On 21 July 2005 at 22:05 Jira commented:

STR-47, martin:
I’m still not sure if we should actually ‘fix’ this.


On 9 January 2013 at 16:55 Eelco Visser removed tag 0.22

On 9 January 2013 at 16:55 Eelco Visser tagged interesting

Log in to post comments