Picat 0.7

Version of implementation Picat of programming language Picat

Changes from the previous version Picat 0.6:

  • In insert_ordered(L,T): L must be a proper list.
  • The two-product encoding is used in sat for the at-most-one constraint.
  • More efficient translation of X #=> Y in sat.
  • The function len(Term) is added, which is equivalent to length(Term).
  • The attribute len is added as an alias of length (e.g., [1,2].len = L)
  • Change the default labeling strategy for max/min back to maxof/minof (in Picat 0.6, it was maxof_inc/minof_inc).
  • The objective expression in minof/maxof/minof_inc/maxof_inc cannot contain dot or index notations.
  • An improvement in the debugger.
  • A bug fix in read_file_lines(File) for reading UTF-8 characters.
  • Standardize the behaviors of mod/2 and div/2 for cp, sat, mip, and basic.

Examples:

Hello, World! - Picat (491):

main =>
     print("Hello, World!\n").

Hello, World! - Picat (492):

main =>
     println("Hello, World!").

Factorial - Picat (493):

This example implements recursive factorial definition using a predicate.

factorial(0, F) => F = 1.
factorial(N, F), N > 0 => factorial(N - 1, F1), F = N * F1.

main =>
     foreach (I in 0 .. 16)
          factorial(I, F),
          writef("%w! = %w\n", I, F)
     end.

Factorial - Picat (494):

This example implements recursive factorial definition using a function.

factorial(0) = 1.
factorial(N) = F, N > 0 => F = N * factorial(N - 1).

main =>
     foreach (I in 0 .. 16)
          writef("%w! = %w\n", I, factorial(I))
     end.