Skip to content

contains_t(Key, Assoc, Value, Truth) ? (or reifed predicate for assoc library? ) #2577

Answered by jjtolton
jjtolton asked this question in Q&A
Discussion options

You must be logged in to vote

I'm about ready to call QED on this. @triska regarding ..., this was the configuration I could achieve with the minimum number of introspections that admitted no redundant choicepoints.

:- use_module(library(assoc)).
:- use_module(library(clpz)).
:- use_module(library(dif)).
:- use_module(library(reif)).
:- use_module(library(lists)).
:- use_module(library(lambda)).

contains_key_assoc_t(Key, t, false).
contains_key_assoc_t(Key, t(K,V,Rel,L,R), Found) :-
        Assoc= t(K,V,Rel,L,R),
        (   ground(Key) ->
            contains_key_assoc_t_(Key, Assoc, Found)
        ;   gen_assoc(Key, Assoc, _), Found=true
        ).
        
contains_key_assoc_t_(Key, t(K,V,_,L,R), Found) :-
    Assoc=

Replies: 8 comments 28 replies

Comment options

You must be logged in to vote
8 replies
@jjtolton
Comment options

@haijinSk
Comment options

@haijinSk
Comment options

@triska
Comment options

@haijinSk
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@triska
Comment options

Comment options

You must be logged in to vote
4 replies
@bakaq
Comment options

@jjtolton
Comment options

@jjtolton
Comment options

@triska
Comment options

Comment options

You must be logged in to vote
3 replies
@jjtolton
Comment options

@jjtolton
Comment options

@jjtolton
Comment options

Comment options

You must be logged in to vote
3 replies
@jjtolton
Comment options

@triska
Comment options

@jjtolton
Comment options

Comment options

You must be logged in to vote
5 replies
@jjtolton
Comment options

@triska
Comment options

@jjtolton
Comment options

@triska
Comment options

@jjtolton
Comment options

Comment options

You must be logged in to vote
4 replies
@jjtolton
Comment options

@triska
Comment options

@jjtolton
Comment options

@jjtolton
Comment options

Answer selected by jjtolton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants