\o_ has quit [Quit: Ce n’est pas une blague, ça, c’est une corde.]
Maelan has joined #ocaml
Maelan has quit [Quit: Ce n’est pas une blague, ça, c’est une corde.]
Maelan has joined #ocaml
ceryo has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Bhavya has quit [Quit: Quit the channel]
<_obad_>
morning/afternoon. is there a way to get opam to rebuild a package? I need the doc for an already installed package, but opam install pkgname -d doesn't do anything. of course the obvious is to remove and reinstall but that triggers a lot of rebuilds.
<Drup>
_obad_: opam reinstall
<Drup>
oh, you don't want to rebuild dependencies ...
<Drup>
eh. that's unsafe, so no.
thomasga has joined #ocaml
Muzer has quit [Excess Flood]
Muzer has joined #ocaml
<_obad_>
hmpf :/
thomasga has quit [Client Quit]
<_obad_>
I guess I'll just open ~/.opam/xxx/libs/blah/blah.mli
thomasga has joined #ocaml
<Maelan>
Are there many packages that tell OPAM how to build their doc? I have almost no doc, except the ones I compiled manually (including Batteries) because I saw no other solution.
AltGr has left #ocaml [#ocaml]
jc2 has joined #ocaml
nullca___ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
thomasga has quit [Quit: Leaving.]
thomasga has joined #ocaml
<Drup>
not enough, unfortunatly
jc2 has quit [Quit: Leaving.]
struk|work has joined #ocaml
ollehar has quit [Quit: ollehar]
BitPuffin has joined #ocaml
sepp2k has joined #ocaml
sh0t has joined #ocaml
mengu has quit [Ping timeout: 252 seconds]
ollehar has joined #ocaml
ollehar has quit [Remote host closed the connection]
sh0t has quit [Ping timeout: 264 seconds]
swgillespie has joined #ocaml
slash^ has joined #ocaml
Submarine has quit [Quit: Leaving]
ben1 has quit [Read error: Connection reset by peer]
ollehar has joined #ocaml
ceryo has joined #ocaml
nullcat has joined #ocaml
rand000 has quit [Quit: leaving]
Hannibal_Smith has joined #ocaml
shinnya has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
rgrinberg has quit [Ping timeout: 246 seconds]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
nullcat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
ygrek has joined #ocaml
sh0t has joined #ocaml
thomasga has quit [Quit: Leaving.]
dongcarl has joined #ocaml
<dongcarl>
Hi all! Just installed ocaml on my mac... invoking 'ocaml' gives me
<struk|work>
hm, well your closer. maybe just opam install core
ygrek has quit [Ping timeout: 256 seconds]
darkf has quit [Quit: Leaving]
Submarine has joined #ocaml
Submarine has joined #ocaml
creichert has joined #ocaml
MrScout has joined #ocaml
zpe has joined #ocaml
<dongcarl>
struk|work: thanks for being the most helpful guy tonight. I'll definitely try out your bootstrap once I know more
<struk|work>
dongcarl: no problem. good luck ! I will respond pretty fast re: ocaml-bootstrap if you post the issueon github
ggole has quit []
Submarine has quit [Remote host closed the connection]
MrScout has quit [Remote host closed the connection]
MrScout has joined #ocaml
MrScout has quit [Remote host closed the connection]
MrScout has joined #ocaml
empyrean has joined #ocaml
monod has joined #ocaml
sh0t has quit [Ping timeout: 244 seconds]
ygrek has joined #ocaml
Haudegen has quit [Ping timeout: 256 seconds]
Haudegen has joined #ocaml
oscar_toro has quit [Ping timeout: 246 seconds]
oscar_toro has joined #ocaml
kushal has quit [Quit: Leaving]
thomasga has joined #ocaml
rgrinberg has quit [Ping timeout: 246 seconds]
thomasga has quit [Client Quit]
Haudegen has quit [Ping timeout: 255 seconds]
rgrinberg has joined #ocaml
Haudegen has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Client Quit]
matason has quit [Ping timeout: 240 seconds]
swgillespie has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
swgillespie has joined #ocaml
monod has quit [Ping timeout: 265 seconds]
Kakadu has joined #ocaml
walter|r has joined #ocaml
billof has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
dsheets has joined #ocaml
jonludlam has joined #ocaml
rgrinberg has quit [Ping timeout: 240 seconds]
rgrinberg has joined #ocaml
Anarchos has joined #ocaml
jonludlam has quit [Ping timeout: 265 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
sh0t has joined #ocaml
rgrinberg has quit [Ping timeout: 252 seconds]
oscar_toro has quit [Ping timeout: 250 seconds]
oscar_toro has joined #ocaml
<dongcarl>
hi guys
<dongcarl>
working thru try ocaml here
<dongcarl>
how do I fix this
<dongcarl>
let one =
<dongcarl>
let accum = ref -54 in
<dongcarl>
for i = 1 to ten do accum := !accum + i done ;
<dongcarl>
!accum
<dongcarl>
apparantly I'm supposed to add parens
<Maelan>
Yes, write (-54) or ~-54.
nullcat has joined #ocaml
<Maelan>
This is because - is a binary operator in OCaml (substraction), whereas ~- is the unary negation.
<Reventlov>
(subtraction)
<Maelan>
Indeed
<Maelan>
.
<dongcarl>
I see...
<dongcarl>
thanks for the help guys!
<dongcarl>
woulda never guessed
<Maelan>
In “ref -54”, the parser recognizes - as the binary operator and separates it from 54, although in “(-54)”, it can not be binary, thus the parser regards it as the integer literal -54.
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
<dongcarl>
Maelan: silly question from a Schemer... what was the justification of OCaml not using more parens? They would have served as great visual aids here
MrScout has quit [Ping timeout: 248 seconds]
MrScout has joined #ocaml
Anarchos has joined #ocaml
<Maelan>
I don’t know dongcarl, I am not involved in the development of OCaml.
<dongcarl>
Maelan: thanks nonetheless
<Maelan>
But sure there some of the developers here.
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
<maurer>
4.02.1 doesn't seem to have the -thread option though. I'm building 4.02, but is that going to work?
<maurer>
*4.02.2
rgrinberg has joined #ocaml
<struk|work>
dongcarl: what do you mean "more parens"? It uses them only as a scoping/grouping indicator for expressions, no more, no less..is that not what you'd expect? (to be 100% accurate, it also uses parens for unit type ())
<Maelan>
dongarl, I am not familiar with Scheme but when comparing S-exprs with OCaml, the main difference I see is infix operator notations and implicit priorities, and “a + b + c” is arguably easier to read than “(+ (+ a b) c)”, isn’t it?
<struk|work>
one reason to * not * use them is it can easy partial function application and sometimes code maintainence is less harry
<struk|work>
*hairy
<struk|work>
*ease
<flux>
actually scheme would use (+ a b c). but that wouldn't work in (oca)ml, as it would need a variadic function to work.
<struk|work>
but as Maelan is hinting at, it's a style choice of infix vs prefix notations, to some extent
<flux>
at times ocaml could do well with parens. in particular when using nested matches. of course, you can use them (or begin/end) if you want, but then it becomes a stylistic issue
<flux>
I guess an official ocaml style guide would be a boon :)
<ollehar>
well, if anyone would like to give a word on php and type-inference, that would be nice:
<ollehar>
(specially before mods close the question >< )
<maurer>
Evvvidently 4.03 is required
<dongcarl>
Maelan: maurer: struk|work: flux: thanks for the discussion, understanding much more now
<dongcarl>
flux: yes, an official style guide would be amazin
<flux>
sadly construction of such would result in huge bikeshedding. so someone line Jane Street should just publish theirs, if they have one (and if not, make one, they probably do have a consistent style)
<struk|work>
dongcarl: np..I like the parentice-less approach for function chaning (monadic) infix operations..eg.. "fun x -> blah x >>= fun y -> foo y >>| fun z -> bar z"
<struk|work>
*chaining
<flux>
ocaml definitely has mostly the lack of )))))))) going for it by its lack of using parens everywhere ;-)
<flux>
maelan, well, syntax-wise I don't really oppose the scheme way of (non-)syntax, a statically typed scheme could be alright perhaps
swgillespie has joined #ocaml
<flux>
I guess the OCaml camlp4-based scheme syntax is going to die along with camlp4 - not that I would have ever used it
<flux>
and while scheme lack of syntax is ok, I still kinda prefer the one with syntax :)
<struk|work>
Maelan: map operator. upon success, it will transform the succesfull result to some another type, upon failure, it just returns the failed result.
<Maelan>
Oh, I did not know about the camlp4 syntax.
<flux>
maelan, it should be added that >>| is nothing built into OCaml, the library struk|work used just provides such a function
<Maelan>
I guessed so. :-)
hay207 has quit [Quit: Leaving]
<flux>
camlp4 is 'the old' (not very old) way of providing syntax extensions; from slight extensions to completely rewriting the language
<flux>
it's documented, but perhaps not very well, and it has some other issues, the most important being that the campl4 parser needs to be kept in sync with the language to allow all programs to be compiled - and sometimes when it lags a bit behind, it can prevent new programs from being compiled with camlp4 extensions
ollehar has quit [Ping timeout: 256 seconds]
<flux>
so it's going to be replaced with ppx, and while ppx does allow such radical syntax changes (ie. write in a completely different language), I understand campl4 makes such operations easier
<flux>
ppx is going to be the future, regardless :)
lobo has joined #ocaml
zoetus has joined #ocaml
jonludlam has joined #ocaml
<zoetus>
does anyone know where i can find documentation on jane street's pa_test?
<zoetus>
there isn't even a readme in the github repo?
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<zoetus>
the first time i ever actually saw it documented at all was in yesterday's blog post about how they are replacing it with a ppx extension
<zoetus>
and the example given doesn't even compile :(
<struk|work>
zoetus: got a link to that blog post?
<zoetus>
if i try that first test expression, the compiler complains: This expression has type unit but an expression was expected of type bool
Reventlov has quit [Quit: leaving]
<zoetus>
how would one fix that? anybody's guess
<flux>
well, it sounds like it's expecting a predicate, ie. an expression that returns 'true' if it succeeds and 'false' otherwise...
<flux>
much like assert
<flux>
so how is your f defined?
<zoetus>
an f wasn't given in the example, so i just tried this:
<zoetus>
TEST = <:test_result< int >> ~expect:42 (41 + 1)
<zoetus>
the usage of that form seems to suggest that you provide an expected value and then an actual one
<flux>
I guess it seems reasonable that it should work.
<flux>
look at pa_test's source?
<zoetus>
yeah i guess so
<flux>
alternative: produce a pretty-printed version
<flux>
(I don't recall how)
MrScout has quit [Remote host closed the connection]
<zoetus>
it's kind of lame that we have to do that, especially if we don't know anything about writing camlp4 extensions
<zoetus>
it just seems weird to me that they spend so much time producing libraries for communal use (as well as their own) and don't even bother with a simple readme
<flux>
well, they produce them for internal use
<flux>
and they probably have toonnns of examples
<flux>
so it's not really a problem there.
<Drup>
zoetus: correction, it's *mostly* for their own
<zoetus>
true
<zoetus>
but they certainly seem to be interested in making it publicly available for general use
<Drup>
the fact that they release it is nice and ocasionally enjoyable, but it's not the primary use, so you shouldn't expect support outside of what they need and documentation outside of what they expect
<flux>
well, I think everyone would agree that it's preferable to release than not, regardless of documentation
<zoetus>
many of their libraries have readmes and at least some form of documentation
<zoetus>
how widely used are these libraries in the ocaml community?
<zoetus>
i mean core in general
<Drup>
hard to tell
<flux>
btw, pa_ounit comes with example/example.ml{i,}, doesn't it explain it enough?
<zoetus>
pa_ounit and pa_test are different things i think
<flux>
oh
<flux>
is pa_test in opam?
<flux>
ah, it is
<zoetus>
yeah
<flux>
well, it comes with test/pa_test_test.ml
<flux>
so it's maybe a bug in the example
<zoetus>
you're right
<flux>
it wasn't probably pulled out of any real code
<zoetus>
maybe i should be using TEST_UNIT, not TEST
<flux>
TEST_UNIT = <:test_eq< int >> 1 1
<zoetus>
that
<flux>
isn't the key using test_eq, not test_result?
ygrek has quit [Ping timeout: 246 seconds]
<zoetus>
yeah maybe, i'll try that -- this test passes: TEST_UNIT "it pushes a line" = <:test_result< int >> ~expect:42 41
<zoetus>
it seems like there's a handy test library hidden in here
<Maelan>
By the way, why “assert” is not a function in OCaml?
<Drup>
it could be, I think it's mostly because the typecheck treats "assert false" specially
magical-imouto has quit [Ping timeout: 240 seconds]
<Drup>
typechecker*
<flux>
..so it couldn't be
<flux>
I suppose you could have a distinct assert_false; though :)
<flux>
but probably: I theorize ocaml didn't 'originally' have backtrace
<Drup>
flux: sure it could be, it's already syntactic anyway
hay207 has joined #ocaml
<flux>
so 'assert' was a nice way to produce a diagnostics that produces current module and line number
<Drup>
just need to recognize "assert false" specially ...
<flux>
no function can make that
<flux>
personlly I've never found the need to pass 'assert' as a function to another function :)
manud has joined #ocaml
swgillespie has joined #ocaml
<Maelan>
Nope, but why introduce a keyword if it is not necessary?
<flux>
perhaps it was practical?
pyon has joined #ocaml
<flux>
let's say you didn't have a backtrace in ocaml.
ollehar has joined #ocaml
<flux>
how would you implement a useful 'assert'?
<Maelan>
I also thought than since assert is a keyword, it might have fancy syntax rules that would allow us to write “assert a = b” with no parentheses.
<flux>
and how about (assert a) = b?
<flux>
well, it doesn't actually make a lot of sense in that case :)
<flux>
but it does make sense in the assert false case
<Maelan>
flux, something like « let assert b = if not b then raise Assert_failure », given that you can retrieve the location of the failure with the backtrace?
<flux>
maelan, so my theory was that many moons ago, in ocaml 1.0, there was no backtrace, but there was a need for assert
<flux>
and thus assert was born
<Drup>
flux: in caml light*
<flux>
these days, one could have an almost assert with plain functions, by making use of back traces
<flux>
(except back traces can be disabled due to performance reasons)
<Maelan>
I understood that.
<flux>
maelan, so it doesn't really make a lot of sense to change the functionality of 'assert' in later versions for no benefit I can see
<Maelan>
Yeah, sure.
<flux>
the back trace mechanism is by default in fact disabled, as you may have noticed :)
Reventlov has joined #ocaml
<flux>
maelan, I guess you did notice that your function wouldn't work similarly as 'assert false' does now?
<Maelan>
Yeah, it always fails even with debug mode off, isn’t it?
<flux>
nope. the key is the return type.
<flux>
assert false has the same return type as failwith "aiee", that is, 'a.
<flux>
this allows this kind of code to compile: let divide a b = if b <> 0 then a / b else assert false
<Maelan>
What would we do that instead of « let divide a b = assert (b <> 0); a / b » ?
MrScout has joined #ocaml
<flux>
well, for example: let unimplemented argument = assert false
<ollehar>
any comment about this?
<ollehar>
"I would not want to use a linting system where the parameter types are inferred by how they are called, seems backwards to me"
<ollehar>
inferring function signatures from usage should be ok, no?
<ollehar>
unambigiuos
<flux>
or: match Case1 when x > 0 -> .. | Case2 when x < 0 -> .. | Case1 | Case2 -> assert false
<Drup>
depends how much subtyping/polymorphism you have in your system
<Drup>
but it's quite regular to do it
<flux>
in fact that's probably a relatively common use: handling impossible match cases the compiler cannot see are impossible
MercurialAlchemi has quit [Ping timeout: 265 seconds]
zoetus has quit [Ping timeout: 246 seconds]
accidus has joined #ocaml
accidus_benartiu has joined #ocaml
Reventlov has quit [Quit: leaving]
tmtwd_ has joined #ocaml
tmtwd has quit [Read error: Connection reset by peer]
<ollehar>
Drup: was that for me?
<Drup>
yes
<ollehar>
ah, thanks! :)
<ollehar>
I'm talking about php still
<ollehar>
sounds like it's worth a try
<Drup>
I mean, every ml system in the world is doing it
<Drup>
(fun f -> f 3)
<ollehar>
really? ok then.
<ollehar>
right
<Drup>
you just infered the type of f according to how it's called ...
<Drup>
the thing is, this is completely incompatible with overloading
tane has quit [Quit: Verlassend]
<Drup>
and a lot of imperative languages have method/operator overloading
<ollehar>
ok, but there is no overloading in php anyway
<Drup>
but you have subtyping and variadic, don't you ?
<ollehar>
in the class system?
<Drup>
doesn't matter
<ollehar>
yeah, variadics might have to go. I want a subset anyway.
<ollehar>
subtyping with inheritance should be able to infer, but with scalars?
<ollehar>
*a subset of php
ygrek has joined #ocaml
Reventlov has joined #ocaml
<ollehar>
well, thanks for your input, always useful.
MrScout has quit [Ping timeout: 248 seconds]
MrScout has joined #ocaml
Simn has quit [Quit: Leaving]
nullca___ has joined #ocaml
nullcat has quit [Ping timeout: 255 seconds]
ollehar has quit [Quit: ollehar]
tmtwd_ has quit [Ping timeout: 256 seconds]
mengu has joined #ocaml
lobo has quit [Quit: leaving]
badkins_ has joined #ocaml
MrScout has quit [Remote host closed the connection]
badkins has quit [Ping timeout: 265 seconds]
<_obad_>
anyone familiar with lacaml?
jao has joined #ocaml
MrScout has joined #ocaml
pyon has quit [Quit: I have irrefutable proof that D < 0. It follows trivially from 2D > 3D, which is obviously true.]
tmtwd_ has joined #ocaml
pyon has joined #ocaml
Kakadu has quit [Remote host closed the connection]
thomasga has joined #ocaml
badkins_ has quit []
MrScout has quit [Remote host closed the connection]
systmkor has quit [Ping timeout: 252 seconds]
rgrinberg has quit [Ping timeout: 256 seconds]
<ygrek>
_obad_, don't ask to ask - ask
mengu has quit [Remote host closed the connection]
jao has quit [Ping timeout: 244 seconds]
walter|r has quit [Remote host closed the connection]
walter|r has joined #ocaml
madroach has quit [Ping timeout: 264 seconds]
walter|r has quit [Ping timeout: 240 seconds]
madroach has joined #ocaml
hay207 has quit [Quit: Leaving]
billof has quit [Ping timeout: 252 seconds]
thomasga has quit [Quit: Leaving.]
<_obad_>
alright, I don't see a way of adding a constant to a vector other than creating a constant vector of the same size. I tried using a vector of size 1 and setting the increment 0 but that got rejected.