Re: nested list



this is my new code..
but, still ERROR in it
/*------------------------------------------------------------------------*/
domains
list=symbol*

predicates
is_list(list)
append(list,list)
append(list,list,list)
my_flatten(list,list)

clauses
is_list([]).
is_list([_|Tail]):-
is_list(Tail).

append(I,O):-
append(I,[],O).
append([],I,I).
append([Hi|Ti],I,[Hi|To]):-
append(Ti,I,To).


/*---------begin main--------------------*/
my_flatten(X,[X]).
my_flatten([],[]).
my_flatten([Hi|Ti],O):-
is_list(Hi),
my_flatten(Hi,FHi),
my_flatten(Ti,FTi),
append(Fhi,FTi,O),
!.

my_flatten([Hi|Ti],O):-
my_flatten(Ti,OTi),
append(Hi,OTi,O).
/*---------end main----------------------*/
/*-----------------------------------------------------------------------*/

i've tried
.
.
my_flatten([[Hi]|Ti],O):-
is_list(Hi),
.
.
but it said that "512 Type Error: Wrong Object Type..."
any comments?? please ( T_T ) hiks..
.



Relevant Pages

  • Re: nested list
    ... imamabudaud wrote: ... but it said that "512 Type Error: ...
    (comp.lang.prolog)
  • April 1
    ... Why does Friday, April 1, 2005 in a date formated cell generate a wrong data ... type error when using the WEEKDAY formula? ... Prev by Date: ...
    (microsoft.public.excel.worksheet.functions)
  • Re: :test #something-specific
    ... the type error earlier and a bug if you want this call to be more ... forgiving. ... Prev by Date: ...
    (comp.lang.lisp)
  • Re: [9fans] MS Research reinvents Inferno?
    ... And you can't bind '#p' onto /dev because you'll get ... a type error. ... Russ ... Prev by Date: ...
    (comp.os.plan9)
  • Re: type error on porting outfile.write
    ... > application platform, I found a "type error" ... > on a fileout statement: ... Prev by Date: ...
    (comp.lang.python)