Skip to content

Instantly share code, notes, and snippets.

@ninjarobot
Last active July 19, 2018 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ninjarobot/dea82b8bf4a7d7c19f3e56136b08a059 to your computer and use it in GitHub Desktop.
Save ninjarobot/dea82b8bf4a7d7c19f3e56136b08a059 to your computer and use it in GitHub Desktop.
Processing a delimited string
?- S = "the|little|brown|fox|lost|its|way", split_string(S,"|","",Strings), maplist(string_length,Strings,Lengths), list_to_set(Lengths,Set).
S = "the|little|brown|fox|lost|its|way",
Strings = ["the", "little", "brown", "fox", "lost", "its", "way"],
Lengths = [3, 6, 5, 3, 4, 3, 3],
Set = [3, 6, 5, 4].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment