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 from the PicoLisp Demo application (https://software-lab.de/demoApp.tgz). I include the source below. Functions like 'menu', '<h3>', 'form', '<grid>', 'csv', '<table>', '<row>' and '<strong>' are FEXPRs. The report runs through, generates the page, and gets garbage-collected. ☺/ A!ex # 08oct20 Software Lab. Alexander Burger (must "Sales" Report) (menu ,"Sales" (<h3> NIL ,"Sales") (form NIL (<grid> "-.-" ,"Date" NIL (prog (gui '(+Var +DateField) '*SalFrom 10) (prin " - ") (gui '(+Var +DateField) '*SalTill 10) ) ,"Customer" (choCuSu 0) (gui '(+Var +Obj +TextField) '*SalCus '(nm +CuSu) 30) ) (--) (gui '(+ShowButton) NIL '(csv ,"Sales" (<table> 'chart NIL (<!> (quote (align) (NIL ,"Date") (NIL ,"Customer") NIL (NIL ,"Zip") (NIL ,"City") (align ,"Total") ) ) (catch NIL (let Sum 0 (pilog (quote @Rng (cons *SalFrom (or *SalTill T)) @Cus *SalCus (select (@Ord) ((dat +Ord @Rng) (cus +Ord @Cus)) (range @Rng @Ord dat) (same @Cus @Ord cus) ) ) (with @Ord (let N (sum> This) (<row> (alternating) (<+> (: nr) This) (<+> (datStr (: dat)) This) (<+> (: cus nm) (: cus)) (<+> (: cus nm2)) (<+> (: cus plz)) (<+> (: cus ort)) (<-> (money N)) ) (inc 'Sum N) ) ) (at (0 . 10000) (or (flush) (throw))) ) (<row> 'nil (<strong> ,"Total") - - - - - (<strong> (prin (money Sum))) ) ) ) ) ) ) ) ) -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe