Re: FEXPRs / PilCon

2021-03-16 Thread Tomas Hlavaty
On Sun 14 Mar 2021 at 09:34, Alexis wrote: > My guess is that Tomas is using the latter meaning, and wants > 'pure' functions that simply return strings, without sending them > to an output device. The final string to be output would be > created by combining the return values of multiple funct

Re: FEXPRs / PilCon

2021-03-15 Thread pd
On Sun, Mar 14, 2021 at 10:19 PM Alexander Burger wrote: > Hi pd, > > > They're are not intended to be right implementations, too bad for that > ;-) > > No no, I did not say that :) > :) ok but *I* say that, it's really not a code to show, only intended to show output > Right. The point is

Re: FEXPRs / PilCon

2021-03-14 Thread Alexander Burger
Hi pd, > > > : (de pp P (prin "") (run P) (prin "") (pack "" (run P) > > "") ) > > ... > > This is a bit problematic, because the body in P is executed twice. Not > > only is ... > >(de pp P > > (prin (pack "" (run P) "")) ) > yes, all my examples in my previous email are bad code, just

Re: FEXPRs / PilCon

2021-03-14 Thread pd
On Sat, Mar 13, 2021 at 2:05 PM Alexander Burger wrote: > > Yes. (And strings are always immutable in PicoLisp anyway) > this is pretty interesting to be rembered, good for newbies to discover why it is that way ;-) > > : (de pp P (prin "") (run P) (prin "") (pack "" (run P) > "") ) > > This i

Re: FEXPRs / PilCon

2021-03-13 Thread Alexis
Alexander Burger writes: On Sat, Mar 13, 2021 at 06:48:22PM +0100, Tomas Hlavaty wrote: (de (Col . Prg) (prin "") (run Prg) (prin "") ) prin has side-effect. Nonsense! 'prin' *is* the only and desired effect. Mm, it seems to me that there might be a mutual misunder

Re: FEXPRs / PilCon

2021-03-13 Thread Tomas Hlavaty
On Sat 13 Mar 2021 at 21:13, Alexander Burger wrote: > On Sat, Mar 13, 2021 at 08:59:37PM +0100, Tomas Hlavaty wrote: >> On Sat 13 Mar 2021 at 19:09, Alexander Burger wrote: >> > On Sat, Mar 13, 2021 at 06:48:22PM +0100, Tomas Hlavaty wrote: >> >>(de (Col . Prg) >> >> (prin "") >> >>

Re: FEXPRs / PilCon

2021-03-13 Thread Tomas Hlavaty
On Sat 13 Mar 2021 at 19:09, Alexander Burger wrote: > On Sat, Mar 13, 2021 at 06:48:22PM +0100, Tomas Hlavaty wrote: >>(de (Col . Prg) >> (prin "") >> (run Prg) >> (prin "") ) >> >> prin has side-effect. > > Nonsense! 'prin' *is* the only and desired effect. see https://e

Re: FEXPRs / PilCon

2021-03-13 Thread Tomas Hlavaty
On Sat 13 Mar 2021 at 18:48, Tomas Hlavaty wrote: > would be better written as: > >(de p @ (cons 'p (args))) s/args/rest: (de p @ (cons 'p (rest))) -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Re: FEXPRs / PilCon

2021-03-13 Thread Tomas Hlavaty
On Sat 13 Mar 2021 at 19:09, Alexander Burger wrote: > On Sat, Mar 13, 2021 at 06:48:22PM +0100, Tomas Hlavaty wrote: >>(de (Col . Prg) >> (prin "") >> (run Prg) >> (prin "") ) >> >> prin has side-effect. > > Nonsense! 'prin' *is* the only and desired effect. see https://e

Re: FEXPRs / PilCon

2021-03-13 Thread Alexander Burger
On Sat, Mar 13, 2021 at 07:09:24PM +0100, Alexander Burger wrote: > > prin has side-effect. > > Nonsense! 'prin' *is* the only and desired effect. > ... > This discussion is useless. Now I think I understand why. Tomas misunderstood my initial mail. He did not attend PilCon, and seems to believe

Re: FEXPRs / PilCon

2021-03-13 Thread Alexander Burger
On Sat, Mar 13, 2021 at 06:48:22PM +0100, Tomas Hlavaty wrote: >(de (Col . Prg) > (prin "") > (run Prg) > (prin "") ) > > prin has side-effect. Nonsense! 'prin' *is* the only and desired effect. > Col is not properly escaped! How so? It generates What kind if escap

Re: FEXPRs / PilCon

2021-03-13 Thread Tomas Hlavaty
On Sat 13 Mar 2021 at 16:04, Alexander Burger wrote: > I don't get your problem with side effects! in your example: (de (Col . Prg) (prin "") (run Prg) (prin "") ) prin has side-effect. Col is not properly escaped! This example: (de Prg (prin "") (run Pr

Re: FEXPRs / PilCon

2021-03-13 Thread Alexander Burger
On Sat, Mar 13, 2021 at 04:04:56PM +0100, Alexander Burger wrote: > I don't get your problem with side effects! Anyway, we are completely off-topic now :) You started with critics about FEXPRs, but never said anything relevant about them. Your code examples like (de (Str) `(p ,Str)) are EXP

Re: FEXPRs / PilCon

2021-03-13 Thread Alexander Burger
On Sat, Mar 13, 2021 at 03:33:23PM +0100, Tomas Hlavaty wrote: > On Sat 13 Mar 2021 at 15:03, Alexander Burger wrote: > I am talking about an example which shows how inconvenient the standard > picolisp your solution with side-effect is. > > Yet another example, writing out pdf. I don't get your

Re: FEXPRs / PilCon

2021-03-13 Thread Tomas Hlavaty
On Sat 13 Mar 2021 at 15:03, Alexander Burger wrote: > On Sat, Mar 13, 2021 at 02:09:30PM +0100, Tomas Hlavaty wrote: >> Avoiding allocations is wrong thing to do for this use-case. Printing >> directly is severely inconvenient. Do you have a neat solution to the >> svg viewBox problem I wrote a

Re: FEXPRs / PilCon

2021-03-13 Thread Alexander Burger
On Sat, Mar 13, 2021 at 03:13:13PM +0100, Tomas Hlavaty wrote: > Another example: you have to be careful not to get an error in the > middle of the side-effect otherwise you get partial output. Hmm, sure, as in all kinds of programming. How does that relate to FEXPRs and/or tracing? Or do I misu

Re: FEXPRs / PilCon

2021-03-13 Thread Tomas Hlavaty
On Sat 13 Mar 2021 at 14:09, Tomas Hlavaty wrote: >> But the FEXPR solution explained at PilCon allocates no new cells at all. It >> prints directly. > > Avoiding allocations is wrong thing to do for this use-case. Printing > directly is severely inconvenient. Do you have a neat solution to the

Re: FEXPRs / PilCon

2021-03-13 Thread Alexander Burger
On Sat, Mar 13, 2021 at 02:09:30PM +0100, Tomas Hlavaty wrote: > Avoiding allocations is wrong thing to do for this use-case. Printing > directly is severely inconvenient. Do you have a neat solution to the > svg viewBox problem I wrote about? You are talking about a different problem domain. Wi

Re: FEXPRs / PilCon

2021-03-13 Thread Alexander Burger
On Sat, Mar 13, 2021 at 01:57:58PM +0100, Alexander Burger wrote: > For such a simple example it works. But keep in mind that typically 'P' > is a large program, with lots of 'if's, 'while's and arbitrarily deeply > nested other HTML tags. For a short real-world example, take the "Sales" report f

Re: FEXPRs / PilCon

2021-03-13 Thread Tomas Hlavaty
On Sat 13 Mar 2021 at 13:33, Alexander Burger wrote: > It does. Just the syntax is different: > >(de (@Str) (fill '(p @Str))) > > This also creates just 2 cells. True, I forgot about fill. > But the FEXPR solution explained at PilCon allocates no new cells at all. It > prints directly. Avo

Re: FEXPRs / PilCon

2021-03-13 Thread Alexander Burger
On Sat, Mar 13, 2021 at 01:30:27PM +0100, pd wrote: > Composing strings (packing) have two main advantages: > > 1. Strings may be inmutable (you can return a new different string, maybe a > copy) > 2. Strings can be passed as parameter Yes. (And strings are always immutable in PicoLisp anyway)

Re: FEXPRs / PilCon

2021-03-13 Thread Alexander Burger
Hi Tomas, > > While this would surely work, I answered that it is a big overhead to > > generate the whole page as strings just to print them. > > Packing strings is not a good idea. Right. > It would be much better to create a cons tree instead, something like: > > (de (Str) `(p ,Str))

Re: FEXPRs / PilCon

2021-03-13 Thread pd
That's true but with comments ;) Composing strings (packing) have two main advantages: 1. Strings may be inmutable (you can return a new different string, maybe a copy) 2. Strings can be passed as parameter The fexpr writing directly to stdout with print and running a program does not returns a

Re: FEXPRs / PilCon

2021-03-13 Thread Tomas Hlavaty
On Sat 13 Mar 2021 at 08:27, Alexander Burger wrote: >(de Prg > (prin "") > (run Prg) > (prin "") ) > > [...] > > One question that came up was why FEXPRs could not be replaced with normal > functions (EXPRs), simply 'pack'ing strings: > >(de (Str) > (pack "" Str

FEXPRs / PilCon

2021-03-12 Thread Alexander Burger
Hi all, at PilCon three days ago we discussed about FEXPRs like (de Prg (prin "") (run Prg) (prin "") ) (de (Col . Prg) (prin "") (run Prg) (prin "") ) which can be called as ( "red" ( (prin "Text"))) giving such output: Text One question t