guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: intern a top level variable


From: tomas
Subject: Re: intern a top level variable
Date: Wed, 16 Aug 2023 16:08:04 +0200

On Wed, Aug 16, 2023 at 08:41:18AM -0400, Mortimer Cladwell wrote:
> Hi,
> How do I intern a top level variable?

You don't intern variables, you intern symbols (now I guess you
know that, but then: what are you trying to do?)

> looks like intern-symbol is
> deprecated? Is there a substitute? gensym does not seem to be it:

gensym evaluates to an already interned symbol:

  (symbol-interned? (gensym "foo"))
  => #t

> 
> scheme@(guile-user)> (gensym "abc")
> $11 = abc2652

... abc2652 would be an interned symbol here.

> scheme@(guile-user)> abc2652
> ;;; <unknown-location>: warning: possibly unbound variable `abc2652'
> ERROR: In procedure module-lookup: Unbound variable: abc2652

...but it is unbound (i.e. there is no value associated with it). For
this you would have to

  (define abc2652 "foo")

or something similar.

Cheers
-- 
t

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]