You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 2911 Reporter: administrator Status: closed (set by @diml on 2016-12-07T17:27:43Z) Resolution: open Priority: normal Severity: feature Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues
Bug description
Hello,
Ça m'a pris pas mal de temps, à coup d'essais, pour trouver comment
implémenter les deux fonctions ci-dessous, en particulier pour les
parenthèses. Le comportement ne me semble pas tout à fait intuitif
(et pas documenté, j'ai l'impression).
let call_lab f l x =
if l = "" then <:expr< $f$$x$ >>
else
if l.[0] = '?' then
let l = String.sub l 1 (String.length l - 1) in
<:expr< $f$ (? $l$ : $x$) >>
else
<:expr< $f$ (~ $l$ : $x$) >>
let abstr_lab l x res =
if l = "" then <:expr< fun $lid:x$ -> $res$ >>
else
if l.[0] = '?' then
let l = String.sub l 1 (String.length l - 1) in
<:expr< fun ? $l$ : ( $lid:x$ ) -> $res$ >>
else
<:expr< fun ~ $l$ : $lid:x$ -> $res$ >>
Original bug ID: 2911
Reporter: administrator
Status: closed (set by @diml on 2016-12-07T17:27:43Z)
Resolution: open
Priority: normal
Severity: feature
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues
Bug description
Hello,
Ça m'a pris pas mal de temps, à coup d'essais, pour trouver comment
implémenter les deux fonctions ci-dessous, en particulier pour les
parenthèses. Le comportement ne me semble pas tout à fait intuitif
(et pas documenté, j'ai l'impression).
let call_lab f l x =$f$ $x$ >>$f$ (? $l$ : $x$ ) >>$f$ (~ $l$ : $x$ ) >>
if l = "" then <:expr<
else
if l.[0] = '?' then
let l = String.sub l 1 (String.length l - 1) in
<:expr<
else
<:expr<
let abstr_lab l x res =$lid:x$ -> $res$ >>$l$ : ( $lid:x$ ) -> $res$ >>$l$ : $lid:x$ -> $res$ >>
if l = "" then <:expr< fun
else
if l.[0] = '?' then
let l = String.sub l 1 (String.length l - 1) in
<:expr< fun ?
else
<:expr< fun ~
Ça serait pratique de pouvoir écrire simplement:
<:expr<$f$ (~ $l$ : $lid:x$ ) >>$l$ : $lid:x$ ) -> $res$ >>
<:expr< fun (~
et que ça marche dans les trois cas (i.e. traiter automatiquement le cas
où l est vide et celui où il commence par '?').
-- Alain
The text was updated successfully, but these errors were encountered: