Re: Feature request - 'fill'

2021-12-14 Thread Alexander Burger
Hi pd, Erik, > several lisps : > > ... > > `(1 ,(+ 2 4) 3) -> (1 8 3) > > ... > Both backquote and comma are already read-macros in picolisp, so that's a > no go > at the language level. Right. And in PicoLisp they are probably more often used than 'fill' (i.e. backquote in other Lisps). I woul

Re: Feature request - 'fill'

2021-12-14 Thread pd
On Tue, Dec 14, 2021 at 3:15 AM Erik Gustafson wrote: > > I think Alex has shown that ',' and ',@' can be rolled into one - '^' > > : (let X (1 2) (macro (1 (^ X) 2))) > -> (1 (1 2) 2) > : (let X (1 2) (macro (1 ^ X 2))) > -> (1 1 2 2) > : (let X (1 2) (macro (1 ^ (apply + X) 2))) > -> (1 3 2) >

Re: Feature request - 'fill'

2021-12-13 Thread Erik Gustafson
> And why not following lisp tradition and use comma character (,) rather > than caret > character (^) for evaluating expressions? > > In fact fill is more or less analogous to backquote (`) (also known as > quasiquote) in > several lisps : > > `(1 2 3) -> (1 2 3) > `(1 (+ 2 4) 3) -> (1 (+ 2 4)

Re: Feature request - 'fill'

2021-12-13 Thread pd
On Mon, Dec 13, 2021 at 6:27 PM Alexander Burger wrote: > > So I went ahead and implemented the extended 'fill' behavior. > >: (fill (1 ^(+ 1 1) 3)) >-> (1 2 3) > > To make it more consistent, I also changed the '~' read macro in the same > way. > Now this works: > >: (~(- 4 3) (2 ~(+

Re: Feature request - 'fill'

2021-12-13 Thread Alexander Burger
On Mon, Dec 13, 2021 at 09:28:07PM +0100, Alexander Burger wrote: > Yes, a difficult decision. And, as Razzy said, we should really, really be careful. To be not carried away by over-fantastic ideas. Recently, there were too many. Perhaps. -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=

Re: Feature request - 'fill'

2021-12-13 Thread Alexander Burger
Hi Andras, > I’ve opted instead to return the usual (1 9) and only lists evaluating to > atoms > trigger the new behaviour in (fill). Yes, a difficult decision. Still, I believe the new semantics are more useful. The expression following '^' can decide whether to return a list (possibly empty)

Re: Feature request - 'fill'

2021-12-13 Thread Andras Pahi
Hi Alex, Thank you for your answer. I’ve opted instead to return the usual (1 9) and only lists evaluating to atoms trigger the new behaviour in (fill). Regards, Andras Pahi > On 2021. Dec 13., at 21:01, Alexander Burger wrote: > > Hi Andras, > >> What should (fill (1 ^ 7 9)) return ? > >

Re: Feature request - 'fill'

2021-12-13 Thread Alexander Burger
Hi Andras, > What should (fill (1 ^ 7 9)) return ? -> (1 7 9) ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Re: Feature request - 'fill'

2021-12-13 Thread Andras Pahi
Hi Alex, What should (fill (1 ^ 7 9)) return ? Regards, Andras Pahi > On 2021. Dec 13., at 18:21, Alexander Burger wrote: > > So I went ahead and implemented the extended 'fill' behavior. > > : (fill (1 ^(+ 1 1) 3)) > -> (1 2 3) > > To make it more consistent, I also changed the '~' read

Re: Feature request - 'fill'

2021-12-13 Thread Alexander Burger
Hi Erik, > >1. If the result of the evaluation is a list, we get the same result as > > now. > >2. But if the result is an atom, it is automatically 'cons'ed into a > > cell. > ... > Works for me! I also often want to use a returned list without splicing, > ... > : (macro (2 4 (^(mapcar '(

Re: Feature request - 'fill'

2021-12-12 Thread Erik Gustafson
Hi Alex, We stick with '^' only, but make it behave more intelligent: > >1. If the result of the evaluation is a list, we get the same result as > now. >2. But if the result is an atom, it is automatically 'cons'ed into a > cell. > > This would not break any existing programs, as atomic re

Re: Feature request - 'fill'

2021-12-12 Thread Alexander Burger
Hi Erik, > I know I (ab)use 'fill' / 'macro' too much in my code, but I often want > to insert (not splice) the result of some calculation. Would you consider > a new '_' syntax within 'fill' forms? > > : (fill (1 2 _ (+ 1 2)) > -> (1 2 3) Hmm, I would not be very happy if we invent yet another

Feature request - 'fill'

2021-12-12 Thread Erik Gustafson
Hi Alex, I know I (ab)use 'fill' / 'macro' too much in my code, but I often want to insert (not splice) the result of some calculation. Would you consider a new '_' syntax within 'fill' forms? : (fill (1 2 _ (+ 1 2)) -> (1 2 3) This can currently be accomplished a few different ways : (let X (+