[Top][All Lists]

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

"Backquote constructs" to "splice" values without "eval".

From: Oleksandr Gavenko
Subject: "Backquote constructs" to "splice" values without "eval".
Date: Mon, 07 Jan 2013 14:50:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

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 
  (assert (eq (+ 2 binstr-len) (length binstr)))

Another solution:

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

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!

reply via email to

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