Re: how to append an element with nested parens and an evaluated centre

2016-12-23 Thread John Duncan
I think using (list 'a (list (list V))) is idiomatic and clear.

John

On Dec 23, 2016 4:02 AM, "dean" <deangwillia...@gmail.com> wrote:

> I noted that '  let you write as many nested parens as you wanted but
> precluded any evaluation in the middle. V was just there to ensure that
> EVALUATION was required to get at "some_str" i.e. to test any solution.
> Irrespectivethank you for 'fill
>
> On 23 December 2016 at 08:46, Joh-Tob Schäg <johtob...@gmail.com> wrote:
>
>> What is the purpose of the symbol V? Is seems like dead code to me.
>> Please check your code for correctness before asking question. The first
>> line does not make any sense for another reason.
>>
>> If you want to have a the list (a (("String"))) use:
>> (setq L (append L '((("String")
>>
>> I assume you wanted to have the value of V in there instead of a constant
>> "String". Have a look at 'fill in this case.
>>
>> 2016-12-22 21:09 GMT+01:00 dean <deangwillia...@gmail.com>:
>>
>>> What is the right way to do this...
>>> (setq V "some_str")
>>> (setq L '(a))
>>> (setq L (append L ???))
>>> --> (  a   ((some_str)))
>>> i.e. I can do '((some_str))
>>> but wonder if there's an easy way to use '(()) AND have an evaluated
>>> value in the middle
>>> i.e quote makes specifying any level of parens easy but doesn't let my
>>> use an evaluated value in the middle.
>>> Sorry if this is a dumb question
>>>
>>
>>
>


Re: how to append an element with nested parens and an evaluated centre

2016-12-23 Thread Joh-Tob Schäg
What is the purpose of the symbol V? Is seems like dead code to me. Please
check your code for correctness before asking question. The first line does
not make any sense for another reason.

If you want to have a the list (a (("String"))) use:
(setq L (append L '((("String")

I assume you wanted to have the value of V in there instead of a constant
"String". Have a look at 'fill in this case.

2016-12-22 21:09 GMT+01:00 dean <deangwillia...@gmail.com>:

> What is the right way to do this...
> (setq V "some_str")
> (setq L '(a))
> (setq L (append L ???))
> --> (  a   ((some_str)))
> i.e. I can do '((some_str))
> but wonder if there's an easy way to use '(()) AND have an evaluated value
> in the middle
> i.e. quote makes specifying any level of parens easy but doesn't let my
> use an evaluated value in the middle.
> Sorry if this is a dumb question
>


Re: append

2015-10-18 Thread Alexander Burger
HI all,

> append operates on LISTS. 'd or 'e is not a list.
> 
> You should do:
> 
> (append '(a b c) '(d) '(e))
> 
> Or, alternatively:
> 
> (append '(a b c) (list 'd 'e))

That's right.

It is best if you try to understand what happens internally

   http://software-lab.de/doc/ref.html#vm

'append' simply sets the CDR of the last cell to the next argument. This
is typically a list, but may well be an atom (especially in the case of
the empty list, which is NIL and which happens to be also an atom).

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


RE: append

2015-10-18 Thread Jonathan Kelly
> -Original Message-
> From: picolisp@software-lab.de [mailto:picolisp@software-lab.de] On Behalf
> Of Alexander Burger
> Sent: Sunday, 18 October 2015 6:03 PM
> To: picolisp@software-lab.de
> Subject: Re: append
> 
> HI all,
> 
> > append operates on LISTS. 'd or 'e is not a list.
> >
> > You should do:
> >
> > (append '(a b c) '(d) '(e))
> >
> > Or, alternatively:
> >
> > (append '(a b c) (list 'd 'e))
> 
> That's right.
> 
> It is best if you try to understand what happens internally
> 
>http://software-lab.de/doc/ref.html#vm
> 
> 'append' simply sets the CDR of the last cell to the next argument. This is
> typically a list, but may well be an atom (especially in the case of the empty
> list, which is NIL and which happens to be also an atom).
> 
> ♪♫ Alex
> --

I get what it's doing now; the thing that seems weird to me is what it's NOT 
doing:  append-ing.

Jonathan.