maplist(share_vars(Vs),ShareVars), (\+ is_list(SourceCode) -> mort(SourceCode) ; maplist(mort,SourceCode)). %vars_to_dictation([_=Value|Gotten],TIn,TOut):- is_vm_map(Value),!, vars_to_dictation(Gotten,TIn,TOut). vars_to_dictation([Name=Value|Gotten],TIn,TOut):- !, my_assertion(atom(Name)), vars_to_dictation(Gotten,TIn,TMid), to_prop_name(Name,UName), tio_tersify(Value,ValueT),!, put_dict(UName,TMid,ValueT,TOut). vars_to_dictation([NameValue|Gotten],TIn,TOut):- !, vars_to_dictation(Gotten,TIn,TMid), to_prop_name(NameValue,UName), tio_tersify(NameValue,ValueT),!, put_dict(UName,TMid,ValueT,TOut). vars_to_dictation([NameValue|Gotten],TIn,TOut):- compound(NameValue),compound_name_arguments(NameValue,Name,Value),!, vars_to_dictation([Name=Value|Gotten],TIn,TOut). vars_to_dictation([],T,T). tio_tersify(Value,ValueT):- is_grid(Value),!,ValueT=_. tio_tersify(Value,Value). :- export(copy_qq_//1). copy_qq_([]) --> []. copy_qq_([C|Cs]) --> [C], copy_qq_(Cs). :- export(copy_qq//1). muarc:copy_qq(A) --> copy_qq_(Cs), {atom_codes(A, Cs)}. to_prop_name(Name=_,UName):- nonvar(Name),!,to_prop_name(Name,UName). to_prop_name(Name,UName):- compound(Name),compound_name_arity(Name,F,_),!,to_prop_name(F,UName). to_prop_name(Name,UName):- to_case_breaks(Name,Breaks),xtis_to_atomic(Breaks,UName). xtis_to_atomic([xti(Str,upper),xti(StrL,lower)|Breaks],StrO):- string_upper(Str,Str), symbol_chars(Str,CharsList),append(Left,[U],CharsList), name(S1,Left),symbolic_list_concat([S1,'_',U,StrL],'',StrUL),!, xtis_to_atomic([xti(StrUL,lower)|Breaks],StrO). xtis_to_atomic([],''). xtis_to_atomic([xti(Str,_)],Lower):- downcase_atom(Str,Lower). xtis_to_atomic([XTI|Breaks],Atomic):- xtis_to_atomic([XTI],S1),xtis_to_atomic(Breaks,S2),!,symbolic_list_concat([S1,S2],'_',Atomic). share_vars(Vs,Name=Value):- member(VName=VValue,Vs),VName==Name,!,(Value=VValue->true;trace_or_throw(cant(share_vars(Vs,Name=Value)))). share_vars(_,Name=_):- string_concat('_',_,Name),!. % Hide some vars share_vars(V,Name=Value):- fbug(missing(share_vars(V,Name=Value))),!. parse_expansions(_,Vs,Vs,Src,Src):- \+ compound(Src),!. parse_expansions(_,Vs0,Vs,dont_include(Var),nop(dont_include(Var))):- dont_include_var(Vs0,Vs,Var),!. parse_expansions(F, Vs0,Vs,[Src0|Sourcecode0],[Src|Sourcecode]):- !, parse_expansions(F, Vs0, Vs1, Src0, Src), parse_expansions(F, Vs1, Vs, Sourcecode0, Sourcecode). parse_expansions(FF, Vs0, Vs, Cmpd0, Cmpd):- compound_name_arguments(Cmpd0,F,Args0), parse_expansions([F|FF], Vs0, Vs, Args0,Args), compound_name_arguments(Cmpd,F,Args). dont_include_var(Vs0,Vs,Var):- select(_=VV,Vs0,Vs),VV==Var,!. dont_include_var(Vs,Vs,_). append_sets(Sets,Set):- append(Sets,List),list_to_set(List,Set). append_sets(Set1,Set2,Set):- append(Set1,Set2,List),list_to_set(List,Set). flatten_sets(Sets,Set):- flatten(Sets,List),list_to_set(List,Set).