CWM Lists Handing Problem

I think I've found a problem with handling lists. I can get the last
element of a list using list:last (whose documentation is wrong; see
the bottom of this email for details), but I can't get the sublist
that the last element is the rdf:first of:

$ cat testlists.n3
@prefix : <http://example.org/test#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix list: <http://www.w3.org/2000/10/swap/list#> .
@prefix string: <http://www.w3.org/2000/10/swap/string#> .

{ ?LIST a :TestList; list:last ?LAST }
 => { ?LIST :last ?LAST } .

{ ?LIST a :TestList; list:last ?LAST .
  ?SUBLIST rdf:first ?LAST }
 => { ?LIST :lastList ?SUBLIST } .

([ :p :q ] [ :r :s ]) a :TestList .

$ cwm testlists.n3 --think
#Processed by Id: cwm.py,v 1.189 2006/08/02 16:59:14 syosi Exp

#  Notation3 generation by
#       notation3.py,v 1.191 2006/08/01 01:14:04 syosi Exp

     @prefix : <#> .
    @prefix list: <http://www.w3.org/2000/10/swap/list#> .
    @prefix log: <http://www.w3.org/2000/10/swap/log#> .
    @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    @prefix test: <http://example.org/test#> .

     @forAll :LAST,
                :LIST,
                :SUBLIST.
         @forSome :_g0,
                :_g1 .
      ( :_g0
        :_g1 )
         a test:TestList;
         test:last :_g1 .

    :_g0     test:p test:q .

    :_g1     test:r test:s .
    {
        :LIST     a test:TestList;
             list:last :LAST .

        }     log:implies {:LIST     test:last :LAST .
        } .
    {
        :LIST     a test:TestList;
             list:last :LAST .
        :SUBLIST     rdf:first :LAST .

        }     log:implies {:LIST     test:lastList :SUBLIST .
        } .

#ENDS

Also, the documentation for the list:last builtin is wrong:

last Iff the object is a list and the subject is the last thing that
list, then this is true. The last element can be calculated as a
function of the list.
- http://www.w3.org/2000/10/swap/doc/CwmBuiltins

It's actually the other way around; the subject is the list, and the
object is the last thing in that list. Please fix the description!

Thanks,

-- 
Sean B. Palmer, http://inamidst.com/sbp/

Received on Thursday, 11 October 2007 16:40:57 UTC