In order to use VTK, I tried to read TCL for three days. I used to use C ++-style languages. Few users. When this project is over, it will be thrown away! The knowledge of VTK Guide may be sufficient in the past few days.
I recently saw Afi's hundred passions classics, which are sorted by rank. I want to sort it by age, and I thought that Tcl is still a little special in character processing, so I tried to train my hands.
The original webpage:
1. Casablanca (1942) Casablanca, North Africa spy film
2. Gone With the Wind (1939)
3. West Side Story (1961) West District story
4. Roman Holiday (1953) Rome holiday
5. An Affair to Remember (1957), the top floor of the Empire State Building in New York, where romance begins
...... (Omitted in the middle)
96. barefoot in the park (1967) Cold War couples, the park is barefoot, barefoot in the parking lot, barefoot beautiful couple
97. Grease (1978) grease, popular prodigal son
98. The Hunchback of Notre Dame (1939) Notre Dame de Paris, bell tower Camel man, bell tower weirdo
99. Pillow Talk (1959) book on the left
100 Jerry Maguire (1996), Mr. Sweet
TCL code:
# Hide the window, which is not used here <br/> WM withdraw. <br/> # Open Text <br/> set fileid [open D: /t.txt] <br/> # list of results <br/> set allmovies [LIST] <br/> # Read a row to Aline each time <br/> while {[gets $ fileid Aline] >=0 }{< br/> # Regular Expression (match four regions with four parentheses) <br/> Regexp {([1-9] [0-9]?) (. *)/([0-9] *)/) (. *)} $ Aline match no enname year chname <br/> set tmpsz "" <br/> # temporary results <br/> append tmpsz $ year "" $ no "" $ chname <br /># add to list <br/> lappend allmovies $ tmpsz <br/>}< br/> # sort, result saved to sortbyyear <br/> set sortbyyear [lsort-ASCII $ allmovies] <br/> # output result <br/> foreach movie $ sortbyyear {<br/> puts $ movie <BR/>}< br/>
Final result:
1920 East, East
1921 80 chiefs
1927 sunrise
1930 Morocco
1933 King Kong
1934 38
1935 42 Anna Karenina
1936 Happy Time
1937 33 Camellia
1937 truth pursuit, amazing deeds
1938 children's note, Yu Ying, Qi Tan
1939 huxiao Villa
1939 2 wonderful people
1939 32 Qing He thin life, dark victory, dying victory
1939 40 nionochica, Ambassador to the Russian Palace
1939 79 Red Shirt tears
1939 98 Notre Dame de Paris, bell tower camel Xia, bell tower weirdo
1940 28 corner store, corner bookstore
1940 44
1941 26 lady and Eve, Lady Eve, Miss Eve
1942 1 Casablanca, North Africa spy film
1942 23 sailing, travel lovers
1942 36
1942 Women who stand alone, this year's women, little aunt alone
1944 60 escape
1944 double compensation and double insurance
1946 49 the postmaster always presses the bell twice to get angry
1946 wonderful life and wonderful life; man of the sky;
1946 86 beauty program
1947 73 ghosts and dead persons
1951 14 queen of Africa
1951 39 An American in Paris, Huadu wuying
1951 Lang xinru tie
1951 67
1952 16 yuzhongqu
1952 76
1953
1953 4 Rome holidays
1954 stars and seas
1954 54 Sabina, Longfeng
1955 46 thieves, spies
1955 59 wild banquet
1955 64 Mathi
1955 life and death
1955 Miss 95 and hooligans, Gender and tramp,
1956 kings and me
1957 5 jin yumeng, the top floor of the Empire State Building in New York, where romance begins
1958 18 ecstasy
1958 35 golden family, golden powder world
1959 92 beggars and cuts
1959 99 pillowbooks
1960 62 peach apartment
1961 3 West Region story
1961 where there is no grass in the world, young dream
1961 61 Tiffany's breakfast
1964 12 lady
1965 27 music voices
1965, 7-day doctor
1966 89 who are afraid of Virginia Wolff?
1967 52 graduates
1967 million
1967 58 guess who is going to dinner
1967 65 Bonny and Claude
1967 Cold War couples, barefoot parks, barefoot parking lots, barefoot couples
1968 41 wonderful girl
1970 love story
1970 love story
1971 69 Harrow and Modal
1972 48 Last Tango in Paris
1972 68 love tracking
1973
1977 11 Anne Hall
1977 81 Goodbye Girl
Return 1978, return home, return home
1978 97 grease, hot prodigal son
1979 66 Manhattan
1981 22 Golden Pond
1981 55 treasure
1981 94 body hot, extremely attractive
1982 officers and gentlemen
1985 leaving Africa
1985 82 witnesses, witnesses
1987 17-month-old man with beautiful people, dizzy, sullen moon, Dizzy moon
1987 rock sinna
1987 Princess Bride
1987 93 hot dance, hot dance 17th
1988: brags, spring in Prague
1988 working girl, working girl
1989 25 When Harry Met Sally/90
1990 19
1990 21
1991 34 Beauty and the Beast
1993 45 sleep in Seattle
1995 70 intelligence and emotion
1995 White House sleepless nights
1995 90 bridges and bridges
1996, Mr. Sweet
1996 56 UK patients
1997 37 Titanic
1998 50 Shakespeare's love history
It can be seen that the efficiency of dynamic languages is indeed high (here it is mainly regular expressions), but the Tcl syntax really does not want to be used. I will study Python more in the future.