native_killer has quit [Ping timeout: 244 seconds]
rbocquet has quit [Quit: WeeChat 1.1.1]
noplamodo has quit [Remote host closed the connection]
jun__ has quit [Quit: WeeChat 1.1.1]
noplamodo has joined #ocaml
palomer has quit [Quit: palomer]
jwatzman|work has quit [Quit: jwatzman|work]
blueperson1102 has joined #ocaml
blueperson1102 has quit [Ping timeout: 244 seconds]
blueperson1102 has joined #ocaml
echo-area has quit [Remote host closed the connection]
inr has quit [Ping timeout: 264 seconds]
swgillespie has joined #ocaml
bernardo1pc is now known as bernardofpc
palomer has joined #ocaml
<palomer>
hey guys
<palomer>
I want to map values to floating point numbers
<palomer>
in a way which appears random
<palomer>
I was thinking of using ocaml’s hashing function
<palomer>
does hash more or less uniformaly maps values to positive integers?
<palomer>
and is there a way to get the maximum positive int in ocaml?
<palomer>
I’m guessing it’s 2^31 - 1
<Algebr``>
max_int
blueperson1102 has quit [Remote host closed the connection]
blueperson1102 has joined #ocaml
nullcatxxx_ has joined #ocaml
toomuchtvrotsurb has quit [Remote host closed the connection]
<palomer>
ah yisss
<palomer>
darn, hash doesn’t uniformaly map values to ints
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
tmtwd has joined #ocaml
inr has joined #ocaml
keen__________12 has joined #ocaml
keen__________11 has quit [Read error: Connection reset by peer]
echo-area has joined #ocaml
blueperson1102 has quit [Remote host closed the connection]
palomer_ has joined #ocaml
palomer has quit [Ping timeout: 260 seconds]
palomer_ is now known as palomer
SomeDamnBody has quit [Ping timeout: 240 seconds]
xfighter1188 has joined #ocaml
<xfighter1188>
can someone explain how this works
<xfighter1188>
let f x y z = x+y+z in f 1 2
nullcatxxx_ has quit [Read error: Connection reset by peer]
palomer has quit [Quit: palomer]
nullcatxxx_ has joined #ocaml
<Algebr``>
you're creating a function called f which takes 3 arguments and then using it but only partially applying with by not supplying the z parameter.
<xfighter1188>
oh
<xfighter1188>
i could do something like
<xfighter1188>
let eq = let f x y z = x+y+z in f 1 2
<xfighter1188>
and then eq 1
<xfighter1188>
?
<xfighter1188>
ooooh makes senes ty
palomer has joined #ocaml
<Algebr``>
try it in utop
swgillespie has joined #ocaml
palomer has quit [Quit: palomer]
<xfighter1188>
yeah it worked
<xfighter1188>
thank you!
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Algebr`` has quit [Ping timeout: 252 seconds]
<Soni>
let me see if I got this right: ocaml has enums, structs and unions?
ygrek has quit [Ping timeout: 246 seconds]
<Soni>
and closures?
higgs has joined #ocaml
palomer has joined #ocaml
vgrbr has joined #ocaml
<vgrbr>
is ocamlcore.org is down?
rpg has joined #ocaml
lolisa has joined #ocaml
jfntn has joined #ocaml
xfighter1188 has quit []
Bluddy has quit [Quit: Connection closed for inactivity]
psy_ has quit [Ping timeout: 256 seconds]
thmslld has quit [Quit: Leaving]
darkf has joined #ocaml
mac10688_ has quit [Ping timeout: 240 seconds]
ygrek has joined #ocaml
Algebr`` has joined #ocaml
nullcatxxx_ has joined #ocaml
opal has joined #ocaml
rpg has quit [Quit: rpg]
vgrbr has quit [Ping timeout: 240 seconds]
opal has left #ocaml [#ocaml]
mea-culpa has joined #ocaml
struk|desk has quit [Quit: Konversation terminated!]
struk|desk has joined #ocaml
jfntn has quit [Remote host closed the connection]
mal`` has quit [Read error: Connection reset by peer]
tibor_ has quit [Quit: Page closed]
MercurialAlchemi has joined #ocaml
mal`` has joined #ocaml
Snark has quit [Ping timeout: 265 seconds]
Snark has joined #ocaml
<Algebr``>
Drup: Are you around?
psy_ has joined #ocaml
<Algebr``>
anyone familiar with js_of_ocaml on...?
MercurialAlchemi has quit [Ping timeout: 264 seconds]
ggole has joined #ocaml
damason has quit [Ping timeout: 240 seconds]
damason has joined #ocaml
SomeDamnBody has joined #ocaml
tmtwd has quit [Remote host closed the connection]
oscar_toro has joined #ocaml
rgrinberg has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
rgrinberg has joined #ocaml
MercurialAlchemi has joined #ocaml
palomer has quit [Quit: palomer]
palomer has joined #ocaml
larhat1 has quit [Quit: Leaving.]
johnf_ has joined #ocaml
AlexRussia has quit [Quit: WeeChat 1.4-dev]
AlexRussia has joined #ocaml
AlexRussia has quit [Client Quit]
damason has quit [Ping timeout: 250 seconds]
damason has joined #ocaml
rgrinberg has quit [Ping timeout: 260 seconds]
Kakadu has joined #ocaml
inr_ has joined #ocaml
nullcatx_ has joined #ocaml
wagle_ has joined #ocaml
vodkaInf1rno has joined #ocaml
jave has quit [Ping timeout: 250 seconds]
inr has quit [Ping timeout: 250 seconds]
jimt has quit [Ping timeout: 250 seconds]
vodkaInferno has quit [Ping timeout: 250 seconds]
johnelse has quit [Ping timeout: 250 seconds]
brendan has quit [Ping timeout: 250 seconds]
sheijk has quit [Ping timeout: 250 seconds]
wagle has quit [Read error: Connection reset by peer]
nullcatxxx_ has quit [Ping timeout: 250 seconds]
ygrek has quit [Ping timeout: 250 seconds]
swgillespie has quit [Ping timeout: 250 seconds]
sheijk has joined #ocaml
johnelse has joined #ocaml
johnelse is now known as Guest53932
jimt has joined #ocaml
brendan has joined #ocaml
ygrek has joined #ocaml
jave has joined #ocaml
higgs has quit [Quit: Leaving]
rbocquet has joined #ocaml
Haudegen has quit [Ping timeout: 240 seconds]
psy_ has quit [Remote host closed the connection]
Guest53932 is now known as johnelse
Haudegen has joined #ocaml
Algebr`` has quit [Remote host closed the connection]
palomer has quit [Quit: palomer]
oscar_toro has quit [Ping timeout: 264 seconds]
browncod_ has joined #ocaml
browncodes has quit [Read error: Connection reset by peer]
johnf_ has quit [Remote host closed the connection]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
SomeDamnBody has quit [Ping timeout: 240 seconds]
ely-se has joined #ocaml
nullcatx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
oscar_toro has joined #ocaml
oscar_toro has left #ocaml [#ocaml]
zpe_ has joined #ocaml
obadz has quit [Ping timeout: 268 seconds]
zpe has quit [Ping timeout: 240 seconds]
obadz has joined #ocaml
orbifx has joined #ocaml
zpe_ has quit [Ping timeout: 250 seconds]
zpe has joined #ocaml
browncod_ has quit [Ping timeout: 240 seconds]
ygrek has quit [Ping timeout: 265 seconds]
sh0t has joined #ocaml
ollehar has joined #ocaml
sh0t has quit [Ping timeout: 240 seconds]
zpe has quit [Remote host closed the connection]
__uu__ has quit [Ping timeout: 264 seconds]
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
mea-culpa has quit []
zpe has joined #ocaml
cdidd_ has joined #ocaml
cdidd has quit [Ping timeout: 260 seconds]
zpe has quit [Ping timeout: 240 seconds]
zpe has joined #ocaml
ely-se has quit [Quit: leaving]
__uu__ has joined #ocaml
ely-se has joined #ocaml
zpe_ has joined #ocaml
zpe has quit [Read error: Connection reset by peer]
jun_ has joined #ocaml
freehck has joined #ocaml
zpe has joined #ocaml
zpe_ has quit [Ping timeout: 264 seconds]
Haudegen has quit [Ping timeout: 240 seconds]
Haudegen has joined #ocaml
ely-se has quit [Quit: leaving]
<Drup>
Soni: we don't call them like that, but yes
echo-area has quit [Remote host closed the connection]
jonludlam has joined #ocaml
rgrinberg has joined #ocaml
ceryo has joined #ocaml
rgrinberg has quit [Ping timeout: 240 seconds]
fds has joined #ocaml
<reynir>
Variants, records, variants and functions?
<mrvn>
MasseR: that you can do: let a = [] let b = 1 :: a let c = 1.0 :: a
ely-se has joined #ocaml
octachron has joined #ocaml
_andre has joined #ocaml
Kakadu has quit [Remote host closed the connection]
ely-se has quit [Quit: leaving]
__uu__ has quit [Remote host closed the connection]
tane has joined #ocaml
<tane>
hi
<tane>
why does opam require to download a package to remove it?
<tane>
i have hevea package installed, the new version does not exist, now i cannot properly remove it
ely-se has joined #ocaml
yomimono has joined #ocaml
tane has quit [Quit: Verlassend]
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 264 seconds]
hcarty has joined #ocaml
Kakadu has joined #ocaml
<MercurialAlchemi>
tokik: maybe it calls make uninstall?
<MercurialAlchemi>
afaik, opam packages don't have a manifest
vgrbr has joined #ocaml
<def`>
some have I think, that's optional.
<MercurialAlchemi>
one day we'll have ONE TRUE BUILD SYSTEM WITH UPPERCASES
<MercurialAlchemi>
and we'll manifest our joy
<def`>
:)
<MercurialAlchemi>
(that said, let me tell you that even the fairly unpalatable we have now are already superior to msbuild)
zpe has quit [Remote host closed the connection]
mort___ has joined #ocaml
<MercurialAlchemi>
(unapalatable alternatives, that is)
<Drup>
"Palatable" would make a good package name
<def`>
The question is more "what are good build systems"
<MercurialAlchemi>
Drup: :)
<MercurialAlchemi>
def`: we can have a process of elimination
<def`>
It seems fragmented in most languages, it is just much more visible in the small community of OCaml.
* MercurialAlchemi
vaporizes msbuild
<Drup>
MercurialAlchemi: I'm affraid pointing out negative instances is not a constructive process
<MercurialAlchemi>
def`: Java has maven
<MercurialAlchemi>
Drup: I don't want to point it out, I want it to go away :)
<def`>
:D
<dmbaturin>
MercurialAlchemi: Wear appropriate protective equipment to avoid inhaling its vapors.
<Drup>
shake, the haskell thing, is decent
<Drup>
but it's a *build* system, not a package description system
<dmbaturin>
Shake? Never heard of it.
<MercurialAlchemi>
yeah, I hear square bracket vapour is bad for your health
<Drup>
I personally don't really care about build systems, as long as the package description is decent and is not leaky in all directions.
<Drup>
(but I have yet to see one such thing)
<MercurialAlchemi>
it gets more important if you care about portability
<def`>
Not leaking in all directions more or less imply breaking legacy. It is too late
<Drup>
def`: I'm talking about oasis here, not opam
<Drup>
opam doesn't leak all that much, build wise
mort___1 has joined #ocaml
BitPuffin has joined #ocaml
mort___ has quit [Ping timeout: 256 seconds]
mort___1 has left #ocaml [#ocaml]
echo-area has joined #ocaml
Simn has joined #ocaml
ely-se has quit [Quit: leaving]
ely-se has joined #ocaml
yomimono has quit [Ping timeout: 240 seconds]
<hcarty>
Does Lwt provide a way to associate a value (or multiple values) with a thread from outside of the thread?
<hcarty>
A way to associate an arbitrary identifying value with a specific thread, for example
<def`>
hcarty: keys ?
<def`>
Like thread local storage?
<hcarty>
def`: Can you access keys from outside of the thread?
<hcarty>
I'd like something very similar to a key but associated with the thread externally rather than internally
<def`>
I don't know. Semantics of keys is not clear to me.
rgrinberg has joined #ocaml
<hcarty>
They seem to be implicitly associated with the currently active thread, but that's more of a guess based on the interface than a real understanding of how they work
<def`>
Yes
MercurialAlchemi has quit [Read error: Connection reset by peer]
<zozozo>
looking at the doc of Pervasives, I find that it lacks a list of the builtin types available, which could be useful, am I the only one thinking that ? if not, where do you think such a list should be ?
<flux>
File "foo.ml", line 1, characters 33-36: Error: Syntax error
<malc_>
apache2: why would it be an error?
<malc_>
it's just a type declaration and a value
<nicoo>
def`: “I want erlang/smalltalk like introspection” -> I want an Erlang-like actor model, but safely typed (and keep “just let it crash”)
<malc_>
nothing erroneous there
<flux>
because it's not a top-level statement
<flux>
and because it IS an error :-)
<companion_cube>
malc_: type a = { .... } ;; 123 ;; might work
<apache2>
malc_: I didn't say it was an error, I just asked what it meant
<malc_>
apache2: oh, it means a type and a value
<def`>
nicoo: +1, et un snickers avec
<apache2>
malc_: what does the value do?
<malc_>
apache2: in this case nothing
<apache2>
ah ok
<apache2>
I guess I was a bit confused that unnamed values are allowed like that
<nicoo>
def`: Yummmm
<Drup>
apache2: you have camlp4 loaded and it's a bug
<apache2>
Drup: yes, I have camlp4 loaded. ok :)
BitPuffin has quit [Ping timeout: 255 seconds]
<Drup>
<insert generic rant about camlp4/>
<flux>
how does it mistranslate .. } foo ()? into .. } let _ = foo () ?
<Drup>
it doesn't, it seems to just drop it
<Drup>
oh no, it doesn't drop, it actually parse/evaluate it
<Drup>
just doesn't show anything in the repl
tibor_ has joined #ocaml
xet7_ has joined #ocaml
xet7 has quit [Ping timeout: 250 seconds]
igoroliveira has joined #ocaml
nullcatxxx_ has joined #ocaml
NingaLeaf has joined #ocaml
xet7_ is now known as xet7
ohama has quit [Ping timeout: 252 seconds]
ohama has joined #ocaml
zpe has joined #ocaml
palomer has joined #ocaml
zpe has quit [Ping timeout: 250 seconds]
^elyse^ has joined #ocaml
jwatzman|work has joined #ocaml
palomer has quit [Ping timeout: 250 seconds]
xet7 has quit [Remote host closed the connection]
xet7 has joined #ocaml
toomuchtvrotsurb has joined #ocaml
Bluddy has joined #ocaml
psy_ has joined #ocaml
octachron has quit [Quit: Leaving]
Algebr has joined #ocaml
jonludlam has quit [Ping timeout: 255 seconds]
<Algebr>
the printf family of functions are hardcoded for certain things, say %d and the like. Why isn't there some way to say %special, say for objects, that it blindly calls my object's method that yields a string representation?
<Algebr>
Or more generally, why can't the printf functions accept my implementation of string representations of my data?
<hcarty>
Algebr: There is %a
<hcarty>
Algebr: And more recently you can do some custom printf stuff via ppx. I don't know the details of how that works though.
dsheets has quit [Ping timeout: 240 seconds]
<Algebr>
ah! didn't see it before.
<def`>
%t can be helpful too
tristero has joined #ocaml
orbifx1 has joined #ocaml
Haudegen has quit [Ping timeout: 252 seconds]
jeffmo has joined #ocaml
toomuchtvrotsurb has quit [Remote host closed the connection]
toomuchtvrotsurb has joined #ocaml
Haudegen has joined #ocaml
<hcarty>
def`: Very handy
<Algebr>
ah, %t looks easier
ollehar1 has joined #ocaml
dsheets has joined #ocaml
bjorkintosh has quit [Quit: Leaving]
jonludlam has joined #ocaml
TheLemonMan has joined #ocaml
^elyse^ has quit [Quit: Leaving]
native_killer has joined #ocaml
zpe has joined #ocaml
Denommus has joined #ocaml
vgrbr has quit [Ping timeout: 264 seconds]
yomimono has quit [Ping timeout: 240 seconds]
mort___ has quit [Ping timeout: 246 seconds]
zpe has quit [Ping timeout: 268 seconds]
chindy has joined #ocaml
ygrek has joined #ocaml
<chindy>
can someone help me lets say i define a list-type this way: [....] = Niil | Cons of('a * 'a list)
<chindy>
i am not sure what Cons of('a * 'a list) is, can anyone expalin ?
nullcatxxx_ has quit [Quit: gone...]
<Algebr>
Cons is a constructor that takes a thing of type a and a list of type a
<Algebr>
and a list filled with stuff of type a
<Denommus>
chindy: ('a * 'a list) is a tuple where the first element has type 'a and the second has type 'a list
<chindy>
so is it a constructor of Ocaml or did "i" define it somewhere?
vgrbr has joined #ocaml
<chindy>
how does ocaml differentiate (10 * 10) from beeing 100 and beeing a tuple of two 10s ?
<chindy>
Denommus:
<Denommus>
chindy: you did
<chindy>
fml... where :(
toomuchtvrotsurb has quit [Remote host closed the connection]
<Denommus>
chindy: in the value level, * is the multiplication operation
<thizanne>
chindy: (10, 10) is a tuple of two 10s of type (int * int)
<Denommus>
chindy: in the type level, it's a tuple constructor
<chindy>
thizanne:so how do i multiply ten by ten ?
orbifx1 has quit [Ping timeout: 255 seconds]
<chindy>
Denommus:type level ?
<thizanne>
chindy: by writing 10 * 10
<thizanne>
read what I wrote
TheLemon1an has joined #ocaml
bjorkintosh has joined #ocaml
<chindy>
... thanks a lot i really am kinda lost with this functional programming :/
<Denommus>
chindy: values aren't types, types aren't values. Types only constraint values in some ways. So, when you are defining a type, functions and operations on values simply don't exist
toomuchtvrotsurb has joined #ocaml
<Denommus>
chindy: this is not really related to functional programming, though
<chindy>
Denommus: I am fairly sure when i write a constructor who it looks/behaves/gets called in imperative or OO languages
<Denommus>
chindy: imperative and OO languages also have type-level construtors
<Denommus>
chindy: for instance, List<Foo>
^elyse^ has joined #ocaml
<Denommus>
chindy: this <...> syntax is only valid in the type-level, you never use it in the value-level
vgrbr has quit [Ping timeout: 252 seconds]
TheLemonMan has quit [Ping timeout: 246 seconds]
<chindy>
Denommus: ohhh... now i know what it is its to instantiate the type 'a since its a "template-type" and needs to be deduced ?
<chindy>
so Cons calls the constructor of a whatever type a may be
hcarty1 has joined #ocaml
<Denommus>
chindy: I was talking about *, actually
<Denommus>
chindy: in C#, for instance, you have the type constructor Tuple
<chindy>
haha, damn
<Denommus>
chindy: you define Tuple<Foo, Bar> to define a tuple where the first element is Foo and the second is Bar
<Denommus>
chindy: in OCaml, that would be foo * bar
<chindy>
YES. I can follow to this point.
<chindy>
and in the cas ('a * 'a list) i tell ocaml that i want a pair of a and list of a
<chindy>
?
<Denommus>
chindy: exactly
<chindy>
so ...Cons of... is specifically the syntax to invoke said constructor?
hcarty has quit [Ping timeout: 255 seconds]
<chindy>
so Cons of('a * 'a list) invokes the constructor of a pair with 'a and 'a list
<Denommus>
chindy: I'll explain, wait
jonludlam has quit [Ping timeout: 264 seconds]
<Denommus>
chindy: a type in OCaml may have one or more constructor. Each constructor defines a variant for that type. Each variant holds a different value of a different type
jonludlam has joined #ocaml
<Denommus>
chindy: type 'a list = Nil | Cons of ('a * 'a list) is defining a type with two variants. The first variant is just "Nil", and holds no associated value
<Denommus>
chindy: the second constructor is called "Cons", and holds a value of type ('a * 'a list)
native_killer has quit [Read error: Connection reset by peer]
<chindy>
OKay, so whats the of keyword for? or is this just how [name of constructor] of ('a * 'a ) syntax works ?
<Denommus>
chindy: it's part of the syntax
<chindy>
could i also just write type 'a list = Nil | Cons of int
<Denommus>
chindy: yup, though that wouldn't be an actual list XD
<chindy>
so list would be a type that could either be Nil or an int ?
<chindy>
yea true ;)
BitPuffin has joined #ocaml
<chindy>
Wow thank you very much...
<Denommus>
chindy: you're welcome
SomeDamnBody has quit [Ping timeout: 252 seconds]
<chindy>
Denommus:any suggestions on projects or way to learn/read OCAML code...?
<chindy>
any goto not tooo compley github reps or anything ?
<dmbaturin>
chindy: type intlist = Nil | Cons of int * int list (* this would be a correct definition of integer list *)
<dmbaturin>
* int intlist
<chindy>
but wouldnt that invoke the constructor of int and then try mutiply it by int int list ?
<Denommus>
chindy: that's an excellent question. I came from a Haskell background, so I already knew how some things worked, so went straight ahead to some web framework (Eliom)
<def`>
depends on what you are interested into also
<dmbaturin>
** intlist. My brain doesn't work today.
<chindy>
dmbaturin:since you omitted the brackets
<def`>
:)))
<Denommus>
chindy: whenever you see a type declaration, keep in mind that you can't use value-level stuff. So * is always, ALWAYS a tuple constructor
<chindy>
def... well right now? Learning and understanding the concept of functional programming
<chindy>
Denommus:okay
<def`>
Ah, that's wise.
<chindy>
def`: ;) yea its part of my Universities curriculum.. and honestly it sounds intriguing just,...., so unfamiliar
adelbertc has joined #ocaml
<def`>
chindy: what are you studying?
<chindy>
def`: Computer Science
<def`>
It's more interesting to look into other projects if you can relate to something you are familiar with
vgrbr has joined #ocaml
<adelbertc>
hey folks - need some hints on implementing a dictionary using a record type to hide the implementation detail (without modules)
malc_ has quit [Ping timeout: 256 seconds]
<adelbertc>
the exercise is to implement an `empty : ('key, 'value) dictionary, given type ('key 'value) dictionary = { insert : 'key -> 'value -> ('key, 'value) dictionary; find : 'key -> 'value }
<chindy>
def`:not quite sure what you mean by that(the irony)... but do i honestly dont really know any smaller projects in Ocaml, that are not already algorithm wise etc... challenging where i can literally read code understand what it is supposed to do and just learn :/
malc_ has joined #ocaml
<adelbertc>
i've tried closing over a list in the implementation, something similar to let insert_f dict key value = (key, value) :: dict in let find_f = List.assoc in { insert = insert_f []; find k = raise Not_found } but it doesn't type check since the returned values int ehf ucntions are lists, not the record type
<dmbaturin>
chindy: Also, functions that use polymorphic types are not really instantiated. When the compiler infers their type, it may restrict some types to their specific instances, or, if nothing depends on it, keep them polymorphic. For instance, "let sum xs = List.fold_left (fun x y -> x + y) 0 xs" will be int list -> int, while "let len xs = List.fold_left (fun x y -> x + 1) 0 xs" will be 'a list -> int.
<chindy>
dmbaturin: so, variable types are "runtime" dependant?
<chindy>
or rather "instantiated at runtime ?
marsam has quit [Read error: Connection reset by peer]
Kakadu has quit [Quit: Page closed]
<dmbaturin>
chindy: No, no type information is kept at runtime (except for "polymorphic variants", but that's a special case). Functions with polymorphic types are those that don't do anything with values attached to data constructors, so they don't care what type they are.
TheLemon1an has quit [Ping timeout: 265 seconds]
<dmbaturin>
As opposed to e.g. Java where generics have to be instantiated with every concrete type you want to use them with.
TheLemonMan has joined #ocaml
kdas_ has joined #ocaml
kdas_ has quit [Read error: Connection reset by peer]
ollehar1 has quit [Ping timeout: 256 seconds]
<dmbaturin>
I hope this explanation didn't add more confusion rather than remove some. ;)
<adelbertc>
@mahem1 - yeah dictionary, set, either works
<adelbertc>
i mostly used set in the SO post for simplicity
rand__ has joined #ocaml
ggole has quit []
sh0t has joined #ocaml
BitPuffin has quit [Read error: Connection reset by peer]
<mahem1>
adelbertc: Hmmm, ok so then what does the insert function's 'a -> 'a set signature mean? We just give 'a as a param and somehow we get a set back? Is this suppose to be an inplace insert/append function?
<adelbertc>
that's whats confusing me
<adelbertc>
the book says the impl should be pure w/ no side effects
<adelbertc>
so can't close over a `ref` or anything
darkf has quit [Quit: Leaving]
<mahem1>
adelbertc: Wait, so the book gave you that signature? Does the book already have a definition of a set anywhere?
<mahem1>
We must be missing something here.
swgillespie has joined #ocaml
<mahem1>
Perhaps the insert function is used more as a "create" function? Like: create_list item = [item];;
<adelbertc>
yeah that's the definition the exercise in the book shows
Kakadu has joined #ocaml
<adelbertc>
i'm pretty confused :|
wagle_ is now known as wagle
<mahem1>
adelbertc: So the book does not provide any other context?
<adelbertc>
not that i can see
<mahem1>
Then this problem is well above my pay grade.
<dmbaturin>
adelbertc: I've added a nice reference to the SO answer. There are examples of implementing a set with a sum type and with nothing but functions.
marsam has joined #ocaml
<adelbertc>
dmbaturin: thanks! i added a comment about your impl for the `insert` case
<rand__>
Hmm, I have a question; we have no way of explicitly including existing polymorphic variant types as part of a new polymorphic variant type - except when doing this directly as part of a patternmatch?
<rand__>
like in 'function #pv1 -> .. | #pv2 -> ..'
<dmbaturin>
rand__: Hhm, I think not, but there may be some trick I missed.
slash^ has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
<rand__>
Ok thx - I guess there is no way to do this when you have a look at Ocsigen's Html5_types interface - all those repetitive pv type-definitions would have been defined with this feature.. https://ocsigen.org/tyxml/3.5/api/Html5_types
<mahem1>
dmbaturin: So in the essay you linked, insert has a signature of (set * int) -> set. So in adelbertc's case, the insert method he was using of 'a -> 'a set then 'a must have to be some type of pair (or just not a simple datatype)?
<adelbertc>
the impl of `insert` is what i've been having trouble with
zpe has quit [Ping timeout: 265 seconds]
<adelbertc>
i've tried the intentional (or is it extensional..) encoding of the set and got stuck there too
<dmbaturin>
mahem1: Ah, yes, the type in adelbertc's example is incomplete. There is no way to refer to the record functions is called from.
<adelbertc>
i see how `contains` would just be `false` but `insert` is tricky.
<adelbertc>
so it's possible the exercise is wrong
<adelbertc>
which is what i'm leaning towards now
kushal has joined #ocaml
larhat1 has joined #ocaml
<dmbaturin>
That's why I say this definition is cumbersome: the record wrapping only makes things harder.
Algebr has quit [Read error: Connection reset by peer]
Algebr has joined #ocaml
Haudegen has quit [Ping timeout: 256 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Algebr>
does lazy make sense in jsoo?
<adelbertc>
@dmbaturin - that's an awesome paper btw, thanks!
_andre has quit [Quit: leaving]
Haudegen has joined #ocaml
jonludlam has quit [Ping timeout: 250 seconds]
moei has quit [Quit: Leaving...]
<Drup>
rand__: it's a bit used in tyxml but ocamldoc fully unfold them
jrslepak has quit [Remote host closed the connection]
<Drup>
you would have to look at the source code to see that used
<Drup>
(at least, iirc)
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
freehck has quit [Ping timeout: 246 seconds]
jrslepak has joined #ocaml
marsam has quit [Remote host closed the connection]
Algebr` has joined #ocaml
hcarty1 has joined #ocaml
marsam has joined #ocaml
Algebr has quit [Ping timeout: 244 seconds]
Haudegen has quit [Ping timeout: 264 seconds]
Haudegen has joined #ocaml
lobo has joined #ocaml
AlexRussia has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 255 seconds]
ontologiae has joined #ocaml
Algebr` has quit [Read error: Connection reset by peer]
Algebr` has joined #ocaml
oscar_toro has joined #ocaml
SomeDamnBody has joined #ocaml
oscar_toro has left #ocaml [#ocaml]
zpe has joined #ocaml
zpe has quit [Ping timeout: 246 seconds]
echo-area has quit [Ping timeout: 268 seconds]
echo-area has joined #ocaml
<mfp>
rand__: type a = [`A | `B ] type b = [ a | `C ] is equivalent to type b = [ `A | `B | `C ]
mac10688_ has joined #ocaml
moei has joined #ocaml
Simn has quit [Quit: Leaving]
orbifx1 has joined #ocaml
ygrek has quit [Ping timeout: 264 seconds]
SomeDamnBody has quit [Ping timeout: 252 seconds]
^elyse^ has quit [Quit: Leaving]
shinnya has joined #ocaml
Algebr` has quit [Remote host closed the connection]
jonludlam has joined #ocaml
<rand__>
mfp: Ah thanks (:
marsam has quit [Remote host closed the connection]
marsam has joined #ocaml
<apache2>
can you do dsomething similar for non-polymorphic variants?
<rand__>
Drup: Ok - that's why (: .. almost couldn't believe my own eyes when I saw the interface of a lib under the functional (declarative + concise) paradigm
adelbertc has quit [Quit: Connection closed for inactivity]
hcarty1 has quit [Ping timeout: 260 seconds]
orbifx1 has quit [Ping timeout: 250 seconds]
jwatzman|work has quit [Quit: jwatzman|work]
nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
<rand__>
apache2: I'm thinking you will able to do something like it with first-class modules by including