9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] rcmain
@ 2005-12-09 21:02 erik quanstrom
  2005-12-09 21:34 ` Russ Cox
  0 siblings, 1 reply; 3+ messages in thread
From: erik quanstrom @ 2005-12-09 21:02 UTC (permalink / raw)
  To: 9fans

rcmain has an interesting construct. it goes something like

	if (~ $#'fn#cd' 1)
		cmd;

i was a little curious about this so i tried this

	fn fu {echo bar}
	if (~ $#'fn#fu' 1)
		echo yes;
	if not
		echo no;

which outputs "no". however this 

	fn fu {echo bar}
	rc
	if (~ $#'fn#fu' 1)
		echo yes;
	if not
		echo no;

outputs "yes". 


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

* Re: [9fans] rcmain
  2005-12-09 21:02 [9fans] rcmain erik quanstrom
@ 2005-12-09 21:34 ` Russ Cox
  2005-12-09 21:46   ` erik quanstrom
  0 siblings, 1 reply; 3+ messages in thread
From: Russ Cox @ 2005-12-09 21:34 UTC (permalink / raw)
  To: erik quanstrom, Fans of the OS Plan 9 from Bell Labs

> rcmain has an interesting construct. it goes something like

What rcmain are you looking at?  I can't find $#'fn#cd' anywhere.

While we're on the topic of surprising constructs, I discovered
this about troff earlier today:

.ds A0 "This is string A0
.ds A1 "This is string A1
.ds A2 "This is string A2
.de A
.tm Look: \\*(A\\$1
..
.A 1

Russ


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

* Re: [9fans] rcmain
  2005-12-09 21:34 ` Russ Cox
@ 2005-12-09 21:46   ` erik quanstrom
  0 siblings, 0 replies; 3+ messages in thread
From: erik quanstrom @ 2005-12-09 21:46 UTC (permalink / raw)
  To: 9fans, Russ Cox

oh boy, that's from an /old/ p9p. i think it's an rcmain that came with the p9p
awhile ago, but i may have written it. i don't remember writing something
like that, but hey, i can't remember what i did last week. 

- erik

Russ Cox <rsc@swtch.com> writes

| 
| > rcmain has an interesting construct. it goes something like
| 
| What rcmain are you looking at?  I can't find $#'fn#cd' anywhere.


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

end of thread, other threads:[~2005-12-09 21:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-09 21:02 [9fans] rcmain erik quanstrom
2005-12-09 21:34 ` Russ Cox
2005-12-09 21:46   ` erik quanstrom

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).