Revert "Fix order of result content" This reverts commit 680cac2714765a5b0e5b11300305d2a308ce8053.
modules/nani/result/jibiki.scm
125 | 125 | (match (car lst) | |
126 | 126 | ((? string? s) | |
127 | 127 | (update-source source | |
128 | - | #:content (append (source-content source) (list s)))) | |
128 | + | #:content (cons s (source-content source)))) | |
129 | 129 | (('lang . l) | |
130 | 130 | (update-source source #:lang l)) | |
131 | 131 | ((? list? l) | |
… | |||
141 | 141 | (#f meaning) | |
142 | 142 | (('n . _) meaning) | |
143 | 143 | (('info . info) (update-meaning meaning | |
144 | - | #:infos | |
145 | - | (append (meaning-infos meaning) (list info)))) | |
144 | + | #:infos (cons info (meaning-infos meaning)))) | |
146 | 145 | (('content . c) (update-meaning meaning | |
147 | 146 | #:glosses (append | |
148 | - | (meaning-glosses meaning) | |
149 | - | (string-split c #\,)))) | |
147 | + | (map string-downcase | |
148 | + | (string-split c #\,)) | |
149 | + | (meaning-glosses meaning)))) | |
150 | 150 | ((? source? s) | |
151 | 151 | (update-meaning meaning | |
152 | - | #:sources (append (meaning-sources meaning) (lit s)))) | |
152 | + | #:sources (cons s (meaning-sources meaning)))) | |
153 | 153 | ((? string? _) meaning) | |
154 | 154 | ((? list? l) (loop l meaning))))))) | |
155 | 155 | ||
… | |||
166 | 166 | (('kanji . k) | |
167 | 167 | (loop (cdr lst) | |
168 | 168 | (update-result result | |
169 | - | #:kanjis (append (result-kanjis result) (list k))) | |
169 | + | #:kanjis (cons k (result-kanjis result))) | |
170 | 170 | infos | |
171 | 171 | sources)) | |
172 | 172 | ((? reading? r) | |
173 | 173 | (loop | |
174 | 174 | (cdr lst) | |
175 | 175 | (update-result result | |
176 | - | #:readings (append (result-readings result) (list r))) | |
176 | + | #:readings (cons r (result-readings result))) | |
177 | 177 | infos | |
178 | 178 | sources)) | |
179 | 179 | ((? meaning? s) | |
180 | 180 | (loop | |
181 | 181 | (cdr lst) | |
182 | 182 | (update-result result | |
183 | - | #:meanings (append (result-meanings result) (list s))) | |
183 | + | #:meanings (cons s (result-meanings result))) | |
184 | 184 | infos | |
185 | 185 | sources)) | |
186 | 186 | ((? source? s) | |
187 | - | (loop (cdr lst) result infos (append sources (list s)))) | |
187 | + | (loop (cdr lst) result infos (cons s sources))) | |
188 | 188 | (('info . info) | |
189 | 189 | (loop (cdr lst) | |
190 | 190 | result | |
191 | - | (append infos (list info)) | |
191 | + | (cons info infos) | |
192 | 192 | sources)) | |
193 | 193 | ((? list? l) | |
194 | 194 | (match (loop l result infos sources) |
modules/nani/result/jmdict.scm
34 | 34 | reading | |
35 | 35 | (loop | |
36 | 36 | (match (car lst) | |
37 | - | (('reading r) (update-reading reading #:readings | |
38 | - | (append (reading-readings reading) (list r)))) | |
39 | - | (('info r) (update-reading reading #:info | |
40 | - | (append (reading-info reading) (list r)))) | |
41 | - | (('limit r) (update-reading reading #:kanjis | |
42 | - | (append (reading-kanjis reading) (list r)))) | |
37 | + | (('reading r) (update-reading reading #:readings (cons r (reading-readings reading)))) | |
38 | + | (('info r) (update-reading reading #:info (cons r (reading-info reading)))) | |
39 | + | (('limit r) (update-reading reading #:kanjis (cons r (reading-kanjis reading)))) | |
43 | 40 | (((? symbol? s) v) (throw 'unknown-content s v)) | |
44 | 41 | ((? string? _) reading)) | |
45 | 42 | (cdr lst))))) | |
… | |||
50 | 47 | source | |
51 | 48 | (loop | |
52 | 49 | (match (car lst) | |
53 | - | (('content c) (update-source source #:content | |
54 | - | (append (source-content source) (list c)))) | |
50 | + | (('content c) (update-source source #:content (cons c (source-content source)))) | |
55 | 51 | (('ls_wasei _) (update-source source #:wasei? #t)) | |
56 | 52 | (('ls_type t) source); type is always "part" or nothing | |
57 | 53 | ((('xml . 'lang) l) (update-source source #:lang l)) | |
58 | 54 | (((? symbol? s) v) (throw 'unknown-content s v)) | |
59 | 55 | ((? list? l) (loop source l)) | |
60 | 56 | ((? string? c) (update-source source #:content | |
61 | - | (append (source-content source) (list c))))) | |
57 | + | (cons c (source-content source))))) | |
62 | 58 | (cdr lst))))) | |
63 | 59 | ||
64 | 60 | (define (sxml->meaning lst) | |
… | |||
67 | 63 | meaning | |
68 | 64 | (loop | |
69 | 65 | (match (car lst) | |
70 | - | (('ref (? string? r)) | |
71 | - | (update-meaning meaning #:references | |
72 | - | (append (meaning-references meaning) (list r)))) | |
73 | - | (('limit (? string? r)) | |
74 | - | (update-meaning meaning #:limits | |
75 | - | (append (meaning-limits meaning) (list r)))) | |
76 | - | (('info (? string? r)) | |
77 | - | (update-meaning meaning #:infos | |
78 | - | (append (meaning-infos meaning) (list r)))) | |
79 | - | ((? source? s) | |
80 | - | (update-meaning meaning #:sources | |
81 | - | (append (meaning-sources meaning) (list s)))) | |
82 | - | (('info (? string? r)) | |
83 | - | (update-meaning meaning #:infos | |
84 | - | (append (meaning-infos meaning) (list r)))) | |
85 | - | (('gloss (? string? r)) | |
86 | - | (update-meaning meaning #:glosses | |
87 | - | (append (meaning-glosses meaning) (list r)))) | |
66 | + | (('ref (? string? r)) (update-meaning meaning #:references (cons r (meaning-references meaning)))) | |
67 | + | (('limit (? string? r)) (update-meaning meaning #:limits (cons r (meaning-limits meaning)))) | |
68 | + | (('info (? string? r)) (update-meaning meaning #:infos (cons r (meaning-infos meaning)))) | |
69 | + | ((? source? s) (update-meaning meaning #:sources (cons s (meaning-sources meaning)))) | |
70 | + | (('info (? string? r)) (update-meaning meaning #:infos (cons r (meaning-infos meaning)))) | |
71 | + | (('gloss (? string? r)) (update-meaning meaning | |
72 | + | #:glosses | |
73 | + | (cons (string-downcase r) | |
74 | + | (meaning-glosses meaning)))) | |
88 | 75 | ((('xml . 'lang) (? string? l)) (update-meaning meaning #:language l)) | |
89 | 76 | (((? symbol? s) v) (throw 'unknown-content s v)) | |
90 | 77 | ((? list? l) (loop meaning l)) | |
… | |||
99 | 86 | (loop | |
100 | 87 | (match (car lst) | |
101 | 88 | (('kanji kanji) | |
102 | - | (update-result result #:kanjis | |
103 | - | (append (result-kanjis result) (list kanji)))) | |
89 | + | (update-result result #:kanjis (cons kanji (result-kanjis result)))) | |
104 | 90 | ((? reading? r) | |
105 | - | (update-result result #:readings | |
106 | - | (append (result-readings result) (list r)))) | |
91 | + | (update-result result #:readings (cons r (result-readings result)))) | |
107 | 92 | ((? meaning? s) | |
108 | - | (update-result result #:meanings | |
109 | - | (append (result-meanings result) (list s)))) | |
93 | + | (update-result result #:meanings (cons s (result-meanings result)))) | |
110 | 94 | ((? string? _) result)) | |
111 | 95 | (cdr lst)))))) | |
112 | 96 | (let* ((word (if (null? (result-kanjis result)) |
modules/nani/result/wadoku.scm
67 | 67 | ((? meaning? s) | |
68 | 68 | (merge-meanings s meaning)) | |
69 | 69 | ((? source? s) | |
70 | - | (update-meaning meaning #:sources | |
71 | - | (append (meaning-sources meaning) (list s)))) | |
70 | + | (update-meaning meaning #:sources (cons s (meaning-sources meaning)))) | |
72 | 71 | (('ref (? string? r)) | |
73 | - | (update-meaning meaning #:references | |
74 | - | (append (meaning-references meaning) (list r)))) | |
72 | + | (update-meaning meaning #:references (cons r (meaning-references meaning)))) | |
75 | 73 | (('info (? string? r)) | |
76 | - | (update-meaning meaning #:infos | |
77 | - | (append (meaning-infos meaning) (list r)))) | |
74 | + | (update-meaning meaning #:infos (cons r (meaning-infos meaning)))) | |
78 | 75 | (('infos (? string? r)) | |
79 | - | (update-meaning meaning #:infos | |
80 | - | (append (meaning-infos meaning) (list r)))) | |
76 | + | (update-meaning meaning #:infos (cons r (meaning-infos meaning)))) | |
81 | 77 | (('infos (? list? r)) | |
82 | 78 | (update-meaning meaning #:infos (append r (meaning-infos meaning)))) | |
83 | 79 | (('trans (? string? r)) | |
84 | - | (update-meaning meaning #:glosses | |
85 | - | (append (meaning-glosses meaning) (list r)))) | |
80 | + | (update-meaning meaning #:glosses (cons (string-downcase r) | |
81 | + | (meaning-glosses meaning)))) | |
86 | 82 | (('related . _) meaning) | |
87 | 83 | (('transcr . _) meaning) | |
88 | 84 | (('pitch . _) meaning) | |
… | |||
121 | 117 | (('foreign foreign) | |
122 | 118 | (update-source source | |
123 | 119 | #:content (if (list? foreign) | |
124 | - | (append (source-content source) foreign) | |
125 | - | (append (source-content source) (list foreign))))) | |
120 | + | (append foreign (source-content source)) | |
121 | + | (cons foreign (source-content source))))) | |
126 | 122 | ((? list? l) (loop source l)) | |
127 | 123 | (_ source)) | |
128 | 124 | (cdr lst))))) | |
… | |||
134 | 130 | (loop | |
135 | 131 | (match (car lst) | |
136 | 132 | (('reading r) | |
137 | - | (update-reading reading #:readings | |
138 | - | (append (reading-readings reading) (list r)))) | |
133 | + | (update-reading reading #:readings (cons r (reading-readings reading)))) | |
139 | 134 | (_ reading)) | |
140 | 135 | (cdr lst))))) | |
141 | 136 | ||
… | |||
147 | 142 | (match (car lst) | |
148 | 143 | (('kanji kanji) | |
149 | 144 | (loop | |
150 | - | (update-result result #:kanjis | |
151 | - | (append (result-kanjis result) (list kanji))) | |
145 | + | (update-result result #:kanjis (cons kanji (result-kanjis result))) | |
152 | 146 | last-source (cdr lst))) | |
153 | 147 | ((? reading? reading) | |
154 | 148 | (loop | |
155 | - | (update-result result #:readings | |
156 | - | (append (result-readings result) (list reading))) | |
149 | + | (update-result result #:readings (cons reading (result-readings result))) | |
157 | 150 | last-source (cdr lst))) | |
158 | 151 | ((? meaning? meaning) | |
159 | 152 | (loop | |
160 | 153 | (update-result result | |
161 | 154 | #:meanings | |
162 | - | (append | |
163 | - | (result-meanings result) | |
164 | - | (list | |
165 | - | (if last-source | |
166 | - | (update-meaning meaning | |
167 | - | #:sources | |
168 | - | (append (meaning-sources meaning) (list last-source))) | |
169 | - | meaning)))) | |
155 | + | (cons | |
156 | + | (if last-source | |
157 | + | (update-meaning meaning | |
158 | + | #:sources (cons last-source (meaning-sources meaning))) | |
159 | + | meaning) | |
160 | + | (result-meanings result))) | |
170 | 161 | last-source (cdr lst))) | |
171 | 162 | ((? list? l) | |
172 | 163 | (loop (loop result last-source l) last-source (cdr lst))) | |
… | |||
341 | 332 | ;(loop (cons `(info ,genki) infos) result lst)) | |
342 | 333 | (loop infos result lst)) | |
343 | 334 | ((('jlpt . jlpt) lst ...) | |
344 | - | (loop (append infos `((info ,(string-append "jlpt-" jlpt)))) result lst)) | |
335 | + | (loop (cons `(info ,(string-append "jlpt-" jlpt)) infos) result lst)) | |
345 | 336 | ((('ref . (? string? ref)) lst ...) | |
346 | - | (loop (append infos `((ref ,ref))) result lst)) | |
337 | + | (loop (cons `(ref ,ref) infos) result lst)) | |
347 | 338 | ((('ref (? string? ref)) lst ...) | |
348 | - | (loop (append infos `((ref ,ref))) result lst)) | |
339 | + | (loop (cons `(ref ,ref) infos) result lst)) | |
349 | 340 | ((('jap l) lst ...) | |
350 | 341 | (sub-loop loop infos result lst l)) | |
351 | 342 | ((('foreign l) lst ...) |