Created
March 15, 2021 04:12
-
-
Save katsaii/78f590f08f2c1060acaf26727d2419dc to your computer and use it in GitHub Desktop.
Splits a name and displays all possible splits, prefixes and suffixes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fst((A, _), A). | |
snd((_, B), B). | |
name("katsaii"). | |
?- | |
name(Name), | |
findall((Prefix, Suffix), string_concat(Prefix, Suffix, Name), Pairs), | |
maplist(fst, Pairs, Prefixes), | |
maplist(snd, Pairs, Suffixes), | |
write("pairs: "), write(Pairs), nl, | |
write("prefixes: "), write(Prefixes), nl, | |
write("suffixes: "), write(Suffixes). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment