โ† 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. What is the correct way to open a file for writing in Picat using the `io` module?

    Answer: open(File, write, Stream)

    `open/3` takes the filename, mode atom (`write`, `read`, or `append`), and binds a stream variable.

  2. Which `sets` module predicate computes the union of two sets represented as sorted lists?

    Answer: union/3

    `union/3` in the `sets` module takes two sorted lists and produces their union as a sorted list.

  3. In Picat's `math` module, which predicate computes the base-10 logarithm?

    Answer: log10/1

    `log10/1` computes the base-10 (common) logarithm, while `log/1` computes the natural logarithm.

  4. Which `string` module function splits a string by a delimiter character?

    Answer: split/2

    `split/2` takes a string and a delimiter string, returning a list of substrings.

  5. What does `:- import lists, sets.` accomplish in a Picat file?

    Answer: Imports both the `lists` and `sets` modules

    Multiple modules can be imported in a single `:- import` directive by separating them with commas.

  6. In the Picat `maps` module, which predicate creates a new empty map?

    Answer: new_map/1

    `new_map/1` binds a variable to a fresh, empty map data structure in Picat.

  7. Which `util` module function returns the minimum value in a list?

    Answer: min_list/1

    `min_list/1` returns the smallest element of a numerical list, symmetric to `max_list/1`.