Skip to content

Latest commit

 

History

History

2

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Picat: Part 1, Part 2

Another easy warmup puzzle.

Part 1

This was a useful opportunity to look for good ways to process the output. Using a list comprehension over the results of read_file_lines() seems pretty handy.

Part 2

Not a problem.

Reflections

I got stung by the predicate_used_as_function error a few times. The function syntax in Picat looks like this:

f(X) = Y =>
  Y = 2*x.

It seems a little unnecessary when you can just use the value of the last expression, which how "function facts" work when there's only one expression in the function body. Maybe there's a good reason for doing it this way that I'm not aware of yet.