Re: [eclipse-clp-users] nth0 source code or another solution

From: Stefan Friese <stefan.friese_at_...255...>
Date: Wed, 28 Apr 2010 16:42:01 +0200
Hi,

something like this?

inth0(0,[First|_],Element) :-
  First == Element.
inth0(N,[First|Rest],Element) :-
  First \== Element,
  inth0(N2,Rest,Element),
  N is N2+1.

Stefan

Am Mittwoch, den 28.04.2010, 16:25 +0200 schrieb Christian Wirth:
> Hi,
> 
> i need a function like nth0 that uses identity instead of unification, 
> but i can't find the source code for nth0.
> 
> To be a bit more exact, i need a function that gives me the position of 
> an element in a list by identity (==)
> 
> best regards Christian
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> ECLiPSe-CLP-Users mailing list
> ECLiPSe-CLP-Users_at_lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users
> 
Received on Wed Apr 28 2010 - 14:42:53 CEST

This archive was generated by hypermail 2.2.0 : Mon Jul 09 2018 - 02:05:29 CEST