% :- solve(happy(X)).
%:- eval(happy_for_eval(X)).

happy(X) :-
 	sex(X),
 	drugs(X),
 	rocknroll(X).
 
happy_for_eval(Caller) :- 
	on_exception(java.lang.Exception, handle_exception()), 
	findall(X,happy(X),ResultList), 
	println(["Called from: ",Caller]), 
	Caller.results_ready_raising_exception(). 
happy_for_eval(Caller) :- 
	on_exception(java.lang.Exception, handle_exception()), 
	findall(X,happy(X),ResultList), 
	println(["Called from: ",Caller]), 
	Caller.results_ready2(ResultList). 
happy_for_eval(Caller) :- 
	on_exception(java.lang.Exception, handle_exception()), 
	findall(X,happy(X),ResultList), 
	println(["Called from: ",Caller]), 
	Caller.results_ready(ResultList). 
 
handle_exception() :- 
	exception(Ex), 
	println([Ex]), 
	fail(). 

drugs(stefan).
rocknroll(erwin).
sex(thomas).
drugs(thomas).
rocknroll(thomas).

sex(olaf).
drugs(olaf).
rocknroll(olaf).
