Hi JmageK,

> The patch is a nice function. I'm having a hard time understanding this entire
> code. Can you explain how it works? What gets bound to @X? Thanks!

Sure!

   (patch http '(out *HtSock (cond @X))
      (fill
         '(prog
            (ana)
            (out *HtSock (cond . @X)) ) ) )


The first argument to 'patch' is the value of 'http', i.e. the whole function
definition to be modified.

The second argument is the pattern. It matches to the expression

   (out *HtSock
      (cond
         ((match '("-" @X "." "h" "t" "m" "l") U)
            (and *SesId (timeout *Timeout))
            ... ) ) )

Thus, '@X' gets bound to

         (((match '("-" @X "." "h" "t" "m" "l") U)
            (and *SesId (timeout *Timeout))
            ... ) ) ) )

Note the additional list level, as 'match' binds its parameters to lists!

So we need the dot in

   (out *HtSock (cond . @X))

so that this subexpression gets properly restored.

☺/ A!ex

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

Reply via email to