RosettaCodeData/Task/Substring-Top-and-tail/Picat/substring-top-and-tail-2.picat
2023-07-01 13:44:08 -04:00

17 lines
398 B
Text

go2 =>
test2("upraisers"),
nl,
test2("Δημοτική"),
nl.
test2(L) :-
L = [_|L1],
remove_last(L, L2),
remove_last(L1, L3),
writef("Original string : %s\n", L),
writef("Without first char : %s\n", L1),
writef("Without last char : %s\n", L2),
writef("Without first/last chars : %s\n", L3).
remove_last(L, LR) :-
append(LR, [_], L).