seanjensengrey / mosh-scheme

Automatically exported from code.google.com/p/mosh-scheme
Other
0 stars 0 forks source link

equal-hash won't terminate if its arguments contain cycles #226

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
mosh> (define v (vector 1 2 3 4))
mosh> (vector-set! v 0 v)
mosh> (vector-set! v 1 v)
mosh> (equal-hash v) ;; => hangs up

What is the expected output? What do you see instead?
proper hash value.

What version of the product are you using? On what operating system?
mosh 0.2.6

Please provide any additional information below.

Original issue reported on code.google.com by ktakash...@gmail.com on 3 Jan 2012 at 1:52

GoogleCodeExporter commented 9 years ago

Original comment by hige...@gmail.com on 3 Jan 2012 at 2:13

GoogleCodeExporter commented 9 years ago
Was: equal-hash hangs up

Confirmed for latest git head. This defect also affects for lists.
R6RS requires equal-hash must be terminate if its argument contain cycles.

Original comment by oku...@gmail.com on 4 Jan 2012 at 2:56

GoogleCodeExporter commented 9 years ago
We can implement it as following.

http://www.cs.grinnell.edu/~stone/courses/discrete/code/ikarus-replacement/hash-
functions.sls

Original comment by hige...@gmail.com on 12 Jan 2012 at 6:16