โ† All Picat Flashcard Decks

Using Standard Modules Flashcards

7 cards from real Picat practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Using Standard Modules flashcards as text
  1. Which predicate from the `lists` module appends two lists?

    Answer: append/3

    `append/3` unifies the third argument with the concatenation of the first two list arguments.

  2. In the Picat `io` module, what does `writef/2` do?

    Answer: Writes formatted output using a format string

    `writef/2` takes a format string and a list of arguments, printing formatted output similar to `printf`.

  3. What does `maps:keys(Map)` return?

    Answer: A sorted list of all keys in Map

    `maps:keys/1` returns a sorted list containing all the keys currently stored in the map.

  4. Which `util` module predicate removes duplicate elements from a list while preserving order?

    Answer: remove_dups/2

    `remove_dups/2` removes duplicate elements from the list while keeping the first occurrence of each element.

  5. In Picat, the `sat` module is used primarily for what purpose?

    Answer: Satisfiability solving over Boolean variables

    The `sat` module provides a SAT (Boolean satisfiability) solver that can handle Boolean constraints efficiently.

  6. What does `lists:nth/3` do in Picat?

    Answer: Returns the Nth element of a list (1-based)

    `nth/3` retrieves the element at a 1-based index N from a list, binding the third argument to that element.

  7. Which `math` module predicate computes the ceiling of a floating-point number?

    Answer: ceiling/1

    `ceiling/1` returns the smallest integer greater than or equal to the given floating-point number.