« Return to Thread: List and Yap Read Buffer in C code

Re: List and Yap Read Buffer in C code

by Ingo Thon-2 :: Rate this Message:

Reply to Author | View in Thread

Hi,

Yes now I see it should obviously be '.'(x,y) instead of cons(x,y).
(Must admit that I programmed the last month some lisp/scheme
where list are defined by the function cons....
thats why I didn't realize)

Thanks and sorry
Ingo



n 27 Mar 2009, at 00:22, Vitor Santos Costa wrote:

> Hi Ingo
>
> I am very confused. cons is a different thing then a list, and I
> didn't follow how you got unification to give a type error :(
>
> Can you give me a small program that shows the problem?
>
> Cheers
>
> Vitor
>
> On Thu, Mar 26, 2009 at 8:01 PM, Ingo Thon  
> <ingo.thon@...> wrote:
>> Hi,
>>
>> I have a samll problem with YAP_ReadBuffer in cases where the string
>> to parse contains a list.
>> Take the follwing code
>> chrs = ":(dpose(cons(*(pose(a),0.15),cons(*(pose(b),0.15),[]))),:
>> (nil,
>> 3))";
>>
>>
>>  YAP_Term err;//=new YAP_Term;
>>   YAP_Term parsed = YAP_ReadBuffer(chrs,&err);
>>   //  __IDENT__;
>>   if( YAP_Unify(parsed,YAP_ARG2)){
>>  ....
>>
>>
>> In c++ the corresponding argument is afterwards unified with
>> dpose(cons(pose(a)*0.15,cons(pose(b)*0.15,[])):nil:3
>>
>> if I now do something like
>> dpose(cons(pose(a)*0.15,cons(pose(b)*0.15,[])):nil:3 = dpose(L):_:_ ,
>>
>>
>> I get  TYPE ERROR-  .... : expected list, got cons(....
>>
>>
>> Do I really have to reconstruct the list manually?
>>
>> Cheers Ingo
>>
>>
>> ---------------------------------------------------
>> Ingo Thon <ingo.thon@...>
>> Dept. of Computer Science
>> Katholieke Universiteit Leuven
>> Phone: +32 16 32 7823
>> skype: ingo_thon
>> ---------------------------------------------------
>>
>>
>>
>> ---------------------------------------------------------------------
>> ---------
>> _______________________________________________
>> Yap-users mailing list
>> Yap-users@...
>> https://lists.sourceforge.net/lists/listinfo/yap-users
>>
>
> ----------------------------------------------------------------------
> --------
> _______________________________________________
> Yap-users mailing list
> Yap-users@...
> https://lists.sourceforge.net/lists/listinfo/yap-users


------------------------------------------------------------------------------
_______________________________________________
Yap-users mailing list
Yap-users@...
https://lists.sourceforge.net/lists/listinfo/yap-users

 « Return to Thread: List and Yap Read Buffer in C code