โ† All Picat Flashcard Decks

Picat String and I/O Operations Flashcards

6 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 6 Picat String and I/O Operations flashcards as text
  1. Which operator concatenates two strings or lists in Picat?

    Answer: S1 ++ S2

    In Picat, the `++` operator concatenates two strings or lists.

  2. How are strings internally represented in Picat?

    Answer: As lists of character codes

    Strings in Picat are represented as lists of character codes (integers), similar to traditional Prolog.

  3. Which built-in converts a number to its string representation in Picat?

    Answer: to_string(N)

    `to_string(N)` converts a number (or any term) to its string representation in Picat.

  4. What does `split(Str, Sep)` return in Picat?

    Answer: A list of substrings split by Sep

    `split(Str, Sep)` returns a list of substrings produced by splitting Str on the separator Sep.

  5. Which predicate reads a full line from standard input in Picat?

    Answer: read_line(L)

    `read_line(L)` reads one line from standard input and unifies it with L.

  6. How do you obtain the length of a string in Picat?

    Answer: length(S)

    `length(S)` returns the number of elements in a list or characters in a string since strings are lists.