
What are the source of non-determinism in Racket (besides external processes and random
)? In other words, if I have a program that sets random-seed
and does not execute external processes or measure execution time, are the results of different runs guarantee to be the same?

Does hash iteration order depend on random-seed
?

Hash table iteration can vary independent of random-seed
, and eq?
-based hash codes are non-deterministic. Thread scheduling is non-deterministic, but maybe you would count that as “measuring time”. The gensym
function uses a global counter, which is not exactly non-deterministic, but it’s so easily affected by other things (such as loading slightly different code in slightly different ways) that it’s practically non-deterministic.

Thanks!

Is there a function that is just like read
, but can handle #<unreadable>
? (either resulting in a predefined value that says “I am not readable” or allow users to supply one)

My task is that I have a list of #<unreadable>
, and I want to know its length.

It would probably be best no to write unreadable values in the first place. Only idea is to fix the input first. Can you use regexp-replace*
on the port first?

Hmm. Come to think of it, the file is really messed up. I don’t think regexp-replace
will help, but I can also see that the read
-like solution won’t work anyway.

Will try another approach. Thanks for helping!



Yet another question: is there a program that analyzes LoC in Racket? Like, given an initial entry point, find all dependencies, and compute LoC, number of expressions, etc.

Hmm. This should be easy to program actually