fork download
  1. take1word([], [], []).
  2. take1word([H|T],[],T) :- integer(H).
  3. take1word([H|T],[H|Hs],Y) :- float(H), take1word(T,Hs,Y); atom(H), take1word(T,Hs,Y).
  4.  
  5. separatewords([],[]).
  6. separatewords(L, [W|T]) :- take1word(L,W,R), separatewords(R,T).
  7.  
  8. :-separatewords([h,e,l,l,o,1,o,v,e,r,3,t,h,e,r,e], X), write(X), nl.
  9.  
Success #stdin #stdout #stderr 0.02s 6204KB
stdin
Standard input is empty
stdout
[[h, e, l, l, o], [o, v, e, r], [t, h, e, r, e]]
stderr