I have a List of tuples of the form (string, int).I\'m trying to search through the list and return the tuple whose string component matches the paramet开发者_JAVA技巧er, as in: let find_tuple string_
If I execute the following in OCaml\'s toplevel: #require \"num\";; open Ratio;; ratio_of_int 2;; The output is:
if I specify the (I think) correct type for a high order function the OCaml compiler rejects the second usage of that function.
Is there any short way to pass zero-arity function to another function. For now I do it like this: let f a b c = ...;;
Is there any kind of keyword, like this, to refere to a current module? For example, what should I put in gap here:
I read in an algorithmic book that the Ackermann function cannot be made tail-recursive (what they say is \"it can\'t be transformed into an iteration\"). I\'m pretty perplex about this, so I tried an
There are large number of texts on data structures, and libraries of data structures code开发者_JS百科. I understand that purely functional data structure is easier to reason about. However I have tro
I often need to match a tuple of values that should have the same constructor. The catchall开发者_如何学JAVA _,_ always winds-up at the end. This of course is fragile, any additional constructor added
I am using OCaml Makefile for a project I am working on and I have the folowing modules DynamicTree.ml
开发者_StackOverflowI\'ve created type t = Test of int * t ref How to create any object of type t?As delnan said, you can use cyclic values :