From 9e5d6dac0e32ecdce036041c878c290dc06599d9 Mon Sep 17 00:00:00 2001 From: Aleksander Sadikov Date: Wed, 21 Sep 2016 19:55:01 +0200 Subject: English translation for isort/2 added. --- prolog/problems/sorting/isort_2/en.py | 55 ++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) (limited to 'prolog/problems/sorting') diff --git a/prolog/problems/sorting/isort_2/en.py b/prolog/problems/sorting/isort_2/en.py index 71b1a12..35beb62 100644 --- a/prolog/problems/sorting/isort_2/en.py +++ b/prolog/problems/sorting/isort_2/en.py @@ -8,4 +8,57 @@ description = '''\ L = [1,2,3,4,5]. ''' -hint = {} +plan = ['''\ +

When going through the list (actually when returning from recursion) at every step insert the current element +in its proper position.

+''', '''\ +

When going through the list at every step take away the head (it's stored on stack), while its tail goes +into recursion (the problem/list is shorter, so this is possible). The recursion returns the sorted +tail, and all that's left for you to do is to put the previously taken away head into its proper place in the +sorted tail. Of course you can reuse some previous exercise for this task.

+''', '''\ +

If list L is composed of head H and tail T and if we assume that +tail T is correctly sorted into SortedTail by recursion, and if head H +is inserted into its proper place within SortedTail, then we get the whole list L +properly sorted.

+'''] + +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).

+

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?

+''', + + 'base_case': '''\ +

Did you think of a base case? Which list can you sort without any effort whatsoever?

+''', + + 'recursive_case': '''\ +

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

+''', + + '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 X is simultaneously smaller and greater than +Y, 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?

+''', + + 'min_used': '''\ +

Try solving this exercise without using the predicate min/2.

+''', +} -- cgit v1.2.1