Path: utzoo!utgpu!news-server.csri.toronto.edu!helios.physics.utoronto.ca!ists!yunexus!nexus.YorkU.CA!oz From: oz@nexus.YorkU.CA (Ozan Yigit) Newsgroups: comp.lang.scheme Subject: format [topics from hell, part 1] Message-ID: <22449@yunexus.YorkU.CA> Date: 18 Apr 91 16:29:33 GMT Sender: news@yunexus.YorkU.CA Organization: York U. Communications Research & Development Lines: 28 Has anyone in the scheme community given any serious thought to (or produced a proposal for) a format primitive for some n, R^nRS inclusion? Existing implementations seem to provide two slightly different version of this primitive: one that takes a port argument (and thus like fprintf in C) and another that does not, and returns the formatted string (and thus like sprintf in C). Unfortunately, both versions are called "format". The former is presumably a carry-over from the past, where destination parameter specifies where the formatted string should go, and if that is nowhere flag (nil or #f) the function returns the formatted string, and thus provides the non-io functionality of the latter. Over the years, I found the latter to be the most convenient form, probably because it is a simpler form that only does one thing and one thing alone. Producing a wrapper around to get the "extended" functionality of the former is, of course, trivial. What is better for scheme? A low-level (string-producing) format primitive [which should probably be called something other than "format", to avoid confusion], or the classic format-as-io-primitive-that-can-return-strings approach? oz --- In seeking the unattainable, simplicity | Internet: oz@nexus.yorku.ca only gets in the way. -- Alan J. Perlis | Uucp: utai/utzoo!yunexus!oz