* With imported functions instead of module?
@ 2024-12-12 10:52 Marc Coquand
2024-12-12 14:06 ` Felix Lechner via
0 siblings, 1 reply; 5+ messages in thread
From: Marc Coquand @ 2024-12-12 10:52 UTC (permalink / raw)
To: help-guix
Hiya!
When creating scripts in guile that uses G-expressions, it's nice to
break out parts into separate functions.
Is there a way to import functions instead of entire modules?
Thanks in advance,
--
Marc
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: With imported functions instead of module?
2024-12-12 10:52 With imported functions instead of module? Marc Coquand
@ 2024-12-12 14:06 ` Felix Lechner via
2024-12-12 15:45 ` Marc Coquand
0 siblings, 1 reply; 5+ messages in thread
From: Felix Lechner via @ 2024-12-12 14:06 UTC (permalink / raw)
To: Marc Coquand; +Cc: help-guix
Hi Marc,
On Thu, Dec 12 2024, Marc Coquand wrote:
> Is there a way to import functions instead of entire modules?
Are you looking for something more than the selective import of module
bindings via '@'? [1]
Kind regards
Felix
P.S. In Guile, the preferred term for functions may be procedures.
[1] https://www.gnu.org/software/guile/manual/html_node/Using-Guile-Modules.html#index-_0040
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: With imported functions instead of module?
2024-12-12 14:06 ` Felix Lechner via
@ 2024-12-12 15:45 ` Marc Coquand
2024-12-12 20:44 ` Felix Lechner via
0 siblings, 1 reply; 5+ messages in thread
From: Marc Coquand @ 2024-12-12 15:45 UTC (permalink / raw)
To: Felix Lechner; +Cc: help-guix
Hmm,
Well essentially what I'm looking for is an easier way of importing
procedures within G-expressions.
So basically if I have
(define (my-procedure args)
...)
(define notify-mail-gexp
(with-imported-modules
'((guix build utils)
...)
#~(begin
(my-procedure)))
I'm wondering if there is a way to call my-procedure without moving the
definition to a separate module and importing that module in the
"with-imported-modules"
--
Marc
On Thu, Dec 12 2024, Felix Lechner wrote:
> Hi Marc,
>
> On Thu, Dec 12 2024, Marc Coquand wrote:
>
>> Is there a way to import functions instead of entire modules?
>
> Are you looking for something more than the selective import of module
> bindings via '@'? [1]
>
> Kind regards
> Felix
>
> P.S. In Guile, the preferred term for functions may be procedures.
>
> [1] https://www.gnu.org/software/guile/manual/html_node/Using-Guile-Modules.html#index-_0040
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: With imported functions instead of module?
2024-12-12 15:45 ` Marc Coquand
@ 2024-12-12 20:44 ` Felix Lechner via
2024-12-13 12:08 ` Marc Coquand
0 siblings, 1 reply; 5+ messages in thread
From: Felix Lechner via @ 2024-12-12 20:44 UTC (permalink / raw)
To: Marc Coquand; +Cc: help-guix
Hi Marc,
On Thu, Dec 12 2024, Marc Coquand wrote:
> I'm looking for is an easier way of importing procedures within
> G-expressions.
I'm not sure that's possible because the G-exp could, in the most
generalized case, run on another piece of equipment.
> I'm wondering if there is a way to call my-procedure without moving the
> definition to a separate module
You could 'define' your procedure inside the G-exp, although that may
not be what you want.
You may also be able to use 'load' on a store item (think 'plain-file'
and friends). Those are automatically copied to the build side.
Kind regards
Felix
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: With imported functions instead of module?
2024-12-12 20:44 ` Felix Lechner via
@ 2024-12-13 12:08 ` Marc Coquand
0 siblings, 0 replies; 5+ messages in thread
From: Marc Coquand @ 2024-12-13 12:08 UTC (permalink / raw)
To: Felix Lechner; +Cc: help-guix
All right, thanks. Then I think the best approach is to just have a
separate module that I import.
--
Marc
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-12-13 12:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-12 10:52 With imported functions instead of module? Marc Coquand
2024-12-12 14:06 ` Felix Lechner via
2024-12-12 15:45 ` Marc Coquand
2024-12-12 20:44 ` Felix Lechner via
2024-12-13 12:08 ` Marc Coquand
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.