Nahra has quit [Read error: Connection reset by peer]
Nahra has joined #ocaml
darkf has joined #ocaml
silver has quit [Quit: rakede]
Nahra has quit [Ping timeout: 250 seconds]
kakadu has quit [Remote host closed the connection]
SilverKey has quit [Quit: Halted.]
SilverKey has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 244 seconds]
darkf has quit [Read error: Connection reset by peer]
darkf has joined #ocaml
cojy has joined #ocaml
mrvn has quit [Ping timeout: 250 seconds]
fluter has joined #ocaml
mrvn has joined #ocaml
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
rgrinberg_ has joined #ocaml
rgrinberg_ has quit [Client Quit]
shinnya has joined #ocaml
<Bluddy[m]>
Only in a language that supports it like Eff. Not in OCaml.
fluter has quit [Ping timeout: 260 seconds]
<cojy>
supports what?
rgrinberg_ has joined #ocaml
<Bluddy[m]>
So long as effects aren't overused, they can be very useful. For example, right now if you want to write concurrent code, you need to use Async or Lwt and use monads. You get into the problem where code is either monadic or not (a constant issue in haskell), and therefore either directly supports concurrency or doesn't. With effects, you can insert a yield in every function where appropriate, but the effect handler will
<Bluddy[m]>
determine if it does anything (like switch to another green thread). So it's much easier to use monadic style functionality, but with the lack of type guarantees, you don't want to go crazy with it.
<Bluddy[m]>
cojy: supports effect type annotations
rgrinberg_ has quit [Ping timeout: 258 seconds]
<Bluddy[m]>
or just effect types
fluter has joined #ocaml
wtetzner has joined #ocaml
wtetzner has quit [Remote host closed the connection]
SilverKey has quit [Quit: Halted.]
mrvn has quit [Ping timeout: 244 seconds]
zpe has joined #ocaml
djellemah has quit [Ping timeout: 240 seconds]
zpe has quit [Ping timeout: 264 seconds]
rgrinberg has quit [Quit: WeeChat 1.5]
rgrinberg has joined #ocaml
shinnya has quit [Ping timeout: 244 seconds]
mrvn has joined #ocaml
seangrove has quit [Ping timeout: 244 seconds]
sdothum has joined #ocaml
unbalancedparen has joined #ocaml
SilverKey has joined #ocaml
unbalancedparen has quit [Quit: WeeChat 1.5]
aconz2 has joined #ocaml
govg has quit [Ping timeout: 252 seconds]
SilverKey has quit [Quit: Halted.]
SilverKey has joined #ocaml
aconz2 has left #ocaml [#ocaml]
zpe has joined #ocaml
mrvn has quit [Ping timeout: 244 seconds]
SilverKey has quit [Quit: Halted.]
mrvn has joined #ocaml
jjk has quit [Ping timeout: 250 seconds]
zpe has quit [Ping timeout: 264 seconds]
SilverKey has joined #ocaml
wtetzner has joined #ocaml
tmtwd has joined #ocaml
jjk has joined #ocaml
wtetzner has quit [Remote host closed the connection]
nicholasf has quit [Remote host closed the connection]
govg has joined #ocaml
cthuluh has quit [Ping timeout: 260 seconds]
cthuluh has joined #ocaml
nicholasf has joined #ocaml
cthuluh has quit [Ping timeout: 244 seconds]
wolfcore has quit [Ping timeout: 240 seconds]
wolfcore has joined #ocaml
zpe has joined #ocaml
Denommus has joined #ocaml
zpe has quit [Ping timeout: 265 seconds]
djellemah has joined #ocaml
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
tmtwd has quit [Ping timeout: 276 seconds]
pierpa has quit [Ping timeout: 252 seconds]
nicholasf has quit [Remote host closed the connection]
nicholasf has joined #ocaml
SilverKey has quit [Quit: Cheerio!]
zpe has joined #ocaml
SilverKey has joined #ocaml
MercurialAlchemi has joined #ocaml
zpe has quit [Ping timeout: 244 seconds]
M-Illandan has quit [Read error: Connection reset by peer]
M-ErkkiSeppl has quit [Remote host closed the connection]
M-jimt has quit [Remote host closed the connection]
Kakadu2[m] has quit [Remote host closed the connection]
regnat[m] has quit [Read error: Connection reset by peer]
M-martinklepsch has quit [Read error: Connection reset by peer]
barkmadley[m] has quit [Read error: Connection reset by peer]
M-pesterhazy has quit [Read error: Connection reset by peer]
Bluddy[m] has quit [Remote host closed the connection]
nicholasf has quit []
rgrinberg has quit [Ping timeout: 250 seconds]
MercurialAlchemi has quit [Ping timeout: 244 seconds]
MercurialAlchemi has joined #ocaml
circ-user-aDuHy has joined #ocaml
circ-user-aDuHy is now known as bruce_r
Kakadu2[m] has joined #ocaml
Simn has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 244 seconds]
cthuluh has joined #ocaml
Denommus has quit [Ping timeout: 276 seconds]
regnat[m] has joined #ocaml
M-martinklepsch has joined #ocaml
M-jimt has joined #ocaml
Bluddy[m] has joined #ocaml
M-ErkkiSeppl has joined #ocaml
barkmadley[m] has joined #ocaml
M-pesterhazy has joined #ocaml
M-Illandan has joined #ocaml
fluter has quit [Ping timeout: 250 seconds]
copy` has quit [Quit: Connection closed for inactivity]
fluter has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
Nahra has joined #ocaml
dexterph` has joined #ocaml
<companion_cube>
Drup: there are also toy-ish typecheckers on github, that might serve as simple references of HM and the likes
cthuluh has quit [Ping timeout: 244 seconds]
<gasche>
well the TAPL would be a reference
AltGr has joined #ocaml
<companion_cube>
I mean code :p
<gasche>
Didier Remy's course notes are also good to present the theoretical side (but for inference they use constraint solving, so a more "modern" approach): http://gallium.inria.fr/~remy/mpri/2015/cours.pdf
lol-icon has quit [Ping timeout: 260 seconds]
bruce_r has quit [Ping timeout: 260 seconds]
ocp has joined #ocaml
ontologiae has joined #ocaml
zpe has joined #ocaml
johnelse has quit [Quit: leaving]
johnelse has joined #ocaml
zpe has quit [Ping timeout: 276 seconds]
tane has joined #ocaml
elfring has joined #ocaml
<elfring>
I would like to extend my software development expererience also around the use of functionals in OCaml.
mcc has quit [Quit: Connection closed for inactivity]
<elfring>
So I am looking again for ways to restrict the kind of functions that can be passed as a parameter for a specific interface.
<elfring>
I find a special use case interesting once more: How would you define the operation "upsert" in a generic way?
<elfring>
gasche: The passed actions should correspond to specific interfaces in this example, shouldn't they?
<gasche>
in my proposed type, you have a single action instead of two; it takes a ('v option), so (Some v) if the entry exists and (None) when it does not
<gasche>
but then any OCaml-expression function of type ('v option -> 'v) is accepted
<gasche>
OCaml-expressible
<gasche>
companion_cube: let me rephrase my remark above that was a bit misleading
<companion_cube>
you mean unification is part of the constraint solving
<gasche>
but in the first-order case (simply-typed lambda-calculus), it corresponds to a *presentation* of the usual unification algorithms as a system of rewrite rules over constraints
<companion_cube>
oh, this
<gasche>
when you move to ML (generalization and instantation), it starts doing more
<companion_cube>
it's very classic for extensions of unification
<gasche>
(you enrich the constraint language)
<gasche>
yep
<companion_cube>
I'm more familiar with E-unification, but it's probably similar
<companion_cube>
(also, row-polymorphism ♥)
<elfring>
gasche: Another design approach might also be useful occasionally: upsert table change_actions
<gasche>
one thing that is surprising in the work on ML inference is how many of the latter advanced ideas (eg. MLF) take roots in implementation considerations for simpler systems (eg. ML)
<gasche>
I think it's fair to say that a lot of the more recent ideas came from looking carefully at how to implement ML inference in an elegant yet efficient way
wolfcore has quit [Ping timeout: 244 seconds]
<gasche>
(another witness to the idea that striving for elegant/beautiful beyond the "working" stage is productive in the long term)
<companion_cube>
as in maths in general
<companion_cube>
in ATP the trend is using SAT as much as possible, it's also using simpler logics!
<elfring>
gasche: How should be ensured that such "change actions" fit to appropriate interfaces for an operation like "upsert"?
<gasche>
companion_cube: but the elegance of the encodings is not always taken into consideration
<gasche>
also, Leo de Moura has the opposite view that SMT solvers should strive to accomodate more expressive problem domains, and I personnally think it's more interesting (but then ATP is not my field)
<gasche>
I think a lot of the tendency to reduce to SAT is caused by seeing SAT solvers as marvelous, unbeatable black boxes
<gasche>
but if you know enough about SMT implementations to see them as white boxes, you can do very nice work
<companion_cube>
gasche: yeah, the two worlds are colliding
<gasche>
you worked on an interesting integration with a SAT-like machinery, but I forgot the name
<companion_cube>
and yes, SMT are awesome
<gasche>
(Babilon, Micromegas, ?)
<companion_cube>
gasche: there is Avatar for superposition provers
<gasche>
yes, I was thinking of Avatar
<companion_cube>
and I'm working on a kind of narrowing-based toy SMT
<companion_cube>
for finding values that satisfy properties in a purely functional lang
<gasche>
yet another Quickcheck for Isabelle? :p
<companion_cube>
well, not only for isabelle, but yeah
<gasche>
(well do you take dependent types into account?)
<companion_cube>
and it might be much better than quickcheck if you have preconditions
<companion_cube>
the integration with Coq will be a huge task, but we want to have at least basic dependent types, inded
<gasche>
well existing quickchecks for isabelle already do symbolic execution and some kind of predicate inversion iirc.
<companion_cube>
indeed
<companion_cube>
they do, but I might have something better, thanks to the power of SAT :p
<gasche>
(does Nitpick use SMTs or a more classic model-checking approach?)
<companion_cube>
(the big advantage is better backtracking)
<companion_cube>
nitpick uses kodkod, a relational-first-order solver, which relies on SAT
<infinity0>
anyone know of an ocaml ide that does code folding
<infinity0>
i've tried like 5 editors, some of them do code folding pretty well but never for ocaml for some reason
kakadu has joined #ocaml
<gasche>
infinity0: apparently vim-ocaml does it fine for vim
<infinity0>
dammit i was invested into emacs :(
<infinity0>
vim-ocaml, can it fold let-expressions?
zpe has joined #ocaml
<gasche>
apparently people use fold-mode for Emacs
<infinity0>
oh looks like fold-mode in emacs does work sort of. except it doesn't fold top-level expressions so i can't see an "overview" of the file, hmph :/
<gasche>
infinity0: look at the .mli file ? :p
<gasche>
(or ocamlc -i foo.ml)
<infinity0>
the mli file is there, it just has documentation that i'd also like to hide, and it's also easier to just fold and not have to switch buffers
<infinity0>
also mli doesn't contain private stuff
<Leonidas>
gasche: oh, you might be right. I had it open but didn't immediately find the part I was looking for so assumed it's not the document I'm looking for
<infinity0>
oh wait sorry, more precisely i was already using hideshow and the problem i described is with that
<infinity0>
fold-mode requires you add manual markers, urgh
<companion_cube>
I use indentation-based folding in vim, which is fine for OCaml
<infinity0>
it is probably possible to fix hideshow to "do ocaml properly" i just wanted to avoid screwing around with lisp, sigh
<infinity0>
it is also ridiculously buggy now that i look at it in more depth. apparently it was so buggy i basically wrote it off as "code folding for ocaml in emacs" and forgot about it before coming here
<Drup>
companion_cube: I don't find toyish typechecker beside Oleg's post very useful
<companion_cube>
too bad
<Drup>
(Oleg's post already gives you the algorithm with an implementation)
<Leonidas>
Algorithm W on steroids?
Submarine has quit [Quit: Leaving]
<Drup>
ahah, cute
<Drup>
no
<Drup>
algorithm W is only of historical and pedagogical significance, you probably don't want to use it
<companion_cube>
Drup: well there are also other interesting extensions that Oleg doesn't speak of
<Drup>
companion_cube: sure, but are they used in the implementation of the OCaml typechecker ?
ggole has joined #ocaml
<Drup>
I agree that constraint based typechecking is very cool, but the goal still is to give hints to be able to dive in the OCaml typechecker ;)
<companion_cube>
sure
johnelse is now known as johnel_away
johnel_away is now known as johnelse
lol-icon has joined #ocaml
silver has joined #ocaml
kev has joined #ocaml
dhil has joined #ocaml
Simn has quit [Quit: Leaving]
sdothum has joined #ocaml
cthuluh has joined #ocaml
kev has quit [Ping timeout: 258 seconds]
bobry has joined #ocaml
<bobry>
Is there a way to use ppx_deriving with num? I get "Unbound value: Num.pp_num"
kev has joined #ocaml
cthuluh has quit [Ping timeout: 260 seconds]
shum has joined #ocaml
sdothum has quit [Read error: Connection reset by peer]
<elfring>
Does the programming language "OCaml" provide "types" for function signatures?
<pierpa>
"yes"
<companion_cube>
":D"
<elfring>
How should a type restriction be specified for a parameter which should get a specific function?
<companion_cube>
val f: int -> string -> bool
<companion_cube>
write this in a .mli file, and it will specify the type of f
<elfring>
Would you like to point more source code examples out where specific functions are passed in parameters (while using also corresponding type restrictions)?
<Drup>
elfring: List module in the stdlib.
<ggole>
"Specific functions"?
<ggole>
If you have a closed set of functions which can be meaningfully passed, you'll probably want a sum type
<ggole>
(Or maybe a private type, depending on what you are doing.)
<elfring>
ggole: I guess that another popular case is the use of comparison functions. How often is it specified in this detail that a passed function expects that will be finally called with two parameters for comparison?
<companion_cube>
val List.sort : ('a -> 'a -> int) -> 'a list -> 'a list
<companion_cube>
the first parameter is a comparison function
<pierpa>
It is specified *always*. You cannot avoid it.
<pierpa>
ocaml is not lisp
<MercurialAlchemi>
you do have a notion of optional parameters, though
<MercurialAlchemi>
but yeah, ocaml's typechecker is unforgiving
<MercurialAlchemi>
(I'll admit that occasionally Typescript's ability to cast X as "any" is extremely convenient...)
<Drup>
MercurialAlchemi: the guilty pleasure of Obj.magic ?
<MercurialAlchemi>
oh, it's even worse
<MercurialAlchemi>
obj.magic lets you cast a Foo into a Bar
<MercurialAlchemi>
any lets you cat a Foo into your average JS object where nothing is typechecked
<companion_cube>
type any let to_any (x:'a): any = Obj.magic
<companion_cube>
here you go
<ggole>
Obj.magic is considerably worse than that, though
<pierpa>
correction: It is specified almost *always*. You can avoid it with some effort :)
<companion_cube>
MercurialAlchemi: no it's not worse, with Obj.magic you can case anything to string and then concatenate
<MercurialAlchemi>
ggole: because it's going to crash your program if you get it wrong?
<companion_cube>
no type checking will take place :)
<ggole>
If you're lucky it will crash
<MercurialAlchemi>
companion_cube: yeah, but your result still has a concrete type
<companion_cube>
until you Obj.magic it again
<MercurialAlchemi>
the result of any is more like a from C# "dynamic"
<MercurialAlchemi>
er, a "dynamic" from C#
<MercurialAlchemi>
like Yoda I speak
elfring has quit [Quit: Konversation terminated!]
<pierpa>
polish reversing are you?
octachron has joined #ocaml
<companion_cube>
int list option ref
kev has joined #ocaml
gndl has joined #ocaml
ygrek_ has quit [Ping timeout: 276 seconds]
gndl has left #ocaml [#ocaml]
dhil has quit [Ping timeout: 276 seconds]
<ubertaco>
I'm not super-familiar with obj.magic, except having heard it mentioned occasionally
<ubertaco>
is it just a "coerce this to a different type" function?
<_y>
better you don’t know
<_y>
it doesn’t exist
<ubertaco>
fair enough
agarwal1975 has quit [Quit: agarwal1975]
<ggole>
uberTaco: it's a function of type 'a -> 'b that is identity under the hood
<ggole>
So you can tell any kind of lie with it.
rgrinberg has joined #ocaml
<freehck>
People, why if I catch some exception and raise it then again, I get stack trace only to the catch continuation I've raised it again?
kev has quit [Ping timeout: 258 seconds]
Nahra has quit [Remote host closed the connection]
sepp2k has joined #ocaml
Nahra has joined #ocaml
Nahra has quit [Remote host closed the connection]
<companion_cube>
I think it depends on whether you use the stack in the intermediate exception handler
octachron has quit [Ping timeout: 250 seconds]
octachron has joined #ocaml
kev has joined #ocaml
ubertaco has quit [Ping timeout: 240 seconds]
tane has quit [Quit: Leaving]
fraggle-boate has quit [Remote host closed the connection]
<gasche>
(I'm not sure the two issues are related)
<gasche>
what's your ocaml version?
<Algebr`>
I'm going to be teaching coding to many new people
<Algebr`>
I'm conflicted about whether I should pick OCaml or JavaScript
<Algebr`>
I'm teaching so that they can get jobs
<Algebr`>
and JavaScript being....well....JavaScript
<gasche>
it may depend on your student's background
<Algebr`>
this is a land of pho
<Algebr`>
php
<Algebr`>
and probably weak backgrounds
<gasche>
and also on the kind of careers they have in mind
<Algebr`>
careers are anything that will pay...which is web coding
<gasche>
it seems you have made a decision already :-)
al-damiri has joined #ocaml
<gasche>
what's the context for the teaching, out of curiosity?
<gasche>
(are you working for an institution, which?)
<Algebr`>
gasche: yea, I kind of see the writing on the wall too then. context is to teach people how to code now so they can get jobs relatively quickly. Not affliated with insitutions, I am suspicious of the burecracy and shitty people trying to co-opt it
<gasche>
so are you working alone? or in an association? how did you find the students?
<gasche>
external reraise : exn -> 'a = "%reraise"
<gasche>
(hm, nope)
<gasche>
I think to pick a language it's best to have either a clear idea of how the language will help students in the future, or how the language will help you teach, or both
<gasche>
(for, say, university students, I'm convinced that picking a functional language is a good choice as they tend to be better for teaching, give more diversity, and they have the time to learn other stuff at their own pace as well)
<Algebr`>
gasche: working alone but various organizations in town are giving me a place to teach, computers, interested people
<Algebr`>
I think OCaml would be better for their mind long term
<Algebr`>
but won't get them a job ow
<Algebr`>
now
<gasche>
(for high-school students, I think job prospects are not so important, giving interest matters more, and then whatever language has cool examples etc. is best; it can be OCaml, it can be Racket for example)
<Algebr`>
it might be a mix of university students and people off the street
<Algebr`>
its an open door policy
<gasche>
creating teaching material from the scratch is a lot of work
<gasche>
did you consider reusing existing sutff? eg. books? that could also help you make a choice
<Algebr`>
good point
<Algebr`>
gasche: gotta run, thanks for insight!
Algebr` has quit [Ping timeout: 264 seconds]
octachron has quit [Quit: Page closed]
octachron has joined #ocaml
cthuluh has quit [Ping timeout: 258 seconds]
ubertaco has joined #ocaml
kev has joined #ocaml
dhil has joined #ocaml
<freehck>
gasche: I'm using 4.01.0 and I can reproduce my problem. Already written code. As flux already said ocamlc and ocamlopt provide binaries with different result.
<gasche>
freehck: in other words, using (-inline 0) with ocamlopt solves your problem, and the next OCaml version should not require any such workaround
tane has quit [Quit: Leaving]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
cojy has left #ocaml [#ocaml]
lol-icon has quit [Ping timeout: 260 seconds]
bruce_r has joined #ocaml
<freehck>
gasche: I got the thing with -inline 0. Thank you. I'll modify my build scripts to adopt this option.
<gasche>
note that this may degrade performances
<gasche>
(it will still be miles faster than bytecode, of course)
rgrinberg has quit [Quit: WeeChat 1.5]
slash^ has joined #ocaml
<freehck>
gasche: I think that debugging facilities are much more important than performance. :)
rgrinberg has joined #ocaml
cthuluh has joined #ocaml
zpe has joined #ocaml
<gasche>
freehck: also, note that more recent OCaml versions let you programmatically capture the backtrace at an exception-capture point
<gasche>
which means that you can print a trace instead of the exception name if you want, and don't need re-reaise so much
cthuluh has quit [Ping timeout: 244 seconds]
<gasche>
(it also lets you explicitly decide not to gather a trace for a raise you statically know will be caught, letting you place the cursor between convenience and performance)
cthuluh has joined #ocaml
sdothum has joined #ocaml
zpe has quit [Ping timeout: 265 seconds]
ChristopheT has joined #ocaml
ontologiae has quit [Ping timeout: 244 seconds]
MercurialAlchemi has quit [Ping timeout: 250 seconds]
ocp has quit [Ping timeout: 258 seconds]
struk|work has quit [Quit: Page closed]
aconz2 has joined #ocaml
dexterph` has quit [Ping timeout: 250 seconds]
aconz2 has quit [Client Quit]
govg has quit [Ping timeout: 250 seconds]
aconz2 has joined #ocaml
MercurialAlchemi has joined #ocaml
cthuluh has quit [Ping timeout: 244 seconds]
SilverKey has quit [Quit: Halted.]
rgrinberg has quit [Ping timeout: 264 seconds]
jeffmo has joined #ocaml
cthuluh has joined #ocaml
zpe has joined #ocaml
cthuluh has quit [Ping timeout: 244 seconds]
zpe has quit [Ping timeout: 240 seconds]
sepp2k has quit [Quit: Leaving.]
sh0t has quit [Remote host closed the connection]
ygrek_ has joined #ocaml
sh0t has joined #ocaml
hay207_ has joined #ocaml
hay207 has quit [Ping timeout: 244 seconds]
copy` has joined #ocaml
aconz2 has quit [Ping timeout: 244 seconds]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
govg has joined #ocaml
sdothum has joined #ocaml
wagle has quit [Remote host closed the connection]
wagle has joined #ocaml
sdothum has quit [Read error: Connection reset by peer]
sdothum has joined #ocaml
bbc_ is now known as bbc
octachron has quit [Quit: Page closed]
lol-icon has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
cthuluh has joined #ocaml
zpe has joined #ocaml
cthuluh has quit [Ping timeout: 276 seconds]
zpe has quit [Ping timeout: 276 seconds]
Anarchos has joined #ocaml
ChristopheT has left #ocaml ["ERC (IRC client for Emacs 24.5.1)"]
SilverKey has joined #ocaml
bruce_r has quit [Ping timeout: 258 seconds]
SilverKey has quit [Max SendQ exceeded]
SilverKey has joined #ocaml
SilverKey has quit [Max SendQ exceeded]
SilverKey has joined #ocaml
SilverKey has quit [Max SendQ exceeded]
Nahra has joined #ocaml
cthuluh has joined #ocaml
bruce_r has joined #ocaml
cthuluh has quit [Ping timeout: 260 seconds]
cthuluh has joined #ocaml
cthuluh has quit [Ping timeout: 244 seconds]
zpe has joined #ocaml
dhil has quit [Ping timeout: 264 seconds]
zpe has quit [Ping timeout: 264 seconds]
aconz2 has joined #ocaml
Algebr` has joined #ocaml
thizanne has joined #ocaml
darkf has quit [Read error: Connection reset by peer]
darkf has joined #ocaml
Nahra has quit [Ping timeout: 240 seconds]
aconz2 has quit [Remote host closed the connection]
aconz2 has joined #ocaml
Algebr` has quit [Ping timeout: 260 seconds]
shinnya has quit [Ping timeout: 265 seconds]
Algebr` has joined #ocaml
aconz2` has joined #ocaml
aconz2`` has joined #ocaml
aconz2` has quit [Remote host closed the connection]
aconz2 has quit [Ping timeout: 264 seconds]
dhil has joined #ocaml
Nahra has joined #ocaml
ollehar has joined #ocaml
<ollehar>
the module Z. is there a float version of this?
<ollehar>
Z.neg
<ollehar>
Float.neg?
<ollehar>
Pervasives.(~-.)?
<ollehar>
hm
zpe has joined #ocaml
picolino has joined #ocaml
Algebr` has quit [Ping timeout: 240 seconds]
zpe has quit [Ping timeout: 250 seconds]
AlexRussia has joined #ocaml
<ollehar>
what's this?
<ollehar>
| #op_something
<ollehar>
#?
<ollehar>
oooh, factored pattern match
kev has joined #ocaml
octachron has joined #ocaml
govg has quit [Ping timeout: 258 seconds]
govg has joined #ocaml
freehck has quit [Ping timeout: 260 seconds]
<ollehar>
different float types in ocaml?
jwatzman|work has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
thizanne has quit [Ping timeout: 250 seconds]
<octachron>
ollehar, (?) only double precision float are supported in the standard library ( and there is some specific support for them within the compiler )
<mrvn>
yes, float is double
<ollehar>
octachron: thanks
shinnya has joined #ocaml
cthuluh has joined #ocaml
thizanne has joined #ocaml
ewanas has joined #ocaml
wtetzner has joined #ocaml
sh0t has quit [Quit: Leaving]
aconz2`` is now known as aconz2
jwatzman|work has quit [Quit: jwatzman|work]
kev has quit [Quit: Leaving]
jhonatanoliveira has joined #ocaml
jwatzman|work has joined #ocaml
jwatzman|work has quit [Read error: Connection reset by peer]
<jhonatanoliveira>
Hello guys. I have a quick question on passing optional arguments. How would it be the implementation of a function that receives an optional argument and then passes this optional argument to a optional argument of a next function. Just to be clear: the idea here is to propagate down a specific argument. thx
cthuluh has quit [Ping timeout: 244 seconds]
<asmanur>
jhonatanoliveira: let f ?foo () = g ?foo ()
kakadu has joined #ocaml
<mrvn>
jhonatanoliveira: optional arguments are just syntactic suggar for option types. So you just pass it on. If the function gets called without then it gets None and you pass on None.
<jhonatanoliveira>
Got it! That sounds interesting. It is clear indeed if I see them as just a argument of option type. Thank you both. I'll try it out
<jhonatanoliveira>
isn't the "?" only at the definition of it? That is, in your example, let f ?foo () = g ?foo () , shouldn't it be let f ?foo () = g ~foo () instead?
<mrvn>
jhonatanoliveira: ~foo would result in Some None
<mrvn>
the second ?foo tells it that it already is an option and to not box it again.
<jhonatanoliveira>
That's prob what i'm doing wrong then, coz I was ~foo when passing it away
<mrvn>
yeah. then you have to: match foo with None -> g () | Some x -> g ~foo:x ()
<jhonatanoliveira>
I still find it strange, because ?foo looks like a fun definition and not a call, but I'll try that
<mrvn>
So again the "?foo" is just syntactic suggar that handles the option type magic for you.
<flux>
well, ?foo is arguably not syntactic sugar and ~foo is sugar for ?foo:(Some foo)
<jhonatanoliveira>
Ok. Yes, it is better to think that way
<flux>
(well, ?foo is still sugar for ?foo:foo)
AlexRussia has quit [Ping timeout: 244 seconds]
<mrvn>
flux: ?foo:bla is suggar for match bla with None -> g | Some x -> g ~foo:x
<flux>
well not really, because if you have more than one label, there is a combinatoric explosion
<flux>
so it is really more expressive
<mrvn>
flux: how so? the label is always given
<flux>
let's say I have foo ?a ?b ?c ()
<mrvn>
then you have ?a, ?b or ?c
<flux>
express that withot using ~labels
jwatzman|work has joined #ocaml
<flux>
hmm, I guess you can do it in parts :)
<flux>
seems like that as it's simpler to go from the ~foo expression to ?foo than it is to go from ?foo to ~foo, ?foo shold be considered the basic case :)
aconz2 has quit [Remote host closed the connection]
aconz2 has joined #ocaml
<jhonatanoliveira>
I didn't follow the discussion (not at that level yet xD ) but I appreciate the help.Thx
zpe has joined #ocaml
<flux>
(optional) labels are really a nice feature of ocaml, though it does have its downsides as well. but, sleep ->
<jhonatanoliveira>
I didn't follow the discussion (not at that level yet xD ) but I appreciate the help.Thx
<jhonatanoliveira>
Oh, sry, duplicated message
<mrvn>
You could say ?foo is no suggar and ~foo is suggar for ?foo:Some foo
<mrvn>
flux: I bet that way is what the compiler does.
jave has quit [Ping timeout: 240 seconds]
thizanne has quit [Ping timeout: 264 seconds]
jave has joined #ocaml
zpe has quit [Ping timeout: 276 seconds]
tvynrylan has quit [Ping timeout: 265 seconds]
aconz2` has joined #ocaml
aconz2 has quit [Remote host closed the connection]
darkf has quit [Quit: Leaving]
ggole has quit []
aconz2` is now known as aconz2
jeffmo has quit [Quit: jeffmo]
aconz2` has joined #ocaml
tvynrylan has joined #ocaml
aconz2 has quit [Remote host closed the connection]
jwatzman|work has quit [Quit: jwatzman|work]
aconz2`` has joined #ocaml
aconz2` has quit [Remote host closed the connection]
jwatzman|work has joined #ocaml
tvynrylan has quit [Ping timeout: 265 seconds]
stormogulen has joined #ocaml
aconz2`` has quit [Remote host closed the connection]
jwatzman|work has quit [Quit: jwatzman|work]
stormogulen has quit [Read error: Connection reset by peer]
stormogulen has joined #ocaml
pierpa has joined #ocaml
stormogulen has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
zpe has quit [Ping timeout: 265 seconds]
AltGr has left #ocaml [#ocaml]
cthuluh has joined #ocaml
agarwal1975 has quit [Quit: agarwal1975]
cthuluh has quit [Ping timeout: 276 seconds]
orbifx has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]