Computational Philosophy / Sites

Sites

When one searches, local listings for example, those associated with particular entities, are listed first.
The following algorithm lists how an entity has interacted with an object to a user. Given a entity’s name, it returns all the objects that that entity has interacted with in a particular way.


%% entitysobjects(Entity,EntitysObjects,Objects)
%% Lists object(s) that a entity has interacted with
%% Entity - Entity to find the object(s) which he/she has interacted with
%% EntitysObjects - List of pairs of a entity's name and the object he/she has interacted with
%% Objects - List of object(s) the entity has interacted with

%% entitysobjects(a,[[a,1],[a,2],[b,1]],Objects).
%% Objects = [1, 2] ;

entitysobjects(Entity,EntitysObjects,Objects) :-
entitysobjects1(Entity,EntitysObjects,[],Objects).

%% entitysobjects1(Entity,EntitysObjects,Objects1,Objects2)
%% Lists object(s) that a entity has interacted with
%% Entity - Entity to find the object(s) which he/she has interacted with
%% EntitysObjects - List of pairs of a entity's name and the object he/she has interacted with
%% Objects1 - List of object(s) the entity has interacted with
%% Objects2 - List of object(s) the entity has interacted with to return

entitysobjects1(_,[],Objects,Objects).
entitysobjects1(Entity,[[Entity,Object]|EntitysObjects],Objects1,Objects2) :-
append(Objects1,[Object],Objects3),
entitysobjects1(Entity,EntitysObjects,Objects3,Objects2).
entitysobjects1(Entity,[[OtherEntity,_]|EntitysObjects],Objects1,Objects2) :-
not(Entity=OtherEntity),
entitysobjects1(Entity,EntitysObjects,Objects1,Objects2).

A thought is that there may be a change in a discussion. An algorithm detecting a change in a discussion finds one in which the thread of discussion changes from writing an idea to writing another idea. If writing an idea is denoted by “+”, and writing about another idea is denoted by “-”, only a line of “+’s”, or a line of “-’s” will return a value of “true” for the result of the algorithm.

%% checksame(Items)
%% Checks whether all the Items are the same

%% checksame([+,+,+]).
%% Yes
%% checksame([+,+,-]).
%% No

checksame([Item|Thread]) :-
checksame(Item,Thread).
checksame(_,[]).

%% checksame(Item,Items)
%% Checks whether all the Items are the same as Item

checksame(Item,[Item|Items]) :-
checksame(Item,Items).

Hosted by www.Geocities.ws

1