[CS3304_1381] binding a logical variable to a list

New Message Reply About this list Date view Thread view Subject view Author view

Grant Mericle (gmericle@VT.EDU)
Sat, 22 Apr 2000 09:49:43 -0400


Message-ID:  <NEBBJHHICLFENMPAKIDPAEMMCBAA.gmericle@vt.edu>
Date:         Sat, 22 Apr 2000 09:49:43 -0400
From: Grant Mericle <gmericle@VT.EDU>
Subject:      [CS3304_1381] binding a logical variable to a list

Ex: 3+2
the list that I pass in looks like this: [[3,1],plus,[2,1]]

factor([Head|Tail], Answer) :-
                is_list(Head), Answer is Head. ??

How do I bind answer to the first element in the list ( [3,1] )?

I realize that I could write the rule as factor([Head|Tail], Head)...

but that creates problems when I have to evaluate something like "+-3".
Any pointers would be appreciated..

Grant


New Message Reply About this list Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b3 on Sat Apr 22 2000 - 09:42:43 EDT