Hi Lutz,
I like implicit indexing a lot, it easy to use and compact...
But what i actualy miss inside implicit indexing is a simple way
to "move" variables inside lists...
Normaly I use a pop and a push to move an list/variable inside a list around, but actualy using pop en push is a little clumpsy together with implicit indexing or actualy overall for moving...
I would like to see something like i.e. this ->
> (set 'a '("one" "two" "three"))
("one" "two" "three")
> (nth-move (a 0) (a -1))
("two" "three" "one")
No its not a rotate, because then the function is getting too long again,
perhpas and extra parameter inside nth-set for moving inside lists?
Moving (like in 'pop then push) a nested list inside another nested list...or anything else..
Or perhpasd just a simple 'move function that moves inside lists
and strings...
Would be a nice to have...
Regards,
Norman.
Implicit move
Implicit move
-- (define? (Cornflakes))
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
Hmm, cool ideas!
Perhaps this is not elegant enough...?
Perhaps this is not elegant enough...?
Code: Select all
(set 'a '("one" "two" "three"))
(swap 1 0 (swap -1 0 a))
;-> ("two" "three" "one")