Subject: mailing-list for TeXmacs Users
List archive
From : "Sam Liddicott" <address@hidden>- To: address@hidden
- Subject: Re: [TeXmacs] More quasi and cline
- Date: Wed, 06 Apr 2011 18:29:54 +0100
- Envelope-to:
- Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAAXNSR0IArs4c6QAAADxQTFRF NTdQY2Z/i286eHFugnNXoJBwm5GCs5VeoqO0ua+fwLCQ4c2q19C81NDF4eLr/unQ/PTf/fXW+/rq /f/7XKo76wAAAAlwSFlzAAALEwAACxMBAJqcGAAAAi9JREFUSMetloGSqyAMRVsFNAQkxP//15cE 62rFdt/MZqbTVu/hBhLEx/qf8fgDIAN455wHyPk7wCIe9nA+fwGSH87hgD8AHPfRpy2GwdMtcBh+ mg4Ech9Ih+RNixJKDLEL0GF8VLkSojePHrDlryNijbFW8zBg8PUKbBOI6D1WCV5Rf2DzxCtgBlMs tRRVW5LyVW3ew1TfAZZ6RcQicpb4yZmaC74DJADK6BdATOrUAbJzsZie+K22ZnEBknNYysvhVH6u 1X8CqAe4DuANoPoOrAbsHXUARJ5knc5z4EyyTnHoAqj7xvkYIdk65AwhyEZKMusOIDV2QQQaCnDQ gBiDR3RdIEb5CBESt2wgQJI0Yx/Agphg1MgNsD+QkszM9wHVPx/PeQOW+fmcR9DF8+4CyCJhCuP8 fDzmBbLqs8JzMODqYNfDvKhoGYM2lDosy5jlRozccRAgrPM8iygQS3Mv87IugUgKlC7NZ6liuy4r uresVq5QuQAr09ZKEga8OkluyKXeQ6Bs3SrtqgC1pWLNqAfwDhBnB+sK8OrVL4D4h1B4zWPWhJhu gPUHKA5EwSMYUMsdQK+UKDhIOTSHeg+8HCoTOGtB/gwcl4mSdGybwXegPWhM/RHYKwchkckhUNMX 6j7ueQNScLbZZOPRxaADyO2UQCJpl7wbnE6gQ+ksWjpngxOwF1tF5ecP3R6KB+AQxPfHLncQ+nKw 06fhu68OTIfJ869eTtg22l+9zfwDK3mKl5BFHMYAAAAASUVORK5CYII=
Well... I worked out that if I am going to use unquote* it doesn't matter if I return a concat or a tuple.
Sam
On 06/04/11 17:03, Sam Liddicott wrote:
Hmmm... get-label on x this macro is: concat
<assign|jags|<macro|c|<quasi|<with|x|0|xpoints||<while|<less|<value|x>|7>|<append-tuple|xpoints|<tuple|<point|<value|x>|<mod|<value|x>|2>>>><assign|x|<plus|<value|x>|1>>><inactive|<assign|points|<value|xpoints>>>>><value|>>>
<quasi|<assign|x|<unquote|<jags|>>>>
I see why.... I see how hard it is to make a macro that actually returns a tuple. I wonder if I really need functions... and not macros...
so if I can't get a macro to return the cline, i try to get it to call the cline:
<assign|do-thing|<macro|c|t|<quasi|<compound|<arg|c>|<unquote*|<arg|t>>>>>>
<do-thing|cline|<tuple|<point|2|2>|<point|3|3>|<point|1|0>>>
but it merely returns the text:
<compound|cline|.....>
However this works.... but is hard wired to cline:
<assign|jags|<macro|c|<with|x|0|xpoints||<while|<less|<value|x>|7>|<append-tuple|xpoints|<tuple|<point|<value|x>|<mod|<value|x>|2>>>><assign|x|<plus|<value|x>|1>>><quasi|<cline|<unquote*|<value|xpoints>>>>>>>
I want to tell it what to call...
I'll keep thinking
On 06/04/11 16:39, Sam Liddicott wrote:
This texmacs draws a triangle
<assign|x|<tuple|<point|2|2>|<point|3|3>|<point|1|0>>>
<quasi|<cline|<point|0|0>|<point|1|1>|<unquote*|<value|x>>>>
I have a macro "jags" which returns a tuple of points that might be used by cline to make a jagged line.
<assign|append-tuple|<macro|name|t|<if|<equal|<get-label|<value|<arg|name>>>|tuple>|<assign|<arg|name>|<merge|<value|<arg|name>>|<arg|t>>>|<assign|<arg|name>|<arg|t>>>>>
<assign|jags|<macro|c|<with|x|0|xpoints||<while|<less|<value|x>|7>|<append-tuple|xpoints|<tuple|<point|<value|x>|<mod|<value|x>|2>>>><assign|x|<plus|<value|x>|1>>><value|xpoints>>>>
Sadly, cline does not take a tuple, but using the output of the macro "jags" keeps causing a segfault:
<assign|x|<jags|>>
<quasi|<cline|<point|0|0>|<point|1|1>|<unquote*|<value|x>>>>
or
<quasi|<assign|x|<unquote|<jags|>>>>
<quasi|<cline|<point|0|0>|<point|1|1>|<unquote*|<value|x>>>>
both crash texmacs.
but not using jags but a tuple directly works and draws the triangle:
<assign|x|<tuple|<point|2|2>|<point|3|3>|<point|1|0>>>
<quasi|<cline|<point|0|0>|<point|1|1>|<unquote*|<value|x>>>>
Any tips?
Judicious use of get-label shows that for both of these:
<quasi|<assign|x|<unquote|<jags|>>>>
<assign|x|<jags|>>
x is a "with" and not a "tuple"
This is clearly the contents of the jags macro showing up - whose first item is a "with" clause
I cannot work out why: <quasi|<assign|x|<unquote|<jags|>>>>
did not evaluate jags but rather just fetches it's definition
Sam
--
[FSF Associate Member #2325] <http://www.fsf.org/register_form?referrer=2325>
<http://www.openrightsgroup.org/>
- [TeXmacs] More quasi and cline, Sam Liddicott, 04/06/2011
- Re: [TeXmacs] More quasi and cline, Sam Liddicott, 04/06/2011
- Re: [TeXmacs] More quasi and cline, Sam Liddicott, 04/06/2011
- Re: [TeXmacs] More quasi and cline, Sam Liddicott, 04/06/2011
Archive powered by MHonArc 2.6.19.