<<

E92 MAPS 39 Jean-Michel Hufflen

Using TEX’s language within a course about functional programming

Abstract ative programming—the paradigm implemented within We are in charge of a teaching unit, entitled Advanced more ‘traditional’ languages, such as [16]—emphasises Functional Programming, for 4th-year university changes in state. Many universities include courses about students in . This unit is optional functional programming, examples being reported in [35]. within the curriculum, so students attending it are especially interested in programming. The main Besides, such languages are sometimes taught as Vrst language studied in this unit is Scheme, but an programming languages, according to an approach com- important part is devoted to general features, e.g., parable to [1, 8, 32] in the case of Scheme. lexical vs. dynamic scoping, limited vs. unlimited extent, Let us remark that some tools developed as part of call by vs. call by name or need, etc. As an TEX’s galaxy have already met functional programming: alternative to other programming languages, X allows E cl-bibtex [18], an extension of BTEX—the bibliography us to show a language where dynamic and lexical A \def \edef processor [26] usually associated with the LTEX word scoping— vs. —coexist. In addition, we can 2 show how dynamic scoping allows users to customise processor [20]—is written using  C  L [7]; TEX’s behaviour. Other commands related to strategies x◦ındy, a multilingual index processor for documents writ- are shown, too, e.g., \expandafter, \noexpand. More ten using LATEX[24, § 11.3] is based on C  L, too; generally, T X commands are related to macros in more E BTEX2 [4], a converter from .bib format—used by classical programming languages, and we can both the bibliography Vles of BT X—to  ,3 is emphasise difficulty related to macros and show E written in  4 [21]; MlBT X,5, a re-implementation non-artificial examples. So TEX is not our unit’s main E focus, but provides significant help to illustrate some of BTEX focusing on multilingual features [11] is writ- difficult notions. ten in Scheme [15]; as another example, Haskell6 [28] has been used in [38]; last but not at least, there were Keywords proposals for developing 7—a re-implementation of N S Functional programming, TEX programming, lexical vs. TEX—using  ,8 an object-orientedT system based on dynamic , macros, evaluation strategies. C  L [39]. The unit we mentioned above is entitled Advanced Functional Programming.9 It is an optional unit for 4th- Introduction year university students in Computer Science, part of the curriculum proposed at the University of Franche-Comté, If we consider programming in TEX[17], we have to at the Faculty of Science and Technics, located at Besan- admit that this language is old-fashioned, and programs çon, in the east of France. Most of these students already are often viewed as rebuses, as shown in the Pearls of TEX know a functional : Scheme, be- programming demonstrated at BachoTEX conferences.1 cause they attended a unit introducing this language in Some interesting applications exemplifying this language the 2nd academic year in Computer Science.10 Other can be found in [19, 30], but as noticed in [5], ‘some of students, who attended the Vrst two university years at these programming tricks are ingenious and even elegant. Belfort, know  . So this unit is not an introductory However [. . . ] it is time for a change’. course; we delve thoroughly into functional program- So, at Vrst glance, it may be strange to use some ex- ming. amples of TEX programming within a present-day course devoted to Functional programming. Let us recall that In the next section, we expose the ‘philosophy’ of our this treats as the unit. Then we summarise the features of TEX that are evaluation of mathematical functions, avoiding state and useful within this unit and discuss our choice of TEX. mutable data as much as possible. Functional program- Reading this article only requires basic knowledge of ming emphasises functions’ application, whereas imper- programming; readers who would like to go thoroughly Using TEX’s language within a course about functional programming EUROTEX 2009 E93

(define ( x) (defun factorial (x) ;; Returns x! if x is a natural number, the ‘false’ "Behaves like the namesake in Scheme ;; value otherwise. (cf. Fig. 1)." (and (integer? x) (not (negative? x)) (and (let tr-fact ((counter x) (integerp x) (not (minusp x)) (acc 1)) (labels ((tr-fact (counter acc) ;; Returns acc * counter!. ;; The labels special form of (if (zero? counter) ;; C  L introduces local acc ;; recursive functions [33, § 7.5]. (tr-fact (- counter 1) (if (zerop counter) (* acc counter)))))) acc (tr-fact (- counter 1) Figure 1. The factorial function, written using Scheme. (* acc counter))))) (tr-fact x 1))))

Figure 2. The factorial function in . into Scheme constructs we have used throughout our examples can refer to [32], very didactic. Of course, the indisputable reference about T X commands is [17]. E know. Besides, this unit ends with some advanced fea- tures of this language: delayed evaluation, , Our unit’s purpose hygienic macros [9]. In addition, this choice allows us to perform a demonstration of  15 [13], initially de- Functional programming languages have a common root signed as the stylesheet language for  16 texts. These in the λ-calculus, a developed in the 1930s students attended a unit about  and  17 [36] the by to investigate function deVnition, func- year before, and  —which may be viewed as  ’s tion application, and [3]. However, these pro- ancestor—is based on a subset of Scheme, enriched by gramming languages are very diverse, some—e.g., the Lisp 11 12 specialised libraries. dialects —are dynamically typed, some—e.g., Stan- When we begin to program, the language we are learn- 13 [27],  , —are strongly typed14 and dard ML Haskell ing is always shown as Vnite product. It has precise rules, include a : end-users do not mechanism precise semantics, and is consistent. According to the have to make precise the types of the variables they use, language used, some applications may be easy or diXcult they are inferred by the type-checker; in practice, end- to implement. When you put down a statement, running users have to conceive a program using a strongly typed it often results in something predictable. That hides an approach because if the type-checker does not succeed in important point: a language results from some important associating a type with an , this expression is choices: does it use lexical or dynamic scoping, or both? proclaimed incorrect. As examples, Fig. 1 (resp. 2) show To illustrate this notion with some examples in TEX, that how to program the factorial function in Scheme (resp. is the diUerence between the commands \firstquestion C  L). In both cases, the factorial function we and \secondquestion in Fig. 4. The former can be related give can be applied to any value, but returns the factorial to lexical scoping, because it uses the value associated of this value only if it is a non-negative integer, otherwise, with the \state command at deVnition-time and pro- the result is the ‘false’ value. Fig. 3 gives the same func- duces: tion in Standard ML: it can only be applied to an integer, as reported by the type-checker (see the line beginning You’re happy, ain’t U? with ‘>’). whereas the latter can be related to dynamic scoping, A course explaining the general principles of func- because it uses the value of the \state command at run- tional programming with an overview of some existing time and yields: functional programming languages would be indigestible You’re afraid, ain’t U? for most students, since they could only with diXculty be- come familiar with several languages, due to the amount Students Vnd this notion diXcult: some know that of time that can be allocated to each unit. In addition, the- they can redeVne a variable by means of a let form oretical notions without practice would not be very useful. in [22], but they do not realise that this So, our unit’s Vrst part is devoted to the λ-calculus’ bases would be impossible within lexically-scoped languages [10]. Then, all the practical exercises are performed with such as C or Scheme. In other words, they do not have only one language, Scheme, which most students already transversal culture concerning programming languages, E94 MAPS 39 Jean-Michel Hufflen

fun factorial x = \def\state{happy} (* If x is a negative integer, the predeVned \edef\firstquestion{You’re \state, ain’t U?\par} exception Domain is raised [27, §§ 4.5–4.7]. The \def\secondquestion{You’re \state, ain’t U?\par} internal function tr_fact is deVned by means of \def\state{afraid} [27, § 4.4]. Figure 4. Lexical and dynamic scope within T X. *) E if x < 0 then raise Domain else let fun tr_fact 0 acc = acc | tr_fact counter acc = {\def\firsttwodigits{20} tr_fact (counter - 1) \def\lasttwodigits{09} acc * counter \global\edef\thisyear{% in tr_fact x 1 \firsttwodigits\lasttwodigits}} end ; Figure 5. Using TeX’s \global command. > val factorial = fn : int -> int

Figure 3. The factorial function in Standard ML. You’re \noexpand\state, ain’t U?\par} and this command \thirdquestion behaves exactly like they see each of them as an independent cell, a of \secondquestion (cf. Fig. 4). black box. A second construct, useful for a point of view related to conception, is \global, shown in Fig. 5, because it The central part of our unit aims to emphasise these allows ‘global’ commands to be deVned within local en- choices: what are the consequences of a lexical (resp. dy- vironments. There is an equivalent method in Scheme, namic) scope? If the language is lexical (resp. dynamic), but not naturally: see Appendix. Let us go on with this what kinds of applications are easier to be implemented? Vgure; any TEXnician knows that \thisyear no longer Likewise, what are the advantages and drawbacks of the works if ‘\edef’ is replaced by ‘\def’. This illustrates that call-by-value18 strategy vs. call-by-name? In the lan- TEX commands have limited extent. guage you are using, what is variables’ extent?19 Of course, all the answers depend on the programming lan- Nuances related to notion of equality exist in TEX: let guages considered. But our point of view is that a course \a be a command already deVned: based on Scheme and using other examples in TEX may \let\b\a be of interest. \def\c{\a} the former expresses that \a and \b are ‘physically’ equal, T X’s features shown it allows us to retain \a’s deVnition, even it is changed E afterwards; the latter expresses an equality at run-time, As mentioned above, \def and \edef allow us to illustrate ensuring that the commands \c and \a are identical, even the diUerence between lexical and dynamic scope. Most if \a changes.22 present-day programming languages are lexical, but we Scheme’s standard does not allow end-users to know can observe that the dynamic scoping allows most TEX whether or not a variable x is bound.23 ATEXnician commands to be redeVned by end-users. The dynamic would use: scope is known to cause ,20 but T X is variable captures E \expandafter\ifx\csname x\endcsname\relax...% protected against undesirable redeVnitions by its internal \else...% commands, whose names contains the ‘@’ character. Of \fi course, forcing these internal commands’ redeVnition is allowed by the \makeatletter command, and restoring For beginners in programming with TEX, this is quite a complicated statement requiring the commands \relax TEX’s original behaviour is done by the \makeatother command. and \ifx to be introduced. However, that leads us to If we are interested in implementation considerations, introduce not only the construct \csname...\endcsname, the commands within an \edef’s body are expanded, so but also \expandafter, which may be viewed as kind of this body is evaluated as far as possible.21 To show this call by value. A simpler example of using this strategy is point, we can get dynamic scope with an \edef com- given by: mand by preventing command expansion by means of \uppercase\expandafter{\romannumeral 2009} \noexpand: —which yields ‘MMIX’—since this predeVned command \edef\thirdquestion{% \uppercase is given its only argument as it is; so Using TEX’s language within a course about functional programming EUROTEX 2009 E95 putting the \expandafter command causes this argu- Conclusion ment to be expanded, whereas removing it would pro- Our unit is viewed as theoretical, whereas other optional duce ‘mmix’, because \uppercase would leave the group units are more practical, so only a few students attend {\romannumeral 2009} untouched, then \romannumeral ours. But in general, students who choose it do not regret would just be applied to 2009. That is, T X commands are E it, and in fact enjoy it. They say that they have clear ideas macros24 in the sense of ‘more classical’ programming about programming after attending it. Some students languages. view our examples in T X as a historical curiosity since The last feature we are concerned with is mixVxed E this language is quite old and originates from the 1980s, terms, related to parsing problems and priorities. T X can E but they are surprised by its expressive power. Some, that put mixVxed terms into action by means of delimiters in are interested in using T X more intensively, can connect a command’s argument, as in: E programming in TEX to concepts present in more modern \def\put(#1,#2)#3{...} languages.

Discussion Acknowledgements As shown in the previous section, we use TEX as When I decided to use TEX to demonstrate ‘alternative’ a ‘cultural complement’ for alternative constructs implementations of some features related to program- and implementations. Sometimes, we explain dif- ming, I was quite doubtful about the result, even if I ferences by historical considerations: for example, knew that some were interested. But feedback was pos- the diUerence between \def and \long\def—that is, itive, some students were encouraged to go thoroughly A \textbf{. . . } the diUerence in LTEX between and into implementing new TEX commands for their reports \begin{bfseries}...\end{bfseries}—comes from per- and asked me for some questions about that. Thanks to formance considerations, since at the time TEX came out, them, they encouraged me to go on with this way in turn. computers were not as eXcient as today. Nevertheless, are there other languages that could be successfully used as support of our unit? Yes and no. Appendix: \global in Scheme An interesting example could be C  L. Nev- In this appendix, we show that a construct like \global in ertheless, this language is less used now than some years T X may be needed. Then we will explain why it cannot ago, and it is complexiVed by the use of several name- E be implemented in Scheme in a ‘natural’ way. spaces.25 Besides, this language’s initial library is as big as possible; it uses old constructs.26 That is why we give Let us consider that we are handling dimensions, that some examples in C  L, but prefer for our course is, a number and a measurement unit—given as a symbol— to be based on Scheme, which is ‘the’ modern Lisp dialect, like in TEX or  . A robust solution consists of using a from our point of view. list preVxed by a marker—e.g., ((*dimension*) 1609344 Concerning the coexistence of lexical and dynamic mm)—such that all the lists representing dimensions—of variables, the 27 language [37] provides it. In addi- type dimension—share the same head element, deVned tion, it has been successfully used to develop large soft- once. To put this marker only when the components—a 29 ware packages, so examples could be credible. However, it number and a unit —are well-formed, it is better for seems to us that dynamic variables in Perl are rarely used the access to this marker to be restricted to the functions in practice. In fact, the two dynamic languages mainly interfacing this structure. So here is a proposal for an implementation of functions dealing with dimensions: used are Emacs Lisp and TEX, in the sense that end-users may perceive this point. From our point of view, using (let ((*marker* ’(*dimension*))) examples in Emacs Lisp requires good knowledge about (define (mk-dimension unit) the emacs28 editor, whereas we can isolate, among TEX’s ;; Performs some checks and creates an features, the parts that suit us, omitting additional details ;; object of type dimension, whose about TEX’s tasks. Likewise, such an approach would be ;; components are r and unit. more diXcult with Perl. ...) (define (dimension? x) ;; Returns #t if x is of type dimension, #f ;; otherwise. ...) (define (dimension->mm dimension-0) E96 MAPS 39 Jean-Michel Hufflen

(define mk-dimension) (define dimension?) (define dimension->mm)

(let ((*marker* ’(*dimension*)) ; Only the cell’s address is relevant. (allowed-unit-alist ‘((cm . ,(lambda (r) (* 10 r))) ; Each recognised unit is associated with a function giving the (mm . ,values)))) ; corresponding length in millimeters. (set! mk-dimension (let ((allowed-units (map car allowed-unit-alist))) (lambda (r unit) (and (real? r) (>= r 0) (memq unit allowed-units) (list *marker* r unit))))) (set! dimension? (lambda (x) (and (pair? x) (eq? (car x) *marker*)))) (set! dimension->mm (lambda (dimension-0) ; dimension-0 is supposed to be of type dimension. ((cdr (assq (caddr dimension-0) allowed-unit-alist)) (cadr dimension-0)))))

Figure 6. Global definitions sharing a common lexical environment in Scheme.

;; Returns the value of dimension-0, [ 2 ] Neil B : The Concise  Companion. ;; expressed in millimiters. Addison-Wesley. 1997. . . . )) [ 3 ] Alonzo C: The Calculi of Lambda- Conversion. Princeton University Press. 1941. Unfortunately, this does not work, because define special [ 4 ] Jean-Christophe F  and Claude M$: forms inside the scope of a let special form are viewed The BTEX2 Home Page. June 2006. http: as local deVnitions, like \def inside a group in TEX. So, //www.lri.fr/~filliatr/bibtex2html/. mk-dimension, dimension?, and dimension->mm become [ 5 ] Jonathan F : “TEX as a Callable Function”. In: inaccessible as soon as this let form is processed. The EuroTEX 2002, pp. 26–30. Bachotek, Poland. April solution is to deVne these three variables globally, and 2002. modify them inside a local environment, as shown in [ 6 ] Michael . G , Arthur J. M  and Fig. 6. Christopher P. W: Edinburgh . No. 78 in . Springer-Verlag. 1979. This modus operandi is quite artiVcial, because it uses [ 7 ] Paul G :  C  L. Series in side eUects, whereas functional programming aims to ArtiVcial Intelligence. Prentice Hall, Englewood avoid such as far as possible. But in reality, from a CliUs, New Jersey. 1996. point of view related to conception, there is no ‘actual’ [ 8 ] Jean-Michel H  : Programmation fonction- mk-dimension side eUect, in the sense that variables like , nelle en Scheme. De la conception à la mise en dimension? dimension->mm , and would have been Vrst œuvre. Masson. Mars 1996. given values, and then modiVed. The Vrst bindings may [ 9 ] Jean-Michel H  : 30 Programmation fonc- be viewed as preliminary declarations; however, using tionnelle avancée. Notes de cours et exercices. ‘global’ declarations for variables introduced within a Polycopié. Besançon. Juillet 1997. local environment would be clearer, as in TEX. To sum up, [ 10 ] Jean-Michel H  : Introduction au λ-calcul such an example illustrates that some use of assignment (version révisée et étendue). Polycopié. Besançon. forms are not related to actual side eUects, and TEX’s Février 1998. \global command allows us to explain how this example [ 11 ] Jean-Michel H  : “A Tour around MlBTEX could appear using a ‘more functional’ form, without any and Its Implementation(s)”. Biuletyn , side eUect.31 Vol. 20, pp. 21–28. In BachoTEX 2004 conference. April 2004. References [ 12 ] Jean-Michel H  : “Managing Languages within MlBTEX”. boat, Vol. 30, no. 1, [ 1 ] Harold A  and Gerald Jay S , with pp. 49–57. July 2009. Julie S : Structure and Interpretation of [ 13 ] International Standard / 10179:1996(): Computer Programs. The MIT Press, McGraw-  . 1996. Hill Book Company. 1985. Using TEX’s language within a course about functional programming EUROTEX 2009 E97

[ 14 ] Technology. March 2008. http://java.sun. [ 27 ] Lawrence C. P  : for the Working com. Programmer. 2nd edition. Cambridge University [ 15 ] Richard  , William . C  , Jonathan A. Press. 1996. R, Harold A  , Norman I. A  , [ 28 ] Simon P J , ed.: Haskell 98 Language David H. B , Gary B , R. Kent D, and Libraries. The Revised Report. Cambridge Daniel P. F , Robert H , Chris University Press. April 2003. H  , Christopher T. H , Eugene Edmund [ 29 ] Erik T. R: Learning  . O’Reilly & Associates, K  ,J, Donald O , Kent M. P , Inc. January 2001. Guillermo J. R, Guy Lewis S ,J, Ger- [ 30 ] Denis B. R : « Anatomie d’une » . ald Jay S and Mitchell W : “Revised5 Cahiers GUTenberg, Vol. 31, p. 19–27. Décembre Report on the Algorithmic Language Scheme”. 1998. , Vol. 11, no. 1, pp. 7–105. August 1998. [ 31 ] Michael S, William C  , R. Kent [ 16 ] Brian W. K  and Dennis M. R: The D, Matthew F , Anton  S , C Programming Language. 2nd edition. Prentice Richard K , Jonathan R, Robert Bruce Hall. 1988. F   and Jacob M: Revised6 Report [ 17 ] Donald Ervin K : Computers & Typesetting. on the Algorithmic Language Scheme. September Vol. A: The TEXbook. Addison-Wesley Publishing 2007. hhtp://www.r6rs.org. Company, Reading, Massachusetts. 1984. [ 32 ] George S  and Daniel P. F : [ 18 ] Matthias K1: ABTEX System in Common Scheme and the Art of Programming. The  Lisp. January 2003. http://www.nongnu.org/ Press, McGraw-Hill Book Company. 1989. cl-bibtex. [ 33 ] Guy Lewis S ,J., with Scott E. F , [ 19 ] Thomas L R : La maîtrise de TEX et Richard P. G , David A. M , Daniel L. LATEX. Masson. 1995. W , Daniel Gureasko B, Linda G. [ 20 ] Leslie L : LATEX: A Document Preparation DM , Sonya E. K , Gregor K , System. User’s Guide and Reference Manual. Crispin P, Kent M. P , Richard Addison-Wesley Publishing Company, Reading, W and Jon L W: C  L. The Massachusetts. 1994. Language. Second Edition. Digital Press. 1990. [ 21 ] Xavier L, Damien D , Jacques G [ 34 ] “TEX Beauties and Oddities. A Permanent Call , Didier R$  and Jéróme V  : The for TEX Pearls”. In TEX: at a turning point, or at Objective System. Release 0.9. Documen- the crossroads? BachoTEX 2009, pp. 59–65. April tation and User’s Manual. 2004. http://caml. 2009. inria.fr/pub/docs/manual-/index.html. [ 35 ] Simon T  and Steve H : “Functional [ 22 ] Bill L, Dan LL, Richard M. S Programming through the Curriculum”. In: and  GNU M  G:   Emacs FPLE ’95, pp. 85–102. Nijmegen, The Netherlands. Lisp Reference Manual for Emacs Version 21. December 1995. Revision 2.8. January 2002. http://www.gnu. [ 36 ] W3C:  Transformations ( ). Version 2.0. org//emacs/elisp-manual/. 3 Recommendation. Edited by Michael H. Kay. [ 23 ] John MC: “Recursive Functions of January 2007. http://www.w3.org/TR/2007/ Symbolic Expressions and Their Computation by WD-xslt20-20070123. Machine, Part I”. Communications of the ACM, [ 37 ] Larry W , Tom C  and Jon O : Vol. 3, no. 4, pp. 184–195. April 1960. Programming Perl. 3rd edition. O’Reilly [ 24 ] Frank M  and Michel G , with & Associates, Inc. July 2000. Johannes B , David C  , Chris A. R [ 38 ] Halina W^. i Ryszard K : „Od  -a , Christine D and Joachim S: The do TEX-a, używając Emacsa i Haskella“. Biuletyn LATEX Companion. 2nd edition. Addison-Wesley , tom 23, strony 35–39. In BachoTEX 2006 Publishing Company, Reading, Massachusetts. conference. kweicień 2006. August 2004. [ 39 ] Jiři Z o :“ : Programming Languages NTS [ 25 ] Chuck M  and Bill K :  and Paradigms”. In: EuroTEX 1999, pp. 241–245. &  : The DeVnitive Guide. 5th edition. Heidelberg (Germany). September 1999. O’Reilly & Associates, Inc. August 2002. [ 26 ] Oren P  : BTEXing. February 1988. Part of the BTEX distribution. E98 MAPS 39 Jean-Michel Hufflen

Notes lambda expression’s body. They use a technique—so-called lexical closure—allowing the function to retrieve its deVnition 1. The most recent pearls can be found in [34]. environment. 2. merican ational tandards nstitute. A N S I 22. There is another distinction in Scheme, between ‘physi- 3. HyperText Markup Language, the language of pages. cal’ (function eq?) and ‘visual’ equality (function equal?)[31, [25] is a good introduction to it. § 11.5]. 4. Categorical Abstract Machine Language. 23. C  L allows that about variables and functions, by 5. MultiLingual BTEX. means of the functions boundp and fboundp [33, 7.1.1]. 6. This language was named after logician Haskell Brooks Curry 24. Macros exist in Scheme: the best way to implement them (1900–1982). is the use of hygienic macros, working by pattern-matching [31, 7. New Typesetting System. It was Vnally developed using Java §§ 11.2.2 & 11.19]. [14]. 25. As an example of handling several namespaces in C  8. C  L Object System. L, let is used for local variables, whereas local recursive 9. ‘Programmation fonctionnelle avancée’ in French. In 2009, it functions are introduced by labels, as shown in Fig. 2. has been renamed to ‘Outils pour le développement’(Tools for 26. For example, there is no hygienic macro in C  L. ), but changes in the contents are slight. Development 27. Practical Extraction Report Language. 10. The program of this 2nd academic year unit can be found 28. Editing MACros. in French in [8]. 29. . . . although we consider only centimeters and millimeters 11. ‘Lisp’ stands for ‘LISt Processing, because Lisp dialects’ in the example given in Fig. 6, for sake of simplicity. major structure is linked lists. Their syntax is common and 30. In Scheme’s last version, a variable can be deVned without based on fully-parenthesised preVxed expressions. Lisp’s Vrst an associated value [31, § 11.2.1]. That was not the case in the version, designed by John McCarthy, came out in 1958 [23]. version before [15, § 5.2], so such a variable declaration was This language has many descendants, the most used nowadays given a dummy value, which enforced the use of side eUects. being C  L and Scheme. 31. Many data structures, comparable with our type 12. ‘Dynamically typed’ means that we can know the type of dimension, are used within MlBT X’s implementation, as an object at run-time. Examples are given in Figs. 1 & 2. E brieWy sketched in [12]. Another technique, based on message- 13. ‘ ’ stands for ‘ eta anguage’ and has been initially devel- M L passing, allows us to avoid side eUects. Only one function oped within the formal proof system  (Logic for Computable would be deVned to manage dimensions, and the three func- Functions) [6]. Later on, it appears as an actual programming tionalities implemented by mk-dimension, dimension?, and language, usable outside this system, and its standardisation dimension->mm would be implemented by messages sent to the resulted in the Standard ML language. general function, the result being itself a function. 14. There are several deVnitions of strong typing. The most used within functional programming is that the variables are typed at compile-time. Some courses at the same level are based on Jean-Michel Hufflen a strongly typed functional programming language, examples LIFC (EA CNRS 4157), being  or Haskell. Is that choice better than Scheme? This University of Franche-Comté, 16, route de Gray, is a lively debate. . . but it is certain that these courses do not 25030 Besançon Cedex, France emphasise the same notions as a course based on a Lisp dialect. 15. Document Style Semantics SpeciVcation Language. 16. Standard Generalised Markup Language. Ancestor of  (eXtensible Markup Language); it is only of historical interest now. Readers interested in  (resp.  ) can refer to [2] (resp. [29]). 17. eXtensible Stylesheet Language Transformations. 18. Nowadays, the call by value is the most commonly used strategy—in particular, in C and in Scheme—the argument ex- pression(s) of a function are evaluated before applying the func- tion. For example, the evaluation of the expression (factorial (+ 1 9))—see Fig. 1—begins with evaluating (+ 9 1) into 10, and then factorial is applied to 10. In other strategies, such as call by name or call by need, argument expressions are evaluated whilst the function is applied. 19. The extent of a variable may be viewed as its lifetime: if it is limited, the variable disappears as soon as the execution of the establishing it terminates; if it is unlimited, the variable exists as long as the possibility of reference remains. In Scheme, variables have unlimited extent. 20. A variable capture occurs when a binding other than the expected one is used. 21. On the contrary, Scheme interpreters do not evaluate a