unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* intern a top level variable
@ 2023-08-16 12:41 Mortimer Cladwell
  2023-08-16 14:08 ` tomas
  0 siblings, 1 reply; 4+ messages in thread
From: Mortimer Cladwell @ 2023-08-16 12:41 UTC (permalink / raw)
  To: guile-user

Hi,
How do I intern a top level variable? looks like intern-symbol is
deprecated? Is there a substitute? gensym does not seem to be it:

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

Thanks
Mortimer


^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: Re: intern a top level variable
@ 2023-08-16 14:55 Mortimer Cladwell
  2023-08-16 16:13 ` Jean Abou Samra
  0 siblings, 1 reply; 4+ messages in thread
From: Mortimer Cladwell @ 2023-08-16 14:55 UTC (permalink / raw)
  To: guile-user, tomas

I would like to intern and assign a value within a method:

(define (test-intern)
(let* ((name "abc")
       (data "def")
       (name-symbol (gensym name))
       )
  (pretty-print (string-append "symbol: " (symbol->string name-symbol)))
  (set! name-symbol data)))

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

Thanks


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-17  6:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-16 12:41 intern a top level variable Mortimer Cladwell
2023-08-16 14:08 ` tomas
  -- strict thread matches above, loose matches on Subject: below --
2023-08-16 14:55 Mortimer Cladwell
2023-08-16 16:13 ` Jean Abou Samra
2023-08-16 19:17   ` Mortimer Cladwell
2023-08-16 20:35     ` Taylan Kammer
2023-08-17  6:07       ` Mortimer Cladwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).