Skip to content

Commit c7fd1fd

Browse files
committed
Operations en toutes lettres ("merci" JPR)
1 parent 12cf3dd commit c7fd1fd

4 files changed

Lines changed: 41 additions & 5 deletions

File tree

doc.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,9 @@
466466
`+`, `-`, `*`, `/`, `%`, `^`, `1000Cosinus`, `1000Sinus`,
467467
`=`, `=/`, `<`, `<=`, `>`, `>=`, `(Entier@ ... ...)`, `(Initialiser@ ...)`.
468468

469+
Les six premières opérations peuvent aussi être écrites
470+
`Somme`, `Diff`, `Produit`, `Quotient`, `Reste` et `Puissance`.
471+
469472
**Logique booléenne**
470473

471474
`Vrai`, `Faux`, `(Et ... [...])`, `(Ou ... [...])`, `(Non ...)`.

microalg.l

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Voir <http://microalg.info>.")
1717
"AV" "BC" "LC" "TD" "TG"
1818
"Affecter_a" "Afficher" "Aide" "Ajouter_a" "Alors"
1919
"Cercle" "Concatener" "Contour" "credit_iterations"
20-
"Declarer" "Definir" "Demander" "Demander_un_nombre"
20+
"Declarer" "Definir" "Demander" "Demander_un_nombre" "Diff"
2121
"Ellipse" "En_position" "Entier@" "Epaisseur" "Et" "Exemples_de"
2222
"Faire" "Faux" "Fois"
2323
"Geler"
@@ -26,10 +26,12 @@ Voir <http://microalg.info>.")
2626
"Millisecondes"
2727
"Nieme" "Nieme@" "Nombre" "Non"
2828
"Ou"
29-
"Queue"
30-
"RAZ" "Rectangle" "Remplissage" "Repere" "Repeter" "Retirer_de" "Retourner" "Rien"
29+
"Produit" "Puissance"
30+
"Queue" "Quotient"
31+
"RAZ" "Rectangle" "Remplissage" "Repere" "Repeter" "Reste"
32+
"Retirer_de" "Retourner" "Rien"
3133
"sequence_tirages@"
32-
"Segment" "Si" "Sinon"
34+
"Segment" "Si" "Sinon" "Somme"
3335
"Tant_que" "Tester" "Tete" "Texte" "Triangle" "Type"
3436
"valeur_utilisateur" "Vide?" "Vrai"
3537
))
@@ -174,13 +176,19 @@ Voir <http://microalg.info>.")
174176
-> 10
175177
")
176178
(put '+ 'text "Commande somme.")
179+
(put 'Somme 'doc (get '+ 'doc))
180+
(put 'Somme 'text (get '+ 'text))
181+
(setq Somme '+)
177182
(put '- 'doc
178183
"Commande qui soustrait son second paramètre à son premier paramètre et retourne le résultat.
179184
180185
: (- 7 3)
181186
-> 4
182187
")
183188
(put '- 'text "Commande différence.")
189+
(put 'Diff 'doc (get '- 'doc))
190+
(put 'Diff 'text (get '- 'text))
191+
(setq Diff '-)
184192
(put '* 'doc
185193
"Commande qui multiplie tous ses paramètres et retourne le résultat.
186194
@@ -190,6 +198,9 @@ Voir <http://microalg.info>.")
190198
-> 24
191199
")
192200
(put '* 'text "Commande produit.")
201+
(put 'Produit 'doc (get '* 'doc))
202+
(put 'Produit 'text (get '* 'text))
203+
(setq Produit '*)
193204
(put '/ 'doc
194205
"Commande qui divise son premier paramètre par son second paramètre et retourne le résultat.
195206
@@ -214,13 +225,19 @@ Sinon :
214225
-> 4.5
215226
")
216227
(put '/ 'text "Commande quotient.")
228+
(put 'Quotient 'doc (get '/ 'doc))
229+
(put 'Quotient 'text (get '/ 'text))
230+
(setq Quotient '/)
217231
(put '% 'doc
218232
"Commande qui retourne le reste de la division euclidienne de son premier paramètre par son second paramètre.
219233
220234
: (% 7 3)
221235
-> 1
222236
")
223237
(put '% 'text "Commande reste.")
238+
(put 'Reste 'doc (get '% 'doc))
239+
(put 'Reste 'text (get '% 'text))
240+
(setq Reste '%)
224241
(put '^ 'doc
225242
"Commande qui retourne son premier paramètre à la puissance du second paramètre.
226243
@@ -229,6 +246,9 @@ Sinon :
229246
")
230247
(put '^ 'text "Commande puissance.")
231248
(de ^ (!x !y) (** !x !y))
249+
(put 'Puissance 'doc (get '^ 'doc))
250+
(put 'Puissance 'text (get '^ 'text))
251+
(setq Puissance '^)
232252

233253
# Commentaires
234254
(put '!!! 'doc

microalg_export.l

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,11 @@
6262
(de caadr (arg)
6363
(car (car (cdr arg)))
6464
)
65-
)
65+
)
66+
67+
(setq Somme '+)
68+
(setq Diff '-)
69+
(setq Produit '*)
70+
(setq Quotient '/)
71+
(setq Reste '%)
72+
(setq Puissance '^)

microalg_tests.malg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@
103103
# Opérations mathématiques
104104
'(= 1 (^ 2 0))
105105
'(= 8 (^ 2 3))
106+
'(= 4 (Somme 2 2))
107+
'(= 1 (Diff 3 2))
108+
'(= 6 (Produit 2 3))
109+
'(= 3 (Quotient 6 2))
110+
'(= 2 (Reste 23 7))
111+
'(= 8 (Puissance 2 3))
106112
# Opérations logiques
107113
'(= Vrai (Non Faux))
108114
'(= Faux (Non Vrai))

0 commit comments

Comments
 (0)