- Code: Select all Expand view RUN
- domains
person, activity = symbol
predicates
likes(person,activity)
clauses
likes(ellen,tennis).
likes(john,football).
likes(tom,baseball).
likes(eric,swimming).
likes(mark,tennis).
likes(bill,X) if likes(tom,X)
Then I thought, could we do that using Harbour ?
- Code: Select all Expand view RUN
- #define likes(x,y) If(ValType(likes[x])=="B", Eval(likes[x],y), likes[x]==y)
function Main()
local likes := {=>}
likes[ "ellen" ] = "tennis"
likes[ "john" ] = "football"
likes[ "tom" ] = "baseball"
likes[ "eric" ] = "swimming"
likes[ "marc" ] = "tennis"
likes[ "bill" ] = { | x | likes( "tom", x ) }
? likes( "bill", "tennis" )
? likes( "bill", "baseball" )
return nil
How far can we go ?