1) How do I append list to the list?
> (setq x '(1 2))
(1 2)
> (setq x (append x '(3 4)))
(1 2 3 4)
In this case, 'push' cannot be used:
> (push '(3 4) x -1)
(3 4)
> x
(1 2 (3 4))
>
Function 'write-buffer' accepts only file (integer) or string. Could we add appending to the lists?
Thank you, Fanda
> (setq x '(1 2))
(1 2)
> (setq x (cons x '(3 4)))
((1 2) 3 4)
> x
((1 2) 3 4)
Let me explain more:
I mean destructive function (like push) that would add (append) elements to the list from inside of other list.
> (setq x '(1 2))
(1 2)
new write-buffer or other function: (write-buffer x '(3 4))
> x
(1 2 3 4)
Fanda
I thought, I might needed it in recursive functions, but (append) will work fine, I guess ;-)
Lutz - do you have any comments to 1) ?
2) Could we add the 'int?' function?
> integer
integer <417ED0>
> int
int <417ED0>
> integer?
integer? <40BC50>
> int?
nil
>
3) I also noticed that we don't have function for rounding numbers:
I am suggesting: (round x [n]) -- x = int/float -- n = int (float?)
(round 1.9) => 2
(round 123.48) => 123
(round 123.48 0) => 123
(round 123.48 1) => 120
(round 123.48 2) => 100
(round 123.48 3) => 0
(round 123.48 -1) => 123.5
Fanda
I want to keep the predicates 'integer?' and 'symbol?' in the long form so they are easier to distinguish from the 'int' and 'sym' functions.
For rounding numbers just try to use 'format' which will do it for you when displaying numbers:
(format "%0.2f" 1.235) => "1.24"
Lutz