unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* "Backquote constructs" to "splice" values without "eval".
@ 2013-01-07 12:50 Oleksandr Gavenko
  0 siblings, 0 replies; 8+ messages in thread
From: Oleksandr Gavenko @ 2013-01-07 12:50 UTC (permalink / raw)
  To: help-gnu-emacs

I construct TLV (table-len-val) structs in string.

Is it possible to omit "eval" from second line by using some sugar code:

  (setq binstr-len 4)
  (setq binstr (eval `(unibyte-string ?s binstr-len ,@(make-list binstr-len ?x))))
  (assert (eq (+ 2 binstr-len) (length binstr)))

Another solution:

  (setq binstr (concat (unibyte-string ?s binstr-len) (make-list binstr-len ?x)))

Or "apply" stands for this purpose(??):

  (setq binstr (apply 'unibyte-string ?s binstr-len (make-list binstr-len ?x)))

Seems that "`" use current variable values when sexp *parsed*, while with
"apply" it use variable values on *evaluation*. Is I am right?

-- 
Best regards!




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

end of thread, other threads:[~2013-01-08  5:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.16855.1357563071.855.help-gnu-emacs@gnu.org>
2013-01-07 15:02 ` "Backquote constructs" to "splice" values without "eval" Barry Margolin
2013-01-07 20:36   ` Oleksandr Gavenko
2013-01-07 21:10     ` Jambunathan K
2013-01-07 21:47       ` Oleksandr Gavenko
2013-01-08  5:48         ` Jambunathan K
2013-01-08  5:51           ` Jambunathan K
     [not found]   ` <mailman.16874.1357591009.855.help-gnu-emacs@gnu.org>
2013-01-07 20:51     ` Barry Margolin
2013-01-07 12:50 Oleksandr Gavenko

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).