<tsuyoshi>
this looks a lot like the sql replacement I've been working on
<tsuyoshi>
he's turning relations into functions.. I was creating a whole new type in the compiler
Snark has joined #ocaml
bringert has joined #ocaml
yminsky has quit []
<tsuyoshi>
huh.. fundamentally it's the same idea but I am being a little more ambitious
hkBst has joined #ocaml
<hsuh>
mfc is great
<Yoric[DT]>
Is it ?
<hsuh>
i think so.
<hsuh>
oh, its mfp, not mfc
<hsuh>
:P
hsuh has quit ["off to work"]
ita has joined #ocaml
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
bringert has quit [Read error: 104 (Connection reset by peer)]
bringert has joined #ocaml
khigia has joined #ocaml
bongy has joined #ocaml
Snark has quit ["Quitte"]
<khigia>
hello
<khigia>
newby question about type dependency problem:
<khigia>
I want a module Tuple, containing a "type t = term array"
<khigia>
and the type term is defined by "type term = | MyInt of int | MyTuple of Tuple"
<khigia>
problem is that module Tuple require module Term, and module Term require module Tuple
<khigia>
so I can't compile!
<khigia>
anyone?
<smimou>
you could use recursive modules
<smimou>
but it's certainly the sign of a bad design
<khigia>
bad design ... I agree, but the concept seems simple: I want a tuple containing terms, and tuple can itself be a term
<khigia>
any recommendation of other design?
<smimou>
why don't you put them in the same module for example ?
<smimou>
type term = | Int of int | Tuple of tuple
<smimou>
and
<smimou>
tuple = term array;;
<khigia>
yes that's what I want
<smimou>
(this is valid caml code)
<khigia>
but I would like tuple to be a module (can do more than array)
<khigia>
recursive module seems ok; thanks
seafood_ has quit []
<khigia>
arg! cannot mix recursive module and type definition: module rec Tuple .... and type term ...
<khigia>
bad design ... but how to do?
buluca has joined #ocaml
<bongy>
sorry how can I define a record with one list field?
CRathman has joined #ocaml
<bongy>
anyone can help me? if i type type nl = { pl:list };; the interactive env. says Characters 15-19:
<bongy>
type nl = { pl:list; };;
<bongy>
^^^^
<bongy>
The type constructor list expects 1 argument(s),
<bongy>
but is here applied to 0 argument(s)
<bongy>
but wich argument have I to supply ?
<smimou>
it should be "int list" if the list contains int, etc.
<smimou>
you must specify the type of the elements of the list
<Yoric[DT]>
Or, if you want any type of list,
<Yoric[DT]>
type 'a nl = {pl : 'a list; };;
Jeff_123 has joined #ocaml
<Yoric[DT]>
khigia: you could also parametrize one upon the other
<Yoric[DT]>
e.g.
<Jeff_123>
hi yoric!
<Yoric[DT]>
Hi Jeff_123
<Yoric[DT]>
Well, I gotta check if there's a demonstration starting now.
* Yoric[DT]
might return later, depending on politics :)
<bongy>
mmm Yoric[DT] can explain me better what means type 'a nl = {pl : 'a list; };; ??
<Jeff_123>
hmpg
<bongy>
no i understand
<bongy>
;)
<Yoric[DT]>
bongy: for every type 'a, 'a nl is the type of ...
<Yoric[DT]>
well, ok :)
<Yoric[DT]>
still, gottago
<bongy>
thanks you Yoric[DT]
<khigia>
Yoric: thanks, that what I did, but then if I want to implement "to_string" function in Tuple module, I need to pass it a function to apply on each of its parameterized term.
<bongy>
guys there is a way to put a function as record field?
<Jeff_123>
like "type 'a something = { somefunction : ('a -> 'a) }" ?
<bongy>
yep
<bongy>
Jeff_123, and when i want to "let" a record how i specify the function?
<Yoric[DT]>
Well, no demonstration around here.
<Yoric[DT]>
bongy: let a = {somefunction: function x -> y}
<Yoric[DT]>
or, if you already have your function f x = ....
<Yoric[DT]>
let a = {somefunction = f }
<bongy>
ok merçi
<Yoric[DT]>
(sorry, the ":" should have been a "=" )
<Yoric[DT]>
Je vous en prię.
* Yoric[DT]
has no clue why bongy added a cedilla, so that deserves a return cedilla in my answer :)
<bongy>
no sorry i wrong
<bongy>
how works a comparison of two list? why:
<bongy>
# [1;1;1;1;1;1;1] > [6];;
<bongy>
- : bool = false
<bongy>
#
<bongy>
compare the first of list1 with the first of list2 and so on?
<Yoric[DT]>
Just know that it's complicated :)
<Yoric[DT]>
Actually, yes, I believe it's lexicographical order.
<Yoric[DT]>
But comparaison, in general, is something complicated in OCaml.
khigia has left #ocaml []
bringert has quit []
<bongy>
Yoric[DT], i'll forever keep in my mind ;)
<Yoric[DT]>
:)
<bongy>
Yoric[DT], i'm writing a function that takes a list in input and checks whenever the list is in increasing order but it doesn't work ;)