dup

Notices and updates
Locked
Jeremy Dunn
Posts: 95
Joined: Wed Oct 13, 2004 8:02 pm
Location: Bellingham WA

dup

Post by Jeremy Dunn »

Lutz,

Why not make DUP take additional multiplier arguments so that
(dup x n1 n2 n3 ....) is the same as (dup (dup (dup x n1) n2) n2)? That way if I want a 3x3 matrix of zeros I can write (dup 0 3 3) instead of (dup (dup 0 3) 3).

newBert
Posts: 156
Joined: Fri Oct 28, 2005 5:33 pm
Location: France

Post by newBert »

Maybe you can do also:

Code: Select all

(dup (series 0 0 3) 3)
;-> ((0 0 0) (0 0 0) (0 0 0))
Manual and Reference wrote:series
syntax: (series num-start num-factor num-count)
In the first syntax, series creates a geometric sequence with num-count elements starting with the element in num-start. Each subsequent element is multiplied by num-factor.
P.S.: sorry, i just realize that it amounts to the same thing :-/
BertrandnewLISP v.10.7.6 64-bit on Linux (Linux Mint 20.1)

newBert
Posts: 156
Joined: Fri Oct 28, 2005 5:33 pm
Location: France

Post by newBert »

Try this way instead:

Code: Select all

> (array 3 3 '(0))
((0 0 0) (0 0 0) (0 0 0))
;o)
BertrandnewLISP v.10.7.6 64-bit on Linux (Linux Mint 20.1)

Locked