|
From: | Jack J. Woehr |
Subject: | Re: How does one define a closure in m4? |
Date: | Sat, 07 Sep 2013 15:56:08 -0600 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0 SeaMonkey/2.20 |
Doug McIlroy wrote:
specialize(unary,binary,value) produces a unary operation by fixing the value of one the operands of a binary operation. define(add,`($1+$2)') define(div,`($1/$2)') define(specialize,`define($1,`$2('$`1,$3)')') specialize(succ,`add',1) specialize(half,`div',2) With these definitions, half(succ(4)) expands to ((4+1)/2)
Thanks, Doug! Works for me. Now I've got closure on closures! :) -- Jack J. Woehr # For in the idea of chess and the development www.well.com/~jax # of the chess mind we have a picture of the www.softwoehr.com # intellectual struggle of mankind. – Richard Reti
[Prev in Thread] | Current Thread | [Next in Thread] |