rkoeninger / ShenSharp

Shen for the Common Language Runtime
BSD 3-Clause "New" or "Revised" License
33 stars 2 forks source link

Last assertion in "FPQi chapter 5" fails #3

Closed rkoeninger closed 7 years ago

rkoeninger commented 7 years ago

Implementation must have some problem with code in "spreadsheet.shen" specifically.

rkoeninger commented 7 years ago

Further inspection reveals that lambdas are getting recognized as symbols. In the Shen REPL, (symbol? (/. X X)) results in true.

rkoeninger commented 7 years ago

This was being caused by the way symbol? is implemented.

symbol? rules out booleans, numbers and strings and then converts the argument to a string using str and if the result is a valid symbol, it's a symbol.

The problem was, Lambdas and Freezes were being represented as "<Lambda>" and "<Freeze>" so they were being identified as symbols. Implementations need to be sure that the str function does not return values that can be mistaken for symbols.

Fixed in 3f5903e2669e4050916004db5ce615444aa90472