From 878daf66ab9c6257c0ef7e677e6c444813efca85 Mon Sep 17 00:00:00 2001 From: Aleksander Sadikov Date: Thu, 1 Sep 2016 16:19:09 +0200 Subject: English translation for shiftleft/2 added. --- prolog/problems/lists_advanced/shiftleft_2/en.py | 58 +++++++++++++++++++++++- prolog/problems/lists_advanced/shiftleft_2/sl.py | 2 +- 2 files changed, 58 insertions(+), 2 deletions(-) (limited to 'prolog/problems/lists_advanced/shiftleft_2') diff --git a/prolog/problems/lists_advanced/shiftleft_2/en.py b/prolog/problems/lists_advanced/shiftleft_2/en.py index 6adbc12..9905cac 100644 --- a/prolog/problems/lists_advanced/shiftleft_2/en.py +++ b/prolog/problems/lists_advanced/shiftleft_2/en.py @@ -8,4 +8,60 @@ description = '''\ X = [2,3,4,5,1]. ''' -hint = {} +plan = ['''\ +

I take the first element of a list, let's call it H, and add it at the end of +the list's remainder (let's call the remainder T). As simple as that! You probably still +remember how we took the last element of the list? Adding an element is the same operation as taking it, +just from the opposite view ;)

+''', '''\ +

A list of length one is represented as a pattern [X]. This might come in handy, as well +as the predicate conc/3.

+''', '''\ +

If the given list L is composed of head H and tail T, and if +we add H at the end of T, then we get list L +shifted left.

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

The operator == is "stricter" than operator = in the sense that +for the latter it is enough to be able to make the two operands equal (unification). Perhaps by using = +you can make the predicate shiftleft/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': '''\ +

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

+''', + + 'predicate_always_false': '''\ +

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': '''\ +

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?

+''', + + 'conc_arg_not_list': '''\ +

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

+''', + + 'arbitrary_result': '''\ +

Did you connect (use) all the variables? It seems as if you're returning an arbitrary result +(a variable without an assigned value). It's usually not a good idea to ignore the warning about +"singleton variables".

+''', + + 'tail_must_be_list': '''\ +

The list's tail is always another list and never an element!

+''', +} diff --git a/prolog/problems/lists_advanced/shiftleft_2/sl.py b/prolog/problems/lists_advanced/shiftleft_2/sl.py index aa83672..aa116ee 100644 --- a/prolog/problems/lists_advanced/shiftleft_2/sl.py +++ b/prolog/problems/lists_advanced/shiftleft_2/sl.py @@ -24,7 +24,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.

+shiftleft/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