Hi, Thorsten!

> I did not yet make it to write a function g [...]

What if you combined your f and g into a "new" g?  Here's one and with
recur/recurse.

(de g Args
  (glue " "
    (recur Args
     (mapcar
      '((Arg)
        (if (atom Arg)
            (let (ChopArgs (chop Arg)
                  ArgsTail (tail 2 ChopArgs)
                  PunctChars (chop ".,;:?!\"'_-{[]}")
                  ensure-escape-quote '((S)
                                        (if (str? S)
                                            (pack "\"" S "\"")
                                            S))
                  Punct NIL)
              (pack
                (ensure-escape-quote
                 (ifn (and (= (car ChopArgs) "$")
                           (or (= (last ChopArgs) "$")
                               (and (= (car ArgsTail) "$")
                                    (member (last ArgsTail) PunctChars)
                                    (setq Punct (last ArgsTail))
                                    (setq ChopArgs (head -1 ChopArgs)))))
                      Arg
                      (val
                       (intern
                        (pack
                         (tail -1 (head -1 ChopArgs)))))))
                Punct))
            (recurse Arg)))
      Args))))

It appears to work as you required.

: (g Is $S1$ before $S2$?
   The answer is
   `(if (and
           (<= $D1$ $D2$)
           (<= $T1$ $T2$) )
       "Yes"
       "No" ) )
-> "Is \"1999-09-09 20:12:05\" before \"2000-03-04 18:03:03\"? The
answer is \"Yes\""
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to