From 384d3c501a38b489312496b0bf9522bdf29053d8 Mon Sep 17 00:00:00 2001 From: Aleksander Sadikov Date: Mon, 14 Dec 2015 13:57:29 +0100 Subject: Add Slovenian translations for Prolog exercises --- prolog/problems/lists/conc_3/sl.py | 15 +++++++++++++++ prolog/problems/lists/count_3/sl.py | 13 +++++++++++++ prolog/problems/lists/del_3/sl.py | 20 ++++++++++++++++++++ prolog/problems/lists/divide_3/sl.py | 15 +++++++++++++++ prolog/problems/lists/dup_2/sl.py | 15 +++++++++++++++ prolog/problems/lists/evenlen_1_+_oddlen_1/sl.py | 18 ++++++++++++++++++ prolog/problems/lists/insert_3/sl.py | 15 +++++++++++++++ prolog/problems/lists/len_2/sl.py | 13 +++++++++++++ prolog/problems/lists/max_2/sl.py | 15 +++++++++++++++ prolog/problems/lists/memb_2/sl.py | 17 +++++++++++++++++ prolog/problems/lists/min_2/sl.py | 15 +++++++++++++++ prolog/problems/lists/palindrome_1/sl.py | 15 +++++++++++++++ prolog/problems/lists/permute_2/sl.py | 18 ++++++++++++++++++ prolog/problems/lists/rev_2/en.py | 4 ++-- prolog/problems/lists/rev_2/sl.py | 15 +++++++++++++++ prolog/problems/lists/shiftleft_2/sl.py | 13 +++++++++++++ prolog/problems/lists/shiftright_2/sl.py | 13 +++++++++++++ prolog/problems/lists/sublist_2/sl.py | 19 +++++++++++++++++++ prolog/problems/lists/sum_2/sl.py | 13 +++++++++++++ 19 files changed, 279 insertions(+), 2 deletions(-) create mode 100644 prolog/problems/lists/conc_3/sl.py create mode 100644 prolog/problems/lists/count_3/sl.py create mode 100644 prolog/problems/lists/del_3/sl.py create mode 100644 prolog/problems/lists/divide_3/sl.py create mode 100644 prolog/problems/lists/dup_2/sl.py create mode 100644 prolog/problems/lists/evenlen_1_+_oddlen_1/sl.py create mode 100644 prolog/problems/lists/insert_3/sl.py create mode 100644 prolog/problems/lists/len_2/sl.py create mode 100644 prolog/problems/lists/max_2/sl.py create mode 100644 prolog/problems/lists/memb_2/sl.py create mode 100644 prolog/problems/lists/min_2/sl.py create mode 100644 prolog/problems/lists/palindrome_1/sl.py create mode 100644 prolog/problems/lists/permute_2/sl.py create mode 100644 prolog/problems/lists/rev_2/sl.py create mode 100644 prolog/problems/lists/shiftleft_2/sl.py create mode 100644 prolog/problems/lists/shiftright_2/sl.py create mode 100644 prolog/problems/lists/sublist_2/sl.py create mode 100644 prolog/problems/lists/sum_2/sl.py (limited to 'prolog/problems/lists') diff --git a/prolog/problems/lists/conc_3/sl.py b/prolog/problems/lists/conc_3/sl.py new file mode 100644 index 0000000..15e3163 --- /dev/null +++ b/prolog/problems/lists/conc_3/sl.py @@ -0,0 +1,15 @@ +# coding=utf-8 + +name = 'conc/3' +slug = 'Združi dva seznama (konkatenacija)' + +description = '''\ +

conc(L1, L2, L): seznam L dobiš tako, da seznamu L1 na konec dodaš elemente seznama L2.

+
+  ?- conc([1,2], [3,4], X).
+    X = [1,2,3,4].
+  ?- conc(X, [], [1,2,3]).
+    X = [1,2,3].
+
''' + +hint = {} diff --git a/prolog/problems/lists/count_3/sl.py b/prolog/problems/lists/count_3/sl.py new file mode 100644 index 0000000..15a4650 --- /dev/null +++ b/prolog/problems/lists/count_3/sl.py @@ -0,0 +1,13 @@ +# coding=utf-8 + +name = 'count/3' +slug = 'Preštej kolikokrat se element pojavi v seznamu' + +description = '''\ +

count(X, L, N): N je število kolikokrat se element X pojavi v seznamu L.

+
+  ?- count(1, [1,2,1,3,1], N).
+    N = 3.
+
''' + +hint = {} diff --git a/prolog/problems/lists/del_3/sl.py b/prolog/problems/lists/del_3/sl.py new file mode 100644 index 0000000..49ab16f --- /dev/null +++ b/prolog/problems/lists/del_3/sl.py @@ -0,0 +1,20 @@ +# coding=utf-8 + +name = 'del/3' +slug = 'Zbriši element iz seznama' + +description = '''\ +

del(X, L1, L2): seznam L2 dobimo iz seznama L1 tako da zbrišemo element X.

+
+  ?- del(1, [1,2,3], L).
+    L = [2,3].
+  ?- del(2, [1,2,3,2,5], L).
+    L = [1,3,2,5] ;
+    L = [1,2,3,5].
+  ?- del(X, [1,2,3], L).
+    X = 1, L = [2,3] ;
+    X = 2, L = [1,3] ;
+    X = 3, L = [1,2].
+
''' + +hint = {} diff --git a/prolog/problems/lists/divide_3/sl.py b/prolog/problems/lists/divide_3/sl.py new file mode 100644 index 0000000..ecf9a5a --- /dev/null +++ b/prolog/problems/lists/divide_3/sl.py @@ -0,0 +1,15 @@ +# coding=utf-8 + +name = 'divide/3' +slug = 'Razdeli dani seznam na dva podseznama (približno) enake velikosti' + +description = '''\ +

divide(L, L1, L2): seznam L1 vsebuje elemente na lihih pozicijah v seznamu L, seznam L2 pa elemente na sodih pozicijah v L.

+
+  ?- divide([a,b,c,d,e,f,g], X, Y).
+    X = [a,c,e,g], Y = [b,d,f].
+  ?- divide([a,b,c,d,e,f], X, Y).
+    X = [a,c,e], Y = [b,d,f].
+
''' + +hint = {} diff --git a/prolog/problems/lists/dup_2/sl.py b/prolog/problems/lists/dup_2/sl.py new file mode 100644 index 0000000..fc974d8 --- /dev/null +++ b/prolog/problems/lists/dup_2/sl.py @@ -0,0 +1,15 @@ +# coding=utf-8 + +name = 'dup/2' +slug = 'Podvoji vse elemente v seznamu' + +description = '''\ +

dup(L1, L2): seznam L2 dobimo iz L1 tako, da podvojimo vsak element.

+
+  ?- dup([1,2], X).
+    X = [1,1,2,2].
+  ?- dup([1,2,3], X).
+    X = [1,1,2,2,3,3].
+
''' + +hint = {} diff --git a/prolog/problems/lists/evenlen_1_+_oddlen_1/sl.py b/prolog/problems/lists/evenlen_1_+_oddlen_1/sl.py new file mode 100644 index 0000000..1959877 --- /dev/null +++ b/prolog/problems/lists/evenlen_1_+_oddlen_1/sl.py @@ -0,0 +1,18 @@ +# coding=utf-8 + +name = 'evenlen/1 + oddlen/1' +slug = 'Brez aritmetike preveri, če je seznam sode ali lihe dolžine' + +description = '''\ +

evenlen(L): seznam L ima sodo število elementov.
+oddlen(L): seznam L ima liho število elementov.

+
+  ?- oddlen([1,2,3,4,5]).
+    true.
+  ?- oddlen([1,2,3,4]).
+    false.
+  ?- evenlen([1,2,3,4]).
+    true.
+
''' + +hint = {} diff --git a/prolog/problems/lists/insert_3/sl.py b/prolog/problems/lists/insert_3/sl.py new file mode 100644 index 0000000..08ffced --- /dev/null +++ b/prolog/problems/lists/insert_3/sl.py @@ -0,0 +1,15 @@ +# coding=utf-8 + +name = 'insert/3' +slug = 'Vstavi element na poljubno mesto v seznamu' + +description = '''\ +

insert(X, L1, L2): seznam L2 dobimo iz L1 tako, da vstavimo element X na poljubno mesto. Predikat naj vrne vse možne rešitve, eno za drugo.

+
+  ?- insert(1, [2,3], L).
+    L = [1,2,3] ;
+    L = [2,1,3] ;
+    L = [2,3,1].
+
''' + +hint = {} diff --git a/prolog/problems/lists/len_2/sl.py b/prolog/problems/lists/len_2/sl.py new file mode 100644 index 0000000..5b9f05a --- /dev/null +++ b/prolog/problems/lists/len_2/sl.py @@ -0,0 +1,13 @@ +# coding=utf-8 + +name = 'len/2' +slug = 'Izračunaj dolžino danega seznama' + +description = '''\ +

len(L, Len): Len je dolžina seznama L.

+
+  ?- len([1,2,3], Len).
+    Len = 3.
+
''' + +hint = {} diff --git a/prolog/problems/lists/max_2/sl.py b/prolog/problems/lists/max_2/sl.py new file mode 100644 index 0000000..81c354b --- /dev/null +++ b/prolog/problems/lists/max_2/sl.py @@ -0,0 +1,15 @@ +# coding=utf-8 + +name = 'max/2' +slug = 'Poišči največji element v danem seznamu' + +description = '''\ +

max(L, Max): Max je največji element v seznamu L.

+
+  ?- max([5,4,1,6], M).
+    M = 6.
+  ?- max([3,2,2], M).
+    M = 3.
+
''' + +hint = {} diff --git a/prolog/problems/lists/memb_2/sl.py b/prolog/problems/lists/memb_2/sl.py new file mode 100644 index 0000000..540394b --- /dev/null +++ b/prolog/problems/lists/memb_2/sl.py @@ -0,0 +1,17 @@ +# coding=utf-8 + +name = 'memb/2' +slug = 'Preveri (poišči), če je dani element v seznamu' + +description = '''\ +

memb(E, L): E je element seznama L.

+
+  ?- memb(X, [1,2,3]).
+    X = 1 ;
+    X = 2 ;
+    X = 3.
+  ?- memb(1, [3,2,X]).
+    X = 1.
+
''' + +hint = {} diff --git a/prolog/problems/lists/min_2/sl.py b/prolog/problems/lists/min_2/sl.py new file mode 100644 index 0000000..6a5964b --- /dev/null +++ b/prolog/problems/lists/min_2/sl.py @@ -0,0 +1,15 @@ +# coding=utf-8 + +name = 'min/2' +slug = 'Poišči najmanjši element v danem seznamu' + +description = '''\ +

min(L, Min): Min je najmanjši element v seznamu L.

+
+  ?- min([5,4,1,6], M).
+    M = 1.
+  ?- min([3,2,2], M).
+    M = 2.
+
''' + +hint = {} diff --git a/prolog/problems/lists/palindrome_1/sl.py b/prolog/problems/lists/palindrome_1/sl.py new file mode 100644 index 0000000..04f1f59 --- /dev/null +++ b/prolog/problems/lists/palindrome_1/sl.py @@ -0,0 +1,15 @@ +# coding=utf-8 + +name = 'palindrome/1' +slug = 'Preveri, če elementi seznama tvorijo palindrom' + +description = '''\ +

palindrome(L): Elementi seznama L se preberejo v istem vrstnem redu z začetka in s konca seznama.

+
+  ?- palindrome([1,2,3,2,1]).
+    true.
+  ?- palindrome([1,2,3]).
+    false.
+
''' + +hint = {} diff --git a/prolog/problems/lists/permute_2/sl.py b/prolog/problems/lists/permute_2/sl.py new file mode 100644 index 0000000..2c98340 --- /dev/null +++ b/prolog/problems/lists/permute_2/sl.py @@ -0,0 +1,18 @@ +# coding=utf-8 + +name = 'permute/2' +slug = 'Generiraj permutacije elementov v seznamu' + +description = '''\ +

permute(L1, L2): seznam L2 je permutacija vrstnega reda elementov v seznamu L1.

+
+  ?- permute([1,2,3], L).
+    L = [1,2,3] ;
+    L = [1,3,2] ;
+    L = [2,1,3] ;
+    L = [2,3,1] ;
+    L = [3,1,2] ;
+    L = [3,2,1].
+
''' + +hint = {} diff --git a/prolog/problems/lists/rev_2/en.py b/prolog/problems/lists/rev_2/en.py index fe36ec5..7941f9e 100644 --- a/prolog/problems/lists/rev_2/en.py +++ b/prolog/problems/lists/rev_2/en.py @@ -6,10 +6,10 @@ slug = 'reverse a list' description = '''\

rev(L1, L2): the list L2 is obtained from L1 by reversing the order of the elements.

-  ?- rev([], X).
-    X = [].
   ?- rev([1,2,3], X).
     X = [3,2,1].
+  ?- rev([], X).
+    X = [].
 
''' hint = {} diff --git a/prolog/problems/lists/rev_2/sl.py b/prolog/problems/lists/rev_2/sl.py new file mode 100644 index 0000000..95ba8b7 --- /dev/null +++ b/prolog/problems/lists/rev_2/sl.py @@ -0,0 +1,15 @@ +# coding=utf-8 + +name = 'rev/2' +slug = 'Obrni seznam' + +description = '''\ +

rev(L1, L2): seznam L2 ima elemente v obratnem vrstnem redu kot seznam L1.

+
+  ?- rev([1,2,3], X).
+    X = [3,2,1].
+  ?- rev([], X).
+    X = [].
+
''' + +hint = {} diff --git a/prolog/problems/lists/shiftleft_2/sl.py b/prolog/problems/lists/shiftleft_2/sl.py new file mode 100644 index 0000000..44e726f --- /dev/null +++ b/prolog/problems/lists/shiftleft_2/sl.py @@ -0,0 +1,13 @@ +# coding=utf-8 + +name = 'shiftleft/2' +slug = 'Premakni elemente seznama za eno mesto v levo' + +description = '''\ +

shiftleft(L1, L2): elemente v seznamu L1 za eno mesto premaknemo v levo ("circular shift").

+
+  ?- shiftleft([1,2,3,4,5], X).
+    X = [2,3,4,5,1].
+
''' + +hint = {} diff --git a/prolog/problems/lists/shiftright_2/sl.py b/prolog/problems/lists/shiftright_2/sl.py new file mode 100644 index 0000000..9d84510 --- /dev/null +++ b/prolog/problems/lists/shiftright_2/sl.py @@ -0,0 +1,13 @@ +# coding=utf-8 + +name = 'shiftright/2' +slug = 'Premakni elemente seznama za eno mesto v desno' + +description = '''\ +

shiftright(L1, L2): elemente v seznamu L1 za eno mesto premaknemo v desno ("circular shift").

+
+  ?- shiftright([1,2,3,4,5], X).
+    X = [5,1,2,3,4].
+
''' + +hint = {} diff --git a/prolog/problems/lists/sublist_2/sl.py b/prolog/problems/lists/sublist_2/sl.py new file mode 100644 index 0000000..27d9b54 --- /dev/null +++ b/prolog/problems/lists/sublist_2/sl.py @@ -0,0 +1,19 @@ +# coding=utf-8 + +name = 'sublist/2' +slug = 'Generiraj vse podsezname danega seznama' + +description = '''\ +

sublist(L, SL): SL je podseznam seznama L. Predikat naj vrne vse možne podsezname, enega po enega.

+
+  ?- sublist([1,2,3], X).
+    X = [] ;
+    X = [1] ;
+    X = [1,2] ;
+    X = [1,2,3] ;
+    X = [2] ;
+    X = [2,3] ;
+    X = [3].
+
''' + +hint = {} diff --git a/prolog/problems/lists/sum_2/sl.py b/prolog/problems/lists/sum_2/sl.py new file mode 100644 index 0000000..0e1e6d6 --- /dev/null +++ b/prolog/problems/lists/sum_2/sl.py @@ -0,0 +1,13 @@ +# coding=utf-8 + +name = 'sum/2' +slug = 'Izračunaj vsoto elementov v seznamu' + +description = '''\ +

sum(L, Sum): Sum je vsota vseh elementov v seznamu L.

+
+  ?- sum([1,2,3], Sum).
+    Sum = 6.
+
''' + +hint = {} -- cgit v1.2.1