This file is indexed.

/usr/share/festival/upc_catalan/upc_catalan_numbers.scm is in festival-ca 3.0.6-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;                                                                     ;;;
;;;                     Carnegie Mellon University                      ;;;
;;;                  and Alan W Black and Kevin Lenzo                   ;;;
;;;                      Copyright (c) 1998-2000                        ;;;
;;;                        All Rights Reserved.                         ;;;
;;;                                                                     ;;;
;;; Permission is hereby granted, free of charge, to use and distribute ;;;
;;; this software and its documentation without restriction, including  ;;;
;;; without limitation the rights to use, copy, modify, merge, publish, ;;;
;;; distribute, sublicense, and/or sell copies of this work, and to     ;;;
;;; permit persons to whom this work is furnished to do so, subject to  ;;;
;;; the following conditions:                                           ;;;
;;;  1. The code must retain the above copyright notice, this list of   ;;;
;;;     conditions and the following disclaimer.                        ;;;
;;;  2. Any modifications must be clearly marked as such.               ;;;
;;;  3. Original authors' names are not deleted.                        ;;;
;;;  4. The authors' names are not used to endorse or promote products  ;;;
;;;     derived from this software without specific prior written       ;;;
;;;     permission.                                                     ;;;
;;;                                                                     ;;;
;;; CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK        ;;;
;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING     ;;;
;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT  ;;;
;;; SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE     ;;;
;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES   ;;;
;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN  ;;;
;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,         ;;;
;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF      ;;;
;;; THIS SOFTWARE.                                                      ;;;
;;;                                                                     ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Tranformador de digits a nombres

(define (catala_number_ordinals name kind)
"(catala_number_ordinals name kind)
Retorna la forma cardinal del nombre 
NAME = número
KIND = gènere&nombre = 0     masculí singular
		       1     femení singular
                       2     masculí plural
                       3     femení plural
                      altres  error"

(let ((num (parse-number (intern name))))
  (if (>= num 1000000) (list "número" "massa" "gran")
  (cond
;; Masculí singular
((string-equal kind "0")
      (cond
    	((string-matches name "1") (list "primer"))
    	((string-matches name "2") (list "segon"))
    	((string-matches name "3") (list "tercer"))
    	((string-matches name "4") (list "quart"))
    	((string-matches name "5") (list "cinquè"))
    	((string-matches name "9") (list "novè"))
    	((string-matches name "10") (list "desè"))
    	(t 
            (cond
          	((or    (string-matches name "[0-9]+30") (string-matches name "[0-9]+40") (string-matches name "[0-9]+50")
			(string-matches name "[0-9]+60") (string-matches name "[0-9]+70") (string-matches name "[0-9]+80")
			(string-matches name "[0-9]+90") (string-matches name "[0-9]+4")  (string-matches name "[0-9]+11")
			(string-matches name "[0-9]+12") (string-matches name "[0-9]+13") (string-matches name "[0-9]+14")
			(string-matches name "[0-9]+15") (string-matches name "[0-9]+16") 
			(string-matches name "30") 	 (string-matches name "40") 	  (string-matches name "12")
			(string-matches name "50") 	 (string-matches name "60") 	  (string-matches name "70") 
			(string-matches name "80") 	 (string-matches name "90") 	  (string-matches name "11") 
		 	(string-matches name "13") 	 (string-matches name "14")       (string-matches name "15") 
			(string-matches name "16"))
            		(reverse (append (list (catala_sufix (car (reverse (catala_number name "0"))) "è" "1")) (cdr (reverse (catala_number name "0"))))))
		((string-matches name "[0-9]+5")
              		(reverse (append (list (catala_sufix (car (reverse (catala_number name "0"))) "què" "1")) (cdr (reverse (catala_number name "0"))))))
           	((string-matches name "[0-9]+9")
              		(reverse (append (list (catala_sufix (car (reverse (catala_number name "0"))) "vè" "1")) (cdr (reverse (catala_number name "0"))))))
		((string-matches name "[0-9]+10")
              		(reverse (append (list (catala_sufix (car (reverse (catala_number name "0"))) "sè" "1")) (cdr (reverse (catala_number name "0"))))))
                (t (reverse (append (list (catala_sufix (car (reverse (catala_number name "0"))) "è" "0")) (cdr (reverse (catala_number name "0"))))))))))
 
;; Femení singular
   ((string-equal kind "1")
      (cond
    	((string-matches name "1") (list "primera"))
    	((string-matches name "2") (list "segona"))
    	((string-matches name "3") (list "tercera"))
    	((string-matches name "4") (list "quarta"))
    	((string-matches name "5") (list "cinquena"))
    	((string-matches name "9") (list "novena"))
    	((string-matches name "10") (list "desena"))
    	(t 
            (cond
          	((or    (string-matches name "[0-9]+30") (string-matches name "[0-9]+40") (string-matches name "[0-9]+50")
			(string-matches name "[0-9]+60") (string-matches name "[0-9]+70") (string-matches name "[0-9]+80")
			(string-matches name "[0-9]+90") (string-matches name "[0-9]+4")  (string-matches name "[0-9]+11")
			(string-matches name "[0-9]+12") (string-matches name "[0-9]+13") (string-matches name "[0-9]+14")
			(string-matches name "[0-9]+15") (string-matches name "[0-9]+16") (string-matches name "[0-9]+1")
			(string-matches name "30") 	 (string-matches name "40") 	  (string-matches name "12")
			(string-matches name "50") 	 (string-matches name "60") 	  (string-matches name "70") 
			(string-matches name "80") 	 (string-matches name "90") 	  (string-matches name "11") 
		 	(string-matches name "13") 	 (string-matches name "14")       (string-matches name "15") 
			(string-matches name "16"))
            		(reverse (append (list (catala_sufix (car (reverse (catala_number name "1"))) "ena" "1")) (cdr (reverse (catala_number name "1"))))))
		((string-matches name "[0-9]+5")
              		(reverse (append (list (catala_sufix (car (reverse (catala_number name "1"))) "quena" "1")) (cdr (reverse (catala_number name "1"))))))
           	((string-matches name "[0-9]+9")
              		(reverse (append (list (catala_sufix (car (reverse (catala_number name "1"))) "vena" "1")) (cdr (reverse (catala_number name "1"))))))
		((string-matches name "[0-9]+10")
              		(reverse (append (list (catala_sufix (car (reverse (catala_number name "1"))) "sena" "1")) (cdr (reverse (catala_number name "1"))))))
                (t (reverse (append (list (catala_sufix (car (reverse (catala_number name "0"))) "ena" "0")) (cdr (reverse (catala_number name "1"))))))))))

;; Masculí plural
((string-equal kind "2")
      (cond
    	((string-matches name "1") (list "primers"))
    	((string-matches name "2") (list "segons"))
    	((string-matches name "3") (list "tercers"))
    	((string-matches name "4") (list "quarts"))
    	((string-matches name "5") (list "cinquens"))
    	((string-matches name "9") (list "novens"))
    	((string-matches name "10") (list "desens"))
    	(t 
            (cond
          	((or    (string-matches name "[0-9]+30") (string-matches name "[0-9]+40") (string-matches name "[0-9]+50")
			(string-matches name "[0-9]+60") (string-matches name "[0-9]+70") (string-matches name "[0-9]+80")
			(string-matches name "[0-9]+90") (string-matches name "[0-9]+4")  (string-matches name "[0-9]+11")
			(string-matches name "[0-9]+12") (string-matches name "[0-9]+13") (string-matches name "[0-9]+14")
			(string-matches name "[0-9]+15") (string-matches name "[0-9]+16") 
			(string-matches name "30") 	 (string-matches name "40") 	  (string-matches name "12")
			(string-matches name "50") 	 (string-matches name "60") 	  (string-matches name "70") 
			(string-matches name "80") 	 (string-matches name "90") 	  (string-matches name "11") 
		 	(string-matches name "13") 	 (string-matches name "14")       (string-matches name "15") 
			(string-matches name "16"))
            		(reverse (append (list (catala_sufix (car (reverse (catala_number name "0"))) "ens" "1")) (cdr (reverse (catala_number name "0"))))))
		((string-matches name "[0-9]+5")
              		(reverse (append (list (catala_sufix (car (reverse (catala_number name "0"))) "quens" "1")) (cdr (reverse (catala_number name "0"))))))
           	((string-matches name "[0-9]+9")
              		(reverse (append (list (catala_sufix (car (reverse (catala_number name "0"))) "vens" "1")) (cdr (reverse (catala_number name "0"))))))
		((string-matches name "[0-9]+10")
              		(reverse (append (list (catala_sufix (car (reverse (catala_number name "0"))) "sens" "1")) (cdr (reverse (catala_number name "0"))))))
                (t (reverse (append (list (catala_sufix (car (reverse (catala_number name "0"))) "ens" "0")) (cdr (reverse (catala_number name "0"))))))))))

;; Femení plural
   ((string-equal kind "3")
      (cond
    	((string-matches name "1") (list "primeres"))
    	((string-matches name "2") (list "segones"))
    	((string-matches name "3") (list "terceres"))
    	((string-matches name "4") (list "quartes"))
    	((string-matches name "5") (list "cinquenes"))
    	((string-matches name "9") (list "novenes"))
    	((string-matches name "10") (list "desenes"))
    	(t 
            (cond
          	((or    (string-matches name "[0-9]+30") (string-matches name "[0-9]+40") (string-matches name "[0-9]+50")
			(string-matches name "[0-9]+60") (string-matches name "[0-9]+70") (string-matches name "[0-9]+80")
			(string-matches name "[0-9]+90") (string-matches name "[0-9]+4")  (string-matches name "[0-9]+11")
			(string-matches name "[0-9]+12") (string-matches name "[0-9]+13") (string-matches name "[0-9]+14")
			(string-matches name "[0-9]+15") (string-matches name "[0-9]+16") (string-matches name "[0-9]+1")
			(string-matches name "30") 	 (string-matches name "40") 	  (string-matches name "12")
			(string-matches name "50") 	 (string-matches name "60") 	  (string-matches name "70") 
			(string-matches name "80") 	 (string-matches name "90") 	  (string-matches name "11") 
		 	(string-matches name "13") 	 (string-matches name "14")       (string-matches name "15") 
			(string-matches name "16"))
            		(reverse (append (list (catala_sufix (car (reverse (catala_number name "1"))) "enes" "1")) (cdr (reverse (catala_number name "1"))))))
		((string-matches name "[0-9]+5")
              		(reverse (append (list (catala_sufix (car (reverse (catala_number name "1"))) "quenes" "1")) (cdr (reverse (catala_number name "1"))))))
           	((string-matches name "[0-9]+9")
              		(reverse (append (list (catala_sufix (car (reverse (catala_number name "1"))) "venes" "1")) (cdr (reverse (catala_number name "1"))))))
		((string-matches name "[0-9]+10")
              		(reverse (append (list (catala_sufix (car (reverse (catala_number name "1"))) "senes" "1")) (cdr (reverse (catala_number name "1"))))))
                (t (reverse (append (list (catala_sufix (car (reverse (catala_number name "0"))) "enes" "0")) (cdr (reverse (catala_number name "1"))))))))))


      (t (list "Error cardinal"))))))
   
   
             
       
         
          
    




;;       (set! b (catala_number name kind))
;;       (last b)
;;    )))   
       

(define (catala_number_decimals name kind separator separatorname)
"(catala_number_decimals name) 
Tractament de nombres decimals
NAME = dígit
KIND = gènere (1 = femení / altres = masculí)"
(if (string-matches name (string-append ".*[" separator "].*") )
    (cond
       ((string-matches (string-after name separator) "0.*") 
	(append (catala_number_point (string-before name separator) kind ) (list separatorname) (catala_speller (string-after name separator))))
        (t (append (catala_number_point (string-before name separator) kind ) (list separatorname) (catala_number_point (string-after name separator) kind))))
(catala_number_point name kind)))

(define (catala_number_point name control)
;;"(catala_number_point name)
;;Elimina els punts dels números
;;NAME = dígits
;;CONTROL = 2    només retorna el número sense punts en format string
;;          1    número femení 
;;       altres  número masculí"
(cond          
((string-matches name ".*[\.].*") (catala_number_point (string-append (string-before name "\.") (string-after name "\.")) control))
((string-matches control "2") (string-append name))
(t (catala_number name control)))
)

(define (catala_number name kind)
"(catala_number name kind)
Transforma els dígits en paraules
NAME = dígit
KIND = gènere (1 = femení / altres = masculí)"

(if (not (string-matches kind "1"))
   (set! kind "0"))

(if (string-matches name "0")
      (list "zero")
      (catala_number_from_digits (symbolexplode name) kind)))

(define (just_zeros digits)
"(just_zeros digits)
Tractament del cas que tot el nombre siguin 0s "
 (cond
  ((not digits) t)
  ((string-equal "0" (car digits))
   (just_zeros (cdr digits)))
  (t nil)))

(define (catala_number_from_digits digits kind)
  "(catala_number_from_digits digits kind)
Agafa una llista de dígits i la converteix en una llista de paraules dient el número."
  (let ((l (length digits)))
    (cond
     ((equal? l 0)
      nil)
     ((string-equal (car digits) "0") ;; digits = 0x, elimina el 0 i torna a cridar la funció
      (catala_number_from_digits (cdr digits) kind))
     ((equal? l 1);; single digit
      (cond 
       ((string-equal (car digits) "0") (list "zero"))
       ((string-equal (car digits) "1") 
	  (if (string-equal kind "1")
            (list "una")
	    (list "un")))
       ((string-equal (car digits) "2") 
	  (if (string-equal kind "1")
	    (list "dues") 
	    (list "dos")))
       ((string-equal (car digits) "3") (list "tres"))
       ((string-equal (car digits) "4") (list "quatre"))
       ((string-equal (car digits) "5") (list "cinc"))
       ((string-equal (car digits) "6") (list "sis"))
       ((string-equal (car digits) "7") (list "set"))
       ((string-equal (car digits) "8") (list "vuit"))
       ((string-equal (car digits) "9") (list "nou"))
       ;; fill in the rest
       (t (list "Error"))));; $$$ what should say?
     ((equal? l 2);; less than 100
      (cond
       ((string-equal (car digits) "0");; 0x 
	(catala_number_from_digits (cdr digits) kind))
     
       ((string-equal (car digits) "1");; 1x
	(cond
	 ((string-equal (car (cdr digits)) "0") (list "deu"))
	 ((string-equal (car (cdr digits)) "1") (list "onze"))
	 ((string-equal (car (cdr digits)) "2") (list "dotze"))
	 ((string-equal (car (cdr digits)) "3") (list "tretze"))
	 ((string-equal (car (cdr digits)) "4") (list "catorze"))
	 ((string-equal (car (cdr digits)) "5") (list "quinze"))
	 ((string-equal (car (cdr digits)) "6") (list "setze"))
         ((string-equal (car (cdr digits)) "7") (list "disset"))
	 (t 
	  (list  (string-append "di" (car (catala_number_from_digits (cdr digits) kind)))))))
     
       ((string-equal (car digits) "2");; 2x
	(if (string-equal (car (cdr digits)) "0") 
	    (list "vint")
	    (list (string-append  "vint-i-" (car (catala_number_from_digits (cdr digits) kind))))))

       ((string-equal (car digits) "3");; 3x
	(if (string-equal (car (cdr digits)) "0") 
	    (list "trenta")
	    (list (string-append  "trenta-" (car (catala_number_from_digits (cdr digits) kind))))))  


       ((string-equal (car digits) "4");; 4x
	(if (string-equal (car (cdr digits)) "0") 
	    (list "quaranta")
	    (list (string-append  "quaranta-" (car (catala_number_from_digits (cdr digits) kind))))))  	    

       ((string-equal (car digits) "5");; 5x
	(if (string-equal (car (cdr digits)) "0") 
	    (list "cinquanta")
 	    (list (string-append  "cinquanta-" (car (catala_number_from_digits (cdr digits) kind))))))   	      	    	    
       ((string-equal (car digits) "6");; 6x
	(if (string-equal (car (cdr digits)) "0") 
	    (list "seixanta")
            (list (string-append  "seixanta-" (car (catala_number_from_digits (cdr digits) kind))))))  
       
	((string-equal (car digits) "7");; 7x
	(if (string-equal (car (cdr digits)) "0") 
	    (list "setanta")
	    (cons "setanta-" (catala_number_from_digits (cdr digits) kind))))

       ((string-equal (car digits) "8");; 8x
	(if (string-equal (car (cdr digits)) "0") 
	    (list "vuitanta")
	    (list (string-append  "vuitanta-" (car (catala_number_from_digits (cdr digits) kind))))))  

       ((string-equal (car digits) "9");; 9x
	(if (string-equal (car (cdr digits)) "0") 
	    (list "noranta")
	    (list (string-append  "noranta-" (car (catala_number_from_digits (cdr digits) kind))))))  

       ))

     ((equal? l 3);; in the hundreds
      (cond 
     
       ((string-equal (car digits) "1");; 1xx
	(cons "cent" (catala_number_from_digits (cdr digits) kind)))

       (t;; ?xx
	(if (string-equal kind "1") 
	(append (list (string-append (car (catala_number_from_digits (list (car digits)) kind)) "-centes")) (catala_number_from_digits (cdr digits) kind))
	(append (list (string-append (car (catala_number_from_digits (list (car digits)) kind)) "-cents")) (catala_number_from_digits (cdr digits) kind))))))
 

     ((< l 7)
      (let ((sub_thousands 
	     (list 
	      (car (cdr (cdr (reverse digits))))
	      (car (cdr (reverse digits)))
	      (car (reverse digits))))
	    (thousands (reverse (cdr (cdr (cdr (reverse digits)))))))
	(set! x (catala_number_from_digits thousands kind))
	(append
	 (if (or (string-equal (car x) "un") (string-equal (car x) "una")) nil x)
	 (list "mil")
	 (catala_number_from_digits sub_thousands kind))))

     ((< l 13)
      (let ((sub_million 
	     (list 
	      (car (cdr (cdr (cdr (cdr (cdr(reverse digits)))))))
	      (car (cdr (cdr (cdr (cdr (reverse digits))))))
	      (car (cdr (cdr (cdr (reverse digits)))))
	      (car (cdr (cdr (reverse digits))))
	      (car (cdr (reverse digits)))
	      (car (reverse digits))
	      ))
	    (millions (reverse (cdr (cdr (cdr (cdr (cdr (cdr (reverse digits))))))))))
	(set! x (catala_number_from_digits millions kind))
	(append
	 (if (or (string-equal (car x) "un") (string-equal (car x) "una")) 
	     (list "un" "milió")
             (append x (list "milions")))
	 (catala_number_from_digits sub_million kind))))

     (t
      (print "Error: Número massa gran")
      (list "Error" "Número" "massa" "gran ")))))
 
(define (catala_score name)
"(catala_score name) 
Tractament del cas x-x -> Resultat esportiu"
(append (catala_number (string-before name "\-") "0") '("a") (catala_number (string-after name "\-") "0"))

) 

(define (catala_money name)
"(catala_money name)
Tracatament del caso xxx$ o xxx¤"
;;(print "moneda in")
;;(print name)
(cond
  ;; Dòlars
  ((string-matches name ".*[\$]") 
    (set! quantity (string-before name "\$")) 
    (set! money "dòlars") 
    (set! money_sing "dòlar")
    (set! sub_money "centaus")
    (set! sub_money_sing "centau")
    (set! gen_money "0")           ;; gènere de la moneda (0: masculí 1: femení)
    (set! gen_submoney "0") 	   ;; gènere de la moneda (0: masculí 1: femení)
    (set! mode "1"))		   ;; la moneda té una submoneda Ex: Dòlar-centau / Euro-cèntim (mode 1: Si 0: No) 
  
;; Lliura
  ((string-matches name ".*[\£]") 
    (set! quantity (string-before name "\£")) 
    (set! money "lliures") 
    (set! money_sing "lliura")
    (set! sub_money "penics")
    (set! sub_money_sing "penic")
    (set! gen_money "1")           ;; gènere de la moneda (0: masculí 1: femení)
    (set! gen_submoney "0") 	   ;; gènere de la moneda (0: masculí 1: femení)
    (set! mode "1"))	  

  ;; Euros
  ((string-matches name ".*[¤]") 
    (set! quantity (string-before name "¤")) 
    (set! money "euros")
    (set! money_sing "euro")
    (set! sub_money "cèntims")
    (set! sub_money_sing "cèntim")
    (set! gen_money "0")
    (set! gen_submoney "0")
    (set! mode "1")))	

(cond 
   ((string-equal mode "1") ;; Moneda amb submoneda
     (set! quantity (catala_number_point quantity "2"))
     (cond 
      ((string-matches quantity ".*[0-9]+,[0-9]+.*") ;; Quantitat amb decimals 
        (set! decimals (string-after quantity ","))
       (set! quantity (string-before quantity ","))
       (set! l (length decimals))
       (if (string-matches quantity "1")
         (set! a money_sing)
         (set! a money))
       (if (string-matches decimals "01")
         (set! b sub_money_sing)
         (set! b sub_money))
       (cond 
         ((equal? l 1) (append (catala_number quantity gen_money) (list a) '( "amb" ) (catala_number (string-append decimals "0") gen_submoney) (list b)))
         ((equal? l 2) (append (catala_number quantity gen_money) (list a) '( "amb" ) (catala_number decimals gen_submoney) (list b)))
         (t (append (catala_number quantity "0") '( "coma" ) (catala_number decimals gen_money) (list a)))))
     (t 
       (if (string-matches quantity "1")
         (set! a money_sing)
         (set! a money))
        (append (catala_number_point quantity gen_money) (list a)))))

   ;;Moneda sense sub-moneda
   (t 
     (if (string-matches money "1")
       (set! a money_sing)
       (set! a money))
     (append (catala_number_decimal quantity gen_money) (list a)))))      
     

(define (catala_sufix word sufix num)
"(catala_sufix word sufix) 
Elimina de WORD les últimes NUM lletres i li afeigeix el SUFIX al final"
(if (not (string-matches num "[0-9]+"))
    (string-append word)
    (if (not (string-matches sufix "[a-zàáèéíìòóúç]+"))
      (string-append word)
   	(let ((l (length word)))
   	    (set! num (parse-number (intern num)))
            (if (not (> l num)) 
              (string-append word)
              (if (equal? l 1)
                (string-append word)
        	(let ((wordexplode (symbolexplode word)) (i (+ 0 num)) (word2 ""))
           		(while (> l i)
           		  (set! word2 (string-append word2 (car wordexplode)))
             		  (set! wordexplode (cdr wordexplode))
             		  (set! i (+ i 1)))
                        (string-append word2 sufix)))))))) 



(provide 'upc_catalan_numbers)