ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: help required w.r.t " vardef "
@ 2004-04-10  4:55 vinuth madinur
  2004-04-13  9:01 ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: vinuth madinur @ 2004-04-10  4:55 UTC (permalink / raw)


Thankx Hans,

But why does this work with "def" and not with "vardef" . "list" is just a macro name i've used.

And "A,B,C,A" is just the replacement text I want when I call the macro "list".

Is there any other way of doing this?

Vinuth.
-- 
______________________________________________
Check out the latest SMS services @ http://www.linuxmail.org 
This allows you to send and receive SMS through your mailbox.


Powered by Outblaze

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Re: help required w.r.t " vardef "
  2004-04-10  4:55 help required w.r.t " vardef " vinuth madinur
@ 2004-04-13  9:01 ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2004-04-13  9:01 UTC (permalink / raw)


At 06:55 10/04/2004, you wrote:
>Thankx Hans,
>
>But why does this work with "def" and not with "vardef" . "list" is just a 
>macro name i've used.
>
>And "A,B,C,A" is just the replacement text I want when I call the macro 
>"list".

from the name vardef you can deduce that it acts like a var; see Jonathan 
Nicholl's excellent explanation for more details,

in general a vardef is used in situations where you want to do a lot of 
things and only get back teh result

n := 0 ;

def blabla (expr x) =
   (1+x)
enddef ;

a := blabla(1) ; % a := (1+1)

def blabla (expr x) =
   n := n + 1 ;
   (1+x)
enddef ;

a := blabla(1) ; % fails, since now the expansion becomes visible: a := n 
:= n+1 ; (1+x)

vardef blabla (expr x) =
   n := n + 1 ;
   (1+x)
enddef ;

a := blabla(1) ; % a := (1+1)

also, vardef has grouping built in

>Is there any other way of doing this?

not that i know of

Hans  

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: help required w.r.t " vardef "
@ 2004-04-15  4:05 vinuth madinur
  0 siblings, 0 replies; 4+ messages in thread
From: vinuth madinur @ 2004-04-15  4:05 UTC (permalink / raw)


 I'm sorry that I hadn't read the mail by Jonathan Nicholl.
Yeah, that was very clear and precise . thank u all.

But I still can't figure out how I can have the contents of variables or the expansion of "def" as suffixes.I now think it's not possible with "def".

I'll try out somethings now.
Thanks again.

Vinuth.
-- 
______________________________________________
Check out the latest SMS services @ http://www.linuxmail.org 
This allows you to send and receive SMS through your mailbox.


Powered by Outblaze

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: help required w.r.t " vardef "
@ 2004-04-15  3:40 vinuth madinur
  0 siblings, 0 replies; 4+ messages in thread
From: vinuth madinur @ 2004-04-15  3:40 UTC (permalink / raw)


Thanks Hans!
              That wolud help me a lot.Also thanks for the reference u mentioned.I'll try it.

Now one last thing :

 Is there a way of having variable arrays whose contents can be used as "suffixes"?

 something like ,

a[0]:= "A" ; 
a[1]:= "B" ; 
a[2]:= "C" ;   %a variable array "a[]"


there are other three "pair" variables : T.A,T.B,T.C;

so now I want to have ,

i := 0;
T.a[i] = blahblah();

so here I want to use the contents of "a[]" as suffix of variable " T " .

I don't know what kind of data type to use for "a[]".
I tried a[] as string type and used it with 
 
 forsuffixes $=a[0],a[1],a[2]: 
   ..... 
 endfor;
but this does not work.

So, can u please help me out here?
thanx in advance.

Vinuth.
-- 
______________________________________________
Check out the latest SMS services @ http://www.linuxmail.org 
This allows you to send and receive SMS through your mailbox.


Powered by Outblaze

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-04-15  4:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-10  4:55 help required w.r.t " vardef " vinuth madinur
2004-04-13  9:01 ` Hans Hagen
2004-04-15  3:40 vinuth madinur
2004-04-15  4:05 vinuth madinur

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).