Simple list head rest split syntax
Posted: 30 Nov 2015 4:19
If I retrieve a string-list from a fact is there a simple syntax-sugar way to split it into the typical head
rest vars
I do know that I could write a predicate to split the list and return Head & Rest by unification but I just wondered if it was possible.
rest vars
Code: Select all
class facts
filename:(string,string,string,string,core::string_list).
clauses
somePred():-
filename(_._._,_,Name_Parts_Str),
[Head,Rest] := Name_Parts_Str, % this is wrong but you get the idea of the split
I do know that I could write a predicate to split the list and return Head & Rest by unification but I just wondered if it was possible.