Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Is knowledge knowable? If not, how do we know that?


devel / comp.lang.prolog / SIMPLE UNIFY( string1 string2 )

SubjectAuthor
o SIMPLE UNIFY( string1 string2 )Graham Cooper

1
SIMPLE UNIFY( string1 string2 )

<7b3b994a-8272-4924-a6c6-b9acff0cda0bn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10227&group=comp.lang.prolog#10227

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a37:e305:0:b0:74a:da50:3ce1 with SMTP id y5-20020a37e305000000b0074ada503ce1mr3538074qki.7.1683103771886;
Wed, 03 May 2023 01:49:31 -0700 (PDT)
X-Received: by 2002:a81:c742:0:b0:54f:a986:3f94 with SMTP id
i2-20020a81c742000000b0054fa9863f94mr11529376ywl.3.1683103771653; Wed, 03 May
2023 01:49:31 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Wed, 3 May 2023 01:49:31 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2001:8004:11a0:3cee:8836:3c04:bb3a:10ea;
posting-account=EsDGawkAAAAN6xcF2fi-X0yb3ECD-3_I
NNTP-Posting-Host: 2001:8004:11a0:3cee:8836:3c04:bb3a:10ea
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7b3b994a-8272-4924-a6c6-b9acff0cda0bn@googlegroups.com>
Subject: SIMPLE UNIFY( string1 string2 )
From: grahamco...@gmail.com (Graham Cooper)
Injection-Date: Wed, 03 May 2023 08:49:31 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2699
 by: Graham Cooper - Wed, 3 May 2023 08:49 UTC

www.miniPROLOG.com

function top($list)
{ $list = $list . "\n";
$cr = strpos( $list , "\n" );
$top = substr( $list , 0 , $cr );
return trim($top);
}

function rest($list)
{ if ($list[strlen($list)-1] != "\n") { $list = $list . "\n"; }
$cr = strpos( $list , "\n" );
$rest = substr( $list , $cr+1 );
return $rest;
}

function first($string)
{ if ($string[strlen($string)-1] != " ") { $string = $string . " "; }
$space = strpos( $string , ' ' );
$first = substr($string , 0 , $space);
return trim($first);
}

function remainder($string)
{ if ($string[strlen($string)-1] != " ") { $string = $string . " "; }
$space = strpos( $string , ' ' );
$remainder = substr( $string , $space+1 );
return $remainder;
}

function unifytolist($goal1)
{ global $dat;

$list = $dat;
$eol = false;
$found = false;
while (!$found & !$eol )
{
$toplist = top($list);
echo "<br>" . $toplist . "<br>";
$found = unify( $goal1 , $toplist );
if (!$found)
{
$list = rest($list);
if ($list == '') { $eol = true; }
}
}
return $found;
}

function unify( $string1 , $string2 )
{ $match = true;
$eol = $false;
while ($match & !$eol)
{
$first1 = first($string1);
$first2 = first($string2);
echo $first1 . '-' . $first2 . " ";
if ($first1==$first2)
{
$string1 = remainder($string1);
$string2 = remainder($string2);
if ( ($string1=='') | ($string2=='') ) { $eol=true; }
}
else
{
$match = false;
}
}
return $eol;
}


devel / comp.lang.prolog / SIMPLE UNIFY( string1 string2 )

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor