From a609aa835e543e53647d55e1992f8c7654f68a30 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 9 Aug 2016 14:46:51 +0200 Subject: Prolog: add a couple of test cases for rev/2 --- prolog/problems/lists_advanced/rev_2/common.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/prolog/problems/lists_advanced/rev_2/common.py b/prolog/problems/lists_advanced/rev_2/common.py index b673660..f79ddca 100644 --- a/prolog/problems/lists_advanced/rev_2/common.py +++ b/prolog/problems/lists_advanced/rev_2/common.py @@ -39,6 +39,10 @@ hint_type = { test_cases = [ ('rev([], X)', [{'X': '[]'}]), + ('rev(X, [])', + [{'X': '[]'}]), + ('rev([42], X)', + [{'X': '[42]'}]), ('rev([s, k, c, d, d], X)', [{'X': '[d, d, c, k, s]'}]), ('rev(X, [s, k, c, d, d])', -- cgit v1.2.1 From bfd0dab7b66702086da0527e6b5b69c3b7a32f67 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 9 Aug 2016 14:49:24 +0200 Subject: Add some style guidelines to readme --- readme.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/readme.md b/readme.md index da79939..7f9fbc0 100644 --- a/readme.md +++ b/readme.md @@ -217,3 +217,40 @@ Problem files razdalja = v ** 2 * sin(2 * kot_rad) / g print("Kroglo bo odneslo", razdalja, "metrov.") ''' + + +Style +===== + +Please observe the following stylistic rules when adding or translating +problems. + + * Wrap lines at 80 columns (not a hard rule). + +Special characters +------------------ + +Use appropriate Unicode characters wherever possible. If your setup makes it +difficult to enter these characters, copy them from this file. + + * "foo" → “foo” (english) or „foo“ (slovene) + * ' → ’ (typographic apostrophe) + * ... → … (ellipsis) + * 2x3 → 2×3 (multiplication sign) + * <= → ≤ + * >= → ≥ + * -> → → + * => → ⇒ + * -- → – (en dash) + * :) → ☺ + * ;) → 😉 + +Some other useful characters: + + * ∪ (set union) + * ∩ (set intersection) + * ∖ (set difference) + * ⊂ + * ⊆ + * ⊃ + * ⊇ -- cgit v1.2.1 From 8f634d6b940d5ebd92fa1a951fcf04ed2d2c433b Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 9 Aug 2016 14:50:00 +0200 Subject: Add a missing import to prolog/common.py --- prolog/common.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/prolog/common.py b/prolog/common.py index 8e3d91d..e591e0b 100644 --- a/prolog/common.py +++ b/prolog/common.py @@ -1,4 +1,6 @@ import operator +import socket + import prolog.engine from prolog.util import tokenize from server.hints import Hint, HintPopup @@ -22,6 +24,7 @@ hint_type = { # Check program for syntax errors. def check_syntax(code, aux_code): + engine_id = None try: engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0) if 'error' in map(operator.itemgetter(0), output): -- cgit v1.2.1