I’m using: SWI-Prolog (threaded, 64 bits, version 8.3.9)
I want the code to: build a list of boolean
But what I’m getting is: false
My code looks like this:
floor_locations([ 0.0, 0.17, 0.33, 0.5, 0.67, 0.83, 1.0 ]).
cabin_location_is_reached( cabin_location, floor_location, true ) :-
abs( cabin_location - floor_location ) =< 0.01.
cabin_location_is_reached( cabin_location, floor_location, false ) :-
abs( cabin_location - floor_location ) > 0.01.
list_floors_to_be_served( [], [],_, [] ).
list_floors_to_be_served( [request|floor_requests], [floor_location|floor_locations], cabin_location, [has_to_be_served|floors_to_be_served_list] ) :-
cabin_location_is_reached( cabin_location, floor_location, has_to_be_served ),
list_floors_to_be_served( floor_requests, floor_locations, cabin_location, floors_to_be_served_list ).
The expected result: [false, false, false, false, false, false, true]