caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* test with several issues
@ 1995-11-11 13:08 quercia
  1995-11-13 19:59 ` Pierre Weis
  0 siblings, 1 reply; 3+ messages in thread
From: quercia @ 1995-11-11 13:08 UTC (permalink / raw)
  To: caml-list


I apologize for my poor english. Please, if you can read french skip the
30 following lines.

------------------------------ "English" text --------------------------------

*match* together with *when* enables to code nicely a test with several issues :

match 0 with
  _ when {condition-1} -> {action-1}
| _ when {condition-2} -> {action-2}
...
| _                    -> {default action}

This replaces the construct :

     if {condition-1} then {action-1}
else if {condition-2} then {action-2}
...
else                       {default action}

wich seems to me less readable. Annoyingly, one has to provide a value to
the match (0 here), but that value won't really be used.
Could you support my demand to INRIA so that the next releases of Caml-light
and Caml-special-light provide a nicer construct :

select
  when {condition-1} -> {action-1}
  when {condition-2} -> {action-2}
  ...
  otherwise          -> {default action}

like for example in PL/1 and in Rexx ?

------------------------------ texte Francais --------------------------------

*match* associe avec *when* permet de coder elegament un test a plusieurs
cas :

match 0 with
  _ when {condition-1} -> {action-1}
| _ when {condition-2} -> {action-2}
...
| _                    -> {action par defaut}

Ceci remplace la construction :

     if {condition-1} then {action-1}
else if {condition-2} then {action-2}
...
else                       {action par defaut}

qui me semble moins lisible. L'ennui est qu'il faut donner une
valeur a tester a match (ici 0) alors qu'on n'en fera rien.
Voulez-vous appuyer ma demande a l'INRIA pour que les prochaines versions
de Caml-light et Caml-special-light autorisent une construction encore plus
claire :

select
  when {condition-1} -> {action-1}
  when {condition-2} -> {action-2}
  ...
  otherwise          -> {action par defaut}

qu'on peut trouver par exemple en PL/1 et en Rexx ?

------------------------------------------------------------------------------
Michel Quercia,
Laboratoire d'informatique du lycee Carnot
16 bd Thiers
21000 Dijon
France
e-mail = quercia@u-bourgogne.fr
------------------------------------------------------------------------------




^ permalink raw reply	[flat|nested] 3+ messages in thread
* Re:  test with several issues
@ 1995-11-13 13:28 Valerie Menissier-Morain
  0 siblings, 0 replies; 3+ messages in thread
From: Valerie Menissier-Morain @ 1995-11-13 13:28 UTC (permalink / raw)
  To: caml-list, quercia


This is almost the ``when'' construction of Caml V3.1. In Caml V3.1, you 
should write:
when cond1 -> action1
   | cond2 -> action2
	   .
           .
           .
   | condn -> actionn
   | _ -> action_default

Vale'rie Me'nissier-Morain




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1995-11-13 20:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-11-11 13:08 test with several issues quercia
1995-11-13 19:59 ` Pierre Weis
1995-11-13 13:28 Valerie Menissier-Morain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).