Ad
  • Custom User Avatar

    Thanks for the clarification. Seems I misunderstood the problem instructions.

  • Custom User Avatar

    I think you have the tests backwards. Your predicate is expected to behave like a generator, and produce single values at a time. The tests check for this by gathering all the values produced into a list. Your solution however produces one single list of all values at once, so the tests collect that into a list, creating a nested list, while the expected result is just a list.

    You need to rebuild your solution to produce individual values. Eg instead of this behaviour:

    foo([1, 2, 3]).
    

    You need behaviour like this:

    foo(1).
    foo(2).
    foo(3).
    
  • Custom User Avatar

    In Prolog, when running the test cases for the 'range' predicates, the tests are returning a list of a list instead of a single list. For example, for range(5), I would expect the result to be [1, 2, 3, 4, 5], but the test returns [[1, 2, 3, 4, 5]].

    It seems the issue lies in how the 'findall/3' predicate is used within the tests. It actually collects the resulting list of the 'range' predicates in another list.

  • Default User Avatar

    the initial code tells you:

    register a goes into registers['a'], register b goes into registers['b'], etc.

    this is not what you are doing, you are putting a into registers[0], b into registers[1], etc

  • Custom User Avatar

    In C, when I print the registers[] array inside the function, the output matches the expected results exactly (at least when running the first test cases). Despite this, the tests still fail, showing that the registers are zero, not matching the expected output. What is the correct way to modify the array, so that the test framework correctly evaluates the results?

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution