Re: Generic term search in a list
- From: Steffen Schwigon <schwigon@xxxxxxxx>
- Date: Tue, 10 Jan 2006 14:50:34 +0100
Jan Wielemaker <jan@xxxxxxxxxxxxxxxxxxx> writes:
> What about
>
> get_range(options(Options), Range) :-
> Range = range(_, ),
> ( memberchk(Range, Options)
> -> true
> ; Range = range(0,inf)
> ).
Aha, memberchk. Looks good. Thanks.
> I see little purpose in the options/1 representation and would use a
> plain list.
I do such things often for readability. Less for the definition
of the predicates but mostly when they are called. I prefer
get_d(options([range(1,2), foo(12), bar(65)]), depends(B,C), D)
over
get_d([range(1,2), foo(12), bar(65)], depends(B,C), D)
I'm still learning typical patterns and are experimenting to find my
personal style. Would you consider the above as unusual style in
Prolog?
Thanks.
Steffen
--
Steffen Schwigon <schwigon@xxxxxxxx>
Dresden Perl Mongers <http://dresden-pm.org/>
.
- Follow-Ups:
- Re: Generic term search in a list
- From: Jan Wielemaker
- Re: Generic term search in a list
- References:
- Generic term search in a list
- From: Steffen Schwigon
- Re: Generic term search in a list
- From: Jan Wielemaker
- Generic term search in a list
- Prev by Date: Re: Generic term search in a list
- Next by Date: Re: Generic term search in a list
- Previous by thread: Re: Generic term search in a list
- Next by thread: Re: Generic term search in a list
- Index(es):