diff options
author | Aleksander Sadikov <aleksander.sadikov@fri.uni-lj.si> | 2016-09-06 16:48:08 +0200 |
---|---|---|
committer | Aleksander Sadikov <aleksander.sadikov@fri.uni-lj.si> | 2016-09-06 16:48:08 +0200 |
commit | d259285459176fc281193adb12483a6e6d527cf5 (patch) | |
tree | 122deea9d5ab3daac9b1e5d7e4903bffec96403d /prolog/problems/lists_advanced/len_2 | |
parent | 0974e756466142e8a24020f5ff4c3391143b73c2 (diff) |
English translation for sum/2 added.
Diffstat (limited to 'prolog/problems/lists_advanced/len_2')
-rw-r--r-- | prolog/problems/lists_advanced/len_2/en.py | 6 | ||||
-rw-r--r-- | prolog/problems/lists_advanced/len_2/sl.py | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/prolog/problems/lists_advanced/len_2/en.py b/prolog/problems/lists_advanced/len_2/en.py index 33b1675..6518eec 100644 --- a/prolog/problems/lists_advanced/len_2/en.py +++ b/prolog/problems/lists_advanced/len_2/en.py @@ -15,14 +15,14 @@ plan = ['''\ is of length <code>LenT + 1</code>.</p> ''', '''\ <p>If I take away the head, and the recursion solves this smaller problem (tail), and if I add 1 to the -result returned by the recursion, then I got the length of the whole list.</p> +result returned by the recursion, then I get the length of the whole list.</p> '''] hint = { 'eq_instead_of_equ': '''\ <p>The operator <code>==</code> is "stricter" than operator <code>=</code> in the sense that for the latter it is enough to be able to make the two operands equal (unification). Perhaps by using <code>=</code> -you can make the predicate <code>conc/3</code> more general (e.g. able to work with output arguments becoming inputs).</p> +you can make the predicate <code>len/2</code> more general (e.g. able to work with output arguments becoming inputs).</p> <p>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).</p> ''', @@ -78,7 +78,7 @@ second operand and only then attempts the unification of both operands.</p> 'forcing_result_onto_recursion': ''' <p>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.</p> -<p>Is your recursive call of the form <code>len(T, LenT + 1)</code>? This forces the recursive call to +<p>Is your recursive call of the form <code>len(Tail, LenTail + 1)</code>? This forces the recursive call to return the length of <em>the whole</em> list, not just the tail! This will not work. It is your job to increase by one the result returned by the recursion. In short, add one outside the recursive call.</p> ''', diff --git a/prolog/problems/lists_advanced/len_2/sl.py b/prolog/problems/lists_advanced/len_2/sl.py index 49b9eea..28fe25e 100644 --- a/prolog/problems/lists_advanced/len_2/sl.py +++ b/prolog/problems/lists_advanced/len_2/sl.py @@ -75,8 +75,8 @@ svoji levi strani.</p> 'forcing_result_onto_recursion': ''' <p>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.</p> -<p>Je tvoj rekurzivni klic oblike <code>len(T, LenT + 1)</code>? S tem vsiljuješ rekurziji -da mora <emph>vrniti</emph> dolžino celega seznama in ne samo repa. To ni v redu, za ena moraš ti povečati +<p>Je tvoj rekurzivni klic oblike <code>len(Tail, LenTail + 1)</code>? S tem vsiljuješ rekurziji +da mora vrniti dolžino <em>celega</em> seznama in ne samo repa. To ni v redu, za ena moraš ti povečati rezultat, ki ti ga rekurzija vrne. Skratka, prištevanje naredi izven rekurzivnega klica.</p> ''', |