lapinou changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | http://www.ocaml.org | OCaml 4.01.0 announce at http://bit.ly/1851A3R | Public logs at http://tunes.org/~nef/logs/ocaml/
<bernardofpc> (the definition of equality of morphisms is easier because we can take that from set theory ; for objects could have to define what it means for two objects to be equal, but fortunately most of the time this is never used ; we only take f: a -> a, never f: a->b with b=a)
jwatzman|work has quit [Quit: jwatzman|work]
<tautologico> whitequark: cmdliner?
<whitequark> applicative functors ಠ_ಠ
<tautologico> it's cool, opam uses cmdliner if I'm not mistaken
<whitequark> this looks horribly contrived
<whitequark> I guess I'll stick to Arg for now
<tautologico> wow you must love Haskell then :)
<whitequark> exactly.
<tautologico> if a simple applicative functor gives you allergies...
<nicoo> whitequark: I believe that Cmdliner's use of an applicative functor is justified, in the sense that it fits in the design on the lib. It's not just here to please CT lovers :)
<whitequark> nicoo: possibly. But I never understood the strange obsession with using machinery as far from the domain area as it's possible solely because it has a structure near to what you want.
<nicoo> Well, my point was that, in Cmdliner's design, Applicative is exactly what one would want :3
* whitequark growls
<tautologico> if you're in the right state of mind, there's an aesthetic appreciation of the baroqueness of some Haskell code out there :)
<whitequark> I prefer to appreciate baroque code with a flamethrower in hand, whether in Haskell or JavaScript ;p
<tautologico> :)
fantasticsid has quit [Ping timeout: 252 seconds]
<nicoo> tautologico: I tend to exit that state of mind when I run out of meds for the headaches ;)
<nicoo> whitequark: Baroque code makes you go medieval ? :D
<tautologico> I still think there should be a Haskell book called "Overengineering with Types"
<whitequark> nicoo: our PM sometimes stick the tag "whitequarkerize" on tasks
<whitequark> sticks*
<nicoo> tautologico: A companion book should give encodings in C++ templates :>
<whitequark> it usually involves at least an order of magnitude more git deletions than insertions
* nicoo hugs whitequark
* whitequark smiles
* nicoo likes delketing code too
<nicoo> deleting*
<whitequark> a year ago, I inherited a codebase literally written by one guy on meth
<whitequark> and I do mean "literally", you could guess where exactly the drugs weared off if you look at the code carefully
dapz has joined #ocaml
<whitequark> It was horrible.
dapz has quit [Client Quit]
<whitequark> I don't think I will ever forget.
<tautologico> nicoo: with C++ templates in the mix I think the book would devolve into a Lovecraftian story
<nicoo> whitequark: Ouch
<whitequark> NoNNaN: yes, I've read all of the dailywtf up to 2013.
* nicoo administers liberal doses of therapetic hugs on whitequark :3
<whitequark> nicoo: at one point, I looked at the code, then just sat there and cried for a few minutes.
<whitequark> you don't even *nearly* have any idea how horrible can it be.
<NoNNaN> the next step is probably some cobol->llvm->javascript compiler
<whitequark> there was an 1.5kloc file with four intertwined Ruby classes which sort-of worked, but not a single person from our company could figure out how it was intended to be, um, designed
<tautologico> MUMPS.js
<whitequark> our CTO attempted no less than a half-dozen times to understand it and failed miserably
* whitequark shakes his head
rgrinberg has quit [Quit: Leaving.]
marr has quit []
clan has joined #ocaml
<whitequark> NoNNaN: http://netcobol.com
<whitequark> "NetCOBOL for SPARC" is probably the oddest combination of technologies I've seen in a long time
dapz has joined #ocaml
<NoNNaN> but still probably a bit better then 1.5kloc write only apl like (eg.: K) code
<whitequark> there's a fair chance that their .net port of COBOL is actually moderately non-terrible
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dapz has joined #ocaml
dapz has quit [Client Quit]
struktured has joined #ocaml
<NoNNaN> or you could use some nonpopular language eg.: Malbolge :)
<whitequark> is Malbolge even proven to be Turing-complete?
<tautologico> befunge
<NoNNaN> and pray that the next maintainer of your code would not find you
dapz has joined #ocaml
rgrinberg has joined #ocaml
dapz has quit [Client Quit]
NoNNaN has quit [Ping timeout: 272 seconds]
<whitequark> ok. I tried to use cmdliner
<whitequark> I can't figure out how to simply make a few mandatory options
<whitequark> with argument
NoNNaN has joined #ocaml
divyanshu has joined #ocaml
fantasticsid has joined #ocaml
ollehar has quit [Ping timeout: 252 seconds]
divyanshu has quit [Client Quit]
racycle_ has quit [Quit: ZZZzzz…]
malo has quit [Quit: Leaving]
dapz has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest99699
dapz has quit [Client Quit]
dapz has joined #ocaml
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
q66 has quit [Quit: Leaving]
q66 has joined #ocaml
q66 has quit [Changing host]
q66 has joined #ocaml
philtor has quit [Ping timeout: 264 seconds]
maattdd has quit [Ping timeout: 276 seconds]
Guest99699 has quit [Remote host closed the connection]
divyanshu has joined #ocaml
brainacid has joined #ocaml
jao has quit [Ping timeout: 265 seconds]
mal`` has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
mal`` has joined #ocaml
mal`` has quit [Remote host closed the connection]
mal`` has joined #ocaml
mal`` has quit [Remote host closed the connection]
mal`` has joined #ocaml
Promit has joined #ocaml
<Promit> hey guys, i'm bashing my head up against some homework problems in ocaml and i could use hints
<Promit> (* Give an expression which has the following type: unit -> 'a *) (* Hint: Trick question. Try staring at methods in Pervasives for a bit *)
<Promit> i don't understand how you can possibly get from unit to 'a and pervasives was no help
q66 has quit [Quit: Leaving]
tlockney is now known as tlockney_away
mcclurmc has joined #ocaml
Rotacidni has joined #ocaml
<xenocons> Promit: this is probably cheating (as in wrong answer) but let x : unit -> 'a = Obj.magic
<xenocons> technically it would be correct i think, but most likely not the answer the homework is after
<Promit> yeah i feel like that's not likely to be it
<Promit> if nothing else this is not involving any object stuff
<Promit> maybe there's some kind of parametric polymorphism trick? i don't know
<Promit> construct a variant that can be unit? does that even makes sense?
<xenocons> i can get unit -> 'a -> 'a heh
mcclurmc has quit [Remote host closed the connection]
<Promit> well that's something though
<whitequark> Promit: what does returning 'a mean ?
<xenocons> let x () = (fun x -> x)
<whitequark> (I'm helping you to do the homework.)
<xenocons> which is returning the identity
<xenocons> well, actually , returning a function of the identity
<whitequark> note how 'a occurs only once in the type.
<Promit> well as far as i know, 'a is a type that isn't known at the current declaration and needs to be inferred
<whitequark> correct.
<whitequark> suppose you have val f : unit -> 'a.
<whitequark> is "((f ()) : int)" valid?
<Promit> i don't know what the : int part does, is it a type coercion?
<whitequark> yup
<xenocons> maybe you can be cheeky and say 'fun x -> x' hehe
<xenocons> its not not unit
<whitequark> xenocons: no, it's the wrong answer
<Promit> so a type coercion could provide the context for inferring the type, i guess?
<xenocons> heh :)
<whitequark> Promit: exactly
claudiuc has quit [Remote host closed the connection]
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Promit> still doesn't give me anything inside the function to refer to though, i don't know how to access the type it'll eventually be coerced to
<whitequark> that is absolutely right, a function with signature unit -> 'a has no idea what it should return
<whitequark> if it's not possible to construct a value which can be returned from this function, what is the only thing that can happen?
<Promit> i just noticed the exception stuffs have similar signatures
* whitequark smiles
dapz has joined #ocaml
<Promit> let fn () = raise Not_found;; does it, neat
<Promit> though if i'd read the page more carefully the first time... still, thanks for putting me on the track
<xenocons> damnit im still stuck at unit -> 'a -> 'a
<xenocons> hmm
* xenocons wants to do it without raise
<Drup> well, you just have to keep a similar idea :)
tlockney_away is now known as tlockney
<whitequark> xenocons: you can use anything that doesn't return
<Drup> (that means : not return)
<whitequark> there are a few possibilities except raise, I can think of at least two
<xenocons> hrmm
<Drup> one is painfully trivial
<Promit> i found one more :D
<Drup> Promit: you're not the first one to come with an exercice of the style "find a function of this type"
<xenocons> can you write it in terms of identity
<whitequark> xenocons: no
* xenocons goes back to marvel shield
<whitequark> the fact that 'a is used once is crucial
<Drup> everytime, I find it sort of stupid :p
<Promit> well at the very least the students who go through this class every semester probably drop in periodically
<xenocons> whitequark: ah, yeah, i can see that
rgrinberg has quit [Quit: Leaving.]
<xenocons> i still like the obj.magic answer :)
<Drup> Obj.magic is too easy
<xenocons> haha
<whitequark> Obj.magic is too evil
<Drup> that too
<whitequark> we should include the nasal demons clause in OCaml docs
rgrinberg has joined #ocaml
<Promit> "we" are you involved in the project?
<xenocons> its opensource
<xenocons> afaik
<whitequark> I'm not
<Drup> it was a "we as a community"
<Drup> :p
<whitequark> ^
<Promit> ah
<Promit> i mean there's still an ocaml team of people who are regular contribs, i imagine
<Promit> the maintainers at least
<whitequark> there's ocamlscope but it's down
<Drup> Promit: very active, I would say
<Drup> xenocons: cheater :p
<xenocons> haha
<Drup> and it's not even helpful :p
<xenocons> breakpoint could be
<xenocons> but yeah, less of concept of unit in such a typed manner
<Drup> you should investigate the "non termination" lead
<xenocons> lazy?
<Drup> such complication
<Drup> do simple.
<Promit> anything that can cause process death, for example
<Drup> oh no, that's not fun
<whitequark> for example, process cancer
<xenocons> stack overflow!
<Drup> No, I really mean non termination.
<bernardofpc> decapitation
<xenocons> non tail recursion !
<bernardofpc> almost there
racycle__ has joined #ocaml
<Drup> bonus point if you do it without any stuff from the standard library.
<Promit> well my other idea was to invoke exit
<Drup> no bonus point for that :p
<xenocons> ah ffs
<xenocons> it seems given that it cant be written in terms of identity, it cant be written with types and functions alone
<xenocons> right?
<Drup> it can be written with functions alone
<bernardofpc> I think there's a solution with only 1-st ML course material
<xenocons> damnit let p (x : unit) (f : 'a) =x;f;
<Drup> x)
<xenocons> dis teasing me
mcsquiggedy has joined #ocaml
mcsquiggedy has left #ocaml []
<Drup> I would even say that it can be written with a function alone :p
<bernardofpc> (and 17chars on my toplevel, 21 with more normal spacing)
squiggnet has joined #ocaml
<xenocons> hrmm
<Drup> bernardofpc: indeed, we probably have the same solution :p
<bernardofpc> :D
<xenocons> aha!
<xenocons> got it
<xenocons> let rec f () = f ()
<xenocons> ;p
<Drup> well done, you have the bonus point x)
<xenocons> yay
<Promit> huh
<xenocons> pretty obvious when you think about it :\
<bernardofpc> yup
<Promit> infinite loop is the last non-term solution
<Promit> of course
claudiuc has joined #ocaml
nikki93 has quit [Remote host closed the connection]
<Drup> it should have been the first one :p
<Promit> granted
<xenocons> it is the most obvious, im ashamed i didnt get it sooner, heh
<bernardofpc> It's far from obvious, I think
<Promit> but my assignment told me to look at pervasives for hints so that's why i wound up with the exception version
<Promit> wish i'd thought of the infinite recurse :\
<bernardofpc> only with some "type-guided development habit" you start to think this is "normal" then "natural"
<Promit> out of curiosity, do you guys have any interest in the F# environment?
<Drup> maybe it's because I produced this "typing anomaly" by accident when doing a main loop in lwt that I find that normal :p
<bernardofpc> (I cannot make enough praise of the simple idea that "the function type will help you write the function itself" is so useful in OCaml)
<Drup> bernardofpc: It's not that useful in OCaml
<Drup> it's far more developed in Agda/Idris
<bernardofpc> dunno those :/
<Drup> (the compiled can actually write some function for you, if you give the complete type)
<bernardofpc> oh, singleton inhabited types ?
<Drup> yep
<Drup> and nice proof search algorithms
<Drup> all of it wrapped in deep emacs magic
<bernardofpc> how often do these functions appear in real life ?
<xenocons> Promit: i use F# almost exclusively
<bernardofpc> deep emacs magic -> héhé
<xenocons> (switching to ocaml atm)
mreca has joined #ocaml
<Drup> bernardofpc: well, all of it, not that often
<Drup> but part of it, quit often
<Promit> ocaml wasn't really on my list of things to learn but now that i've been forced into it, i thought it might be interesting to try on more familiar territory (ie .net)
<Drup> you loose the functor
<bernardofpc> Promit: out of curiosity, who/what forced you ?
<xenocons> F# is pretty good, its similar to ocaml in many ways
<xenocons> Drup: you can the comp expressions + tooling
<Promit> i'm taking a class
<Drup> and functor are sooo cool
<Promit> these guys are helping me wrap my head around the homework
<xenocons> gain*
<Drup> comp expressions ?
<Promit> "programming languages" is the uninspired name of the course
<Drup> xenocons: you loose the tooling again if you are on linux :)
<xenocons> Drup: definetly
<xenocons> (which is why im trying to get up to speed with ocaml)
<Drup> also, F# is barely open source.
<xenocons> mono is pretty stable and fast, but ugh the tooling around it isn't really there
<bernardofpc> xenocons: merlin+utop+(batteries or Core) will help you
<Drup> xenocons: oh, that's do notation
<xenocons> bernardofpc: yeah, ive been digging utop
<xenocons> Drup: oh you are from haskell?
<whitequark> Drup: I think MS recently opensourced a lot of their stack
<Drup> do notation is a pretty common concept, don't need to be haskelish for that :p
<Drup> whitequark: ""opensourced""
<xenocons> ive only ever encountered it in haskell
<xenocons> Drup: its getting better, its noway near ocaml in terms of open source
<Drup> xenocons: but yeah, I did some haskell
<xenocons> knew it ;p
<bernardofpc> by the way" is there any place detailing all #-directives of toplevel ? I only recently found #use_mod (thanks to this channel) and I felt I should read more about it
<whitequark> Drup: hm?
<mreca> hey (hopefully) quick question: let's say i've read in a text file that contains "Hello World\n", where "\n" != '\n', and i want to replace "\n" with the newline character '\n'. I've tried doing Str.global_replace (Str.regexp "\\n") (String.make 1 '\n') myString, but so far it removes all n's as well...
<Drup> whitequark: z3 too is open source
clan has quit [Quit: clan]
<Drup> external contributions are isolated in a separate branch of the main one
<Drup> and are basically invisible
<Drup> """open source"""
<xenocons> Drup: biggest gripe for me atm coming to ocaml is probably twofold, libraries are annoying (or rather, lack of standard libs) and 'in' keyword ;p
<xenocons> biggest pro so far: damn the feel of ocaml is squeaky clean
<xenocons> writing much less type signatures than i do with F#
<Drup> xenocons: agreed with the first one. Just use one of the two big standard library (Batteries or Core)
<xenocons> yeah so i used batteries and i dont mean to pick, but it was buggy and slow (im generalising here)
<Drup> buggy ?!
<xenocons> diff is, with ocaml its up to you to fix, with F# you just have to wait a few years and MS will do it!
<xenocons> Drup: yeah, 1 tic
<Drup> a few years :p
<Drup> oh, yes, I was surprised by the bug report
<Drup> batteries is pretty reliable, usually
<xenocons> (im not complaining tho, its cool to poke around with this stuff)
<xenocons> ahh ok
<xenocons> i was just unlucky that the very first thing i tried didn't work
<xenocons> heh
<Drup> you can read the source, most module have lot's of inline tests
<xenocons> i was meant to work on BatText rfind today and speed it up
<xenocons> sidetracked
<bernardofpc> xenocons: I've not used batteries much, but for some EulerProblems, and it never bit me
<bernardofpc> but regarding your original problem
<bernardofpc> why don't you use ocamllex+menhir ?
<Drup> xenocons: performance wise, batteries is of the kind "a contributor considered it was not fast enough and commited a fix for that" :)
<xenocons> ah
<xenocons> Drup: yeah, makes sense
<xenocons> bernardofpc: i needed to process 8mb strings constantly
<xenocons> is lex a bit more optimized?
<xenocons> ultimately as NoNNaN suggested, i should look to a solution that doesn't require splitting
<bernardofpc> well, I read you'll need to parse streams
<bernardofpc> so I guess that any mmap solution is not good
<Drup> xenocons: F# is whitespace sensitive, right ?
<xenocons> Drup: yeah, but has #light
<Drup> ?
<bernardofpc> whereas lex wil build you a transition table for your grammar, which is pretty much as fast as you can get
<xenocons> bernardofpc: that does sound like an interesting approach.. i hadn't considered it
<bernardofpc> ocamllex is simple and powerfull, especially if your grammar is simple enough
ontologiae has joined #ocaml
<xenocons> yeah, reasonably simple, i need to define it formally later i think
<bernardofpc> (I guess you read '\n', ',', rest)
<xenocons> so lex might be a good path
<xenocons> yeah
<bernardofpc> (which classifies as simple enough)
<Drup> (ocamllex is not the grammar pack, just nitpicking :p)
<Drup> part*
<bernardofpc> Drup: righ, sorry
<bernardofpc> lexing is syntax
<bernardofpc> menhir/yacc is grammar
<xenocons> right
<Drup> xenocons: ok, so normal syntax is the same as ocaml + #light whitespace based syntax
<xenocons> yeah, i never use 'in' in F# really unless i want stuff on the same line
<bernardofpc> but sometimes the grammar is *so* simple that I don't write yacc stuff
<xenocons> bernardofpc: there is a couple of regex transforms, but its pretty simple
<whitequark> argh, why is it that OCaml doesn't have a method to replace all substrings?!
<Drup> xenocons: I dislike whitespace sensitive grammars a lot, so ... :p
<xenocons> Drup: then turn off #light ;p
<xenocons> so i hate pythons sensitive whitespace-ness
<whitequark> ocaml-re doesn't have any *at all*. String doesn't have any *at all*. ExtString.String.replace replaces *one* string.
<whitequark> what the fuck.
<Drup> Can't turn off whitespace sensitivity in haskell >_>
<xenocons> whitequark: yeah, i used regex to do that before
<whitequark> Str is evil
<xenocons> Str.global_replace (Str.regex "blahgb\alh") s
<xenocons> it is
<Drup> yeah, don't use Str ...
<whitequark> Drup: WELL I'M TRYING
<xenocons> so when googling for replacing strings, str comes up first ;p
<Drup> whitequark: just patch ocaml-re already :D
<whitequark> I already have more pending PRs to various libs than my inbox can handle
<bernardofpc> global_replace
<xenocons> whitequark: what about split?!!!
<bernardofpc> too slow :/
<xenocons> :) hint hint
<Drup> jerome vouillon is quick to answer PR, you can go on
<xenocons> perhaps you can fix rfind in BatText while you are there :D?
<whitequark> I don't use batteries
<xenocons> snif
<xenocons> let replace rep del = concat rep . split del
<xenocons> wonder if that has bad perf
<xenocons> hehe
<bernardofpc> Drup> yeah, don't use Str -> any special reason ?
<whitequark> btw, no . in ocaml
<whitequark> bernardofpc: it has a lot of implicit global state
<whitequark> and a horrible interface overall
<Drup> the api is terrible and it's not even fast
<whitequark> lol
IbnFirnas_ is now known as IbnFirnas
<bernardofpc> I don't care that much about global state if it's advertised on the packaging
<rgrinberg> there's re2 from JS
<bernardofpc> I take your other points
<rgrinberg> the api is very good but it's a rather large dependency
<Drup> bernardofpc: well, you can just use something else
<bernardofpc> and wish you a good night /day /weekend
<whitequark> bernardofpc: huh? this means you can't handle any functions you don't own
<xenocons> whitequark: says you! let (<<) f g x = f(g(x))
<whitequark> in between Str calls
mreca has quit [Quit: Textual IRC Client: www.textualapp.com]
<Drup> xenocons: that's @@
<xenocons> hmm
<Drup> hum, no, sorry
<xenocons> f:('a -> 'b) -> g:('c -> 'a) -> x:'c -> 'b
<whitequark> ew
<xenocons> :D
<Drup> it's called % in batteries
<xenocons> ah
<Drup> rgrinberg: is it dependent on core ?
<whitequark> I think re2 has a C core
<whitequark> C++ even
<rgrinberg> Drup:, whitequark: correct
<Drup> o_o
<whitequark> what?
<whitequark> it is a C ext and *also* requires Core?!
<rgrinberg> whitequark: why the outrage?
<Drup> well ...
<Drup> "but it's a rather large dependency"
<whitequark> rgrinberg: core is bloated and I don't want to have it; and re2 has nothing that requires core, in principle
<Drup> rgrinberg: what is the advantage compared to ocaml-re ?
<rgrinberg> Drup: sane api, probably faster
<Drup> ocaml-re is not sane ?
<rgrinberg> the api is very anemic
<rgrinberg> unless youre using the carbon copy of Str
<Drup> oh, right
<rgrinberg> which puts you back at square one
<Drup> (it's not really an insanity issue, but I agree)
<rgrinberg> i don't think core is bloated either. maybe it looks that way because of how small stdlib is in comparison
<whitequark> I'm pissed off because of link times and the amount of indirection in docs
<Drup> my main point against core is the documentation
<rgrinberg> just checked, it's 30k lines but at least of that is mlis + docs probably
<whitequark> and for some weird reason core felt the need to reinvent lwt, which is also beyond me
<rgrinberg> whitequark: but async is independent from core and they did improve on lwt (at least a little bit)
<Drup> whitequark: well, they didn't reinvent it when they did Async .. since lwt was not there yet
<whitequark> Drup: whoa, that explains it
<whitequark> I thought lwt was ancient
<Drup> it is
<Drup> so is Async
<whitequark> oh
<Drup> it was just not released yet
<Drup> rgrinberg: huh, no, they didn't. they messed up exception handling
<whitequark> I see
<whitequark> ^
<xenocons> i notice batteries Enum has no parallel
<xenocons> is it because it isn't threadsafe or something
<rgrinberg> Drup: they saw lwt messed up exception handling
<whitequark> xenocons: it is because of the global lock. it doesn't in general make sense to use threads in ocaml
<Drup> so they did worse ? :D
<whitequark> since only one computation may proceed in parallel anyway
<rgrinberg> Drup: why do you think it's worse?
* whitequark fetches popcorn
<rgrinberg> myself, i don't understand why lwt had to inline the error case in Lwt.t
<Drup> I'm not sure it's worth it to have this conversation at 6h in the morning x)
<Drup> rgrinberg: well, in lwt it's quite simple, you just have new construct for exceptions that have the exact same semantic as the regular one. You use them everywhere, you are done.
<Drup> in Async .. I looked at it, I'm still not sure what's going on
ontologiae has quit [Ping timeout: 265 seconds]
<Drup> I don't have the insider view, you will need to ask dimino for that, but as a user ...
<rgrinberg> im the opposite i find async more intuitive view now
<Drup> (and, again, Async is as documented as the rest of core)
<whitequark> vim vs emacs, lwt vs async
<whitequark> even the character counts are correct
<Drup> :D
<rgrinberg> just define exception handlers/catchers and structure them in a tree
<whitequark> why does this even exist?!
<Drup> rgrinberg: that's just working around the fact that async doesn't handle them :p
<rgrinberg> whitequark: pretty sure that's abandoned ever since |> was released
<whitequark> >3 months ago 109.60.00
<rgrinberg> looking at the last commit it doesn't seem like a significant
cesar_ has joined #ocaml
<rgrinberg> maybe they have some internal code still using it?
<whitequark> yeah, probably.
<Drup> sed s/|!/|>/
<Drup> :D
cesar_ is now known as Guest87857
<rgrinberg> Drup: first have to reimplement sed in ocaml cause of NIH...
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ontologiae has joined #ocaml
<Drup> rgrinberg: <3
<Drup> I'm less familiar with other programming language communities
dapz has joined #ocaml
<Drup> but is NIH that common everywhere ?
<rgrinberg> there was a nice post on G+ by lukasz stafiniak on lwt's error handling failure
<rgrinberg> unfortunately i can't spell his name properly and my google skills are weak
<whitequark> doesn't look like there is a single post on g+ about lwt
<rgrinberg> Drup: i dont know javascript has many promise libraries as well
<rgrinberg> or maybe it was allesandro astrada, the guy behind the google drive thing
<rgrinberg> who wrote the post
<Drup> rgrinberg: javascript is even more ridiculous than ocaml, on the nih side
<whitequark> yeah, there's a gotcha that you should wrap native exception raises with catch or try_lwt
<whitequark> still, if you enable the syntax extension, lwt has *proper backtraces*
<whitequark> I *love* it
<whitequark> brb taking lwt on a date
<rgrinberg> whitequark: you got it
<rgrinberg> async has proper backtraces too. i don't know how they manage it
<rgrinberg> at least they aren't polluting the language with a monad specific do notation
<Drup> well, the syntax extension is just sugar for Lwt.raise and Lwt.catch
<whitequark> having to care about wrapping native functions in try_lwt beats some weird exception handler trees at any time of day
<whitequark> Drup: I think it adds more location info
<whitequark> but not sure
<rgrinberg> Drup: can't the syntax extension be implemented as a "computation expression"? http://msdn.microsoft.com/en-us/library/dd233182.aspx
<rgrinberg> hypotehtically of course
<Drup> rgrinberg: if I understood "computation expressions" correctly
<Drup> it's just do notation
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
oval-in has joined #ocaml
<rgrinberg> it seems like it allows you to overload more syntax
<whitequark> >> module M' = struct end;; print_endline "OKAY THIS WAS REALLY ROUNDABOUT"
<oval-in> whitequark: OKAY THIS WAS REALLY ROUNDABOUT (http://eval.in/142273)
<rgrinberg> including try..catch which could maybe replace try_lwt
<Drup> rgrinberg: I'm not sure
<Drup> I would need to look at it more closely
<Drup> and there is still this issue with "finally"
<Drup> (since it's not in ocaml ...)
<Drup> (taking of NIH, I'm not sure if you saw this one : https://github.com/dbuenzli/fut)
<rgrinberg> I saw but I'm not particularly attracted
<rgrinberg> I'm not obsessed with library size
<Drup> :p
<rgrinberg> the core of async is much smaller than lwt but it's why i use it
<rgrinberg> s/it's/it's not/
oval-in has quit [Remote host closed the connection]
<whitequark> the core of lwt is even smaller than async
oval-in has joined #ocaml
<whitequark> >> print_endline "greetings"
* whitequark sighs
<rgrinberg> whitequark: that's fine. as i said, i'm not a size queen ^_^
<whitequark> hrm, odd.
<whitequark> >> print_endline "greetings"
<whitequark> why doesn't this work in #ocaml but works elsewhere?
oval-in has quit [Remote host closed the connection]
oval-in has joined #ocaml
<rgrinberg> Drup: have you seen this however: https://github.com/janestreet/lwt-async
<Drup> I've heard of, by castorks
<rgrinberg> has anyone done any lwt vs async performance comparisons?
oval-in has quit [Remote host closed the connection]
<Drup> I'm sure someone did
oval-in has joined #ocaml
<whitequark> >> print_endline "greetings"
<whitequark> okay, works now.
<Drup> but I haven't see any
ontologiae has quit [Ping timeout: 252 seconds]
Guest87857 has quit [Remote host closed the connection]
charliesome has joined #ocaml
dapz has joined #ocaml
<xenocons> >> exit 0
<xenocons> >> let rec f () = f () in f ()
axiles has joined #ocaml
clan has joined #ocaml
nikki93 has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
rgrinberg has joined #ocaml
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
<rgrinberg> >> 5 + 3
<rgrinberg> >> let x = 5 + 3
<rgrinberg> >> let x = 5 + 3 in x
alinab has joined #ocaml
racycle__ has quit [Quit: ZZZzzz…]
divyanshu has quit [Quit: Computer has gone to sleep.]
Promit has quit [Ping timeout: 264 seconds]
divyanshu has joined #ocaml
yacks has joined #ocaml
ruzu has quit [Changing host]
ruzu has joined #ocaml
divyanshu has quit [Ping timeout: 252 seconds]
divyanshu has joined #ocaml
nikki93 has quit [Remote host closed the connection]
avsm has joined #ocaml
divyanshu has quit [Quit: Computer has gone to sleep.]
avsm1 has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
nikki93 has joined #ocaml
<flux> drup, seems like an interestnig future library, much more complete than I would have expected one would need to be :)
<flux> btw, here's my future library ;) https://github.com/eras/tgup/blob/master/src/future.mli
<flux> though I suppose it's the 'promise' part of that library with some of the future
<flux> that has been quite convenient in interthread-communication, though I still like the Event interface
<adrien> hmmm
<samebchase> I'm able to compile a trivial program using corebuild. How do I build a program that uses some libraries? ocamlgraph in my case
<samebchase> hm I see a -pkg flag
<samebchase> neat, this seems to work
divyanshu has joined #ocaml
divyanshu has quit [Client Quit]
<samebchase> What's the best way to load my code into utop so that I can interactively test it?
<samebchase> I saw a blog post by someone recently, but I can't seem to find it now
<samebchase> I mean, without having to #require a lot of things frist
Simn has joined #ocaml
claudiuc has quit [Remote host closed the connection]
rand000 has joined #ocaml
avsm has quit [Quit: Leaving.]
tlockney is now known as tlockney_away
testcocoon has quit [Quit: Coyote finally caught me]
clan has quit [Quit: clan]
studybot has quit [Remote host closed the connection]
testcocoon has joined #ocaml
studybot_ has joined #ocaml
clan has joined #ocaml
tautologico has quit [Quit: Connection closed for inactivity]
avsm has joined #ocaml
avsm has quit [Ping timeout: 276 seconds]
ggole has joined #ocaml
<flux> nice
nikki93 has quit [Remote host closed the connection]
charliesome has left #ocaml []
AltGr has joined #ocaml
Nuki has joined #ocaml
studybot_ has quit [Remote host closed the connection]
Kakadu has joined #ocaml
maattdd has joined #ocaml
avsm1 has quit [Quit: Leaving.]
troydm has quit [Quit: What is hope? That all of your wishes and all of your dreams come true? (C) Rau Le Creuset]
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
nikki93 has joined #ocaml
avsm has joined #ocaml
nikki93 has quit [Ping timeout: 252 seconds]
steshaw1 has quit [Quit: Leaving.]
Nuki has quit [Remote host closed the connection]
jao has quit [Ping timeout: 240 seconds]
ollehar has joined #ocaml
ikaros has joined #ocaml
avsm has quit [Quit: Leaving.]
AltGr has left #ocaml []
Thooms has joined #ocaml
studybot_ has joined #ocaml
tane has joined #ocaml
Submarine has quit [Remote host closed the connection]
Thooms has quit [Quit: WeeChat 0.3.8]
studybot_ has quit [Remote host closed the connection]
studybot_ has joined #ocaml
jbrown has quit [Remote host closed the connection]
parcs has joined #ocaml
studybot_ has quit [Read error: Connection reset by peer]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
studybot_ has joined #ocaml
<jpdeplaix> whitequark: I just tried to compile a program with target dependent optimizations. It's awesome !
ontologiae has joined #ocaml
malc has joined #ocaml
maattdd has quit [Ping timeout: 265 seconds]
malc is now known as malc_
avsm has joined #ocaml
avsm1 has joined #ocaml
troydm has joined #ocaml
<jpdeplaix> whitequark: the lto pass should be used only for the resulting/last module, right ?
clan has quit [Quit: clan]
rand000 has quit [Ping timeout: 240 seconds]
maattdd has joined #ocaml
tane has quit [Quit: Verlassend]
maattdd has quit [Ping timeout: 240 seconds]
q66 has joined #ocaml
q66 has quit [Changing host]
q66 has joined #ocaml
rand000 has joined #ocaml
fraggle_ has joined #ocaml
maattdd has joined #ocaml
tane has joined #ocaml
shinnya has joined #ocaml
maattdd has quit [Ping timeout: 240 seconds]
NoNNaN has quit [Ping timeout: 272 seconds]
<Drup> jpdeplaix: are you really surprised that llvm is an optimizing compiler ? :D
wwilly has joined #ocaml
<wwilly> bonjour
<Drup> flux: since you're enthousiastic about, you can explain it to me : why not lwt or async ?!
<Drup> about it*
divyanshu has joined #ocaml
maattdd has joined #ocaml
rand000 has quit [Ping timeout: 240 seconds]
maattdd has quit [Ping timeout: 240 seconds]
AeroNotix has joined #ocaml
<flux> well, lwt seems so much less nice than the Event-module. sometimes it's difficult to reason about its behavior. I can see that difficulty from others as well in some posts on the ocaml mailing list.
<flux> I have not used Async, so I should.
<flux> I actually have an Event-inspired module Msgqueue that implements the same and some additional functionality (timeouts..) but it has receive-buffers, that is, receiving/writing is not a synchronous operation.
<flux> apparently this is not great from the theoretical point of view, but nice from practical ;)
divyanshu has quit [Ping timeout: 264 seconds]
<flux> especially as the origins of the Event come from concurrent ml where the threads where garbage collected - they are not garbage collected in ocaml
<flux> so it becomes a bit less nice to add some buffering threads, you need to manage them as well
<adrien> and ocamlnet's Equeue?
<Drup> which event's are you talking about ?
<flux> I haven't used it. it deals with communication between threads as well?
<flux> drup, "Event", you have it in ocaml ;)
<flux> it's part of the threading sysetm
<flux> but it's a bit neutered, as you can't really properly hook up things for it and implementing timeouts is hackish at best
<Drup> oh right the "almost frp, but not really" interface to thread, yes
<Drup> I would use Lwt+react instead of that.
<adrien> flux: I think so
<flux> adrien, well, haven't looked at that either
divyanshu has joined #ocaml
<flux> I actually had a decent lwt-like version of the Msgqueue/Event but sadly it's owned by an ex employer
<Drup> looking at the event module, I really think you could just use react
<Drup> all the functions are there
<flux> how about wrap and wrap_abort?
<Drup> E.map
<flux> wrap_abort?
<Drup> I'm not sure, since I don't understand what means "but if it is not selected"
<flux> well, let's say you have match select [launch_nuclear_missile; make_tee] with .. then if tee gets done first, you can make it to abort the nuclear missile launch
<Drup> for this use case, Lwt.pick
darkf has quit [Read error: Connection reset by peer]
darkf has joined #ocaml
<flux> yeah, with lwt I would select on threads. and I better make sure that if I use that kind of structure, I always create all the threads involved. I can't just use an old variable referring to a thread, because it would get aborted.
<jpdeplaix> Drup: No, it's just that I didn't saw the result of the target dependent optimization (which does things like the optimizations related to alignments, et cetera), as it wasn't in the same module than the usual optimizations
shinnya has quit [Ping timeout: 240 seconds]
darkf has quit [Quit: Leaving]
|jbrown| has joined #ocaml
rand000 has joined #ocaml
struktured has quit [Ping timeout: 252 seconds]
brainacid has left #ocaml []
maattdd has joined #ocaml
struktured has joined #ocaml
fantasticsid has quit [Ping timeout: 252 seconds]
maattdd has quit [Ping timeout: 265 seconds]
|jbrown| has quit [Ping timeout: 252 seconds]
nojb`` has joined #ocaml
nojb`` has quit [Remote host closed the connection]
maattdd has joined #ocaml
divyanshu has quit [Ping timeout: 252 seconds]
|jbrown| has joined #ocaml
eizo has joined #ocaml
<bernardofpc> >> "test" ;;
<bernardofpc> >> let test = "test"
<bernardofpc> This is a >> test ;;
divyanshu has joined #ocaml
tani has joined #ocaml
tane has quit [Ping timeout: 264 seconds]
<AeroNotix> >> 1 + 1;;
<bernardofpc> >> (+) 1 1 ;;
<Drup> It's a bit broken :p
<AeroNotix> :)
<bernardofpc> right, we're only the testers :D
ontologiae has quit [Ping timeout: 264 seconds]
avsm1 has quit [Quit: Leaving.]
knz has left #ocaml []
maattdd has quit [Ping timeout: 240 seconds]
<whitequark> jpdeplaix: I'm glad you found it useful
<whitequark> you can perform LTO as much times as you want, in principle. Note that there is an "internalize" pass which marks all functions except "main" internal, which gives the optimizer permission to rip them out
<AeroNotix> I'm learning OCaml. I'm trying to reimplement Clojure's group-by, I can't understand the compiler error. Any tips: https://gist.github.com/AeroNotix/d609fcc8ad99f9e65f90
<whitequark> bernardofpc: Drup: you need to print explicitly.
<whitequark> >> print_endline "hello"
<whitequark> >> Printf.printf "%d" ((+) 1 1)
<whitequark> hm
<whitequark> need to get this fixed then :p
<Drup> (quick note whitequark, you should ask op's for the bot, it was proposed earlier and decided against it :p)
fantasticsid has joined #ocaml
<Drup> ops*
<Drup> also, on the feature side, I think it's completly useless if it doesn't behave exactly as a toplevel
<whitequark> Drup: (ops) well, I've asked publicly in the channel... ping mrvn ?
<whitequark> (toplevel) this thought has crossed my mind.
<Drup> I didn't see you asked, I must have missed it :p
<Drup> ops are mrvn and adrien, afaik
<whitequark> I think I could make use of linux's seccomp
<ggole> AeroNotix: what's the actual error?
<Drup> xenocons: what are the "Yield" and "Use" supposed to do ?
<Drup> oh, yield is just return
struktured has quit [Ping timeout: 240 seconds]
ollehar has quit [Ping timeout: 252 seconds]
ollehar has joined #ocaml
maattdd has joined #ocaml
maattdd has quit [Ping timeout: 255 seconds]
cesar_ has joined #ocaml
cesar_ is now known as Guest92946
Smerdyakov has joined #ocaml
Guest92946 has quit [Remote host closed the connection]
maattdd has joined #ocaml
philtor has joined #ocaml
fantasticsid has quit [Ping timeout: 252 seconds]
ikaros has quit [Quit: Ex-Chat]
ollehar has quit [Ping timeout: 252 seconds]
tautologico has joined #ocaml
S11001001 has joined #ocaml
S11001001 has quit [Changing host]
S11001001 has joined #ocaml
tlockney_away is now known as tlockney
dapz has joined #ocaml
Anarchos has joined #ocaml
rgrinberg has joined #ocaml
divyanshu has quit [Quit: Computer has gone to sleep.]
Hannibal_Smith has joined #ocaml
mcclurmc has joined #ocaml
Rotacidni has quit [Ping timeout: 255 seconds]
ollehar has joined #ocaml
struktured has joined #ocaml
mcclurmc has quit [Read error: Connection reset by peer]
mcclurmc has joined #ocaml
mcclurmc has quit [Client Quit]
NoNNaN has joined #ocaml
tobiasBora has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
S11001001 has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
maattdd has quit [Ping timeout: 252 seconds]
dsheets has quit [Ping timeout: 252 seconds]
HoloIRCUser2 has joined #ocaml
HoloIRCUser2 is now known as __obad___
Rotacidni has joined #ocaml
rgrinberg has joined #ocaml
tlockney is now known as tlockney_away
tlockney_away is now known as tlockney
passiveobserver has quit [Quit: EliteBNC free bnc service - http://elitebnc.org - be a part of the Elite!]
passiveobserver has joined #ocaml
ikaros has joined #ocaml
jonludlam has joined #ocaml
passiveobserver has quit [Ping timeout: 240 seconds]
rgrinberg has quit [Quit: Leaving.]
rgrinberg has joined #ocaml
tlockney is now known as tlockney_away
lordkryss has joined #ocaml
passiveobserver has joined #ocaml
maattdd has joined #ocaml
tani has quit [Quit: Verlassend]
eizo has quit [Ping timeout: 240 seconds]
rgrinberg has quit [Quit: Leaving.]
rgrinberg has joined #ocaml
nikki93 has joined #ocaml
Hannibal_Smith has quit [Quit: Sto andando via]
<Drup> question to people who hacked into the parse tree : why is there a contstructor "Lapply" in the ADT for long indents ?
<whitequark> Make(Foo)
<tizoc> there is no way using stdlib's Hashtbl to do `try Hashtbl.find t s with Not_found -> Hashtbl.add t s v; v` in one step right? (I want to avoid the need to hash twice, while also maintaining the original value if it exists)
<whitequark> tizoc: nope
<Drup> whitequark: that's was my first though, but is it possible to do M(A).x ?
<kerneis> tizoc: is there any reason why you want to maintain the original one?
eizo has joined #ocaml
<kerneis> I can't think of a case where the difference would be observable, but I must be missing something
<kerneis> oh wait, i'm stupid
<kerneis> if the value already exists, you don't want to replace it
<kerneis> because it might be a new value
<tizoc> kerneis: I'm using identity to compare equality
<tizoc> (this is a symbols table)
<Drup> tizoc: BatHashtbl.modify_opt
<whitequark> >> module M(X: sig end) = struct let x = 1 end;; M(struct end).x
<tizoc> thats why I want to keep the original
<whitequark> apparently not
<tizoc> Drup: ah ok, will check batteries
<Drup> whitequark: so it's a bit weird to have that directly in Longident.t
<tizoc> thanks everyone
<whitequark> Drup: no clue
<Drup> It's when things are not available that you realize how much you're dependent on them : I want merlin for 4.02 :(
<whitequark> port it!
<whitequark> also, are you working on the lwt syntax thingy? :)
<Drup> yes
shinnya has joined #ocaml
<whitequark> awesome, I'm going to need it soon
<Drup> have to look at the documentation a lot for now, so it goes quit slowly
* whitequark is hacking on ocaml-sodium
<Drup> quite*
<Drup> even without the quotation, the code is smaller than the camlp4 version ...
<whitequark> have you published it yet?
<Drup> no no, I just started this afternoun, It's not working at all for now :D
<whitequark> I was more thinking along the lines of reading and/or contributing to it
<Drup> wait tomorrow :)
malc_ has quit [Quit: leaving]
<Drup> I'm wondering if "let rec%lwt" would make sense
<Drup> probably not with the easy transformation
<whitequark> um, it definitely doesn't
Smerdyakov has quit [Quit: Leaving]
<whitequark> you can't define functions with lwt x = y, and recursive immutable structures are best left unmentioned
<Drup> whitequark: it's not possible now, yes
HoloIRCUser has joined #ocaml
__obad___ has quit [Ping timeout: 276 seconds]
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
lostcuaz has joined #ocaml
maattdd has quit [Ping timeout: 252 seconds]
rgrinberg has quit [Quit: Leaving.]
Rotacidni has quit [Ping timeout: 252 seconds]
rgrinberg has joined #ocaml
Rotacidni has joined #ocaml
Submarine has quit [Remote host closed the connection]
struktured has quit [Ping timeout: 276 seconds]
shinnya has quit [Ping timeout: 240 seconds]
axiles has quit [Remote host closed the connection]
<Drup> whitequark: huum, I'm not sure where should I report attributes in "let%lwt[@foo] ..."
<whitequark> report?
<Drup> well, I'm not gonna just discard them
<Drup> hu, report is not the good verb, damn french
<whitequark> well, they are discarded by default. you aren't introducing anything unexpected
<whitequark> perhaps just attach them to underlying let ?
<whitequark> err fun
<Drup> well, there are various possibilities
<Drup> 1) the underlying lets (there is not only one)
<Drup> 2) the Lwt.bind applications
<Drup> 2) the funs
<whitequark> more than one let?
<Drup> in case of "lwt ... and ..."
<Drup> hum, actually, only one let, put multiple bindings
<Drup> but*
<whitequark> I don't think let%lwt translates even into a single let
<Drup> it does
<Drup> for now, I attach everywhere :]
steshaw1 has joined #ocaml
wwilly has quit [Quit: This computer has gone to sleep]
rgrinberg has quit [Quit: Leaving.]
rgrinberg has joined #ocaml
tlockney_away is now known as tlockney
<whitequark> ha
rand000 has quit [Quit: leaving]
jonludlam has quit [Ping timeout: 240 seconds]
divyanshu has joined #ocaml
HoloIRCUser2 has joined #ocaml
tlockney is now known as tlockney_away
HoloIRCUser has quit [Ping timeout: 240 seconds]
Simn has quit [Quit: Leaving]
<AeroNotix> is there any way to stop needing to put semicolons inside lists?
<AeroNotix> seems superfluous
<AeroNotix> (and tuples)
<mrvn> without it would be function calls
<AeroNotix> good point
<AeroNotix> ok
<mrvn> for lists you can use ::
<AeroNotix> indeed
eizo has quit [Ping timeout: 240 seconds]
<mrvn> The pages about crt* should have that too. You just don't have seperate crt* objects for your kernel.
<mrvn> ups#
<Drup> AeroNotix: [ x1 ; x2 ; x3 ] <- where is the ; superfluous ? :)
<AeroNotix> Drup: yeah I was tripping
Rotacidni has quit [Ping timeout: 265 seconds]
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<_obad_> anyone got experience with ocaml on arm? specifically, cross-compiling, buildroot, that kind of stuff.
<_obad_> I managed to get ocamlbrew to compile a good opam subset on debian armel, but now I want to see if I can cross-compile things instead.
<_obad_> (I was using qemu)
<_obad_> and "managed" is an overstatement, it just worked flawlessy on its own with the proper dependencies installed.
<nicoo> _obad_: Ask adrien
<_obad_> ok... adrien?
racycle__ has joined #ocaml
<nicoo> _obad_: I know nothing about cross-compiling OCaml applications and am mildly tipsy, so don't ask me for advise ;)
clan has joined #ocaml
tlockney_away is now known as tlockney
lordkryss has quit [Quit: Connection closed for inactivity]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
ggole has quit [Ping timeout: 276 seconds]
nikki93 has quit [Remote host closed the connection]
rgrinberg has quit [Quit: Leaving.]
<_obad_> fuck this shit. I don't really need to cross-compile. I just need a build that uses uclibc. so my problem is now this: get a gcc using uclibc on debian armel.
<xenocons> Drup: re yield+use yes, you are right, use is for stuff that is disposable, after the function exits scope, cleanup is performed, kinda like python 'with open(file,...'
<Drup> so completly useless in ocaml
<xenocons> yeah id say so
<xenocons> yield however isn't
<xenocons> especially in terms of enumerations
<Drup> what is it for ?
<Drup> the document I read speak about the way computational expressions are expanded, but not about the semantic
<xenocons> 2 places i see it used are sequences and async(comp expressions)
<xenocons> [for c in 'a'..'z' do yield c ]
<xenocons> (or you can use -> short hand)
<xenocons> advantage is that it doesnt return elemens you dont want
<Drup> that's just return
lostcuaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<xenocons> 1 sec
<Drup> ok :D
<xenocons> i have to go to brekkie, but check this out http://tomasp.net/blog/async-sequences.aspx/
<xenocons> brb 10
<whitequark> _obad_: try crosstool-ng
parcs has left #ocaml []
tlockney is now known as tlockney_away
rom1504 has quit [Quit: Lost terminal]
rom1504 has joined #ocaml
<Drup> xenocons: in this document, it's still just return :D
<_obad_> whitequark: interesting idea... use crosstools-ng on debian armel to generate gcc-uclibc.
<xenocons> Drup: yeah i suppose, except you can bind the result of a yield immediately
patronus_ has joined #ocaml
<xenocons> and it works with async expressions (as yield!)
<Drup> huum, what do you mean ?
<xenocons> say you have f = async { return 1 }
<xenocons> and you want to clal that from another async function
<xenocons> wait no thats let..
<xenocons> hmm
<xenocons> humm
<xenocons> no i am wrong
patronus has quit [Ping timeout: 240 seconds]
<xenocons> well ! ok you can use yield to concat! :)
<Drup> hum ?
<xenocons> let s = "hello"
<xenocons> [for e in 'a'..'b' do yield! xs; yield e];;
<xenocons> ['h'; 'e'; 'l'; 'l'; 'o'; 'a'; 'h'; 'e'; 'l'; 'l'; 'o'; 'b']
<xenocons> (i haven't really used it outside of list comp :\)
<Drup> what is the semantic of yield! ? :)
<xenocons> i have used 'return!' and 'return' in async exps a lot though
<xenocons> specification just says yield! yields a computation :9
<Drup> I field like running in circle
<Drup> feel*
<Drup> :(
<xenocons> just a bit
<xenocons> its mostly invisible to me
<xenocons> [ for i in 0..5 -> i ] is using yield
<xenocons> [for i in 0..5 do if i <> 2 then yield i ] also, but explicit
<xenocons> `yield!` can be used to combine sequences to a final result..
<xenocons> as far as semantics go i have nfi how to explain it
darkf has joined #ocaml
Kakadu has quit [Quit: Konversation terminated!]
<Drup> my first question was : is there a difference between yield and return ?
<Drup> apparently, no.
<xenocons> semantically? perhaps not
<xenocons> but in terms of language keywords, cant use return like a yield
<mrvn> doesn't return stop the loop or something?
<Drup> xenocons: why ?
<Drup> xenocons: oh, return is a keyword in F# ?
<xenocons> (infact there is no actual return keyword outside of comp exprs afaik)
<xenocons> yeah
<xenocons> only for async i have ever used it
<Drup> yeah, doesn't matter for us
<xenocons> can ocaml use return inside comprehensions
<whitequark> there's no return in ocaml
<Drup> there is no comprehension in ocaml
<xenocons> what about Enum? that looks like sequences to me
<xenocons> (batteries)
<Drup> Enum is just a data structure
<Drup> (and a bad one)
<mrvn> Didn't x86 have more differences depending on wether you came from user or kernel mode?
<mrvn> ups, ewin
<xenocons> ah i see
<xenocons> yield seems useful especially for people who write imperative code
<whitequark> mrvn: what is that channel you constantly struggle to send a message to?
<Drup> xenocons: you have some syntax extension for comprehension, but it's not in ocaml
<xenocons> Drup: i see
<xenocons> i will miss that, i love my ghetto for loops :)
<xenocons> but i suppose you can initialise a list then map over it which is in essence the same thing... now
<whitequark> comprehensions are hardly necessary in ocaml
<Drup> xenocons: in OCaml, and as far as I can see, yield is specifically used for .. yielding, in the context of concurency libraries
<xenocons> on that note, F#'s comprehensions are really inefficient
<Drup> (in Lwt; yield : unit -> unit Lwt.t)
<xenocons> as in, it uses a sequence behind the scenes, then toArray\toLists it depending on the initialiser
<xenocons> usually chokes big data
<xenocons> Drup: right
<xenocons> yeah
claudiuc has joined #ocaml
<tautologico> comprehensions aren't strictly necessary, but they can make some code clearer
<xenocons> one thing i note about ocaml is that parallel constructs are really obscure
<xenocons> tautologico: correct
<Drup> and for asynchronous concurency libraries, return is used
<xenocons> but there is an efficiency hit with them
<Drup> xenocons: well, there are no parallel constructs so ...
fraggle_ has quit [Ping timeout: 255 seconds]
madroach has quit [Ping timeout: 252 seconds]
<xenocons> Drup: e.g. (and im not being a fanboy here) if i want to perform a function over an array in parallel, i just change Array.map to Array.Parallel.map, itd be cool if batteries had that
<tautologico> F# comprehensions may be slow, that doesn't mean comprehensions are always slow
<whitequark> xenocons: Lwt has that
<tautologico> for multicore parallelism, F# is in a much better position than OCaml
<Drup> tautologico: it's not hard :D
<tautologico> in OCaml you have to deal with processes
<xenocons> ahh so lwt?
<xenocons> tautologico: correct
<tautologico> but will lwt threads run in different cores?
<xenocons> but ocaml is in a better position in terms of xplat maturity (except windows)
<Drup> xenocons: if you want true parallelism, you have Parmap to do this // map
madroach has joined #ocaml
<xenocons> parmap? hmm
<xenocons> whats the state of lwt?
<Drup> if you want concurent "parallel" mapping, yeah, lwt.map_p
<tautologico> OCaml and F# are in kind of mirrored situation
<xenocons> or lwt <> parmap?
<tautologico> regarding platforms
<xenocons> tautologico: haha yeh
<Drup> lwt <> parmap
<xenocons> k
<Drup> lwt is very solid
<xenocons> k
<tautologico> F# is good on Windows, getting better elsewhere but most users are still on Windows so few people care about other platforms
<xenocons> ill be checking that out
<xenocons> tautologico: yep
<tautologico> OCaml is good on unixes and most users are on unixes so few people care about windows
<Drup> xenocons: but it's *concurent* asynchronous library, no parallelism whatsoever
<xenocons> Drup: aha! an important difference
<xenocons> (however one i still need to refer back to someones blog to re-understand)
fraggle_ has joined #ocaml
<Drup> parmap is a very kiss library to do // map or fold on big arrays
nikki93 has joined #ocaml
<Drup> but it's quite heavy weigth, since it's forking
<Drup> (it's basically a local map reduce)
<xenocons> hmm interesting
<xenocons> ill check it out later, day stuff to do
<Drup> There is parmap like integrated into Async, iirc
<Drup> (Async being the other concurrent asynchronous library)
NoNNaN has quit [Remote host closed the connection]
steshaw1 has quit [Quit: Leaving.]
<Drup> whitequark: I'm a bit confused by something in the lwt syntax extension
NoNNaN has joined #ocaml
<Drup> raise_lwt is translated to "Lwt.fail (try raise $e$ with exn -> exn)" is "debug" is on and "Lwt.fail $e$" otherwise
<Drup> and I'm not sure I understand the difference :|
<Drup> is it just a trick to appear in the backtrace or something ?
<whitequark> it is
divyanshu has quit [Quit: Computer has gone to sleep.]
<Drup> I see
ikaros has quit [Quit: Ex-Chat]
<Drup> make sense
<Drup> huho, raise is not a keyword
<Drup> well, no raise%lwt
<whitequark> you can translate raise_lwt calls though
<Drup> apparently it as always been the case. For some reason I was convinced that raise was a keyword
<whitequark> assert is, though!
<whitequark> I was confused by this too
<mrvn> Drup: raise is a special function
<whitequark> mrvn: a special one?
<Drup> well, it seems quite hard to implement in pure ocaml :)
<mrvn> # raise;;
<mrvn> - : exn -> 'a = <fun>
<mrvn> where the 'a is a +'a iirc
<mrvn> and it never returns.
rgrinberg has joined #ocaml
avsm has quit [Quit: Leaving.]