Hello,
First, you really need strong tyupe checking because your definition is actually
incorrect.
Second, see polymorphic-recursion :
http://alaska-kamtchatka.blogspot.com/2009/05/polymorphic-recursion.html
Be sure to read the comments by bluestorm.
There is also pa_polyrec, a syntax
I have to apologize because your definition is actually correct.
Sorry i have read it too fast and didn't see map burried in type casting.
It seems to me your are doing structural recursion on some binary tree
structure.
Presumably to fast-merge binary heaps or something like that.
pa_polyrec is
Hi Dawid,
Have you ever considered recursive modules ?
http://caml.inria.fr/pub/docs/manual-ocaml/manual021.html#toc75
- damien
En réponse au message
de : Dawid Toton
du : 2009-10-16 09:51:57
À : caml-list@yquem.inria.fr
CC :
Sujet : [Caml-list] Linking mutually dependent modules for fun
Hi Gilles,
The type display routine uses right-associativity of the - operator as a
rewriting rule.
Thus ('a - 'a - float) and 'a - ('a - float) are the same type and are both
displayed as 'a - 'a - float.
The type 'a - ('a - float) means the application will be (f x) y which is
actually the
As Ocaml modules are essentially ML modules, the MLton experience is certainly
one to be carefully considered.
People, please don't hesitate to elaborate about how (un-)happy you are with
ML/MLton alternate type naming strategies.
- damien
En réponse au message
de : Stephen Weeks
du :
Hi Yaron,
I think you better think twice about the problem in general (rather than the
particular needs of Core) before proposing some controversial type display
improvement.
Imagine my code is:
type color = int
let black : color = 0
Then, following your proposition, evaluating black
'a foldable = 'a map and fold_key = key
type ('a,'b) fold = (key - 'a - 'b - 'b) - 'b - 'a map - 'b
type 'a set = 'a map
type set_key = key
type 'a set_select = 'a select
...
end
En réponse au message
de : Yaron Minsky
du : 2009-10-09 18:52:40
À : Damien Guichard
CC : caml
hacker.
Hoping i have made the matter less esoteric to OCaml beginners,
Regards,
- damien
Damien Guichard
2009-09-29
En réponse au message
de : Jeremy Yallop
du : 2009-09-28 22:56:32
À : caml-l...@inria.fr
CC :
Sujet : [Caml-list] ANN: pa_polyrec: syntax for polymorphic recursion
I'm
with None - f := Some x; x | Some y - y)
| G _ - (match !g with None - g := Some x; x | Some y - y)
| A - A
| B - B
Then top_most () gives you a function with the expected behavior.
Hope it helps,
- damien
Damien Guichard
2009-09-17
En réponse au message
de : Matthias Puech
du : 2009
(f n.item) n.right)
let flatten_map f = flatten_map f None
It seems to me that my solution gives you the cartesian product as an ordered
(balanced) binary tree set in optimal time.
- damien
Damien Guichard
2009-07-30
En réponse au message
de : Ligia Nistor
du : 2009-07-30 19:56:57
À
Thanks to Dunod Éditions for this much appreciated donation.
Bonjour Olivier,
The book sources are already included in the Caml/examples/
directory of your Caml-Light distribution.
(or at least they are in my windows distribution)
- damien
Damien Guichard
2009-07-21
En réponse au
, it
encourages a much more elaborated design.
-- damien
Damien Guichard
2009-04-02
En réponse au message
de : Alp Mestan
du : 2009-04-02 15:40:45
À : Jon Harrop; caml-list@yquem.inria.fr
CC :
Sujet : Re: [Caml-list] Re: LLC book [was: Questions]
Indeed, as I said above, a book on today's OCaml
in add d c,double c
in let n,_ = loop a in n
That is dirty untested code yet i hope you get the idea.
Addition/substraction and division will be somewhat trickier however.
- damien
Damien Guichard
2009-03-21
En réponse au message
de : Su Zhang
du : 2009-03-21 18:36:11
À : caml-list
Well said Brian.
Any tutorial is good enough at underlining respective language features.
Haskell has lazy evaluation, Caml has strict evaluation, don't pretend it's a
secret and don't ask whether good or bad.
Be responsible, try it yourself if needed, then choose yourself.
- damien
And I am not sure that Ocaml has been ported to non-unix free
software... Does Ocaml runs on Hurd, or Syllable, or EROS?
OCaml 3.10.2 binary package for SyllableOS:
http://web.syllable.org/pages/resources.html
Regards.
-- damien
___
Caml-list
15 matches
Mail list logo