* Actions using symbols
@ 2024-09-02 12:30 Heime
2024-09-02 13:38 ` Manuel Giraud via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 4+ messages in thread
From: Heime @ 2024-09-02 12:30 UTC (permalink / raw)
To: Heime via Users list for the GNU Emacs text editor
I customarily make symbols that I can check on as conditionals
(defun myfunc (actn)
(when (eq actn 'something) dothis)
Would things go wrong should I start using function names as arguments
For instance, myfunc would use a mapcar implementation when ACTN is
'mapcar and an apply-partially implementation when ACTN is 'apply-partially
(defun myfunc (actn)
(when (eq actn 'mapcar) dothis)
(when (eq actn 'apply-partially) dothat)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Actions using symbols
2024-09-02 12:30 Actions using symbols Heime
@ 2024-09-02 13:38 ` Manuel Giraud via Users list for the GNU Emacs text editor
2024-09-02 17:10 ` Heime
0 siblings, 1 reply; 4+ messages in thread
From: Manuel Giraud via Users list for the GNU Emacs text editor @ 2024-09-02 13:38 UTC (permalink / raw)
To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor
Heime <heimeborgia@protonmail.com> writes:
> I customarily make symbols that I can check on as conditionals
>
> (defun myfunc (actn)
> (when (eq actn 'something) dothis)
>
> Would things go wrong should I start using function names as arguments
No.
> For instance, myfunc would use a mapcar implementation when ACTN is
> 'mapcar and an apply-partially implementation when ACTN is 'apply-partially
>
> (defun myfunc (actn)
> (when (eq actn 'mapcar) dothis)
> (when (eq actn 'apply-partially) dothat)
This is correct code.
--
Manuel Giraud
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Actions using symbols
2024-09-02 13:38 ` Manuel Giraud via Users list for the GNU Emacs text editor
@ 2024-09-02 17:10 ` Heime
2024-09-02 19:07 ` alexbuhl
0 siblings, 1 reply; 4+ messages in thread
From: Heime @ 2024-09-02 17:10 UTC (permalink / raw)
To: Manuel Giraud; +Cc: Heime via Users list for the GNU Emacs text editor
Sent with Proton Mail secure email.
On Tuesday, September 3rd, 2024 at 1:38 AM, Manuel Giraud via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> Heime heimeborgia@protonmail.com writes:
>
> > I customarily make symbols that I can check on as conditionals
> >
> > (defun myfunc (actn)
> > (when (eq actn 'something) dothis)
> >
> > Would things go wrong should I start using function names as arguments
>
>
> No.
>
> > For instance, myfunc would use a mapcar implementation when ACTN is
> > 'mapcar and an apply-partially implementation when ACTN is 'apply-partially
> >
> > (defun myfunc (actn)
> > (when (eq actn 'mapcar) dothis)
> > (when (eq actn 'apply-partially) dothat)
>
>
> This is correct code.
> --
> Manuel Giraud
What happens when I do (let ((actn 'mapcar)) ? It is actually setting
actn to the 'mapcar symbol. When one defines the function mapcar, does
elisp also make the symbol 'mapcar ?
(let ((actn 'mapcar))
dothat(actn))
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Actions using symbols
2024-09-02 17:10 ` Heime
@ 2024-09-02 19:07 ` alexbuhl
0 siblings, 0 replies; 4+ messages in thread
From: alexbuhl @ 2024-09-02 19:07 UTC (permalink / raw)
To: Heime; +Cc: Manuel Giraud, Heime via Users list for the GNU Emacs text editor
On Tuesday, September 3rd, 2024 at 5:10 AM, Heime <heimeborgia@protonmail.com> wrote:
> Sent with Proton Mail secure email.
>
>
> On Tuesday, September 3rd, 2024 at 1:38 AM, Manuel Giraud via Users list for the GNU Emacs text editor help-gnu-emacs@gnu.org wrote:
>
> > Heime heimeborgia@protonmail.com writes:
> >
> > > I customarily make symbols that I can check on as conditionals
> > >
> > > (defun myfunc (actn)
> > > (when (eq actn 'something) dothis)
> > >
> > > Would things go wrong should I start using function names as arguments
> >
> > No.
> >
> > > For instance, myfunc would use a mapcar implementation when ACTN is
> > > 'mapcar and an apply-partially implementation when ACTN is 'apply-partially
> > >
> > > (defun myfunc (actn)
> > > (when (eq actn 'mapcar) dothis)
> > > (when (eq actn 'apply-partially) dothat)
> >
> > This is correct code.
> > --
> > Manuel Giraud
>
>
> What happens when I do (let ((actn 'mapcar)) ? It is actually setting
> actn to the 'mapcar symbol. When one defines the function mapcar, does
> elisp also make the symbol 'mapcar ?
I should have meant this actually
(let ((actn 'mapcar))
(dothat actn))
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-09-02 19:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-02 12:30 Actions using symbols Heime
2024-09-02 13:38 ` Manuel Giraud via Users list for the GNU Emacs text editor
2024-09-02 17:10 ` Heime
2024-09-02 19:07 ` alexbuhl
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).