Skip to content

Section 1.6 and 1.7 of Programming in Cryptol Textbook - Edits #875

@manleykm

Description

@manleykm

There are a few errors in sections 1.6: Floating Point Numbers and 1.7: Tuples of the Programming in Cryptol textbook.

The first two, in section 1.6, were just minor typos:

Floating point numbers may be written using either integral or fractioanl literals. In general, literals that cannot be represented exactly are rejected with a type error, with the exception of decimal fractional litrals which are rounded to the nearest even representable numbers.

(emphasis added)

The last error was in Exercise 1.7, of section 1.7.
image

The textbook says that the answers to the last two problems should be as follows:
image

However, this results in the error message

Cryptol> ((1, 2), False, (3-1, (4, True))).2.1

Parse error at <interactive>:1:35,
  unexpected: 2.1

Extra parentheses are needed in order to make these projections run without errors.

Cryptol> (((1, 2), False, (3-1, (4, True))).2).1
Showing a specific instance of polymorphic result:
  * Using 'Integer' for type of 0th tuple field
(4, True)

and

Cryptol> ((((1, 2), (2, 6, (True, 4)), False).1).2).0
True

respectively.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions