adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml MOOC http://1149.fr/ocaml-mooc | OCaml 4.02.3 announced http://ocaml.org/releases/4.02.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
habs has quit [Quit: WeeChat 1.0]
danieli has quit [Ping timeout: 240 seconds]
JacobEdelman has quit [Quit: Connection closed for inactivity]
danieli has joined #ocaml
danieli has quit [Max SendQ exceeded]
danieli has joined #ocaml
danieli has quit [Max SendQ exceeded]
danieli has joined #ocaml
danieli has quit [Max SendQ exceeded]
danieli has joined #ocaml
danieli has quit [Max SendQ exceeded]
danieli has joined #ocaml
danieli has quit [Max SendQ exceeded]
danieli has joined #ocaml
danieli has quit [Max SendQ exceeded]
danieli has joined #ocaml
danieli has quit [Max SendQ exceeded]
kakadu has quit [Remote host closed the connection]
ygrek has joined #ocaml
madroach has quit [Ping timeout: 246 seconds]
madroach has joined #ocaml
damason has joined #ocaml
haesbaert has quit [Ping timeout: 265 seconds]
haesbaert has joined #ocaml
badon_ has joined #ocaml
badon has quit [Disconnected by services]
badon_ is now known as badon
ril has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ncthom91 has joined #ocaml
ril has joined #ocaml
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
struk|desk|away is now known as struk|desk
<Mirry> How can I simplify this? List.map (List.group (List.sort ~cmp:(compare) num) ~break:(<>)) ~f:(fun x -> (List.length x, List.head x));;
<Mirry> with num = [1; 1; 3; 2; 1]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
contempt has quit [Ping timeout: 265 seconds]
contempt has joined #ocaml
br01 has quit [Quit: Quitte]
groovy2shoes has joined #ocaml
FreeBirdLjj has quit [Read error: Connection reset by peer]
FreeBirdLjj has joined #ocaml
ril has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<pierpa> mirry: do you want the result sorted, or only uniqued & counted?
<Mirry> sorted, uniqued and counted
<pierpa> then I don't think you can semplify what you did
philtor has quit [Ping timeout: 255 seconds]
<Mirry> What if I use hashtables?
<Mirry> Would it improve my code readability?
<pierpa> that's what I was thinking
<pierpa> but you want the result sorted
<pierpa> so you must sort anyway
ril has joined #ocaml
<Drup> do you need it polymorphic ?
<Mirry> Nope, only integers
<Drup> then use a map
<Mirry> Yeah, that's what I'm gonna do, thank you both
<pierpa> and, ahem, if the integers are bounded and not too big, an array?
<Mirry> That I've tried pierpa
<pierpa> if it is adeguate, it should be the simplest and also the fastest, no?
<Mirry> That make sense
<Mirry> Can I update an array with fold_left?
<pierpa> sure
<pierpa> fold_left (fun acc i -> acc.(i) <- acc(i) + 1) (Array.make N 0) list_of_int
<lyxia> that's a map
JacobEdelman has joined #ocaml
<pierpa> then, Array.fold_right (fun acc i x -> if x = 0 then (i,x)::acc else acc) [] result_of_previous_expression
<pierpa> and he has a list with the result he wanted
<pierpa> except that Array.fold_left does not supply the index :(
<pierpa> *fold_right
<Mirry> List.fold_left num ~init:(Array.create 10 0) ~f:(fun acc i -> acc.(i) <- acc.(i) + 1);; it doesn't work because the function doesn't return anything
<Mirry> well it returns unit, which is of no interest
<pierpa> make it return the acc
<Drup> yeah, it should be an iter here
<pierpa> (I didn't test the code)
struk|desk has quit [Quit: Konversation terminated!]
<Mirry> almost got it !
<Mirry> let frequency numbers = let arr = Array.create 10 0 in List.iter numbers ~f:(fun i -> arr.(i) <- arr.(i) + 1);;
<Mirry> This is gonna sound dumb for sure, but, how the hell do I return arr?
<lyxia> replace ";;" with "; arr;;"
<Mirry> Perfect !
<Mirry> Thank you very much
<pierpa> the fun i shouldn't be fun () i ?
<pierpa> or fun _ i
<pierpa> ah, no, sorry
<pierpa> ignore me :)
<Mirry> : 'a list -> f:('a -> unit) -> unit = <fun>
<pierpa> ignore me :)
<Mirry> Sure nevermind
struk|desk has joined #ocaml
ril has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
haesbaert has quit [Ping timeout: 276 seconds]
haesbaert has joined #ocaml
kushal has joined #ocaml
ril has joined #ocaml
ncthom91 has joined #ocaml
struk|desk is now known as struk|desk|away
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
struk|desk|away is now known as struk|desk
ril has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
mcc has joined #ocaml
mac10688 has quit [Ping timeout: 240 seconds]
BitPuffin|osx has quit [Ping timeout: 276 seconds]
shinnya has quit [Ping timeout: 256 seconds]
rossberg has quit [Ping timeout: 264 seconds]
Accidus has quit [Ping timeout: 250 seconds]
cody` has joined #ocaml
maufred_ has quit [Ping timeout: 260 seconds]
maufred has joined #ocaml
darkf has joined #ocaml
pierpa has quit [Ping timeout: 240 seconds]
MercurialAlchemi has joined #ocaml
JacobEdelman has quit [Quit: Connection closed for inactivity]
MercurialAlchemi has quit [Ping timeout: 240 seconds]
Mirry has quit [Quit: leaving]
ollehar1 has joined #ocaml
Fleurety has quit [Ping timeout: 245 seconds]
struk|desk2 has joined #ocaml
struk|desk2 is now known as struk|desk|away
struk|desk has quit [Ping timeout: 260 seconds]
ril has joined #ocaml
sbrouf has quit [Quit: Quitte]
octachron has joined #ocaml
larhat1 has quit [Quit: Leaving.]
<adrien> #7121 and #7122 on mantis plus skipping the copy of ocamlyacc$(EXE) and ocamlrun$(EXE) in the install: rule \o/
<adrien> basically OOTB support for cross-compilation to Windows
MercurialAlchemi has joined #ocaml
freehck` has joined #ocaml
mcc has quit [Quit: Connection closed for inactivity]
Haudegen has quit [Ping timeout: 240 seconds]
Simn has joined #ocaml
ollehar1 has quit [Quit: ollehar1]
Haudegen has joined #ocaml
djellemah has joined #ocaml
tmtwd has joined #ocaml
cody` has quit [Quit: Connection closed for inactivity]
ril has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
larhat has quit [Ping timeout: 265 seconds]
jacquev6 has joined #ocaml
larhat has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
tmtwd has quit [Ping timeout: 272 seconds]
inr_ is now known as inr
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
sh0t has joined #ocaml
FreeBird_ has joined #ocaml
zpe has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 245 seconds]
fluter is now known as fluter_
zaquest has quit [Ping timeout: 256 seconds]
zaquest has joined #ocaml
_andre has joined #ocaml
fluter_ is now known as fluter
Fleurety has joined #ocaml
sepp2k has joined #ocaml
fluter is now known as fluter_
mort___ has joined #ocaml
Anarchos has joined #ocaml
<Anarchos> why coq doesn't use dypgen for its parser ?
<def`> deep reason is not totally understood yet, but you can find an accessible attempt here http://www.wired.com/2014/04/quantum-theory-flow-time/
rossberg has joined #ocaml
icing has joined #ocaml
<icing> Greetings! I am trying to download ocaml 4.0.1 source but caml.inria.fr appears to be down
<def`> icing: yes, this is a planed maintenance
<icing> Thanks very much for the information :-)
ontologiae has joined #ocaml
icing has quit [Quit: Page closed]
fluter_ is now known as fluter
FreeBird_ has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
Accidus has joined #ocaml
mort___ has quit [Quit: Leaving.]
Haudegen has quit [Ping timeout: 245 seconds]
d0nn1e has quit [Ping timeout: 250 seconds]
rand has joined #ocaml
d0nn1e has joined #ocaml
rand is now known as Guest80066
Accidus has quit [Ping timeout: 256 seconds]
zpe has quit [Remote host closed the connection]
jacquev6 has quit [Quit: jacquev6]
FreeBird_ has joined #ocaml
Recurs has joined #ocaml
Haudegen has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
jacquev6 has joined #ocaml
lewis1711 has joined #ocaml
_whitelogger has joined #ocaml
jacquev6 has quit [Quit: jacquev6]
ggole has joined #ocaml
_whitelogger has quit [Ping timeout: 240 seconds]
_whitelogger_ has joined #ocaml
mac10688 has joined #ocaml
<haesbaert> what's my best option to use sexp with Maps ?
<companion_cube> I don't use sexplib, but doesn't Core provide such functions?
<companion_cube> (otherwise, a simple way is to convert to a list of pairs first)
<haesbaert> ah, I'm not using core
<freehck`> haesbaert: If you need to work with sexps you could use an internal r5rs interpreter.
<companion_cube> then I'd say to convert into a list or iterator of pairs
<freehck`> for example OCR could be a good variant
<companion_cube> oh, I assumed it was about serialization in S-exprs
<freehck`> but OCR is not in opam
<haesbaert> companion_cube: it is
<haesbaert> companion_cube: you mean using Map.bindings and then convert ?
<freehck`> Sry, I missed the beginning of the discussin maybe.
<haesbaert> that would be enough, I'll try that.
<haesbaert> so basically writing a t_of_sexp and sexp_of_t for my map module
<companion_cube> haesbaert: I think so
<haesbaert> I can try that
<freehck`> haesbaert: sorry, OCS, not OCR :)
<haesbaert> ack :D
mac10688 has quit [Ping timeout: 246 seconds]
Mirry has joined #ocaml
JacobEdelman has joined #ocaml
zpe has joined #ocaml
jacquev6 has joined #ocaml
jacquev6 has quit [Client Quit]
jacquev6 has joined #ocaml
FreeBird_ has quit [Remote host closed the connection]
jacquev6 has quit [Quit: jacquev6]
jacquev6 has joined #ocaml
struk|desk|away is now known as struk|desk2
<lewis1711> sometime I want to use objects just so I don't have to write stupid code like "VM.eval vm"
raphaelss has joined #ocaml
<ggole> I choose to write stupid code like Vm.eval vm so I don't have to use objects.
<lewis1711> vm#eval. mmm
<Drup> ggole: come on, they are not that bad in ocaml.
<Drup> just slow, but typing/API wise, it's very reasonable
<ggole> Open-endedness where you don't need it is pretty questionable in my eyes.
<ggole> (When you need that stuff, objects are OK.)
zpe has quit [Remote host closed the connection]
<Anarchos> Drup the typing of objects is awful for a day-work engineer :/
<Drup> ggole: depending of the programming style, you don't necessary have to deal with the open-endedness at all
shinnya has joined #ocaml
<lewis1711> Anarchos, you mean the structural typing?
<Anarchos> lewis1711: no idea but i am unable to understand what the reference manual says about object and class typing
<ggole> The RWO chapters are probably a bit more clear.
<lewis1711> it's a really good object system. but different to other languages
<lewis1711> I particularly like the way constructors are done
<Anarchos> ggole: i should look at it for times :)
<Drup> lewis1711: constructors are pretty much just functions
<lewis1711> Drup, exactly
<Drup> (with a few things for initializer)
<Drup> I never understood why it was not like that in other languages
<Drup> well, it's like that in javascript, almost
<ggole> Because they have silly things like 'this' which needs special handling
<ggole> (Not really a great reason.)
<Drup> ggole: well, we have "this" too
<ggole> Not in the constructor?
<Drup> What we don't have in the late binding semantic, so it can only be used inside the object
<Drup> but ... late binding semantic is insane ...
<companion_cube> Drup: you mean 'self'? it's explicitely bound, so I don't think it should be compared to the usual 'this'
<Drup> self/this, same thing
<ggole> The issue is not that 'this' is implicitly bound, but that accesses to the fields may be made during object construction, which causes all kinds of problems
<ggole> eg, Java has special rules to handle it
<ggole> So constructors are 'special'.
Recurs has quit [Quit: Page closed]
<lewis1711> I usually end up writing my modules in a semi-oo style anyway
<lewis1711> each module has a type t, which is just the data
<Drup> that's just hierachical, not really OOP :p
<lewis1711> if ocaml had something like java's "final", I'd probably use modules a lot less
<Drup> reminds me what this is
<companion_cube> non heritable classes
<Drup> what's the point ?
<lewis1711> optimisation
<Drup> ah, so that objects behaves like modules ? :D
<lewis1711> kind of
<lewis1711> except... then I could do vm#eval and not repeat myself ;)
<ggole> So rather than the semantic features of objects, you just want foo.bar syntax?
<lewis1711> it's an important idea though
<lewis1711> also, then I could write a function that sums a sequence, and not care whether it was a list or array
<Drup> yeah, it's a terrible idea to solve that with objects
<Drup> objects are crap, as far as extensibility goes
<Drup> you can't add methods after the fact
<Drup> (and have good typing)
<Drup> typeclasses/implicits are much better at solving this.
<MasseR> hnngh, scala and implicits. Way to make code incomprehensible
<lewis1711> Drup, C# is statically typed, and you can add methods to its objects
<Drup> scala's implicits are a bit bleh
<Drup> lewis1711: and how do you know statically if an object has a method ?
<ggole> Elm does OK in terms of record extensibility
<lewis1711> Drup, not sure, I didn't write the C# compiler
<ggole> Although row variable records have their own costs
<lewis1711> I think it's mainly a syntax hack
<lewis1711> you write static methods that wrap the objects and have access to the public interface. but you call them as if they were methods
<Drup> (also, C# is half static, half dynamic, and people are using the dynamic stuff a lot)
<lewis1711> huh? extension methods are definitely not dynamic
<lewis1711> how is C# half dynamic?
<ggole> My understanding is that extension methods are lexically visible
<Drup> I was just pointing out :p
govg has joined #ocaml
luzie is now known as tei
struk|desk2 is now known as struk|desk|away
xyh has joined #ocaml
badon_ has joined #ocaml
badon has quit [Disconnected by services]
badon_ is now known as badon
<xyh> this page is down ?? :: http://caml.inria.fr/pub/docs/manual-ocaml/
<Anarchos> xyh: maintenance planned
<Anarchos> [11:30] <def`> icing: yes, this is a planed maintenance [11:32] <def`> http://article.gmane.org/gmane.comp.lang.caml.inria/64025
<xyh> oh, I will read the local doc then ~
tei has quit [Quit: WeeChat 1.5-dev]
lewis1711 has quit [Ping timeout: 250 seconds]
octachron has quit [Quit: Leaving]
luzie has joined #ocaml
luzie is now known as tei
sepp2k has quit [Quit: Leaving.]
psy_ has joined #ocaml
manizzle has quit [Ping timeout: 272 seconds]
ollehar has joined #ocaml
Anarchos has quit [Quit: Page closed]
rpg has joined #ocaml
philtor has joined #ocaml
pierpa has joined #ocaml
jeffmo has joined #ocaml
ontologiae has quit [Ping timeout: 246 seconds]
ananas has joined #ocaml
ananas is now known as Guest86742
<Guest86742> Hello ! Does someone knows how to use classes in dynamically-loaded plugins (cma, cmxs) ? If I build a plugin containing "class t = object initializer print_endline "Hello !" end;; new t;;" and load it (in bytecode or native mode), it fails because of lacking CamlinternalOO or c stubs... Should I include more things to have it compile ?
<Guest86742> (sorry for my english)
ygrek has joined #ocaml
jacquev6 has quit [Quit: jacquev6]
<smondet> Guest86742: you should try with a dummy version of the plugin already loaded (with the program that does the dynlink), it looks like the linker is discarding modules that unused (at compile time)
slash^ has joined #ocaml
<Guest86742> Well, now the bytecode works. There is still an invalid elf header error for my cmxs, but it will be fixed soon. Thank you :-)
<flux> smondet, I wonder if that's actually a bug, so that dynlink should just load those parts as well?
kakadu has joined #ocaml
ollehar has quit [Ping timeout: 255 seconds]
ollehar has joined #ocaml
aphprentice has joined #ocaml
yomimono has quit [Ping timeout: 276 seconds]
tei has quit [Quit: WeeChat 1.5-dev]
<smondet> flux: it's difficult to know what the user wants there :) if ocaml starts inclding modules that are not needed, we're are going to start complaining that “binaries take 42 KB more on my netbsd-router-toaster and that's totally inacceptable”
MercurialAlchemi has quit [Ping timeout: 240 seconds]
xyh has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 272 seconds]
<Drup> smondet: it's probably going to be much more than 42KB
MercurialAlchemi has joined #ocaml
ril has joined #ocaml
Jane-PC has joined #ocaml
<Jane-PC> Hi ! I'm learning OCaml on my own, and I'm stuck with an error.
<Jane-PC> Here's my code, and I add the error at the end.
<companion_cube> line 28, you need to write 'let a = ref b in ....' instead of 'let a = ref b; ....'
<companion_cube> you have other issues in the code, mostly because you declare constants in places you should declare variables
<companion_cube> (if you prefer to speak french, btw, there is #ocaml-fr)
<Jane-PC> Ok thx, but then, I can't access enteredNumber (line 13 for exemple)
<Jane-PC> (yep', I'm on #ocam-fr too, but as there's more people here, I asked here ;) )
<companion_cube> what i mean is that "let enterNumber = foo; read_int () ;; " will be evaluated only once
<Jane-PC> (Is my english so bad that you saw I'm french or.. ?)
<companion_cube> no, line 2 betrayed you
<companion_cube> :p
<Jane-PC> Ah ok haha !
<companion_cube> so, imho, you should write let enterNumber () = foo; read_int ();;
<companion_cube> then, in every loop step at the end, you call `let n = enterNumber() in ....` and the other functions take n as a parameter
<Jane-PC> I should add a ref somewhere, that's it ?
<companion_cube> functions would be much better
<Jane-PC> hum ok
<Jane-PC> I'll try it, thx.
<companion_cube> does it compile without errors now?
<Jane-PC> I'll tell you once I've done it. ;)
<companion_cube> sure
ril is now known as ril[away]
ygrek has joined #ocaml
ril[away] is now known as ril
<Jane-PC> Ok, now it compiles without error.
<Jane-PC> But, it never get out of the while loop.
<companion_cube> exactly: the values you have declared with `let foo = ...` will never change
<Jane-PC> And juste write: "It's more\nIt's more\n"...
<companion_cube> that's almost correct, but you still have `enterNumber` as a constant
<companion_cube> parametrize it with () and it should work
<companion_cube> currently, enterNumber is a constant, so enteredNumber := enterNumber; does not do much
<Jane-PC> as a constant ?
<companion_cube> well it's a constant, not a function
<Jane-PC> Ah ok.
<Jane-PC> let enterNumber () =
<Jane-PC> should work ?
<companion_cube> it should, yes
<Jane-PC> ok, I think I get it
<companion_cube> note that it is the reason with read_int takes a () parameter
<Jane-PC> Ok, it works.
<Jane-PC> Yep'
<Jane-PC> Hum..
<Jane-PC> Now it's the boolean which seems to have wrong value.
<Jane-PC> Or my Random.int 101; which is wrong.
<Jane-PC> I put: "1833728", it says: "It's more", when it should be between 0 and 100 haha.
<Jane-PC> Ah it's ok lol.
<Jane-PC> let minus n = (secretNumber > n);; instead of let minus n = (secretNumber < n);;
<Jane-PC> Thx for the help.
<companion_cube> you're welcome
_andre has quit [Quit: leaving]
<Jane-PC> Btw, I've got a question, I didn't find the answer on internet.
<Jane-PC> Maybe you've got it.
<Jane-PC> As ! is used to get the value of a ref.
<Jane-PC> How can I write something like, in C: if(!a)
<Drup> the "not" function
i_am_mahasamoot has joined #ocaml
<Jane-PC> It works, thx.
<nullcatxxx_> Drup : i'd like to rephrase my metaocaml question again...
<nullcatxxx_> say you have a function ``fun arg1 arg2 ... argN -> result``, is it possible to generate a function ``fun g arg1 arg2 ... argN -> g result``
<Drup> ooh, ok
<nullcatxxx_> also, i can know the arity of the function.
<nullcatxxx_> so i know the value of ``N``
<Drup> isn't .< (fun g arg1 ... -> g (~.f arg1 ... ) >. enough ?
<Drup> no CSP for functions ?
<nullcatxxx_> you can't examine the inside of function...
manizzle has joined #ocaml
<nullcatxxx_> you don't know the name of argument
<Drup> you don't need to, since you said you have 1) the function 2) the arity
<Drup> you juste have to CSP it and call it
<nullcatxxx_> ok i see
<Drup> I don't remember if you can CPS functions
<Drup> worst case, you will be restricted to identifiers that are in another module, I think ?
<nullcatxxx_> yes...
<nullcatxxx_> let me think about it...
<nullcatxxx_> say you can write out a function that does this
<nullcatxxx_> what's the type the function then
<nullcatxxx_> the type of the function
<nullcatxxx_> i still feel it's not possible...
<Drup> ah well, you need a gadt, obviously
<nullcatxxx_> gadt for which part?
<Drup> to count
<Drup> ah, I see what your issue is
<Drup> it doesn't have much to do with metaocaml :D
octachron has joined #ocaml
sh0t has quit [Ping timeout: 245 seconds]
exm has left #ocaml [#ocaml]
Algebr has joined #ocaml
<Algebr> When an Lwt thread is canceled, presumably its garbage collected right? Also are there any good profilers for Lwt, like how many threads are being created, cleaned up, etc
xyh has joined #ocaml
xyh has quit [Client Quit]
manizzle has quit [Ping timeout: 240 seconds]
xyh has joined #ocaml
ggole has quit [Ping timeout: 245 seconds]
<Algebr> okay, nice. the state of an lwt thread is return, fail or sleep. under which one is it actually doing work, say in a loop?
spip has joined #ocaml
idegen has joined #ocaml
darkf has quit [Quit: Leaving]
spip has left #ocaml ["Konversation terminated!"]
Algebr has quit [Ping timeout: 260 seconds]
ril has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
larhat1 has joined #ocaml
<kakadu> Folks, If I need generic printer (general one, non ad-hoc) should I look at modular implicits or dyntypes?
<companion_cube> in the future, you may have more luck with modular implicits
<kakadu> Gasche mentioned something this year that they were created kind of for the same purpose
<companion_cube> right now neither option is available, so I'd advise ppx_deriving
<kakadu> No, deriving is not an option
<companion_cube> why not?
<kakadu> you kind of need to pass function t -> string to the place where printer is used
<kakadu> And it is inavoidable with codegeneration approach
<kakadu> At the moment I have a function 'a -> 'a t which wraps values to `my values` which should be printed
<kakadu> I can pass printer explicitly when I call this wrapper
<kakadu> but I want to avoid it
<companion_cube> well right now you're out of luck
<companion_cube> wait for modular implicits
<kakadu> So, at the moment I see 4 optins which I don't like
<kakadu> 1) pass 'a -> string function explicitly which I don't like for obvious reasons
<Drup> nullcatxxx_: wow, ok, that was messy
<kakadu> 2) As well as my code is neing runned in the toplevel I can add additional stage when I get typed tree, pass it to kind of PPX syntax extension, gneereate right code for printing when I aware of types, untype it, and pass back to the toplevel. Seems a large amount of work
<nullcatxxx_> ok...
<kakadu> 3 and 4) are dyntypes and modular implicits which I 'm a little bit afraid to touch... TT
<Drup> It types, I have no idea if metaocaml is going to like it
<Drup> gimme a sec, adding comments
slash^ has quit [Read error: Connection reset by peer]
<companion_cube> kakadu: what can I say
<companion_cube> the language isn't designed for this
<kakadu> companion_cube: Which approach do you dislike less ?
Algebr has joined #ocaml
<companion_cube> well 1) looks like the only reasonable option to me
<companion_cube> polymorphism or functor
Algebr is now known as Guest77356
<nullcatxxx_> it works pretty nicely...
<nullcatxxx_> use this to print the code out
<kakadu> Also, I heared that modular implicits could not be added to the compiler because there are some problems with proving soundness or something lioke that
<companion_cube> it's not merged yet because of this, indeed
<companion_cube> that's why it won't be in 4.03
<companion_cube> but hopefully it will be in 4.04 (?)
i_am_mahasamoot is now known as mahasamoot
<nullcatxxx_> def is working with jacques to formally prove the soundness of it...
Guest77356 is now known as Algebr``
<Drup> nullcatxxx_: remind me, how do I solve "Reference to undefined global `Trx'" ?
<nullcatxxx_> metaocamlc file.ml
ely-se has joined #ocaml
<nullcatxxx_> did you use metaocamlc
<nullcatxxx_> or ocamlc
<Drup> woot, it works
JacobEdelman has quit [Quit: Connection closed for inactivity]
<nullcatxxx_> can you add some notes on num and tuple?
<Drup> remind me how do I close code ?
<nullcatxxx_> close code?
<nullcatxxx_> oh hold on sec
<Drup> "close_code"
<Drup> eh, too obvious
freehck` has quit [Remote host closed the connection]
<Drup> anyway, as usual, mighty diff lists to the rescue
<nullcatxxx_> i didn't see close_code
zpe has joined #ocaml
<Drup> no, that was just for a test
<Drup> (I wanted to see the differences between the printing function you gave)
<Drup> the main difficulty was to realize that I should use a reversed list for the arguments. I tried to reverse the number at the beginning and it didn't work
ril has joined #ocaml
<nullcatxxx_> hold on sec...
<nullcatxxx_> it's very close to what i want
<Drup> I sense a "but"
<nullcatxxx_> actually, the result should look like
<nullcatxxx_> fun a b c g -> g (a + b + int_of_float c)
<Drup> isn't that trivial code reduction from what we have ?
MercurialAlchemi has quit [Ping timeout: 272 seconds]
<nullcatxxx_> let me figure that out =_=
<nullcatxxx_> thank you so much
<Drup> no problem, it was fun, but a bit too mind bending
<Drup> I'm hungry now x)
<nullcatxxx_> yesterday, i didn't realize i can have information about arity
<nullcatxxx_> without arity, it's impossible...
<Drup> yeah
<Drup> nullcatxxx_: to have the expression you want
<Drup> instead of "(arg1 -> .. -> ret) code", you would need "arg1 code -> arg2 code -> ... ret code"
<Drup> it's possible too, I think
<Drup> you need to change a few types here and there
<nullcatxxx_> let me think about it. if i don't know how to do it, i'll come back to you
<Drup> sure
please_help has quit [Quit: Leaving]
ril has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Anarchos has joined #ocaml
<Algebr``> Does it really matter if Lwt_io.server doesn't get a Lwt_io.shutdown server called on the server?
please_help has joined #ocaml
<Drup> nullcatxxx_: done, gist updated
<nullcatxxx_> thanks
<Drup> nullcatxxx_: node that, with g = identity, we end up with a way of transforming "a1 code -> ... -> ret code" into "(a1 -> ... -> ret) code"
<nullcatxxx_> this is so contrived..
<Drup> no idea if it's usefull
<nullcatxxx_> haha...
<Drup> (with implicits, it would be even better)
<Drup> (you would not need the number argument, it would be infered)
<nullcatxxx_> wait...
<nullcatxxx_> f now has type ``xx code -> yy code -> zz code -> uu code``
<nullcatxxx_> what if i don't want to change the type of ``f``...
<nullcatxxx_> it should still be (xx -> yy -> zz -> uu) code
Guest86742 has quit [Quit: Leaving]
<Drup> I don't think you can have both your nice expression and that
<nullcatxxx_> ok thanks
<Drup> it would mean metaocaml operates reductions over the symbolic code
<Drup> (to beta reduce)
<Drup> and ocaml doesn't do that :)
<Drup> metaocaml*
JacobEdelman has joined #ocaml
<nullcatxxx_> thanks...
<nullcatxxx_> then i can say my problem cannot be solved
<Drup> why do you absolutely need the nice version ?
<Drup> it should be exactly equivalent
<nullcatxxx_> well, you cannot make your user to write semantic function like f
<nullcatxxx_> the metathing should be invisible to the user
<nullcatxxx_> well, your first version has to use .<>.
<nullcatxxx_> that's fine...
<Drup> yeah, my first version was fine
<nullcatxxx_> but i feel xx code -> yy code -> zz code -> ..
<nullcatxxx_> that's too much
<Drup> oh, probably
<Drup> but you asked for nice generated code
<Drup> and that's the only solution
<nullcatxxx_> yes.
<Drup> hence my question: why do you care about what the generated code looks like
Haudegen has quit [Ping timeout: 260 seconds]
<nullcatxxx_> hold on sec... let me see
<nullcatxxx_> for you second version
<nullcatxxx_> how do you write produce the code i want? I tried let f' = .<fun g -> .~(make_apply .<g> f (~~ ~~ ~~Z))>.
<nullcatxxx_> there will be a type error
<Drup> huum, indeed
<nullcatxxx_> oh yes!
<nullcatxxx_> your first version works
<nullcatxxx_> great
<nullcatxxx_> this solves my problem perfectly now
<nullcatxxx_> i was so stupid haha
<nullcatxxx_> sorry for the extra work
<Drup> 3rd version, which is version 2 + fix for that issue
<nullcatxxx_> ... ha
<Drup> (just changed the type of g, type of f is unchanged)
<nullcatxxx_> actually first version is already very nice
<Drup> :)
xyh has quit [Remote host closed the connection]
<Drup> you can switch from one to the other anyway
<nullcatxxx_> btw, not related to this question, but about the interface to user.
<nullcatxxx_> the user has to quote f
<nullcatxxx_> otherwise there will be CSP problem again
<Drup> yeah
<Drup> unsurprising
<Drup> (side note: there is a generalisation issue)
<Drup> let make_apply f n = .< fun g -> .~ (gen_apply .<g>. f Zero n) >.
<Drup> that doesn't generalize properly
<Drup> You can probably use let-insertion
<nullcatxxx_> yeah i know
<Drup> right :D
<nullcatxxx_> g should be polymorphic on it's output
Haudegen has joined #ocaml
<nullcatxxx_> it has to be otherwise i will serious problem..
<nullcatxxx_> will have
<Drup> yep
<nullcatxxx_> how let-insertion helps here?
<nullcatxxx_> let g = ... ?
<Drup> maybe ?
octachron has quit [Quit: Leaving]
DanielRichman has quit [Quit: leaving]
DanielRichman has joined #ocaml
Jane-PC has quit [Quit: Leaving]
Simn has quit [Quit: Leaving]
Guest80066 has quit [Quit: leaving]
raphaelss has quit [Remote host closed the connection]
ely-se has quit [Quit: Leaving...]
<nullcatxxx_> alright, i asked Jeremy. he showed me a plan which doesn't involve all this craziness...
<nullcatxxx_> my problem at very first is too complicated
<nullcatxxx_> it should be reduced to a easier problem. then i don't need to think about generating crazy code like this
zpe has quit [Remote host closed the connection]
govg has quit [Ping timeout: 260 seconds]
govg has joined #ocaml
Jane-PC has joined #ocaml
<Jane-PC> It's me again.
<Jane-PC> It works fine, but I'd like to know if I write it in a good way.
<Jane-PC> So, if someone is ready to tell me what he thinks about it, I'd like to hear him. :)
Denommus has joined #ocaml
<pierpa> is there any standard library function for writing integers with separators, like 1_234_567?
<pierpa> (I wrote one myself, but then it occurred to me that may be one is already in the lib)
<Algebr``> Jane-PC: no need for ;; at top level, do not use ==
<Jane-PC> Of thx, what should I use instead of == ?
<Jane-PC> Ok thx*
<Mirry> =
<Mirry> because == is physical equality I think
<Algebr``> =
<Jane-PC> Ah ok, thus, = isn't going to be true at any time, unlike in C, that's it ?
<Mirry> "abc" = "abc" will be true, but "abc" == "abc" won't
<Jane-PC> I don't think == is physical equality, (my program shouldn't work if it was), or I'm not sure of what do you mean about physical
<Algebr``> == is pointer equality
<Jane-PC> ok
<Mirry> physical as in same mem address
nicoo has quit [Ping timeout: 255 seconds]
nicoo has joined #ocaml
mac10688 has joined #ocaml
<Algebr``> I can't tell if this is a bug with Lwt. I use Lwt_io.with_connection instead of the callback of Lwt_io.establish server, but even after the connection is done and finished I see one of these for each connection made, TCP 127.0.0.1:callbook->127.0.0.1:54106 (CLOSE_WAIT), which sucks because eventually I run out of file descriptors.
mahasamoot has quit [Ping timeout: 246 seconds]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
<zozozo> pierpa: no need for anything, writing numbers with underscores is supported by the compiler
<pierpa> zozozo, but I want to print numbers in that format
<pierpa> # ultospun 3 "_" 1234567;;
<pierpa> - : string = "1_234_567"
<pierpa> this is my function. anything similar in the lib?
<Algebr``> I don't think so
<pierpa> ok
<zozozo> pierpa: ah, sorry, though you wanted to write numbers with underscores in your code, :p
<zozozo> *thought
<pierpa> no, I knew that the syntax was supported by the compiler. Thank you :)
Stalkr_ has joined #ocaml
<Algebr``> pierpa: are you looking for OCaml open source work to do, or just to get better with lang?
<pierpa> just learning
<Algebr``> yay, stick with it!
<pierpa> sure :)
mahasamoot has joined #ocaml