# Freeze with dictionaries

**URL:** <https://swi-prolog.discourse.group/t/freeze-with-dictionaries/5282>\
**Category:** Predicate\
**Created:** [April 15, 2022, 9:53am UTC](https://swi-prolog.discourse.group/t/freeze-with-dictionaries/5282 "2022-04-15T09:53:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Losbarthos](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/losbarthos/32/4037_2.png) [@Losbarthos](https://swi-prolog.discourse.group/u/Losbarthos)\
**Post date:** [April 15, 2022, 9:53am UTC](https://swi-prolog.discourse.group/t/freeze-with-dictionaries/5282/1 "2022-04-15T09:53:07Z")

</div>

Based on my question [here](https://swi-prolog.discourse.group/t/succ-x-y-alternative-if-x-and-y-are-var/5278/6) unfortunately another question has raised today. I have some dictionary and want to add different key-values on it.

My code so far:

```prolog

?- use_module(library(clpfd)).
true.

?- X #= Y+1, freeze(Y, A=ara{1:[3]}.put([Y=[2]])), freeze(B, B = A.put([5=33])), Y#=1.
X = 2,
Y = 1,
A = ara{1:[2]},
freeze(B, ('.'(ara{1:[2]}, put([5=33]), _115810), B=_115810)).

```

but my desired output was:

```prolog
B=ara{1:[2], 5:33}

```

what could be the reason the output here is such cryptic and how could I solve it?

---

<div class="post-metadata">

**Author:** ![brebs](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@brebs](https://swi-prolog.discourse.group/u/brebs)\
**Post date:** [April 15, 2022, 1:45pm UTC](https://swi-prolog.discourse.group/t/freeze-with-dictionaries/5282/2 "2022-04-15T13:45:43Z")

</div>

Instead of `freeze(B` :

```prolog
?- X #= Y+1, freeze(Y, A=ara{1:[3]}.put([Y=[2]])), freeze(A, B = A.put([5=33])), Y#=1.
X = 2,
Y = 1,
A = ara{1:[2]},
B = ara{1:[2],5:33}.

```

The `_115810` is a “system” variable without a value.

For this example, CLPFD is not needed, can add another freeze instead:

```prolog
?- freeze(Y, X is Y+1), freeze(Y, A=ara{1:[3]}.put([Y=[2]])), freeze(A, B = A.put([5=33])), Y=1.
Y = 1,
X = 2,
A = ara{1:[2]},
B = ara{1:[2],5:33}.

```
