Return-Path: <john.harrison-request@uk.ac.cam.cl>
Delivery-Date: 
Received: from ted.cs.uidaho.edu by swan.cl.cam.ac.uk with SMTP (PP-6.2);
          Tue, 20 Oct 1992 11:22:44 +0100
Received: by ted.cs.uidaho.edu (16.6/1.34) id AA13701;
          Tue, 20 Oct 92 03:10:34 -0700
Sender: info-hol-request@edu.uidaho.cs.ted
Errors-To: info-hol-request@edu.uidaho.cs.ted
Precedence: bulk
Received: from ganymede.inmos.co.uk by ted.cs.uidaho.edu (16.6/1.34) id AA13646;
          Tue, 20 Oct 92 03:10:02 -0700
Received: from frogland.inmos.co.uk by ganymede.inmos.co.uk;
          Tue, 20 Oct 92 11:08:53 BST
From: David Shepherd <des@uk.co.inmos>
Message-Id: <2984.9210201008@frogland.inmos.co.uk>
Subject: Re: Error in variant -- Can anyone explain...
To: kimdam@dk.tfl (Kim Dam Petersen)
Date: Tue, 20 Oct 92 11:08:38 BST
Cc: info-hol@edu.uidaho.cs.ted (info-hol mailing list)
In-Reply-To: <m0mgygy-0003h6C@ux6.tfl.dk>; from "Kim Dam Petersen" at Oct 19, 92 5:05 pm
X-Mailer: ELM [version 2.3 PL11]

Kim Dam Petersen has said:
> 
> According to the Reference Manual
> 
>    variant : term list -> term -> term
> 
> never fails.  Nevertheless the simple application:
> 
>   variant ["T"] (mk_var(`x`,":num"));;
> 
> yields the error message:
> 
>   evaluation failed     VARIANT

from the code its clear that variant expects the term list to be a 
list of variables. 

for a more general version you could use

let gen_variant tml tm = variant (itlist append (map frees tml) []) tm;;

which primes tm so it doesn't clash with any free variables in any
term in tml.


--------------------------------------------------------------------------
david shepherd: des@inmos.co.uk or des@inmos.com    tel: 0454-616616 x 625
                inmos ltd, 1000 aztec west, almondsbury, bristol, bs12 4sq
                1992: celebrate the quincentenary of columbus getting lost
