[plt-scheme] Please help test version 359.100

From: Williams, M. Douglas (M.DOUGLAS.WILLIAMS at saic.com)
Date: Mon Nov 6 10:59:58 EST 2006

I have a problem that seems to have cropped up somewhere between 352.4
and 352.8 and is still in 359.100.  If you download the inference
collection from PLaneT as follows:

(require (planet "inference.ss" ("williams" "inference.ss)))

Find and run ancestor.ss (the simplest example) from the examples
directory - from the downloaded PLaneT package.

Under 352 (and up to at least 352.4), it runs fine.  Under later
versions - I noticed it first under 352.8 and it's still in 359.100 -
you get the following error:

context expected 1 value, received 0 values

Or, if I run a local copy instead of the PLaneT copy [so I can change
the code] and use (require "../inference.ss")

..\private\inference-control.ss::25016: context expected 1 value,
received 0 values

This points to the following code as the problem:

  (define (match-node-retract match-node assertion)
    (set-match-node-n! match-node (- (match-node-n match-node) 1))
    (let/cc exit
      (let loop ((previous #f)
                 (matches (node-matches match-node)))
        (when (not (null? matches))
          (let ((match (car matches)))
            (when (eq? assertion (caar match))
              ;; Remove the match
              (if previous
                  (set-cdr! previous (cdr matches))
                  (set-node-matches! match-node (cdr matches)))
               (lambda (successor)
                 (unpropagate-match-from-match-node match successor))
               (node-successors match-node))
          (loop matches (cdr matches))))
      ;; Match not found
       (lambda (successor)
         (unpropagate-nonmatch-from-match-node successor))
       (node-successors match-node))))

The problem is the (exit) with no value.  None of the upstream code uses
the return value from match-node-retract.  The only usage (and the one
that fails) is in the following - within the for-each:

  (define (retract assertion)
    (when (current-inference-trace)
      (printf "<<< ~a~n" assertion))
    ;; Remove the fact from the assertion index.
    (hash-table-put! (current-inference-assertion-index)
                     (fact-first (assertion-fact assertion))
                     (delete! assertion
                               (fact-first (assertion-fact
    ;; Match and unpropagate through the rule network.
     (lambda (match-node)
       (match-node-retract match-node assertion))
     (hash-table-get (current-inference-data-index)
                     (fact-first (assertion-fact assertion)))))

If I change the (exit) to (exit #f), the code doesn't fail, but it gives
an incorrect result - it seems to terminate at that point.

If I change the (exit) to (exit '()) [or, it seems, to anything other
than #f (including (exit (void)))], it works correctly.

Does anyone have any idea what the problem is?


> -----Original Message-----
> From: plt-scheme-bounces at list.cs.brown.edu [mailto:plt-scheme-
> bounces at list.cs.brown.edu] On Behalf Of Eli Barzilay
> Sent: Saturday, November 04, 2006 9:22 AM
> To: plt-scheme at list.cs.brown.edu
> Subject: [plt-scheme] Please help test version 359.100
> Version 359.100 is now available for testing from
>   http://pre.plt-scheme.org/installers/
> (Note that this not available from the usual download site.)
> If all goes well, we will turn this version into a v360 release within
> a couple of weeks.
> This is, again, a release that is more substantial than the normal
> releases -- there are many new features that are now part of PLT,
> including the #px syntax for sophisticated "regular" expressions,
> delimited continuations and a library of control operators, the
> readline interface, the macro debugger, Lazy Scheme, and a host of
> additional optimizations and fixes -- including improved support for
> international keyboards.
> Your help in testing this new release candidate would be much
> appreciated.
> --
>           ((lambda (x) (x x)) (lambda (x) (x x)))          Eli
>                   http://www.barzilay.org/                 Maze is
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.