The Icon Analyst
Total Page:16
File Type:pdf, Size:1020Kb
TThehe IconIcon AnalystAnalyst In-Depth Coverage of the Icon Programming Language April 1999 Number 53 ploration of weaving, which focuses on patterns. Instead, we use pattern-forms [3], which include In this issue … the Painter weaving language repertoire [2,4]. Weaving Drafts .................................... 1 Pattern-Form Drafts Graphics Corner ................................... 4 It’s easy enough to represent the five parts of A Small Programming Problem ...... 10 a draft by strings. The threading and treadling Built-In Generators ............................ 16 sequences (T-sequences) can be composed from Answers to Structure Quiz ............... 19 characters that label the shafts and treadles, re- spectively. The warp and weft color sequences (C- Quiz — Expression Evaluation ........ 19 sequences) can be composed from characters that What’s Coming Up ............................ 20 label colors. Weaving Drafts The tie-up is a matrix that can be represented by, say, concatenated rows composed of zeros and We now know that handwork is a heritage which no ones. It’s also necessary to add dimension informa- machine can ever take from us; we are adjusting our tion, since the matrix need not be square. needs to this knowledge. There is one missing ingredient: the colors — Marguerite P. Davison [1] themselves. To be general, we’d need the actual color values. For our purposes, however, Icon’s The term draft is used in weaving for any built-in color palettes do nicely. There are two description of a weave that can be used to produce reasons for this: (1) the number of different colors it on a loom. For a treadle loom, a draft has five in actual weaves is small, and (2) color fidelity is parts: not necessary for exploring patterns in weaves; in threading sequence fact, it is not even achievable in actual weaving. treadling sequence There is one potential problem with using warp color sequence palettes. The color palettes span color space in weft color sequence various ways. No color palette can come even close tie-up to representing, say, 50 shades of blue (although the grayscale palettes can represent up to 256 shades There are many other aspects of a weave that of gray). We’ve not seen this kind of problem in we won’t consider here, such as thread thickness. practice, but we’re working on programmer-de- fined palettes to supplement the built-in ones. Draft Formats Such defined palettes could handle situations the Drafts traditionally have been hand-drawn built-in ones cannot. Although programmer-de- on grid paper [2]. Most computer weaving pro- fined palettes do not exist yet, they at least give us grams display an on-screen grid that is familiar to an out for now. weavers, but weaving drafts are stored in propri- The name of the palette from which the color etary formats. There is also a program-indepen- labels in C-sequences are composed adds a line to dent format for exchanging drafts between pro- pattern-form drafts. We added a line for the draft grams. We’ll describe it later in this article. name, making a pattern-form draft seven lines in None of these formats is suitable for our ex- all. Figure 1 on the next page shows an example of a pattern-form draft. The Icon Analyst 53 / 1 Grammar Drafts To keep a draft together in one file, we de- signed a grammar-draft format that is composed We have used grammars to find and charac- of three sub-grammars — one for the T-sequences, terize patterns in various kinds of strings [3, 5-8]. one for the C-sequences, and a token grammar in To use this approach for pattern-form drafts, we which the name, tie-up, and palette are hidden need a corresponding grammar draft. The prob- away. The sequence pairs are connected in defini- lem is that a weaving consists of several relatively tions that use variables not contained in the se- unrelated parts. quences. The T-sequences naturally go together, since A grammar draft is shown in Figure 2 with they often have patterns in common — in fact, in long sequences truncated. It is the grammar from many cases the two T-sequences are the same: which the pattern-form draft in Figure 1 was de- “tromp as writ” in weaving parlance. rived. The C-sequences have similar relationships and use the same labeling characters. But the char- WIFs acters in T- and C-sequences mean different things: shafts and treadles versus colors. To combine them WIFs (Weaving Information Files) provide a all in one grammar invites chaos. program-independent way of specifying weaves. WIFs are widely used to exchange drafts between There are also patterns in tie-ups, but they weaving programs <1>, and there are several stand- tend to be two-dimensional in nature and search- alone programs for converting between propri- ing for such patterns in a one-dimensional repre- etary forms and WIFs <2-5>. sentation does not work well. aquadesign name [[1>8]∗5][[7<1]8∗4]765432[[1>8]∗5][[7<1]8∗4][7<1] threading [[1>8]∗10] treadling [G∗20][H∗39][G∗20][G∗19][H∗39][G∗20] warp colors [0–>80] weft colors c1 palette 8;8;1001001111000001111000000111000000111001100101000100101000100101 tie-up Figure 1. A Pattern-Form Draft name:T–aquadesign.wgr comment: axiom:@ genr:1 @–>X;Y X–>1234567812345678123456781234567812345678765432187654321876543218765432... Y–>1234567812345678123456781234567812345678123456781234567812345678123456... end: name:C–aquadesign.wgr comment: axiom:@ genr:1 @–>U;V U–>GGGGGGGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH... V–>0 end: name:t–aquadesign.wgr n–>aquadesign p–>c1 t–>8;8;1001001111000001111000000111000000111001100101000100101000100101 end: Figure 2. A Grammar Draft 2 / The Icon Analyst 53 The WIF format is text-based, very general, [WIF] and extensible. Its syntax is based on the Windows Version=1.1 INI format [9], which uses named sections that Date=April 20, 1998 contain lists of keywords and associated values. [email protected] Source Program=QD WIF Figure 3 shows portions of a typical WIF. Source Version=0.9.2 WIFs have properties that make them inap- [CONTENTS] propriate for direct use in our investigations: Color Palette=yes Weaving=yes … • The format is very verbose; a typical WIF [COLOR PALETTE] contains a large amount of redundant infor- Entries=16 mation. Form=RGB Range=0,255 • Parsing a WIF file is a messy process and not [WEAVING] something to do repeatedly. Shafts=16 Treadles=25 • The format provides no mechanism for de- [THREADING] scribing patterns — it’s just raw data. 1=1 2=2 On the other hand, WIFs provide a ready 3=1 source of material for studying patterns in weaves. 4=2 5=3 Some WIFs are available on the Web <6-8> and 6=4 there is a moderately priced CD-ROM that con- … tains thousands of WIFs [10]. [TIEUP] 1=4,5,6,7,8,9,10,11,12,13,14,16 To use WIFs, we need to be able to convert 2=1,2,6,11,12,13,14,15 them to pattern-form drafts. This is the kind of task 3=1,2,3,4,8,12,16 for which Icon is well suited. As is typical with 4=1,2,3,4,5,6,10,15 5=1,2,6,11,14 format-conversion programs, the process is messy 6=1,2,3,4,5,6,7,8,12,16 and infested with special cases. We won’t list the … program here: It would take up a lot of space [TREADLING] without providing much in the way of insight. We 1=17 2=18 will, however, include it with the Web material for 3=17 this issue of the Analyst, along with a consider- 4=18 ably simpler program to convert pattern-form drafts 5=17 6=18 to WIFs. … [COLOR TABLE] Further Articles 1=192,192,192 2=152,152,152 We have several articles on weaving in the 3=0,0,0 4=176,144,144 works, including 5=116,100,152 • a weaving case study 6=152,100,132 … • finding patterns in draft sequences [WARP COLORS] • creating images from drafts 1=6 • creating drafts from images 2=5 3=3 • name and algebraic drafting 4=3 5=3 • network drafting 6=8 • name and algebraic drafting … • sequence drafting [WEFT COLORS] 1=14 • dobby devices and liftplans 2=12 3=8 • weavability 4=14 • a weaving program 5=3 6=14 We’re also investigating Jacquard loom tech- … nology and exotic topics like three-dimensional Figure 3. A WIF weaving. The Icon Analyst 53 / 3 http://www.gac.edu/~max/weaving/ptn2wif/ The situation with respect to weaving is remi- niscent of versum sequences — the more we ex- 4. QD WIF (Macintosh) for Macintosh ProWeave , plore, the more we find to explore. Incidentally, WeaveMaker One, WeaveNet, and WeavePoint: we’re not finished with versum sequences — we’re http://www.softweave.com/html/QD_WIF.html just taking a breather. And don’t be surprised to see a versum weave. 5. WIFCNVT (Windows) for WeaveIt: Acknowledgment http://www.weaveit.com/support.htm We owe thanks to Jane Eisenstein, an experi- 6. Weaving File Exchange: enced handweaver. She uses several weaving pro- http://www.wyellowstone.com/users/ww/ grams for the Macintosh and is the author of QD weaving.htm#File Exchange WIF for that platform <5>. She has patiently an- 7. Association of Northwestern Weavers Guilds: swered our naive questions as we’ve been learning about weaving. She’s also given us pointers to ftp://anwg.org/pub/weaves/ other useful resources related to weaving. 8. Maple Hill Software: References http://www.mhsoft.com/wif/files/ 1. A Handweaver’s Pattern Book, Marguerite P.