Question about gensym

Hello, everyone.

I want to generate unique names containing only alphanumeric characters and '_' in racket. Is it safe to use gensym?

For example,

(define (make-unique-name)
   (gensym 'my_name))

Can I be sure (make-unique-name) will always generate names I want?

gensym is not really for generating a unique name. It’s for generating a value that is not eq? with any other values. If you want a (practically) unique name, I would recommend uuid.

2 Likes

Thanks for your reply! That really works!