main :-
L = [1/2, 3/4, 5/6],
new(D, dialog),
new(Q, text_item(query)),
send(D, append, Q),
send(D, append, button(find, message(@prolog, process, prolog(L), Q?selection))),
send(D, open).
process(List, Key) :-
find_by_key(List, Key, Value),
write(List), nl,
write(Key), nl,
write(Value), nl.
find_by_key([ K/V | _ ], K, Value) :-
Value = V.
find_by_key([ _ | Tail], K, Value) :-
find_by_key(Tail, K, Value).
find_by_key(_, _, Value) :-
Value = "Not found".
у меня выводит так:
[1/2, 3/4, 5/6]
1
[78, 111, 116, 32, 102, 111, 117, 110, 100]