Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Collections/Prolog/collections-1.pro
Normal file
11
Task/Collections/Prolog/collections-1.pro
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
% create a list
|
||||
L = [a,b,c,d],
|
||||
|
||||
% prepend to the list
|
||||
L2 = [before_a|L],
|
||||
|
||||
% append to the list
|
||||
append(L2, ['Hello'], L3),
|
||||
|
||||
% delete from list
|
||||
exclude(=(b), L3, L4).
|
||||
14
Task/Collections/Prolog/collections-2.pro
Normal file
14
Task/Collections/Prolog/collections-2.pro
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
% create an empty dict call 'point'
|
||||
D1 = point{},
|
||||
|
||||
% add a value
|
||||
D2 = D1.put(x, 20).put(y, 30).put(z, 20),
|
||||
|
||||
% update a value
|
||||
D3 = D2.put([x=25]),
|
||||
|
||||
% remove a value
|
||||
del_dict(z, D3, _, D4),
|
||||
|
||||
% access a value randomly
|
||||
format('x = ~w, y = ~w~n', [D4.x, D4.y]).
|
||||
Loading…
Add table
Add a link
Reference in a new issue