FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
tmtwd has joined #ocaml
AlexRussia has quit [Ping timeout: 276 seconds]
Mercuria1Alchemi has joined #ocaml
mistermetaphor has quit [Remote host closed the connection]
<Algebr`>
it would help to have a fully complete code sample that can be run
<zRecursive>
sorry, just code snippets here
<jun__>
actually your code fail on the first assertion
<jun__>
since List.length yes_red = 2 and count = 8
<zRecursive>
List.length yes_red should be greated thant count
<zRecursive>
1 .. 55
<jun__>
well it is not
<jun__>
[1 ; 55] is a list with two elements
<jun__>
1 and 55
douglascorrea has quit [Remote host closed the connection]
<jun__>
what youu want is probably something along the line of Array.init 55 succ |> Array.to_list
<zRecursive>
oh, there is a function (--) let (--) i j = let rec aux n acc = if n < i then acc else aux (n-1) (n :: acc) in aux j [];; so (1--55) works.
<zRecursive>
[1;55] should be [1--55]
Mercuria1Alchemi has quit [Ping timeout: 258 seconds]
<jun__>
rather 1 -- 55 (without brackets)
<zRecursive>
yeah
<zRecursive>
(1 -- 55)
<jun__>
in utop I get different results
<zRecursive>
I guess it is due to windows
<jun__>
your print_oneRed in your example is dubious as well
<zRecursive>
i will check it
<jun__>
if you had a complete and minimal exemple it would help
<zRecursive>
it is not by hand
<zRecursive>
i will check it later
clockish has quit [Ping timeout: 260 seconds]
clockish has joined #ocaml
dsheets has joined #ocaml
dsheets has quit [Remote host closed the connection]
d0nn1e has quit [Ping timeout: 276 seconds]
orbifx-m has joined #ocaml
d0nn1e has joined #ocaml
dsheets has joined #ocaml
dsheets has quit [Ping timeout: 246 seconds]
connorjacobsen has quit [Remote host closed the connection]
orbifx-m has quit [Ping timeout: 244 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
<flux>
heh, 11 years old project (docs mention date 2005)
<Algebr`>
nice
redpoppies has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
nore has quit [Ping timeout: 240 seconds]
yunxing_ has quit [Remote host closed the connection]
yunxing_ has joined #ocaml
douglascorrea has joined #ocaml
yunxing_ has quit [Ping timeout: 276 seconds]
nore has joined #ocaml
AltGr has joined #ocaml
douglascorrea has quit [Ping timeout: 276 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
sgnb has joined #ocaml
ygrek has joined #ocaml
dsheets has joined #ocaml
dsheets has quit [Ping timeout: 272 seconds]
ia0 has quit [Quit: reboot]
AlexRussia has joined #ocaml
ia0 has joined #ocaml
dsheets has joined #ocaml
dsheets has quit [Ping timeout: 260 seconds]
TheVoid has quit [Read error: Connection reset by peer]
mehdib has quit [Ping timeout: 258 seconds]
dexterph has joined #ocaml
mehdib has joined #ocaml
A1977494 has joined #ocaml
TheVoid has joined #ocaml
infinity0 has joined #ocaml
jonasen has joined #ocaml
dsheets has joined #ocaml
bba has joined #ocaml
jonasen has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
larhat has joined #ocaml
jwatzman|work has joined #ocaml
jwatzman|work has quit [Changing host]
jwatzman|work has joined #ocaml
TheLemonMan has joined #ocaml
dsheets has quit [Remote host closed the connection]
dsheets has joined #ocaml
demonimin has quit [Ping timeout: 244 seconds]
demonimin has joined #ocaml
demonimin has joined #ocaml
zRecursive has quit [Remote host closed the connection]
Simn has joined #ocaml
amnn has joined #ocaml
dhil has joined #ocaml
douglascorrea has joined #ocaml
douglascorrea has quit [Ping timeout: 250 seconds]
dsheets has quit [Remote host closed the connection]
dsheets has joined #ocaml
sdothum has joined #ocaml
ygrek has quit [Ping timeout: 272 seconds]
dsheets has quit [Remote host closed the connection]
orbifx-m has joined #ocaml
dsheets has joined #ocaml
bba has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<orbifx-m>
Hello l
<orbifx-m>
All
dsheets has quit [Remote host closed the connection]
dsheets has joined #ocaml
<orbifx-m>
Does at_exit get called even if there was an uncaught exception?
<mrvn>
orbifx-m: why don't you just try it?
<orbifx-m>
Time efficiency. Faster and more reliable asking those who might know
<orbifx-m>
That said, I just noticed the documentation specifies it
dsheets has quit [Remote host closed the connection]
dsheets has joined #ocaml
<reynir>
heh
lokien has quit [Ping timeout: 258 seconds]
tane has joined #ocaml
dsheets has quit [Remote host closed the connection]
dsheets has joined #ocaml
bba has joined #ocaml
douglascorrea has joined #ocaml
Simn has quit [Read error: Connection reset by peer]
douglascorrea has quit [Ping timeout: 258 seconds]
pierpa has joined #ocaml
Simn has joined #ocaml
algoriddle has joined #ocaml
dsheets has quit [Remote host closed the connection]
lokien has joined #ocaml
bba has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<flux>
thanks for not sharing.. :-)
bba has joined #ocaml
ygrek has joined #ocaml
octachron has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
douglascorrea has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 246 seconds]
FreeBirdLjj has joined #ocaml
sh0t has joined #ocaml
douglascorrea has quit [Ping timeout: 244 seconds]
douglascorrea has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
AltGr has left #ocaml [#ocaml]
FreeBirdLjj has joined #ocaml
amnn has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dsheets has joined #ocaml
AltGr has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Read error: Connection reset by peer]
FreeBirdLjj has joined #ocaml
dsheets has quit [Ping timeout: 252 seconds]
rgrinberg has joined #ocaml
redpoppies has quit [Quit: redpoppies]
tane has quit [Quit: Verlassend]
amnn has joined #ocaml
dsheets has joined #ocaml
<sh0t>
guys when I use polymorphic variants how do I specify references I mean say I have: type a = [`Int of int| `String of string] is there a way i can then do: type b=[ a ref | `Float of float] ?
<companion_cube>
type b = [a | `Float of float]
bba has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<sh0t>
yes but i want b to be either a reference to an a or a Float of float...
<Drup>
a ref is not a polymorphic variant
<Drup>
you need poly variants.
<sh0t>
sorry Drup I am very new of ocaml...can you please point me at the right web page to start reading bout them?
<companion_cube>
type b = [`Ref of a ref | `Float of float] ?
<Drup>
sh0t: honestly, if you are very new, don't use poly variants :)
<sh0t>
so companion_cube the point is I didn't want to add a new constructor...for ref if possible...cause it's getting a pain ...
<Drup>
use normal variants, they are quite easier to use, then you can jump the hook later on
<companion_cube>
sh0t: I understand, but the thing is, you need something to know if you're manipulating a reference or a `Float of float
<companion_cube>
(and +1, poly variants are not really a beginner topic)
<sh0t>
so should not use poly variants either lol?
<sh0t>
*should I
<sh0t>
:)
<pierpa>
why do you think you need to use them?
<sh0t>
it's not strictly necessary I think but: say i have a type a=A of...|... and then another one type b=C of int |...| N of (a ref). Now to construct an object of b i need to concatenate a constructor for a and one for b (plus ref...) when it's actually the type a that i am working on...
<sh0t>
not sure if i am clear ...probably not.
<sh0t>
So i thought let's use polymorphic variants...that would allow me to use a as b but I cant use ref...
<pierpa>
polymorphic or not, they're still algebraic types. They need a constructor
<pierpa>
and, you are getting into trouble just because you don't wa to type N!
<pierpa>
+want
<sh0t>
yes they need a constructor sure...
<pierpa>
THAT's lazy
<sh0t>
?
<companion_cube>
thaT's LazY
<sh0t>
i don't think i am lazy i was just thinking that I was having a bad style of programming
<pierpa>
using a constructor for your refs is ok
jwatzman|work has quit [Quit: jwatzman|work]
<sh0t>
ok one problem i had is this: say i have another type c=D of...|M of (a ref)...
<sh0t>
say I want a function from b to c I mean (let's sya we only care about elements of he form N(a ref) on the domain and M of (a ref)...
<sh0t>
now doing something like: let f x= let N(t)=x in M(t) is it ugly?
<pierpa>
I think it's normal
<Drup>
what do you do if it's not a N ?
tane has joined #ocaml
<sh0t>
well Drup it shouldn't happen from the way i am writing my programm but i should actually raise an exception or let ocaml do that for me...
<sh0t>
(this is probably bad)
octachron_ has joined #ocaml
<mehdib>
this IS BAD
<pierpa>
hmmm
octachron has quit [Ping timeout: 250 seconds]
<Drup>
sh0t: why not just pass the ref, then ?
<Drup>
instead of the N
<Drup>
if you are sure it's an N, you have already pattern matched, so you can pass the ref directly
<sh0t>
mmm
<Drup>
in general, sh0t, first do it with good old ADT and some carefully placed assert false
<Drup>
then, we you are more fluent in OCaml, use fancy types
<sh0t>
ok Drup
<sh0t>
another thing
<Drup>
when*
|meta has joined #ocaml
<sh0t>
is it bad practice to add type annotations to your function arguments?
<Algebr`>
not bad practice
<Drup>
it's not bad practice, but it's not idiomatic
<sh0t>
ok it helps me
<sh0t>
i mean in general
<Algebr`>
if it helps you then do it
<sh0t>
ok
<Drup>
Are you using merlin ?
seangrove has joined #ocaml
<sh0t>
mmm no u mean the emacs-thing?
<Drup>
it's not emacs only, you can use it with some other text editors
<sh0t>
i am using tuareg...
<Drup>
You should use it
<sh0t>
ok
<sh0t>
why?
rgrinberg has quit [Quit: WeeChat 1.5]
<reynir>
It's awesome
<sh0t>
ahah fair enough
<Algebr`>
tuareg is like syntax highliginting in emacs
<Algebr`>
it provides code completion, typechecking. Will help you not have to use type annotation since you could just check the type of any expression
<Algebr`>
sh0t:
<sh0t>
ohh
<sh0t>
good
<sh0t>
i'll try that
<sh0t>
ok thanks guys
octachron_ has quit [Ping timeout: 250 seconds]
FreeBird_ has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 260 seconds]
FreeBird_ has quit [Ping timeout: 240 seconds]
Reshi has joined #ocaml
Kakadu has joined #ocaml
bba has joined #ocaml
bba has quit [Client Quit]
TheLemonMan has quit [Remote host closed the connection]
TheLemonMan has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 276 seconds]
MercurialAlchemi has joined #ocaml
Reshi has quit [Quit: WeeChat 1.5]
sh0t has quit [Remote host closed the connection]
kyo91 has joined #ocaml
wiredsister has joined #ocaml
<Algebr`>
sh0t: while you're at it, could also look at ocp-indent, has editor plugins as well
<Algebr`>
I'm wondering about this:
<Algebr`>
Say you do Lwt_preemptive.detach
mistermetaphor has joined #ocaml
<Algebr`>
No point then to do Lwt.async in the thread right, since you already did a detach
<Algebr`>
Assume there is only task to be done
<Algebr`>
Could it be argued that detach and async are interchangable in some situations?
kyo91 has quit [Ping timeout: 272 seconds]
<Algebr`>
one task*
copy` has joined #ocaml
bba has joined #ocaml
struktured has joined #ocaml
sh0t has joined #ocaml
struktured has quit [Ping timeout: 240 seconds]
<Enjolras_>
Algebr`: yes. Actually detach use Lwt.wait/Lwt.wakeup under the hood
<Enjolras_>
detach basically sends a message to a pool of threads via a queue, the worker threads peek tasks from the queue, execute, and send back the results to the main thread which does Lwt.wait to waekup your waiting thread and detach completes
redpoppies has joined #ocaml
<Algebr`>
right, Lwt is so simple
<Algebr`>
Enjolras_: thanks!
k1000 has quit [Ping timeout: 260 seconds]
<seangrove>
Algebr`: Just a heads up that the Mirage fortnight call is in #mirage right now
<Leonidas>
is there a lua_of_ocaml compiler? or a beltscript compiler?
<Algebr`>
noooo my cat chewed through my laptop charger
jwatzman|work has joined #ocaml
<Drup>
Leonidas: that would be fun
<Leonidas>
is your cat still alive?
<Algebr`>
she's too sweet to be mad at.
kyo91 has joined #ocaml
<Algebr`>
what is beltscript
<Leonidas>
Drup: yeah, I got a few backends like Factorio or LOVE that I could program for
<Leonidas>
Algebr`: the lua equivalent to bucklescript
<Drup>
I'm not even sure what that is supposed to be
<Algebr`>
Lua -> JS?
<Leonidas>
one is a game and the other a game engine. but there are many applications that can be scripted in lua
dexterph has quit [Ping timeout: 240 seconds]
<Algebr`>
nginx can be scripted with lua
<seangrove>
Redis as well, I believe
<Algebr`>
I see lua used a lot in games
<seangrove>
That's the common wisdom, yeah
redpoppies has quit [Quit: redpoppies]
ygrek has quit [Ping timeout: 246 seconds]
jonasen has joined #ocaml
dsheets has quit [Remote host closed the connection]
k1000 has joined #ocaml
dsheets has joined #ocaml
k1000 has quit [Client Quit]
mistermetaphor has quit [Remote host closed the connection]
Sim_n has joined #ocaml
k1000 has joined #ocaml
Algebr` has quit [Ping timeout: 250 seconds]
Simn has quit [Ping timeout: 260 seconds]
AltGr has left #ocaml [#ocaml]
slash^ has joined #ocaml
kyo91 has quit [Ping timeout: 260 seconds]
jwatzman|work has quit [Quit: jwatzman|work]
thibm has joined #ocaml
jwatzman|work has joined #ocaml
dakk has quit [Ping timeout: 260 seconds]
unbalancedparen has joined #ocaml
<sh0t>
guys I am trying to use merlin but i keep getting "Unbound module..." error
<sh0t>
I have for now the .ml in the same dir..and the mli in another one by the way i am tryign to use a .merlin file but it seems it doesn't work
dsheets has quit [Remote host closed the connection]
dsheets has joined #ocaml
<companion_cube>
you probably need to add the build dirs
<companion_cube>
you also need to have built the other modules
<sh0t>
well in _build/src there are the respective .cm[i|o|t]
<def`>
sh0t: emacs or vim?
<sh0t>
emacs
<def`>
Try M-x merlin-project-check
<def`>
Tell us what is the output :)
<sh0t>
it says...Loaded .merlin files: /home/gpietro/proj/.merlin
<def`>
what happens if you type C-c C-t on some expression? Can you see types from your project?
<sh0t>
def`, yes I can...i don't know why it works now...
A1977494 has quit [Remote host closed the connection]
<sh0t>
i added B _build/src/*
<def`>
you have subdirectories ?
<sh0t>
no
<sh0t>
it's weird reading the doc i shouldn't need that
<def`>
maybe the .merlin file was not updated when you first tried.
<sh0t>
mmmm maybe but i doubt that
<def`>
you shouldn't need this last line yes, try again without it
<sh0t>
ok
<def`>
sorry I cannot help more :)
<sh0t>
it's ok thanks anyway. A question when i edit .merlin
<sh0t>
shoud i do something to "load it"?
<Algebr>
Nothing
<Algebr>
Merlin will read it
<sh0t>
allright thanks
<sh0t>
anyway now without the * works too
<Algebr>
say you are using lwt, then you just need PKG lwt
<sh0t>
ok
<Algebr>
the _build/src/* sort of assumes oasis/ocamlbuild. Its where the compiled code is.
<Algebr>
but you can choose whatever you want to be that path
dsheets has quit [Remote host closed the connection]
douglascorrea has quit [Remote host closed the connection]
MercurialAlchemi has quit [Ping timeout: 260 seconds]
avsej has joined #ocaml
avsej has quit [Changing host]
avsej has joined #ocaml
shinnya has joined #ocaml
<sh0t>
ok. Guys I have another question: I am trynig to implement a semantics for a toy language. This semantics has a lots of complex rules.. so I thought I'd define a function for every rule and then in another function i'd pattern match on the expression and call this functions. Now this functions in general go from expr->a, but every single "small function" takes care only of a specific constructor for expr. This means that when I pattern
<sh0t>
match on the expression on the small function i get a lot of warnings (cause i don't cover all the patterns). Whatwould you guys do? I am sure there is a smarter way.
<Algebr>
have you heard of menhir, ocamlyacc, ocamllex?
<thizanne>
sh0t: let's say one of your patterns is Construction (arg1, arg2, arg3)
<sh0t>
yes. But those are for parsing and lexing...
<sh0t>
ok thizanne
<thizanne>
currently you have let deal_with_construction (Constriuction (a, b, c)) = ...
<thizanne>
and a matching warning
<thizanne>
change it to let deal_with_construction a b c = ...
<thizanne>
and have a big function which does match thing with ... | Construction (a, b, c) -> deal_with a b c
<sh0t>
yeah i guess that's the way to go...
<thizanne>
it's one way to go, i'm not sure being afraid of one big function and splitting it into several ones that don't factorise anything is the right way to do things
<thizanne>
i personnally often do it though
<sh0t>
i don't like big functions personally.
<sh0t>
Also i find that using small functions helps me to match with the rules of the formal semantics better
<sh0t>
and so "i think" i can reason better about programs
seangrove has quit [Ping timeout: 276 seconds]
<sh0t>
just a vague opinion
<sh0t>
:)
<sh0t>
Algebr, sorry maybe I didn't understand..why did you mention to me those tools?
bba has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bba has joined #ocaml
dsheets has joined #ocaml
lokien has quit [Ping timeout: 258 seconds]
<Algebr>
sh0t: I thought you were making a programming language
<sh0t>
yes I am..a very simple one and yes I did use ocamllex and ocamlyacc for the first stage.
douglascorrea has joined #ocaml
<Algebr>
ohh, you're writing the eval function
<Algebr>
or somethign like it
<sh0t>
actually so far that was the harder part...doing that WITHOUT those tools i think i'd kill myself.
<sh0t>
yes thee eval :)
thibm has quit [Quit: WeeChat 1.5]
wiredsister has quit [Ping timeout: 260 seconds]
kolko has joined #ocaml
seangrove has joined #ocaml
orbifx-m2 has joined #ocaml
orbifx-m has quit [Read error: Connection reset by peer]
orbifx-m3 has joined #ocaml
orbifx-m has joined #ocaml
connorjacobsen has joined #ocaml
<Algebr>
if you're in the Bay area then consider coming to OCaml office hours on Friday in SF.
<Algebr>
sh0t:
<sh0t>
? i don't know what that is :)
<sh0t>
oh i see
<seangrove>
Algebr: This Friday won't work for me, sadly. Maybe next week.
connorjacobsen has quit [Remote host closed the connection]
orbifx-m2 has quit [Ping timeout: 246 seconds]
connorjacobsen has joined #ocaml
<Algebr>
SF is San Francisco, USA.
larhat has quit [Quit: Leaving.]
orbifx-m3 has quit [Ping timeout: 260 seconds]
<Algebr>
seangrove: no probs, I finally made it reoccuring so it will happen each week automatically.
jwatzman|work has quit [Quit: jwatzman|work]
mistermetaphor has joined #ocaml
orbifx-m has quit [Ping timeout: 260 seconds]
myst|fon has quit [Quit: Connection closed for inactivity]
tane has quit [Quit: Verlassend]
yunxing_ has joined #ocaml
<struk|work>
I need to make it back out there
<struk|work>
its too hot i nyc
<struk|work>
*in
lokien has joined #ocaml
copy` has quit [Quit: Connection closed for inactivity]
rgrinberg has quit [Ping timeout: 276 seconds]
dsheets has quit [Remote host closed the connection]
<Algebr>
weather is pretty much ideal here right now
cat5e is now known as EnergeticLube
amnn has quit [Read error: Connection reset by peer]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
sdothum has joined #ocaml
connorjacobsen has quit [Read error: Connection reset by peer]
connorja_ has joined #ocaml
Sim_n has quit [Read error: Connection reset by peer]
<Drup>
sh0t: I tend to just make a big function which all the cases
<Drup>
the issue with lot's of small functions is that you often need to touch some state, and you end up with each small function having 15 arguments
<sh0t>
yeah Drup while I am working on it i am experiencgin something similar so yeah the function is getting as a result bigger than i wanted
<Drup>
one alternative is to make a type state = { ... } will all your pieces of state
<Drup>
which helps manage that a bit
<Drup>
and then your evaluation function is just "eval : state -> term -> value"
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
<sh0t>
where can I read a bit more about this tecnhique?
<Drup>
I'm not sure it's really written anywhere ^^'
<sh0t>
oh allright...cn you please be little more specific then?
<sh0t>
:)
<Drup>
it's probably going to be "eval : state -> term -> state * value", actually
<Drup>
well, what's the type of your eval function right now ?
sdothum has joined #ocaml
Kakadu has quit [Quit: Page closed]
<sh0t>
at the moment: expr -> heap -> environment -> (expr*heap)
<Drup>
so you have all your state in the heap, so that looks enough
<sh0t>
the heap is supposed to be where i store all references to data object (in the language)
<sh0t>
i am not sure it is what you meant before
<Drup>
yes
MercurialAlchemi has joined #ocaml
<sh0t>
yes like it is?
<Drup>
You are already doing what I was saying, you have one type that contains all your state and you pass it around, and it's all fine
<sh0t>
oh ok
Bahman has quit [Quit: ave atque vale]
dsheets has joined #ocaml
jonasen has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rgrinberg has quit [Quit: WeeChat 1.5]
dhil has joined #ocaml
rgrinberg has joined #ocaml
dsheets has quit [Ping timeout: 250 seconds]
Denommus has joined #ocaml
wiredsister has left #ocaml ["ERC (IRC client for Emacs 24.5.1)"]
octachron_ has joined #ocaml
bba has quit [Ping timeout: 260 seconds]
amnn has quit [Ping timeout: 264 seconds]
connorja_ has quit [Remote host closed the connection]
amnn has joined #ocaml
bba has joined #ocaml
yunxing_ has quit [Remote host closed the connection]
dsheets has joined #ocaml
orbifx-m has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
orbifx-m2 has joined #ocaml
hbar_ has joined #ocaml
tane has joined #ocaml
orbifx-m3 has joined #ocaml
orbifx-m has quit [Ping timeout: 272 seconds]
orbifx-m2 has quit [Ping timeout: 258 seconds]
_y has quit [Ping timeout: 272 seconds]
orbifx-m has joined #ocaml
rgrinberg has quit [Ping timeout: 264 seconds]
_y has joined #ocaml
orbifx-m2 has joined #ocaml
orbifx-m3 has quit [Ping timeout: 260 seconds]
ril has joined #ocaml
orbifx-m has quit [Ping timeout: 244 seconds]
ril has quit [Client Quit]
MercurialAlchemi has quit [Ping timeout: 276 seconds]
orbifx-m has joined #ocaml
rgrinberg has joined #ocaml
ril has joined #ocaml
orbifx-m2 has quit [Ping timeout: 260 seconds]
ril has quit [Client Quit]
MercurialAlchemi has joined #ocaml
dsheets_ has joined #ocaml
connorjacobsen has joined #ocaml
bba has quit [Ping timeout: 244 seconds]
dsheets has quit [Ping timeout: 250 seconds]
shinnya has quit [Ping timeout: 250 seconds]
orbifx-m has quit [Ping timeout: 272 seconds]
connorjacobsen has quit [Ping timeout: 264 seconds]
bba has joined #ocaml
VeiledSpectre has joined #ocaml
yunxing_ has joined #ocaml
orbifx-m has joined #ocaml
ygrek has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 240 seconds]
orbifx-m has quit [Read error: Connection reset by peer]
orbifx-m has joined #ocaml
orbifx-m2 has joined #ocaml
<rgrinberg>
vbmithr: mind if I cherrypick your harmless changes? or would you like to extract out a patch yourself?
dsheets_ has quit [Remote host closed the connection]
orbifx-m has quit [Ping timeout: 264 seconds]
orbifx-m has joined #ocaml
connorjacobsen has joined #ocaml
orbifx-m3 has joined #ocaml
orbifx-m2 has quit [Ping timeout: 276 seconds]
connorjacobsen has quit [Ping timeout: 244 seconds]
orbifx-m has quit [Ping timeout: 260 seconds]
connorjacobsen has joined #ocaml
orbifx-m3 has quit [Ping timeout: 244 seconds]
orbifx-m has joined #ocaml
orbifx-m2 has joined #ocaml
connorjacobsen has quit [Ping timeout: 244 seconds]
orbifx-m has quit [Ping timeout: 240 seconds]
AltGr has joined #ocaml
AltGr has left #ocaml [#ocaml]
malc_ has joined #ocaml
malc_ has quit [Client Quit]
dhil has quit [Ping timeout: 264 seconds]
VeiledSpectre has left #ocaml ["Leaving"]
bba has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bba has joined #ocaml
connorjacobsen has joined #ocaml
bba has quit [Client Quit]
mrallen1 has joined #ocaml
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
connorjacobsen has quit [Ping timeout: 260 seconds]
orbifx has joined #ocaml
connorjacobsen has joined #ocaml
groovy2shoes has left #ocaml ["Leaving"]
copy` has joined #ocaml
steve_gh has joined #ocaml
unbalancedparen has quit [Quit: WeeChat 1.5]
dakk has joined #ocaml
connorja_ has joined #ocaml
connorjacobsen has quit [Read error: Connection reset by peer]
connorja_ has quit [Read error: Connection reset by peer]
<steve_gh>
Hi. How would I define a constructor for a tuple type (say type foo = float * float). I want to ensure that a function that modifies foo's has type signature foo -> foo, not foo -> float*float
connorjacobsen has joined #ocaml
ygrek has quit [Ping timeout: 276 seconds]
pyon has quit [Quit: Ihnen, Herr Lasker, habe ich nur drei Worte zu sagen: Nyan und Pasu~.]
connorjacobsen has quit [Remote host closed the connection]
<tane>
steve_gh, what's wrong with defining the signature as such?
connorjacobsen has joined #ocaml
<pierpa>
I think they mean that sometimes the type will be inferred and printed as float * float instead of the desired foo
rgrinberg has quit [Ping timeout: 244 seconds]
tane has quit [Quit: Verlassend]
<steve_gh>
tane - my foo is actually a (prob, value) pair, so I know the first element of the tuple is in the range 0.0 to 1.0
<steve_gh>
pierpa. My problem is that the type inference leaves me with a mismatch between the sig function type foo -> foo and the inferred struct type foo -> float * float.
<steve_gh>
So if I had a constructor for foo's I could ensure that the return type of the function was forced to be a foo, not a float * float
<pierpa>
I may be wrong, but I believe that with that type declaration there's no difference between foo and float * float
<pierpa>
to force printing the type as foo you can use a type annotation in the right spot
<pierpa>
If you use a contructor, I'm not sure if there's a runtime cost
<pierpa>
or you could use a module and make the typeabstract
<steve_gh>
Possibly a constructor function is the path of least resistance
<pierpa>
then just type foo = Con float * float ?
<octachron_>
an intermediary solution would be a private type "type t= private float * float"
A1977494 has quit [Remote host closed the connection]
<pierpa>
*then just type foo = Con of float * float ?
<octachron_>
with a private type, you can enforce that foo is only created using a specific construction function but can still be deconstructed to float * float if needed
<pierpa>
looks like the best solution
<steve_gh>
thxs
yunxing_ has quit [Read error: Connection reset by peer]
orbifx has quit [Quit: WeeChat 1.5]
yunxing_ has joined #ocaml
<Drup>
pierpa: a construction means one added indirection
pyon has joined #ocaml
octachron_ has quit [Quit: Leaving]
<pierpa>
Drup: ok. ty.
|2701 has quit [Quit: Connection closed for inactivity]
connorjacobsen has quit [Read error: Connection reset by peer]
connorjacobsen has joined #ocaml
manizzle has quit [Ping timeout: 244 seconds]
ril has joined #ocaml
<apache2>
is there a good resource for reading about the 'private' keyword? I haven't seen it before, it sounds useful
connorjacobsen has quit [Read error: Connection reset by peer]
<pierpa>
I seem to remember that RWO explains it
connorjacobsen has joined #ocaml
<chelfi>
It does
<pierpa>
Yay for my memory!
<apache2>
aha, thanks!
amnn has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
connorjacobsen has quit [Remote host closed the connection]
<Algebr>
nice JS blog post about it too
connorjacobsen has joined #ocaml
connorjacobsen has quit [Remote host closed the connection]
connorjacobsen has joined #ocaml
amnn has joined #ocaml
d0nn1e has quit [Ping timeout: 240 seconds]
d0nn1e has joined #ocaml
yunxing_ has quit [Remote host closed the connection]
yunxing_ has joined #ocaml
mcc has joined #ocaml
yunxing_ has quit [Read error: Connection reset by peer]