[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
what's wrong ?
Hi,
i 'm working with centaur-2.0.
I would like to write a function, which calculates a random number, and i
want to use it in my typol's program. But i 'mnot able to realize it.
this is my typol stuff :
taille(lref |- litteralint n) &
choisir_valeur(litteralint n,litteralint x) &
recherche_acteur( lref,lref |- litteralint "1", litteralint x ->
identite(litteralint m,FILE,CONT,link,comp)
: message)
---------------------------------------------------------------------
|- lref -> identite(litteralint m,FILE,CONT,link,comp) + message ;
this typol's rule seeks one element of the list lref.
taille calculates the length of lref, and lref is a list.
my ``litteralint'' is implemented with metal as a STRING.
choisir_valeur calculates a random number between 1 and lenght(lref)+1
taille and recherche_acteur are OK, but when i ``step'' with the debugger to
choisir_valeur, i always had errors, or backtrack step !!
error is like this one :
Error: err-vtp-protocol: type error in _g2286 =.. [1, _g2272, _g2276, _g2280]
Warning: ** MM-error : : Timeout occurred
here they are my prolog functions :
plasmafunc$add1('$Plasma$litteralint'(A),'$Plasma$litteralint'(B)) :-
$lispfun_atom(addition,[A],B).
plasmafunc$choisir_valeur('$Plasma$litteralint'(X),'$Plasma$litteralint'(Y)):-
$lispfun_atom(tirerausort,[X],Y).
and my lisp functions :
(de addition( A )
(+ (implode (explode A)) 1))
(de tirerausort( A )
(srandom) (random 1 (+ (implode (explode A)) 1)))
i use implode & explode because i receive atoms, in lisp and to realize addition, i
need numbers.
i would like to know what's wrong, with lisp or prolog or typol, ...
thanks in advance.