Jun 15, 2019, 1:57 PM by [email protected]:

> 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.
>
Right! It hanged the REPL on a 2nd function call
> 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.
>
>
I guess the inefficiency of copying the whole lists can be mitigated partially 
by passing a copy of '@ to conc I tested & it works fine across function calls. 
But then may as well use cons solution.


  (cons (copy'@) (conc (chop "Si")'(@)))
or 
  (conc (copy '(@)) (chop "Si")'(@))

> So I would say that
>  (conc (cons '@) (chop S) '(@))
>
> or alternatively
>  (cons '@ (conc (chop S) '(@))
> is the best
>
Yeah, this is straight forward. Originally, I assumed it was just a different 
way to do it, good to know. Thanks!

JmageK
--
Securely sent with Tutanota



--
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe

Reply via email to