Re: Use of lambda

Subject: Re: Use of lambda
From: Chris Maden <crism@xxxxxxx>
Date: Thu, 26 Feb 1998 14:09:37 -0500
[Dan Speck]
> You aren't calling the function in the above (string-append "..."
> pages "...") you are accessing the value of the variable pages which
> should be a function of no arguments. You should be getting an error
> message when (string-append ...) tries to append its string
> arguments to the procedure that pages evaluates to. In order to call
> the function you need to wrap the pages variable in parentheses,
> e.g., (pages). Perhaps you could post a complete code fragment that
> demonstrates Jade's behavior when presented with the above?

[Dave Love]
> This seems confused, but I'm not sure how without more context.  On
> the basis of the above fragment, Jade has a bug since the second
> argument of string-append is a function, not string.  Do you
> _really_ mean that it's evaluated as (string-append "..." (pages)
> "...")?  It's not what I see:

Here's the definition of pages:

;; pages is a string for inclusion as MIF Pages.
(define pages
  (lambda ()
    (string-append "<Page 
 <PageType LeftMasterPage>
 <PageTag `Left'>
 <TextRect 
  <ID 1>
... yadda yadda ...
<TextFlow 
 <Para 
  <PgfTag `Header'>
  <ParaLine 
   <TextRectID 4>
   <Variable 
"
		   (if (member (gi (current-node))
			       '("GLOSSARY"
				 "GLOSSDIV"
				 "PREFACE"))
		       "    <VariableName `Running H/F 3'>
"
		       "    <VariableName `Running H/F 4'>
")
		   "   > # end of Variable
   <Char Tab>
   <Variable 
    <VariableName `Current Page #'>
   > # end of Variable
  >
 > # end of Para
> # end of TextFlow
... yadda yadda ...
")))

Here's the procedure that calls it:

(define (make-mif-start page-num
			page-num-style)
  (sosofo-append (make formatting-instruction
		       data: (string-append "<MIFFile 5.00> # Generated by Jade 1.0
<PgfCatalog 
"
;; some stuff - then:
					    pages
					    "<TextFlow 
 <TFTag `A'>
 <TFAutoConnect Yes>
 <Notes 
"))
		 ;; process footnotes
		 (make-footnotes)
		 (make formatting-instruction
		       data: " > # end of Notes
")))

Here's what I get:

[... stuff before pages gets called ...]
<Page 
 <PageType LeftMasterPage>
 <PageTag `Left'>
 <TextRect 
  <ID 1>
[... stuff omitted ...]
<TextFlow 
 <Para 
  <PgfTag `Header'>
  <ParaLine 
   <TextRectID 4>
   <Variable 
    <VariableName `Running H/F 4'>
   > # end of Variable
   <Char Tab>
   <Variable 
    <VariableName `Current Page #'>
   > # end of Variable
  >
 > # end of Para
> # end of TextFlow

You can see that the conditional for TextRectID 4 is correctly
evaluated.  Is it because the procedure was included in another
procedure?  Is Jade unusually tolerant in this case?

Thanks,
Chris
-- 
<!NOTATION SGML.Geek PUBLIC "-//Anonymous//NOTATION SGML Geek//EN">
<!ENTITY crism PUBLIC "-//O'Reilly//NONSGML Christopher R. Maden//EN"
"<URL>http://www.oreilly.com/people/staff/crism/ <TEL>+1.617.499.7487
<USMAIL>90 Sherman Street, Cambridge, MA 02140 USA" NDATA SGML.Geek>


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread
  • Use of lambda
    • Chris Maden - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id LAA28437Thu, 26 Feb 1998 11:52:50 -0500 (EST)
      • Daniel Speck - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id NAA00390Thu, 26 Feb 1998 13:13:50 -0500 (EST)
        • Chris Maden - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id OAA01627Thu, 26 Feb 1998 14:05:15 -0500 (EST) <=
      • Dave Love - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id NAA01122Thu, 26 Feb 1998 13:51:12 -0500 (EST)