Re: Less powerful 'str?

2017-06-18 Thread Alexander Burger
On Sat, Jun 17, 2017 at 05:39:15PM -0800, Christopher Howard wrote:
> I think I found what I was looking for, modifying an example from the docs:
> 
> : (mapcar pack (split (chop (line T)) " "))

Minor optimization: You can avoid the overhead of 'chop':

   (mapcar pack (split (line) " "))


> On 06/17/2017 02:35 PM, Joh-Tob Schäg wrote:
> > Take a look at 'read.

This does not solve the problem, because 'str' *is* 'read' internally, and
therefore evaluates the read macros.

> > You may need to 'eval the result.

'eval' is not needed, and in fact is what Christopher wanted to avoid (i.e. the
evaluation triggered by the read macros)

♪♫ Alex

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


Re: Less powerful 'str?

2017-06-17 Thread Christopher Howard
I think I found what I was looking for, modifying an example from the docs:

: (mapcar pack (split (chop (line T)) " "))
go north
-> ("go" "north")

On 06/17/2017 02:35 PM, Joh-Tob Schäg wrote:
> Take a look at 'read.
> You may need to 'eval the result.
> If 'read does not suit your needs i wrote a tokenizer and parser but the
> source code is not yet ready fot publication
> 
> Am 17.06.2017 23:42 schrieb "Christopher Howard"
> >:
> 
> Hi list. I find that the 'str function is rather convenient for
> processing commands from the user, as it converts the input to list
> format, like in
> 
> : (str (line T))
> go north
> -> (go north)
> 
> However, it creates complications in allowing commands like:
> 
> : (str (line T))
> `(+ 1 2 3)
> -> (6)
> 
> and
> 
> : (str (line T))
> "crash!
> EOF Overrun
> ?
> 
> Is there another simple way to get the lists provided by 'str without
> the user this power to run code?
> 
> --
> https://qlfiles.net
> 
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de
> ?subject=Unsubscribe
> 

-- 
https://qlfiles.net

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


Re: Less powerful 'str?

2017-06-17 Thread Joh-Tob Schäg
Take a look at 'read.
You may need to 'eval the result.
If 'read does not suit your needs i wrote a tokenizer and parser but the
source code is not yet ready fot publication
Am 17.06.2017 23:42 schrieb "Christopher Howard" <
christopher.how...@qlfiles.net>:

> Hi list. I find that the 'str function is rather convenient for
> processing commands from the user, as it converts the input to list
> format, like in
>
> : (str (line T))
> go north
> -> (go north)
>
> However, it creates complications in allowing commands like:
>
> : (str (line T))
> `(+ 1 2 3)
> -> (6)
>
> and
>
> : (str (line T))
> "crash!
> EOF Overrun
> ?
>
> Is there another simple way to get the lists provided by 'str without
> the user this power to run code?
>
> --
> https://qlfiles.net
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>