Brian Harvey wrote: > > KERRB@Magill.UniSA.edu.au writes: > >What is the distinction b/w creating procedures and composing functions?? > > By "composing" I didn't mean "writing," as in composing music. I meant > the mathematical sense, in which composing functions f and g means > creating the new function h(x) = f(g(x)). > > In Logo terms, procedures are divided into commands, which do things, > and operations, which compute values; the operations correspond to > mathematical functions. (Strictly speaking, an operation is a function > only if it always gives the same output for the same input(s), so for > example RANDOM is an operation but not a function.) The question of > composition doesn't come up for commands, because they don't produce > a value that can be used as input to another procedure. With commands, > what you have is a *sequence* of events, rather than a *composition* > of functions. Note that, in Lisp, to make a sequence with,say, f1 f2 f3, you have to "compose" them inside the "sequencer" progn or prog1 or whatever: (progn (f1) (f2) (f3)) So, you really apply "progn" to the results returned by f1 f2 and f3, which consists in keeping only the last one (a lisp fun always returns at least nil). In Logo, the way to combine operations is usualy in an implicit "progn", but it could be with a "protect": protect f1 f2 f3 which means: do f1, and then f2, even if f1 fails. In a multithreaded Logo, the combinator could be a "parallel progn": start-all f1 f2 f3 which means: start f1 f2 and f3 simultaneously. So operations might be combined, but the combinator would act on the control flow, not the data flow, since there is none for operations. -- | # # | # # # | # # | # # # | # # | # # # | Jacques Duthen | | # # | # # # | # # | # # # | # # | # # # | duthen@club-internet.fr | |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_| --------------------------------------------------------------- Please post messages to the Logo forum to logo-l@gsn.org. Mail questions about the list administration to logofdn@gsn.org. To unsubscribe send unsubscribe logo-l to majordomo@gsn.org.
Global SchoolNet Foundation -
Linking Kids Around the World!
Copyright GSN - All Rights Reserved
- Comments
& Questions
Visit GSN's
Global
Schoolhouse for more exciting learning resources!
Search our Site
-
Home