mcclurmc has quit [Remote host closed the connection]
Simn has quit [Quit: Leaving]
Guest99859 has joined #ocaml
ontologiae_ has joined #ocaml
kyrylo has quit [Remote host closed the connection]
kyrylo has joined #ocaml
talzeus has quit [Remote host closed the connection]
wolfnn has quit [Ping timeout: 264 seconds]
ontologiae_ has quit [Ping timeout: 252 seconds]
Guest99859 is now known as jao
jao has quit [Changing host]
jao has joined #ocaml
talzeus has joined #ocaml
thomasga has joined #ocaml
ygrek has joined #ocaml
thomasga has quit [Ping timeout: 272 seconds]
boogie has quit [Remote host closed the connection]
manizzle has quit [Read error: Operation timed out]
mcclurmc has joined #ocaml
watermind has quit [Read error: Connection reset by peer]
watermind has joined #ocaml
watermind has quit [Read error: Connection reset by peer]
watermind has joined #ocaml
nisstyre has quit [Quit: Leaving]
introom has joined #ocaml
mcclurmc has quit [Ping timeout: 252 seconds]
Neros has joined #ocaml
watermind has quit [Ping timeout: 240 seconds]
ollehar has joined #ocaml
Neros has quit [Ping timeout: 252 seconds]
cesar_ has joined #ocaml
cesar_ is now known as Guest5774
carm has joined #ocaml
zpe has quit [Remote host closed the connection]
<UltimateGOTO>
def-lkb, hmm "In Objective CAML, the order of evaluation of arguments is not specified. As it happens, today all implementations of Objective CAML evaluate arguments from left to right. All the same, making use of this implementation feature could turn out to be dangerous if future versions of the language modify the implementation."
<Drup>
the book is quite old already, and the answer is in the quote
carm has quit [Quit: Konversation terminated!]
thomasga has joined #ocaml
ollehar has quit [Ping timeout: 246 seconds]
introom has quit [Ping timeout: 240 seconds]
thomasga has quit [Ping timeout: 252 seconds]
dnm has quit [Ping timeout: 265 seconds]
mcclurmc has joined #ocaml
erider has quit [Read error: Connection timed out]
erider has joined #ocaml
erider has quit [Changing host]
erider has joined #ocaml
zpe has joined #ocaml
kyrylo has quit [Ping timeout: 272 seconds]
zpe has quit [Ping timeout: 252 seconds]
manizzle has joined #ocaml
thomasga has joined #ocaml
introom has joined #ocaml
hyperboreean has quit [Ping timeout: 245 seconds]
thomasga has quit [Ping timeout: 240 seconds]
maurer_ is now known as maurer
boogie has joined #ocaml
manizzle has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 252 seconds]
erider has quit [Quit: ChatZilla 0.9.90.1 [Firefox 26.0/20131206152524]]
hcarty has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Ping timeout: 246 seconds]
jao has quit [Ping timeout: 260 seconds]
lostcuaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hcarty has quit [Ping timeout: 252 seconds]
hcarty has joined #ocaml
acieroid has quit [Read error: Connection reset by peer]
acieroid` has joined #ocaml
zpe has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
zpe has quit [Ping timeout: 260 seconds]
gereedy has quit [Ping timeout: 240 seconds]
bitbckt has quit [Ping timeout: 240 seconds]
WraithM has quit [Ping timeout: 272 seconds]
WraithM has joined #ocaml
Kakadu has joined #ocaml
ulfdoz has joined #ocaml
boogie has quit [Remote host closed the connection]
Guest5774 has quit [Remote host closed the connection]
thomasga has joined #ocaml
peterbb has joined #ocaml
yezariaely has joined #ocaml
yezariaely is now known as arj
arj has quit [Client Quit]
arj has joined #ocaml
thomasga has quit [Ping timeout: 252 seconds]
zpe has joined #ocaml
zpe has quit [Ping timeout: 252 seconds]
watermind has joined #ocaml
ulfdoz has quit [Ping timeout: 252 seconds]
bitbckt has joined #ocaml
gereedy has joined #ocaml
rand000 has joined #ocaml
rand000 has quit [Ping timeout: 240 seconds]
rand000 has joined #ocaml
peterbb has quit [Ping timeout: 272 seconds]
ygrek has joined #ocaml
kizzx2 has quit [Read error: Connection reset by peer]
axiles has joined #ocaml
ulfdoz has joined #ocaml
cynddl has quit [Ping timeout: 272 seconds]
thizanne has quit [Ping timeout: 248 seconds]
cynddl has joined #ocaml
hyperboreean has joined #ocaml
skchrko has joined #ocaml
Simn has joined #ocaml
ulfdoz has quit [Ping timeout: 246 seconds]
peterbb has joined #ocaml
thomasga has joined #ocaml
nikki93 has joined #ocaml
thomasga has quit [Ping timeout: 272 seconds]
zpe has joined #ocaml
zpe has quit [Ping timeout: 272 seconds]
AltGr has joined #ocaml
mort___ has joined #ocaml
watermind has quit [Read error: Connection reset by peer]
watermind has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Client Quit]
thomasga has joined #ocaml
cago has joined #ocaml
dant3 has joined #ocaml
dant3 has quit [Remote host closed the connection]
dant3 has joined #ocaml
watermind has quit [Quit: Konversation terminated!]
mort___ has quit [Quit: Leaving.]
pippijn_ is now known as pippijn
Arach has quit [Remote host closed the connection]
Arach has joined #ocaml
mika1 has joined #ocaml
<gasche>
UltimateGOTO: this book was written in 2001
introom has quit [Ping timeout: 265 seconds]
<UltimateGOTO>
gasche, yes, so I gather, hmm
<UltimateGOTO>
Make way for innovation
peterbb has quit [Ping timeout: 272 seconds]
<gasche>
it's actually still a pretty good reference
thizanne has joined #ocaml
<UltimateGOTO>
I wonder though, if && and || can be considered operators then why not ;.
<UltimateGOTO>
Can you also pass (&&) to functions like that?
<UltimateGOTO>
utop # id (&&);;
<UltimateGOTO>
- : bool -> bool -> bool = <fun>
<UltimateGOTO>
Wow, funky
<UltimateGOTO>
I wonder how the runtime manages to do that
<UltimateGOTO>
doesn't that take a significant performance drain having to with every function call check if it's a normal function or a special one?
dsheets has joined #ocaml
<companion_cube>
o/
<pippijn>
hi
mchqwerty has joined #ocaml
<companion_cube>
hi pippijn
zpe has joined #ocaml
thomasga has quit [Quit: Leaving.]
zpe has quit [Ping timeout: 265 seconds]
thomasga has joined #ocaml
thomasga has quit [Client Quit]
_andre has joined #ocaml
thomasga has joined #ocaml
Arach has quit [Ping timeout: 240 seconds]
<def-lkb>
UltimateGOTO: once reified as a function, (&&) is evaluated like any function (this is equivalent to fun (a b -> a && b))
Arach has joined #ocaml
<def-lkb>
no runtime check, it's just a function. it's a && b as a syntactic construction which evaluates left-to-right and is subject to short-circuit
wwilly has joined #ocaml
<wwilly>
bonjour
<def-lkb>
(oops, you should read (fun a b -> a && b) ofc :))
zpe has joined #ocaml
<companion_cube>
\o wwilly
zpe has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
dant3_ has joined #ocaml
jonludlam has joined #ocaml
dant3 has quit [Ping timeout: 240 seconds]
<UltimateGOTO>
def-lkb, oh yeah, that's a good point
<UltimateGOTO>
It can obviously just be fun a b -> a && b
<UltimateGOTO>
Wait no, it can't.
<UltimateGOTO>
Oh wait, now I see what you are trying to say
<companion_cube>
(id (||)) true (let _ = print_endline "foo" in false);; prints
<flux>
also let (||)=(||) in (||) true (let _ = print_endline "foo" in false);; prints
<flux>
so a fun trick to do to future maintainers of the code
<flux>
hide let (||) = (||) in some common.ml
<UltimateGOTO>
Ahahahah
<UltimateGOTO>
I'm never too sure what to think about such behaviour.
<def-lkb>
Syntactic trick, not very elegant… better than nothing :)
<UltimateGOTO>
I would probably myself opt to make && || hardcoded syntax like if and force people to use fun a b -> a && b to use them as functions but that's just I.
rand000 has quit [Ping timeout: 252 seconds]
<UltimateGOTO>
Can you also use (if) to reify that as function?
<UltimateGOTO>
ahh, apparently not
<companion_cube>
well, you can let ite a b c = if a then b else c
<companion_cube>
but both branches will be evaluated
<companion_cube>
(or you can use lazy...)
<UltimateGOTO>
I always wondered why if in Haskell is special syntax.
<UltimateGOTO>
There's like no reason.
<flux>
because syntax is nice :)
<UltimateGOTO>
No it's not.
<UltimateGOTO>
Special syntax should be kept to a bare minimum, we should all lgo to S-expressions anyway
<UltimateGOTO>
(if cond then else)
<companion_cube>
well, sounds like you want a typed lisp ^^
<companion_cube>
but I don't know of any good syntax for pattern matching in lisp
<flux>
there is no. because there is no syntax :)
<UltimateGOTO>
Well, actually S-expressions are pretty bad for a hindly-milner based language.
<UltimateGOTO>
S-expressions were designed for languages where most functions are n-ary of course.
<UltimateGOTO>
Imagine having to type (((f a) b) c)
<flux>
would it be so bad if that just worked automatically?
<flux>
(((f a) b) c) works in ocaml, all they would need to do is to make (f a b c) work as well :)
<UltimateGOTO>
Well, ( ... ) in S expressions sin't grouping
<UltimateGOTO>
(a) is not the same as a, it's what C calls a()
<flux>
or it could be a language where tuples are the common way to call functions. (f (, a b c))
<UltimateGOTO>
But because everything is praefix you don't need grouping any more so there is no grouping operator
<UltimateGOTO>
Well, what calls , then? , is itself a type constructor
<UltimateGOTO>
A function of 3 arguments, so yeah.
TDJACR has quit [Ping timeout: 264 seconds]
<flux>
I don't see how it would be a lot more 'magic' to convert an n-ary call to a series of unitary calls than it is to have the current variable number of arguments everywhere.
<UltimateGOTO>
It isn't magic, I'm just saying that S-expressions loose their use if functions are not variadic.
nikki93 has quit [Remote host closed the connection]
TDJACR has joined #ocaml
nikki93 has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
thomasga has quit [Quit: Leaving.]
rwmjones has quit [Ping timeout: 264 seconds]
zpe has quit [Ping timeout: 252 seconds]
kyrylo has joined #ocaml
ygrek has quit [Ping timeout: 252 seconds]
rwmjones has joined #ocaml
ontologiae_ has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Quit: Leaving.]
dant3_ has quit [Remote host closed the connection]
dant3 has joined #ocaml
zpe has joined #ocaml
ontologiae_ has quit [Ping timeout: 240 seconds]
nikki93 has quit []
talzeus has quit [Remote host closed the connection]
<companion_cube>
UltimateGOTO: I don't think type inference works well with variadic functions
ocp has joined #ocaml
<UltimateGOTO>
companion_cube, well, typed scheme has type inference, but it's not exactly a hindly milner type system you're dealing with.
ocp has quit [Ping timeout: 260 seconds]
darkf has quit [Quit: Leaving]
shinnya has joined #ocaml
<companion_cube>
ah, explaining why Lwt is cool to colleagues... ^^
agarwal1975 has joined #ocaml
ygrek has joined #ocaml
<companion_cube>
poke hnrgrgr
talzeus has joined #ocaml
demonimin has quit [Ping timeout: 248 seconds]
thomasga has joined #ocaml
thomasga has quit [Quit: Leaving.]
michael_lee has joined #ocaml
lostcuaz has joined #ocaml
rwmjones has quit [Read error: Operation timed out]
kyrylo has quit [Remote host closed the connection]
<MG_>
However, I unfortunately fail to achieve this in toplevel
<MG_>
I type:
<MG_>
open Num;;
<MG_>
#load "nums.cma";;
<MG_>
(num_of_int 0)//(num_of_int 0);;
<MG_>
and what I get is
<MG_>
Exception: Failure "create_ratio infinite or undefined rational number".
<MG_>
Why so?
thomasga has joined #ocaml
<companion_cube>
interesting, I have no idea
<companion_cube>
I never saw those two constants
<companion_cube>
MG_: by the way, you might prefer to use the third-party Zarith library, which provides a cleaner, more powerful interface and uses gmp
<companion_cube>
it's on opam
<MG_>
unfortunately... I may not use it... at least on this task I'm trying to solve now
<MG_>
I'm limited to ocaml standard library, and there's not much I can do about this
<MG_>
I am also limited to ocaml version 3.12.1
rand000 has quit [Quit: leaving]
<companion_cube>
awwww
<companion_cube>
is it an academic exercise?
<MG_>
Is it possible that this is the reason why I can't get these two special num constants?
<MG_>
indeed...
<flux>
well, it fails for my ocaml 4.01.0 as well
<flux>
maybe it's a bug :-o
<MG_>
rats...
<MG_>
too bad...
<MG_>
well, thank you anyway
<MG_>
:)
<companion_cube>
or maybe the documentation is out-of-date
<flux>
so bug :)
<companion_cube>
MG_: if you have time, it would be very nice to fill a bug report on mantis
<MG_>
wow... this will be my very first bug report ever...
<MG_>
i feel honoured!
<companion_cube>
^^
<flux>
Ratio.create_ratio Big_int.zero_big_int Big_int.zero_big_int fails similarly, but I don't know how Num should take care of those two cases, so that could be by design
<flux>
actually I don't know how 'Num' is supposed to report the infinite or undefined values, so companion_cube is probably right (ie. it's a feature that got removed, docs not updated)
<companion_cube>
I think it's probably a documentation error, but mention all possibilities in the report
ocp has quit [Ping timeout: 260 seconds]
testAcc has joined #ocaml
mchqwerty has quit [Quit: Odcházím]
<testAcc>
hello, anyone know haskell here?
<companion_cube>
well, that may not be the best chan for it
<companion_cube>
if you have a haskell question, you'd get more help on #haskell
talzeus has quit [Read error: Connection reset by peer]
<dRbiG>
I'd very much appreciate comment on the OCaml version, linked above
<dRbiG>
in terms of style and approach
<Drup>
stupid stylistic remark : you don't need the ;;
<dRbiG>
not any of those present?
<Drup>
you never need ;;
<dRbiG>
so does the indent matter then?
<Drup>
no
kyrylo has joined #ocaml
<dRbiG>
aye, I guess I see it
<Drup>
except this
<Drup>
"let f = fun x -> blabla" ≡ "let f x = blabla"
<dRbiG>
hmm, not fully understanding the above, my question is which is more 'standard' let foo = fun x y -> ... or let foo x y = ...
<Drup>
the later
<dRbiG>
makes sense
<dRbiG>
same approach in scheme
<Drup>
you could write dup_list in a more functional way
<dRbiG>
gimme a minute, i'm updating as we speak :)
<Drup>
your version is both ugly and inneficiant
<Drup>
inefficient*
<Drup>
no problem :)
<Drup>
note that the @ operator is linear in the size of the left list, so it's a very bad idea to use it you like you did, by adding stuff to the right each time
<dRbiG>
i think I know the solution, let me try it
kyrylo has quit [Ping timeout: 260 seconds]
kyrylo has joined #ocaml
<dRbiG>
ok, a hint is needed, am I thinking correctly here: I should prepend instead of appending?
kyrylo has quit [Remote host closed the connection]
<def-lkb>
yes
<dRbiG>
ok. now i'll just need to figure out the correct syntax for that
<Drup>
other than that, it's ok
<Drup>
the issue I can see is that "1:2" is a valid mac address according to your code :)
<Drup>
well, according to your "parse_mac" at least, it's checked later on
<dRbiG>
it isn't
<dRbiG>
there is a rudimentary length check
<dRbiG>
but error-awareness was not the goal here
<dRbiG>
(yet)
<Drup>
fair enough :p
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
thomasga has joined #ocaml
osnr_ has quit [Remote host closed the connection]
Anarchos has joined #ocaml
wagle has quit [Read error: Connection reset by peer]
wagle has joined #ocaml
thomasga has quit [Quit: Leaving.]
thomasga has joined #ocaml
<dRbiG>
Drup: i don't see how I could implement with prepend; i guess another homework then :)
<dRbiG>
thx for comments!
<Drup>
dRbiG: are you familiar with prolog ?
thomasga has quit [Client Quit]
<Drup>
if you are, think "list chaining", it may help you
_andre has quit [Quit: leaving]
kyrylo has joined #ocaml
ontologiae_ has quit [Ping timeout: 252 seconds]
kyrylo has quit [Remote host closed the connection]
kyrylo has joined #ocaml
WraithM_ has quit [Ping timeout: 252 seconds]
WraithM_ has joined #ocaml
skchrko has quit [Ping timeout: 252 seconds]
malvarez has joined #ocaml
<j0sh>
I'm getting this warning which I'm unsure of how to resolve: "This record of type xxx contains fields that are not visible in the current scope: yyy zzz."
<Anarchos>
j0sh maybe a typo ?
<j0sh>
the record xxx is part of a parameterized module, i've tried to be explicit with the fully qualified type when instantiating the record instance, but no dice
<j0sh>
Anarchos: don't think so, if the field is nonexistent the compiler errors out as expected
mfp_ has joined #ocaml
mfp has quit [Read error: Connection reset by peer]
<malvarez>
j0sh can you post the code?
kyrylo has quit [Remote host closed the connection]
<j0sh>
it's possible i'm using the ocaml-redis library incorrectly (there's no documentation and i'm still fairly new to ocaml)
<malvarez>
Never used ocaml-redis myself, but OCaml is kind of...annoying with records sometimes
<Anarchos>
malvarez with the non shareable names of fields ?
othiym23 has joined #ocaml
kyrylo has joined #ocaml
othiym23 has left #ocaml []
<malvarez>
Anarchos well yeah. I think that's what's happening here, I think you need to explicitly tell OCaml the record literal you're creating is a Redis_lwt.Client.connection_spec
ocp has quit [Ping timeout: 246 seconds]
<j0sh>
malvarez: my code is doing that
<malvarez>
j0sh no, you're saying the variable cfg has that type
<Drup>
j0sh: do somehting like "let cfg = Redis_lwt.Client.connection_spec.{host = "localhost"; port = 6379}"
<Drup>
I don't remember if you need extra paranthesis or if .{ ... } is accepted
<malvarez>
Drup I think extra parenthesis are needed
<malvarez>
Also can't you write {Redis_lwt.Client.connection_spec. host=""; port=1111} ?
<Drup>
I think so, yes
<malvarez>
j0sh: in a nutshell, when you write a record literal, the unqualified type must be within scope (for example, opening Redis_lwt.Client), or you must annotate the literal itself
<Drup>
or you can cope with the warning
Ptival_ is now known as Ptival
<j0sh>
strange that annotating the variable declaration isn't enough, i would've expected that
<malvarez>
j0sh: welcome to the wonderful world of OCaml records
<Drup>
j0sh: it's enough
<Drup>
there is a misunderstanding about this warning I think
<j0sh>
Drup: the way I did the annotation (in my code) still throws the warning
<Drup>
This warning is not telling you that you are doing something wrong
<Drup>
it's telling you that the compiler used the "smart" record name resolution and looked outside the current scope
<j0sh>
still trying to figure out the exact syntax to annotate the literal
<Drup>
it's a warning "ok, right now I had to be a bit smarter than usual, and I'm telling you about it"
<Drup>
it's functionally equivalent to the manually fully resolved
<malvarez>
Drup: you might be right, but my compiler also tells me that "the fields will not be selected if the type becomes unknown", which I don't really understand
<malvarez>
And doesn't look harmless anymore
<j0sh>
yup, i get that too
<malvarez>
I don't really understand the implications, but it sounds a bit too much like "things might break in unexpected ways"
<malvarez>
Also, j0sh, I think it should suffice with "{Redis_lwt.Client. host=...; port=...}"
<malvarez>
Note that Redis_lwt.Client.({ host=...; port=... }) also works, although for slightly different reasons
<malvarez>
j0sh: you can make it work by opening Redis_lwt.Client
<j0sh>
i was trying {Redis_lwt.Client.connection_spec.host = ...} and it wouldn't work
<Drup>
malvarez: It might break, for example if you stop linking the package with the correct record
<malvarez>
j0sh: yeah, my previous indication was wrong, my bad
<Drup>
which is far from being "unexpected" if you ask me.
<j0sh>
malvarez: no worries
<j0sh>
thanks for the help, everyone
<Drup>
it's regular ocaml name resolution, just a bit extended
<malvarez>
Drup: well, that makes sense
<j0sh>
Drup: "stop linking the package with the correct record" <-- what do you mean by this?
<j0sh>
how do you link it with the "wrong" record?
<Drup>
no, but you can not have it :p
zpe has joined #ocaml
dant3 has quit [Remote host closed the connection]
<dRbiG>
Drup: not that familiar; but I can see I can just change the order in my case and instead of going through the ever-growing list @ will only have to go as far as the length of the initial list
<dRbiG>
which is a level-up
<dRbiG>
from the initial version :)
sheijk has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Client Quit]
dant3 has joined #ocaml
thomasga has joined #ocaml
zxqdms has quit [Quit: leaving]
malvarez has quit [Read error: No route to host]
kyrylo has quit [Read error: Connection reset by peer]
samebchase has quit [Ping timeout: 276 seconds]
kyrylo has joined #ocaml
erider has joined #ocaml
axiles has quit [Remote host closed the connection]
thomasga has quit [Quit: Leaving.]
dsheets has joined #ocaml
defromeo has joined #ocaml
Kakadu has quit []
tobiasBora has joined #ocaml
kyrylo has quit [Quit: Hi Rob!]
kyrylo has joined #ocaml
kyrylo has quit [Client Quit]
kyrylo has joined #ocaml
WraithM_ has quit [Read error: Connection reset by peer]
kyrylo has quit [Changing host]
kyrylo has joined #ocaml
kyrylo has quit [Remote host closed the connection]
kyrylo has joined #ocaml
ollehar has joined #ocaml
ocp has joined #ocaml
kyrylo has quit [Remote host closed the connection]
kyrylo has joined #ocaml
kyrylo has quit [Changing host]
kyrylo has joined #ocaml
kyrylo has quit [Remote host closed the connection]
kyrylo has joined #ocaml
kyrylo has quit [Remote host closed the connection]
kyrylo has joined #ocaml
thomasga has joined #ocaml
ygrek has joined #ocaml
ollehar has quit [Ping timeout: 246 seconds]
lostcuaz has joined #ocaml
jao has quit [Ping timeout: 260 seconds]
lostcuaz has quit [Client Quit]
ygrek has quit [Ping timeout: 265 seconds]
avsm has joined #ocaml
ollehar has joined #ocaml
mreca has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ocp1 has joined #ocaml
ocp has quit [Read error: Operation timed out]
darkf has joined #ocaml
jonludlam has joined #ocaml
tobiasBora has quit [Quit: Konversation terminated!]
oriba has quit [Quit: oriba]
thomasga has quit [Quit: Leaving.]
tnguyen has quit [Quit: tnguyen]
ollehar has quit [Ping timeout: 246 seconds]
kyrylo has quit [Remote host closed the connection]
jonludlam has quit [Remote host closed the connection]
mcclurmc has quit [Remote host closed the connection]
lostcuaz has joined #ocaml
avsm has quit [Quit: Leaving.]
Simn has quit [Quit: Leaving]
manizzle has quit [Read error: Operation timed out]
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 252 seconds]
zenspider has joined #ocaml
madroach has quit [Ping timeout: 252 seconds]
madroach has joined #ocaml
NoNNaN has quit [Remote host closed the connection]