From c2e782122d52acea0e69f8a5a92b40bbbb7072e5 Mon Sep 17 00:00:00 2001 From: Aleksander Sadikov Date: Wed, 10 Aug 2016 00:18:27 +0200 Subject: English translation for rev/2 added. --- prolog/problems/lists_advanced/rev_2/en.py | 79 ++++++++++++++++-------------- prolog/problems/lists_advanced/rev_2/sl.py | 2 +- 2 files changed, 43 insertions(+), 38 deletions(-) (limited to 'prolog/problems/lists_advanced') diff --git a/prolog/problems/lists_advanced/rev_2/en.py b/prolog/problems/lists_advanced/rev_2/en.py index 01ed83e..3b85a74 100644 --- a/prolog/problems/lists_advanced/rev_2/en.py +++ b/prolog/problems/lists_advanced/rev_2/en.py @@ -11,84 +11,89 @@ description = '''\ ''' plan = ['''\ -

To je ena najlepših in najbolj poučnih nalog. Klasična rekurzija! Problem poskusi zmanjšati. Seveda, prevedi na -krajši seznam.

+

This is one of the most rewarding exercises. Classic recursion! Try to reduce the problem into a smaller one. +That, of course, means reducing it to a shorter list.

''', '''\ -

Seznamu odvzamem glavo, rekurzija mi obrne rep in vse, kar moram na koncu narediti jaz je, da glavo vstavim nazaj -v obrnjen rep na pravo mesto.

+

I divide the list into its head and tail, the recursion reverses the tail, and all I have to do +is to insert the head into its proper location in the reversed tail.

''', '''\ -

Če je podani seznam L sestavljen iz glave H in repa T -in če predpostavim, da rekurzija obrne T v obrnjen rep RT in če RT na konec -dodam H, potem je rezultat obrnjen seznam L.

+

If the given list L is composed of head H and tail T +and if I assume the recursion reverses tail T into reversed tail RT and if I add head +H at the end of RT, then the result is reversed list L.

'''] hint = { 'eq_instead_of_equ': '''\ -

Operator == je strožji od operatorja = v smislu, da je za slednjega dovolj, -da elementa lahko naredi enaka (unifikacija). Morda z uporabo = narediš predikat -memb/2 delujoč tudi v kakšni drugi smeri.

-

Seveda pa lahko nalogo rešiš brez obeh omenjenih operatorjev, spomni se, da lahko unifikacijo narediš -implicitno že kar v argumentih predikata (glavi stavka).

+

The operator == is "stricter" than operator = in the sense that +for the latter it is enough to be able to make two elements equal (unification). Perhaps by using = +you can make the predicate rev/2 more general (e.g. able to work with output arguments becoming inputs).

+

Of course, you can also solve the exercise without explicit use of either of these two operators, just +remember that unification is implicitly performed with the predicate's arguments (head of clause).

''', 'eq_instead_of_equ_markup': '''\ -

Morda bi bil bolj primeren operator za unifikacijo (=)?

+

Perhaps the operator for unification (=) would be better?

''', 'base_case': '''\ -

Si pomislil na robni pogoj? Kateri seznam je trivialno obrniti?

+

Did you think of a base case? Which list is the most trivial to reverse?

''', 'recursive_case': '''\ -

Robni primer deluje. Kaj pa rekurzivni, splošni, primer?

+

The base case is ok. However, what about the general recursive case?

''', 'predicate_always_false': '''\ -

Vse kaže, da tvoj predikat vedno vrne "false". Si mu dal pravilno ime, si se morda pri imenu zatipkal?

-

Če je ime pravilno, se morda splača preveriti tudi, če se nisi zatipkal kje drugje, -je morda kakšna pika namesto vejice ali obratno, morda kakšna spremenljivka z malo začetnico?

-

Možno je seveda tudi, da so tvoji pogoji prestrogi ali celo nemogoči (kot bi bila npr. zahteva, -da je N enako kot N + 1 ali kaj podobno logično zlobnega).

+

It seems your predicate is always "false". Did you give it the correct name, +or is it perhaps misspelled?

+

If the name is correct, check whether something else is misspelled, perhaps there is a full stop instead of +a comma or vice versa, or maybe you typed a variable name in lowercase?

+

It is, of course, also possible that your conditions are too restrictive, or even impossible to satisfy +(as would be, for example, the condition that N is equal to N + 1, +or something similarly impossible).

''', 'timeout': '''\ -

Je morda na delu potencialno neskončna rekurzija? Kako se bo ustavila?

-

Morda pa je kriv tudi manjkajoč, neustrezen ali preprosto nekompatibilen (s splošnim primerom) robni pogoj?

+

Is there an infinite recursion at work here? How will it ever stop?

+

Or perhaps is there a missing, faulty, or simply incompatible (with the general recursive case) base case?

''', 'base_case_at_len1': '''\ -

Ta robni pogoj je seveda povsem smiseln, a ga vseeno popravi tako, da bo deloval tudi za prazen seznam. -Vendar ne imej dveh robnih pogojev, ker bo to podvajalo rešitve./p> +

Your base case is perfectly reasonable, but it doesn't work for an empty list. +However, don't use two base cases here, because this will duplicate the solutions./p> ''', 'arbitrary_base_case': '''\ -

Kaj je rezultat obračanja praznega seznama? Gotovo ne karkoli (spremenljivka brez določene vrednosti)!

+

What is the result of reversing an empty list? Surely not an arbitrary list (a variable without +an assigned value)!

''', 'forcing_result_onto_recursion': ''' -

Ne vsiljuj rekurziji kaj naj vrne, prepusti se ji. To je tisti del, ko narediš predpostavko, -če je ta izpolnjena, potem bo tvoje pravilo delovalo za večji primer.

-

Je tvoj rekurzivni klic oblike rev(T, [RevTail|H])? S tem vsiljuješ rekurziji -da mora vrniti na zadnjem mestu tudi glavo, ki je sploh ne pozna, ker si jo ravnokar vzel stran! To moraš -narediti ti z rezultatom, ki ti ga rekurzija vrne. Skratka, element H vstavi izven rekurzivnega klica.

+

Don't force the result onto recursion, don't tell it what it should return. Just assume it will do its job. +If this assumption is correct, then the rule will work for a larger case.

+

Is your recursive call of the form rev(T, [RevTail|H])? This forces the recursive call to +return the head at the end of the list. But it doesn't know of this head, because you just +took it away! Inserting the head into the result, returned by the recursive call, is your job. To put it shortly, +insert H outside of the recursive call.

''', 'using_other_solutions': '''\ -

Od predikatov last/2, shiftleft/2 ali shiftright/2 tukaj ne bo veliko -pomoči. Poskusi raje brez, bo lažje.

+

Predicates last/2, shiftleft/2, or shiftright/2 will not be of +much help here. Rather try without them, it will be easier.

''', 'insertion_at_beginning': '''\ -

Vstavljaš morda glavo nazaj na začetek obrnjenega repa? To ni pravo mesto, ker s tem samo sestaviš nazaj -enak seznam kot na začetku.

+

Did you insert the head at the start of the reversed tail? That's not its proper place; in this way +you just reassemble the original list.

''', 'invalid_insert_at_end': '''\ -

Spomni se, rep seznama je vedno seznam! Kako vstaviš element na zadnje mesto?

+

Remember, a list's tail is always another list, not an element. +How do you insert an element at the end of the list?

''', 'conc_arg_not_list': '''\ -

Vsi trije argumenti predikata conc/3 morajo biti seznami. Si prepričan, -da si ga tako uporabil?

+

All three arguments of predicate conc/3 are lists. +Are you sure you used it properly?

''', } diff --git a/prolog/problems/lists_advanced/rev_2/sl.py b/prolog/problems/lists_advanced/rev_2/sl.py index 5c8ab13..cc7bd89 100644 --- a/prolog/problems/lists_advanced/rev_2/sl.py +++ b/prolog/problems/lists_advanced/rev_2/sl.py @@ -26,7 +26,7 @@ hint = { 'eq_instead_of_equ': '''\

Operator == je strožji od operatorja = v smislu, da je za slednjega dovolj, da elementa lahko naredi enaka (unifikacija). Morda z uporabo = narediš predikat -memb/2 delujoč tudi v kakšni drugi smeri.

+rev/2 delujoč tudi v kakšni drugi smeri.

Seveda pa lahko nalogo rešiš brez obeh omenjenih operatorjev, spomni se, da lahko unifikacijo narediš implicitno že kar v argumentih predikata (glavi stavka).

''', -- cgit v1.2.1