Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Prolog how to store first 3 elements in a list into another list
- first_three(N,[H|T],[H|_]):- not(N=0),N is N-1, first_three(N,T,L).
- first_three(0,_,[).
- first_three(N,[H|T],[H|L]):-
- N=0,
- N1 is N-1,
- first_three(N,T,L).
- first_three([One,Two, Three|_], [One,Two, Three]).
- first_three(Path, Y).
Add Comment
Please, Sign In to add comment