On Sat, Jun 15, 2019 at 10:03:02AM +0200, JmageK wrote:
> >> : (conc (cons '@) (chop S) '(@))
> >> -> (@ "t" "s" "t" @)
> >
> I mean (conc '(@)(chop S)'(@))

Well, this is not to recommend.

'conc' is a destructive operation, so

   (conc '(@) ...

will concatenate the rest to the cell (@). This works well if called only a
single time (e.g. in the REPL), but is not desirable if it is in a function
definition.

Instead, you could call the non-destructive pendant of 'conc', which is
'append':

   (append '(@) (chop S) '(@))

but this is less efficient because it copies not only (@) but also the result of
the 'chop' (which in turn does not *need* to be copied as it is just freshly
created and not shared anywhere.

So I would say that

   (conc (cons '@) (chop S) '(@))

or alternatively

   (cons '@ (conc (chop S) '(@))

is the best.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to