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/
rgrinberg has joined #ocaml
ollehar has quit [Ping timeout: 252 seconds]
_obad_2_ has joined #ocaml
clan has quit [Quit: clan]
_obad_ has quit [Quit: Leaving.]
ollehar has joined #ocaml
yetanotherion has quit [Remote host closed the connection]
LU324_ has joined #ocaml
tlockney is now known as tlockney_away
waneck has quit [Quit: Leaving]
LU324_ has quit [Client Quit]
lpw25 has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
ollehar has quit [Ping timeout: 252 seconds]
LU324_ has joined #ocaml
ollehar has joined #ocaml
petterw has joined #ocaml
clan has joined #ocaml
philtor has joined #ocaml
LU324 has quit [Quit: WeeChat 0.4.3]
LU324_ is now known as LU324
zpe has joined #ocaml
darkf_ has joined #ocaml
darkf has quit [Disconnected by services]
darkf_ is now known as darkf
<xenocons> ocamlc.orgs learn section is great
zpe has quit [Ping timeout: 276 seconds]
msch_ has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
__marius____ has joined #ocaml
racycle has quit [Quit: ZZZzzz…]
msch has quit [Ping timeout: 246 seconds]
esden has quit [Ping timeout: 246 seconds]
esden has joined #ocaml
freling has quit [Ping timeout: 246 seconds]
__marius___ has quit [Ping timeout: 246 seconds]
esden has quit [Ping timeout: 246 seconds]
philtor has quit [Ping timeout: 265 seconds]
msch_ is now known as msch
__marius____ is now known as __marius___
<xenocons> a funny difference between F# and ocaml is the diff between "^" and String.concat perf
<xenocons> as it turns out, "^" in F#, is faster than String.concat ""
<xenocons> (infact, String.concat is twice as slow)
<xenocons> where as in ocaml, "^" is slower than String.concat!
esden has joined #ocaml
kig has quit [Ping timeout: 252 seconds]
kig has joined #ocaml
freling has joined #ocaml
q66 has quit [Quit: Leaving]
<xenocons> well i found it interesting ;p
studybot has quit [Read error: Connection reset by peer]
<NoNNaN> what are you doing with these strings ?
<xenocons> NoNNaN: nothing in particular, was just noting the difference
<xenocons> (in F# i just tested it using for i in 0..5000000 do ignore("test" ^ "test" ^ "test"))
<xenocons> ocaml was just the observation the other day and what people on irc mentioned about ^
<NoNNaN> xenocons: if you do bulk large string concat and/or insertion you should check the rope data structure, eg.: https://www.lri.fr/~filliatr/ftp/ocaml/ds/rope.ml.html and http://rope.forge.ocamlcore.org/ and http://batteries.forge.ocamlcore.org/doc.preview:batteries-beta1/html/api/Rope.html
yacks has quit [Ping timeout: 265 seconds]
<xenocons> ahhh you know... i had a link on twitter fav'd for ropes stuff
<xenocons> ty
<xenocons> been meaning to check it out
ollehar has quit [Ping timeout: 253 seconds]
ollehar has joined #ocaml
ollehar has quit [Ping timeout: 252 seconds]
<_obad_2_> opam fails on a given package, and I would like to fix it. how do I do that? in debian terms I'm looking for an opam equivalent of "apt-get source"
<_obad_2_> and by opam fails, I mean that the package fails to compile. so it's not a problem with opam but with the package.
Rota has quit [Ping timeout: 240 seconds]
lostcuaz has joined #ocaml
ygrek_ has joined #ocaml
studybot has joined #ocaml
Rota has joined #ocaml
nikki93 has joined #ocaml
nikki93 has quit [Remote host closed the connection]
mal`` has quit [Ping timeout: 264 seconds]
mal`` has joined #ocaml
shinnya has quit [Ping timeout: 252 seconds]
marr has quit [Ping timeout: 264 seconds]
claudiuc has quit [Remote host closed the connection]
alinab has quit [Quit: leaving]
<xenocons> so i was reading http://ocaml.org/learn/tutorials/performance_and_profiling.html , specifically noticing the different assembler output for polymorphic vs non polymorphic functions, my question obviously is: does polymorphism often hurt perf? if so is there a compiler flag to warn of polymorphic constructs?
<xenocons> _obad_2_: when you opam something (from my limited exp) it will download the package into ~/.opam/packages or something similar, perhaps you can check there?
studybot has quit [Read error: Connection reset by peer]
<_obad_2_> xenocons: I did that. turns out I was missing zlib*-dev. but had there been a bug in the source, the only way I know is changing the "url" file to point to your own tarball.
<xenocons> ah
<xenocons> did opam update not make the link new?
NaCl has left #ocaml []
<_obad_2_> I didn't run opam update; wouldn't that overwrite any changes I may have made to the url file?
<xenocons> it probably would, but it might have updated the url file to point to the new url?
<xenocons> (if the new package was in opam)
studybot has joined #ocaml
studybot_ has joined #ocaml
<_obad_2_> yes, but the opam package was the newest available anyway. I thought there was a bug there that I might fix while staying within opam. kinda like how you can apt-get source a package, add your own patch, and recreate the *.deb files
<xenocons> hmm, i haven't gone deep enough into opam to be able to answer that
studybot has quit [Ping timeout: 240 seconds]
f[x] has joined #ocaml
ygrek_ has quit [Ping timeout: 276 seconds]
ygrek_ has joined #ocaml
f[x] has quit [Ping timeout: 264 seconds]
racycle__ has joined #ocaml
<Drup> _obad_2_: look up opam pin
<xenocons> ive been having issues with opam too, i think im missing some crucial config step, it seems ocamlfind cant find packages that succesfully opam installed
<xenocons> Drup: can you give me some advice on that :)?
<Drup> xenocons: did you put "eval `opam config env`" in your .profile ?
<Drup> or .bashrc or whatever
<xenocons> hmm
<xenocons> let me check
<xenocons> ok so that is what it was
<xenocons> however, the opam installer definetly asked me if i wanted that line in my config and i said yes
<xenocons> i just need to make it work in ocaml for finding the .cma's now
<xenocons> works when i use findlib
studybot_ has quit [Read error: Connection reset by peer]
kig has quit [Quit: kig]
<tautologico> I still don't know how to implement a signature that has a signature inside it
studybot has joined #ocaml
studybot_ has joined #ocaml
lostcuaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
waneck has joined #ocaml
tlockney_away is now known as tlockney
studybot has quit [Ping timeout: 240 seconds]
dapz has joined #ocaml
yacks has joined #ocaml
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
philtor has joined #ocaml
dapz has joined #ocaml
divyanshu has joined #ocaml
rgrinberg has quit [Read error: Connection reset by peer]
dapz has quit [Client Quit]
rgrinberg has joined #ocaml
dapz has joined #ocaml
<xenocons> why doesnt ocaml doco link to src?
<xenocons> e.g. where would i find teh implementation for http://batteries.forge.ocamlcore.org/doc.preview:batteries-beta1/html/api/Rope.html\
<xenocons> (i found it, batText.ml, but curious how to effeciently find this kind of thing)
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dapz has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
<tautologico> ocamldoc could be a lot better
<xenocons> yeh
<xenocons> but still good
hyperboreean has quit [Ping timeout: 240 seconds]
<tautologico> I think there may be people working to improve it
<tautologico> I don't know
hyperboreean has joined #ocaml
philtor has quit [Ping timeout: 252 seconds]
<xenocons> weird
<xenocons> open BatText, now i can get to 'replace' but not 'replace_chars'
rgrinberg has joined #ocaml
steshaw1 has joined #ocaml
steshaw has quit [Read error: Connection reset by peer]
steshaw_ is now known as steshaw
<xenocons> guess i can write my own in terms of split
claudiuc has joined #ocaml
siddharthv has quit [Remote host closed the connection]
studybot_ has quit [Read error: Connection reset by peer]
siddharthv has joined #ocaml
axiles has joined #ocaml
rand000 has joined #ocaml
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
<tautologico> ls -l
<tautologico> oops
<xenocons> so uh, how to compile against batteries?
<xenocons> works from findlib + toplevel
<adrien> ocamlfind -package batteries -linkpkg yourfile.ml
<adrien> if for a whole project, look at oasis
<xenocons> hmm
<xenocons> ok that works
<xenocons> heh
<xenocons> ocamlfind ocamlopt -package batteries -linkpkg parser.ml
<adrien> ergh, right
<adrien> too early :)
<xenocons> this seems to work i think: let replace_chars (s:BatText.t) sep rep = concat (of_char rep) (nsplit s (of_char sep));;
<xenocons> im trying utop, its very good compared to default repl
<xenocons> seems there may be some differences between src and doco of BatText and the stuff opam installed
<xenocons> i cant seem to see 'to_float' in the one opam installed
<xenocons> nor BatText.to_float
racycle__ has quit [Quit: ZZZzzz…]
finnrobi has quit [Read error: Operation timed out]
finnrobi has joined #ocaml
Snark has joined #ocaml
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
rand000 has quit [Ping timeout: 255 seconds]
ygrek_ has quit [Ping timeout: 252 seconds]
nikki93 has joined #ocaml
nikki93 has quit [Ping timeout: 252 seconds]
<orbitz> Hrm, I wonder how long until we get a third stdlib
<xenocons> is Enum in batteries lazy?
tlockney is now known as tlockney_away
steshaw1 has quit [Quit: Leaving.]
studybot has joined #ocaml
<xenocons> seems so, no wonder its so fast (initially ;p)
dapz has joined #ocaml
tane has joined #ocaml
clan has quit [Quit: clan]
<xenocons> wow, huge perf speedup using batteries file operations and enum
<xenocons> but could be a lie until i actually eval *
AltGr has joined #ocaml
Simn has joined #ocaml
tane has quit [Quit: Verlassend]
jao has quit [Ping timeout: 252 seconds]
shinnya has joined #ocaml
ygrek_ has joined #ocaml
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mpmilano has quit [Remote host closed the connection]
clan has joined #ocaml
wwilly has quit [Remote host closed the connection]
ygrek_ has quit [Ping timeout: 240 seconds]
rand000 has joined #ocaml
claudiuc has quit [Ping timeout: 255 seconds]
<xenocons> nsplit frmo batteries has some strange behaviour
<xenocons> let ss = "a,b,c,d,e," ; to_string(concat (of_char ',') (nsplit (of_string ss) (of_char ','))) = ss; ---> : bool = false
<xenocons> seems to trim off the trailing ""
<xenocons> bug?
jo` has joined #ocaml
clan has quit [Quit: clan]
zpe has joined #ocaml
ontologiae has joined #ocaml
tautologico has quit [Quit: Connection closed for inactivity]
<mrvn> who? the concat? The nsplit?
<xenocons> mrvn: its in Batteries.BatText
<xenocons> eff this is frustrating, http://batteries.forge.ocamlcore.org/doc.preview:batteries-beta1/html/api/IO.html says there is a ulines_of, yet that doesn't resolve in my batteries
jonludlam has joined #ocaml
eizo has joined #ocaml
claudiuc has joined #ocaml
<xenocons> ok so that doco seems to be old, and ulines_of has since been removed
<xenocons> pity it was the first result on google
<xenocons> it seems 'lines_of' is not actually removing the newline
claudiuc_ has joined #ocaml
ikaros has joined #ocaml
zpe has quit [Remote host closed the connection]
claudiuc has quit [Ping timeout: 240 seconds]
claudiuc_ has quit [Remote host closed the connection]
<xenocons> or maybe it is...
<xenocons> argh
claudiuc has joined #ocaml
q66 has joined #ocaml
q66 has quit [Changing host]
q66 has joined #ocaml
claudiuc_ has joined #ocaml
dsheets has joined #ocaml
claudiuc has quit [Ping timeout: 252 seconds]
Kakadu has joined #ocaml
marr has joined #ocaml
<xenocons> i must be getting tired
<xenocons> BatText.nsplit (of_string "1,2,3,4,") (of_char ',') |> List.length;;
<xenocons> - : int = 1
<NoNNaN> some parallel text processing magic
<adrien_oww> mfp: btw, what's up with your website? did you give up? ='(
zpe has joined #ocaml
<xenocons> NoNNaN: nice
<xenocons> still, id like batteries to work
<xenocons> this seems broken ;p
<xenocons> List.map BatText.to_string (BatText.nsplit (of_string "1,2,3,4") (of_char ','));;
<xenocons> - : string list = ["1"]
<xenocons> whut?
<NoNNaN> xenocons: depends on your goal, if you want max performance, you have to work on a non-extractive way
<xenocons> NoNNaN: yeah :( i know you are right
<NoNNaN> xenocons: so gc will not mess up the processing pipeline
<xenocons> still, i cant explain this behaviour in batteries im seeing ;p
<xenocons> is it me being tired?
<xenocons> "val nsplit : t -> t -> t list
<xenocons> nsplit s sep splits the rope s into a list of ropes which are separated by sep. nsplit "" _ returns the empty list. If the separator is not found, it returns a list of the rope s."
<xenocons> effing confusing
<xenocons> does anyone use these libraries?
* adrien_oww probes companion_cube
<Kakadu> xenocons: I haven't use batteries but is looks really starnge
<xenocons> yeh :(
zpe has quit [Ping timeout: 240 seconds]
<xenocons> cant see the bug (if there is one)
<Kakadu> nsplit (of_string "1, 2, 3, 4") (of_char ',') |> List.map to_string;;
<Kakadu> - : string list = ["1"; " 2"; " 3"; " 4"]
<xenocons> hmmm, whats going on with my utop then?
ollehar has joined #ocaml
<Kakadu> nothing, I have just put another string
<xenocons> ahh, i see the space after the seperation
<xenocons> utop # nsplit (of_string "1, 2, 3, 4") (of_char ',') |> List.map to_string;;
<xenocons> - : string list = ["1"; " 2"; " 3"; " 4"] ─( 19:30:11 )─< command 13 >─────────────────────────────────────────────────────────────────────────────────────â”
<xenocons> - : string list = ["1"]
<xenocons> oops sorry long line
<xenocons> so splitting when there are spaces work, but without spaces it dies?
<xenocons> sloppy if that is the case
<companion_cube> I guess that's a bug
<xenocons> hmm ok
<xenocons> ill put an issue on the git
<kerneis> the problem is not spaces but the trailing comma, no?
<kerneis> (judging from above examples, I didn't test)
<Kakadu> Well
<xenocons> it seems to be the spaces
<Kakadu> Batteries seems to be as buggy as Windows
<Kakadu> xenocons: Have you tried Core?
<xenocons> i was using core's split before, but needed to use ropes due to string sizes
* xenocons utop remove batteries
<xenocons> i mean opam..
<companion_cube> how is it possible though, the tests pass
<xenocons> perhaps its just my end?
Snark has quit [Ping timeout: 252 seconds]
dsheets_ has joined #ocaml
<xenocons> https://github.com/ocaml-batteries-team/batteries-included/issues/561 will see if pepople respond with something like 'check your lib version, was bug fixed in past' or something
<companion_cube> no, it does it with my version too
<xenocons> its a shitty bug, i dont want to fix it locally
<xenocons> figured batteries was kinda like non official 'standard'
remyzorg has joined #ocaml
dsheets has quit [Ping timeout: 255 seconds]
yetanotherion has joined #ocaml
<companion_cube> well it's indeed a strange bug
<xenocons> companion_cube: are you 1 of the maintainers?
dsheets_ is now known as dsheets
<dsheets> does anyone here have experience with Lwt_preemptive and exception handling?
<companion_cube> xenocons: well, yes
<xenocons> ah
zpe has joined #ocaml
<companion_cube> I never looked at the Text code though
<xenocons> i meant no offense :)
<companion_cube> nah, don't worry
<companion_cube> it's really a weird bug though, because it works with other separators
<xenocons> heh
<xenocons> even worse
<companion_cube> but right now I'm working on something else :s
<xenocons> its ok
maattdd has joined #ocaml
freling has quit [Read error: No route to host]
ontologiae has quit [Ping timeout: 252 seconds]
zpe has quit [Ping timeout: 255 seconds]
freling has joined #ocaml
<xenocons> companion_cube: i reverted to an old version of batteries and it works
<xenocons> nsplit (of_string "1,2,3,4") (of_char ',') |> List.map to_string;;
<xenocons> - : string list = ["1"; "2"; "3"; "4"]
<xenocons> i hacked it a bit so i duno perf
<xenocons> so who wants to track back the change ;)
ggole has joined #ocaml
studybot has quit [Remote host closed the connection]
<xenocons> lets add a unit test for non spaced strings
<companion_cube> indeed
<companion_cube> how far in the past did you have to go?
<xenocons> i got lucky and found it on google first hit
<xenocons> find it interesting that the entire algorithm looks re-written
rand000 has quit [Ping timeout: 255 seconds]
<xenocons> wondering if the bug is the ofs - end_of_occurance
<xenocons> (ofs - end_of_occurance + 1) vs. (end_of_occurance + 1)
<xenocons> wouldn't make sense that it only breaks for non spaced strings though ...
jo` has quit [Ping timeout: 264 seconds]
<xenocons> it would though if the search function is somehow reading in the wrong order and you subtract the length of string + 1 off the offset? maybe...
<xenocons> ok next problem is rfind seems a bit ... shoddy
<xenocons> in the comments it mentions that is inefficient, yet nsplit relies on it
igitoor has quit [Ping timeout: 265 seconds]
<xenocons> [1] 23.1 0.97 0.00 camlBatString__find_all_1094 [1]
igitoor has joined #ocaml
igitoor has quit [Changing host]
igitoor has joined #ocaml
Thooms has joined #ocaml
rand000 has joined #ocaml
zpe has joined #ocaml
zpe has quit [Read error: Operation timed out]
ontologiae has joined #ocaml
arrays has joined #ocaml
zpe has joined #ocaml
Thooms has quit [Quit: WeeChat 0.3.8]
ollehar has quit [Ping timeout: 252 seconds]
zpe has quit [Remote host closed the connection]
<companion_cube> xenocons: Text is unicode, so it might not be easy at all to write efficient search functions
<xenocons> hmm
<xenocons> surely something like boyer moore?
<xenocons> wont it just mean the dictionary is bigger if its unicode?
<companion_cube> maybe, but it'd have to reverse the multi-byte unicode chars?
<xenocons> ah
<companion_cube> for rfind
<xenocons> yeh
<xenocons> hmm
<xenocons> is the cost of list.rev much?
<xenocons> i mean, perhaps its more efficient to simply boyer more it, and have nsplit do a .rev
<xenocons> moore*
<Drup> List.rev is O(n)
<xenocons> oh :(
waneck has quit [Ping timeout: 264 seconds]
<Drup> for unicode stuff, you have several libraries to do that, just use them
<xenocons> yeah, fair enough
<xenocons> is there a unicode rfind equiv lying around that batteries can use
<xenocons> i can look at it tmr i guess
siddharthv is now known as siddharthv_away
<mrvn> xenocons: utf-8? ucs32?
<xenocons> i figure its utf-8 , don't know enough about how batteries encodes its ropes though
<companion_cube> it's probably utf8, yes
waneck has joined #ocaml
<mrvn> search forward, do it recursively for the first 100, build the list as you return, recurse for the next 100 and stitch the results together using modify.
jonludlam has quit [Ping timeout: 240 seconds]
ollehar has joined #ocaml
rand000 has quit [Ping timeout: 240 seconds]
jo` has joined #ocaml
shinnya has quit [Ping timeout: 276 seconds]
rand000 has joined #ocaml
jonludlam has joined #ocaml
Rota has quit [Ping timeout: 252 seconds]
shinnya has joined #ocaml
<xenocons> mrvn: im not confident i wont eff it up, but ill give it a shot tmr
lostcuaz has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 264 seconds]
lostcuaz has quit [Quit: Textual IRC Client: www.textualapp.com]
studybot has joined #ocaml
studybot_ has joined #ocaml
studybot has quit [Ping timeout: 255 seconds]
<Drup> what does "tmr" stand for ?
lostcuaz has joined #ocaml
knz has joined #ocaml
<knz> hi all
<knz> is there a mathematician around?
<knz> I am confused about a result from cat theory: that "the identity morphism is unique for each objet"
<knz> how is that possible?
<asmanur> what do you mean ?
<knz> well
claudiuc_ has quit [Ping timeout: 252 seconds]
<asmanur> it follows from a more general result, in a monoid, there can be only one identity
<knz> I have a category in mind with two objects: a = the set of all terminating programs and b = the set of all non-terminating programs. I can clearly build plenty of compilers that are identities for a, and others that are identities for b; however they are all different from each other!
<xenocons> Drup: tomorrow
<asmanur> knz: that does not make much sense
steshaw1 has joined #ocaml
<asmanur> you mean that it is a subcategory of set ?
<asmanur> (ie. the maps are inherited from set ?)
<knz> unless I am mistaken in my understanding of categories: I though so far that "x -> y" designates "a particular morphism from x to y", leaving the opportunity for *multiple* such morphisms. Should I understand that "x -> y" instead designates "the set of all possible morphisms from x to y"?
<asmanur> no you are right, f: x → y often is used to denote a morphism from a to b
<def-lkb> (les carottes sont-elles cuites ?)
<knz> ok
<knz> so I could have f : x -> y *and* also g : x - >y, with g != f
<asmanur> yes
<asmanur> but in your example
<asmanur> if your compilers don't change the programs
<asmanur> they are all equal (because they are the same function)
<xenocons> shared identity
<knz> that's not my example :)
<knz> in my exa,ple I have sets of progras
<def-lkb> (even if you have different implementations of identities, you are not able to distinguish from within the categories, right ?)
<asmanur> def-lkb: no you can, it juste depends on the equality you consider
<asmanur> (it's orthogonal to categories)
<knz> so a compiler that replaces its input program entirely by a no-op, and another program that keeps its input program unchanged, are both identities over the set of all (terminating) programs
<asmanur> you can build a category of "programs", and there your different "identity" compilers will be different
<asmanur> why knz ?
<knz> because their input and output sets are the same
<asmanur> no
<asmanur> well, yes
<asmanur> but that does not mean they are the same function
<asmanur> because they don't have the same graph
<knz> how so?
<asmanur> well
<knz> both are functions "a -> a" (keeping with my earlier naming of objects)
<asmanur> they map the linux kernel to two different programs
<asmanur> yes
<asmanur> but they are different
<knz> but they are arrows from the same object to the same object in the category
<asmanur> yes
<knz> so ok back to what I said
<asmanur> that does not make them equal
<knz> there can be multiple identities in the category, that are different from each other
<asmanur> no
<knz> tsk
<asmanur> for each object A, there is exactly one object that behaves as the identity
<Drup> knz: I think you are confusing f : a -> a with g : {a} -> {a}
<asmanur> one morphism A → A
<Drup> {a} being a set of a
<knz> Drup: my category is defined with a = set of all terminating programs
<knz> so I have a category over a set of objects {a={terminating}, b={nonterminating}
ontologiae has quit [Ping timeout: 240 seconds]
<knz> two objects in the category, each of them is a set
<knz> my morphisms are from set to set
<knz> (compilers over languages)
<Drup> your question is not specific to categories theory, as far as I understand
<knz> that may be
<knz> BUT
<Drup> you just have a set of set
<knz> that's fine
<knz> BUT
<Drup> and you're trying to deduce a property about the identity over set of set by using functions over the set inside
<Drup> and it's not gonna work
<knz> what?
<knz> a compiler is a function from set to set
<knz> not from program to program
<asmanur> uh?
<Drup> ( asmanur : stop me if I'm wrong, I'm not into category theory )
<knz> well compilers transform languages
<knz> hmm
<knz> that's where the confusion comes from
<asmanur> knz: a compiler, as a set-theoretic object, is a map from a language (= set of programs) to another one
<knz> a "compiler" can be either seen a "the compiler program" which is a function from programs to programs, and "the set of all possible implementations of a compiler from this language to this other language"
<asmanur> ie. it maps program from a language to another language
<knz> so
<knz> ok
<knz> let's keep the compilers away from this
<knz> I had another category in mind with the same problem, maybe easier to rephrase
<knz> say all unix files as objects, and commands that input and output files as morphisms (piping for composition)
<knz> hmm
<knz> not unix files, rather data streams (sequences of bytes)
<asmanur> yes
steshaw1 has left #ocaml []
<asmanur> ok
<knz> I was observing that "cat" and "grep .*" are identities
<knz> but they are distinct
<asmanur> how do you compare two commands ?
Rota has joined #ocaml
<knz> asmanur: by comparing the process images that are created in the system as a result of running them
<asmanur> "the process images"
<asmanur> ?
<knz> (because the data streams are processed by processes, not commands)
<knz> well
<knz> heap, stack, text, kernel structures, over the lifetime of the process
<asmanur> ok
<asmanur> then they are not identities
<asmanur> because cat | cat in memory is not the same as cat
<knz> how so?
<knz> but my objects are not the processes!
<knz> my objects are the data streams that they transform
<ousado> because stack randomization
<asmanur> yes
<asmanur> but you only compare the morphism
<knz> cat | cat transforms a data stream in the same way as cat does
<knz> sure
<asmanur> a morphism f : a → a is an identity if f o g = g and g o f = g for all compatible g
<asmanur> yes
<asmanur> but in memory they are not the same
<asmanur> thus they are not equal for the definition above
<knz> AH
<asmanur> if you consider that two commands are the same when they produce the same output on the same input
<knz> there we go
<asmanur> then cat = grep .*
<asmanur> i think what you have an issue with is not categories but set theory :) in particular quotients
<knz> problem solved: the identity morphism is the abstraction of the class of all morphisms that have the identity property
<def-lkb> with this definition the identities don't exist as commands
<knz> yes
<knz> def-lkb: yes
<asmanur> knz: no
<asmanur> you have to fix an equality once and for all
<asmanur> knz: but you should prove that
<knz> hm
<asmanur> if you have two morphism f, g : a → a such that for all other φ : a → a, φ o f = f o φ = φ and φ o g = g o φ = φ, then f = g
<knz> so actually the category is not just a set of objects and morphism, but also the particular selection of equivalence relation between objects, and equivalence between morphisms
<asmanur> (simple equational reasoning)
<asmanur> no
<knz> because depending on the specific equivalence chosen, one can find different identities
<asmanur> 1) equality for objects don't matter
reynir is now known as turgenevskaya
<asmanur> 2) you always use the standard (mathematical) equality but you can use quotienting to twist it (that's orthgonal to category theory)
turgenevskaya has quit [Disconnected by services]
<knz> so far I know there is not just one "standard" mathematical equality between objects
reynir1 has joined #ocaml
reynir1 is now known as reynir
<asmanur> yes there is
<knz> two objects are qual in an equivalence class depending on which predicate is used
<asmanur> in maths (well set theory & type theory), there is such a thing as equality
<asmanur> which has an "absolute definition"
<asmanur> namely, the smallest equivalence relation
<knz> smallest?
<asmanur> yes
<asmanur> because equivalence relations are stable under intersection, you can construct the smallest equivalence relation
<asmanur> (as the intersection of all equivalence relation)
<knz> ok
<asmanur> or simply
<asmanur> as a graph
<asmanur> the graph of equality is (x, x)
<asmanur> the graph of equality in A is { (x, x) | x ∈ A }
<knz> (but now I think this is not relevant to my initial problem: I think my main problem was defining what the set of morphisms is. For example for pipes, I can either define my set as "particular processes" (which differ if the programs they run differ), or "stream transformers" (which only differ if they don't transform streams in the same way))
<asmanur> yes
<knz> depending on which definition I choose, my identities are different
<asmanur> yes
<knz> well
<knz> then I stand by my point, that the definition of a category is heavily dependent on which equivalence relation is used for the set of morphisms
<knz> hmm
<knz> more formally, which equivalence relation is used to define a *set* of morphisms from a collection of morphism-like things
<asmanur> yes and no
<def-lkb> knz: yet, this is orthogonal
<asmanur> if you look at definition of categories inside type theory no one is parametrized over an equality relation
<asmanur> whoops
<asmanur> set theory*
<knz> well duh, of course, because anything that's a set already has (implicitly) an equivalence relation
<knz> if x and y are equivalent, they are the same object in the set :)
avsm has joined #ocaml
<asmanur> ...
darkf has quit [Quit: Leaving]
<knz> but I think I now know enough
<knz> many thanks for helping me think better
struktured has quit [Ping timeout: 276 seconds]
rand000 has quit [Ping timeout: 240 seconds]
rgrinberg has joined #ocaml
<jpdeplaix> whitequark: If you think that nobody use llvm as I do (as a portable code generator), you're barking up the wrong tree I think
<jpdeplaix> The ideal world for me would be to have the equivalent of InitializeAllTargets in the ocaml binding
<jpdeplaix> otherwise llc works for me
<whitequark> jpdeplaix: I would accept a patch adding InitializeAllTargets.
<whitequark> talking about portable code generators... do you never use any data types more complex than a single integer value?
<whitequark> and even then, you at least have to have three versions of the emitted code, for 32-bit, ILP32 and LP64 models
<whitequark> otherwise even the function signatures with C calling convention wouldn't match the target ABI and would not be able to interface with it
<mrvn> whitequark: don't forget IP32L64
<whitequark> mrvn: ಠ_ಠ
<mrvn> whitequark: x32
<whitequark> oh
<mrvn> (or example)
<jpdeplaix> I use only the i8* type
jo` has quit [Read error: Connection reset by peer]
arrays has quit [Ping timeout: 240 seconds]
<jpdeplaix> all my data are boxed and I don't use any native types
<whitequark> jpdeplaix: and no optimizations either?
<jpdeplaix> I do an optimization pass yes.
Snark has joined #ocaml
<whitequark> note that optimizations in general require the data layout of a module to be set
<whitequark> (not all of them, but most)
<whitequark> that said... you use LLVM in an unique kind of way, ignoring 99% of what LLVM has to offer. so yes, it will work as a portable code generator in this way, but it's not at all how it was intended to be used
divyanshu has quit [Quit: Computer has gone to sleep.]
<whitequark> it's kind of like loading Linux to blink a LED. *shrug*
brainacid has joined #ocaml
<brainacid> Good morning
<brainacid> I have never programmed before and i was looking into learning with ocaml the functional way first before going into java and learning that
<mrvn> so you want to learn the best and then use the worst?
<Kakadu> brainacid: I'm afraid that you will hate Java after OCaml...
<Drup> brainacid: be aware that, doing it this way, you will rant about Java constantly
<Drup> :D
<xenocons> hah
<xenocons> not sure if trolling
<xenocons> ok night
<Drup> xenocons: I did it this way, I did rant about Java :]
<jpdeplaix> whitequark: I don't really care about LLVM optimizations
<brainacid> ok so maybe i should go with scala
_obad_ has joined #ocaml
_obad_ has quit [Client Quit]
<brainacid> mrvn, im not very sure...honestly i know very little
<whitequark> brainacid: I'd say go for it. it's not possible to know too many languages
_obad_ has joined #ocaml
<Drup> brainacid: go for it, it doesn't matter
<Drup> the worst you can end up is an ocaml guy, that could be worse.
<Drup> :)
<mrvn> whitequark: there are some language better not to know
<jpdeplaix> whitequark: by the way, Drup asked the other day if the llvm binding could be separated from llvm itself (for speed up the compilation time). I don't know, so I ask to you
<whitequark> jpdeplaix: short answer: no.
berke_durak has left #ocaml []
<Drup> :(
<whitequark> long answer: it's possible to make a set of ADTs mirroring LLVM IR and add a two-way transformation
<whitequark> it is not currently done and the bindings are missing a few accessor functions required for that, but I'll make it sure they're added without too much hassle
<Drup> whitequark: don't you just need the llvm library .so to be installed in the system ?
<Drup> (to compile the bindings)
<whitequark> Drup: if the only thing that concerns you is the compilation time, then yes, dynamically linking to LLVM suffices
<whitequark> it'll result in just the stubs being linked in, and that's very fast
<whitequark> it's the static linking to actual LLVM libraries which is slow
rgrinberg has quit [Quit: Leaving.]
<whitequark> well, or get a faster machine. a modern i7 links in LLVM with X86 backend in just some 5 seconds :p
<Drup> I must admit, I'm not fond of recompiling all llvm to recompile the bindings :)
<adrien_oww> i7's only advantage over i5 currently is HT
<whitequark> adrien_oww: hm, no bigger caches?
<adrien_oww> yes, bigger cache too
<brainacid> any good free resources i should use to study ocaml?
<whitequark> adrien_oww: that matters a lot when linking
<adrien_oww> which changes nothing unless you're doing database
<adrien_oww> hmmm
<Drup> whitequark: my laptop is not a grill :D
<adrien_oww> from 8MB to 10MB?
<whitequark> Drup: nonono, you don't need to recompile all of LLVM
<johnelse> brainacid: http://try.ocamlpro.com/
<Drup> whitequark: well, with the current opam package, yes, I do.
<whitequark> Drup: you can install the system packages for ocaml and LLVM
<whitequark> apt-get install libllvm-ocaml-dev
<Drup> I don't use the system switch
<Drup> for various reasons
<brainacid> thanks johnelse
<whitequark> well, then either use the opam package that exists or write a better one :p
<Drup> whitequark: well, that's jpdeplaix subjects :3
<whitequark> Drup: in principle, the bindings are not dependent on non-public or unstable interfaces of LLVM
<Drup> (and the cause of this discussion :p)
<whitequark> so it is possible to separate them from the LLVM package itself
<whitequark> but the buildsystem is almost a decade old and quite braindead
<Drup> ahah :D
<whitequark> and it uses LLVM's Makefile.common
<whitequark> Drup: is compiling LLVM once a problem?
<Drup> no
<Drup> (I did that already)
<Kakadu> brainacid: I was studying it using http://mirror.ocamlcore.org/ocaml-tutorial.org/. it can be rather old but main aspects haven't changed
<jpdeplaix> Drup: I'm currently trying something
nikki93 has joined #ocaml
<knz> hmm
remyzorg has quit [Read error: Connection reset by peer]
<knz> followup to my earlier question: in a category, if x and y are specific objects, there can be only at most one morphism x -> y, right?
<mrvn> could go both ways
<asmanur> no
<mrvn> (meaning they are equal)
<asmanur> in set, is there at most one function from natural numbers to natural numbres ?
<knz> asmanur: no ok
<knz> then I don't understand how to prove that if x = y, then all morphisms of type x -> y are equal
<knz> (to the identity)
<asmanur> because this is wrong
<mrvn> is x -> x/2 a morphism?
<knz> hmm
<knz> so the unicity of the identity morphism is an axiom, not a theorem?
<asmanur> no
<mrvn> maybe you should ask in #math
<asmanur> it's a theorem
<asmanur> only the existence is an axiom
<knz> mrvn: people in #math don't connect well with my constructivist view of abstraction :)
<asmanur> the statement you want to prove is: if id : a → a and id' : a → are two identity functions then id = id'
cesar_ has joined #ocaml
cesar_ is now known as Guest78441
tane has joined #ocaml
avsm has quit [Quit: Leaving.]
_obad_ has quit [Quit: leaving]
_obad_ has joined #ocaml
nikki93 has quit [Remote host closed the connection]
nikki93 has joined #ocaml
nikki93 has quit [Remote host closed the connection]
nikki93 has joined #ocaml
freling has quit [*.net *.split]
Thooms has joined #ocaml
Guest78441 has quit [Remote host closed the connection]
S11001001 has joined #ocaml
S11001001 has quit [Changing host]
S11001001 has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest38333
Guest38333 has quit [Remote host closed the connection]
freling has joined #ocaml
jwatzman|work has joined #ocaml
ygrek_ has joined #ocaml
mort___ has joined #ocaml
nikki93 has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
racycle_ has joined #ocaml
tlockney_away is now known as tlockney
skchrko has quit [Quit: Leaving]
maattdd has quit [Ping timeout: 276 seconds]
mort___ has quit [Quit: Leaving.]
mort___ has joined #ocaml
ygrek_ has quit [Ping timeout: 264 seconds]
nikki93 has joined #ocaml
tane has quit [Quit: Verlassend]
nikki93 has quit [Ping timeout: 255 seconds]
tautologico has joined #ocaml
mort___ has quit [Quit: Leaving.]
<tautologico> I just learned today that @@ is in the language
maattdd has joined #ocaml
<companion_cube> yes, since 4.01.0
<tautologico> I missed the memo :)
<tautologico> though I think |> is more useful in general
<tautologico> whitequark: yes, I even reported a few typos here
<whitequark> oh, right
<tautologico> there's a lot of good stuff that can be done with ppx
<tautologico> one of the things I've been thinking about is type providers like in F#
<whitequark> yeah
<_obad_> speaking of which. do you guys use ( & ) f x = f x ?
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
<_obad_> or do you have another convention?
<pippijn> _obad_: why?
<pippijn> that's @@
<_obad_> oh
<tautologico> yeah
<_obad_> I've been using & for years actually... hmm
<tautologico> using piping is quite useful too, ( |> ) x f = f x
<companion_cube> piping is great
<_obad_> I just tried defining <| but it's not right associative so it doesn't work
<_obad_> 0.3 |> cos |> cos works
<_obad_> cos <| cos <| 0.3 doesn't :(
<_obad_> so cos @@ cos @@ 0.3 it is
<tautologico> cos @@ cos @@ 0.3 works
<Drup> _obad_ @@ is predefined in ocaml >= 4.0
<Drup> (with |> )
<_obad_> I know I just checked. I just think & is shorter
<Drup> tautologico: what are type providers exactly ?
<tautologico> Haskell uses $
<Drup> we still lacks haskell's .
<tautologico> yes
<Drup> afaik, batteries use % for that
<tautologico> Drup: type providers are basically a way to define types based on external data sources
<Drup> hum, concretely ?
<tautologico> a simple example is loading a CSV file
<Drup> oh, I see
<tautologico> the CSV declares the names of the columns, the provider then defines a record type
<tautologico> and infers the data type for the column
<Drup> not sure you can do that with ocaml's type erasure
<whitequark> it's done at compile-time
<tautologico> it's compile-time
<tautologico> yeah
<Drup> if it's done at compile time, then it's trivial
<tautologico> yes
<tautologico> one idea would be to do a general lib for writing type providers using ppx, then users of the lib wouldn't need to deal with ppx directly
<Drup> tautologico: what more support do you need then ? You just want a big library that do that for lot's of sources ?
<Drup> oh, I got it
malo has joined #ocaml
<Drup> you want to provide a sample of your CSV and extract the type with that, instead of having a declarative syntax for the type
<tautologico> yes
<Drup> I think it's silly, I prefer a declarative syntax
ollehar has quit [Ping timeout: 252 seconds]
<tautologico> defining a way to infer the type for any CSV
<jpdeplaix> Drup: batteries has % :)
<Drup> pgocaml does the way you describe for pgsql databases
<Drup> and it's just a pita in my opinion
<tautologico> the other way around may be interesting too, a typeconv approach: I write the type and the lib generates a typed CSV reader for it
<Drup> that's better imho
<Drup> and you don't even need a syntax extension for that, most of the time
<tautologico> yeah, I can see what you mean
<Drup> csv is a bad example, because it's so trivial :)
<tautologico> yes
<Kakadu> btw, can we print generated by ppx extension AST into human readable form?
<Drup> (a set of parser for each collumn, a & operator to combine parsers, you're done).
jonludlam has quit [Ping timeout: 265 seconds]
<tautologico> but it's cool that F# people talk a lot about type providers and we can define them as libraries
<Drup> tautologico: I'm still not sure what the "F# support" is
<Drup> it seems pretty much on a case by case basis
<NoNNaN> you could generate a type provider for c headers
ikaros has quit [Quit: Ex-Chat]
<NoNNaN> or provide typed schema for freebase (with millions of types)
<tautologico> yes, anything
<NoNNaN> debugging it is not so fun, but if it works it could really simplify the code
<whitequark> it's most interesting to generate ctypes definitions automatically
<whitequark> using libclang
<NoNNaN> exactly this is why I mentioned the c type provider
<whitequark> Kakadu: yes, ocamlc -dsource -ppx ...
<Drup> if you can generate ctypes définition, you can generate proper bindings, and I don't see an advantage of not doing so
Kakadu has quit [Quit: Page closed]
<NoNNaN> then think about javascript type provider or java or other language type provider
<NoNNaN> some kind of easy interop, ide support, etc
<_obad_> tautologico: $ doesn't work in ocaml alas... wrong associativity
AltGr has left #ocaml []
nikki93 has joined #ocaml
<whitequark> Drup: proper bindings?
<jpdeplaix> Drup, whitequark: I succeed !!!!
jwatzman|work has quit [Quit: jwatzman|work]
nikki93 has quit [Remote host closed the connection]
jwatzman|work has joined #ocaml
ontologiae has joined #ocaml
<whitequark> jpdeplaix: what did you do?
divyanshu has joined #ocaml
<jpdeplaix> It builds under 1 minutes ! \o/
<whitequark> jpdeplaix: nice
johnf has quit [Ping timeout: 276 seconds]
<whitequark> you should probably remove all the --enable- switches for ./configure which are no longer applicable because those parts are not built
claudiuc has joined #ocaml
<whitequark> just as conf-llvm-debug won't work anymore
<jpdeplaix> mmmh no, it enables the shared and static binaries for the ocaml binding
<jpdeplaix> oh yes, and the shared one works !
<whitequark> of course it does, with libLLVM-3.4.so being in the dynamic linker path
<whitequark> it worked just as well before if you put the opam libdir in LD_LIBRARY_PATH
<whitequark> sadly there is no dynamic linker option to embed it into the executable.
nikki93 has joined #ocaml
Thooms has quit [Quit: WeeChat 0.3.8]
tane has joined #ocaml
tane is now known as HomerSimpsoy
dsheets has quit [Ping timeout: 265 seconds]
jave has quit [Quit: ZNC - http://znc.in]
ontologiae has quit [Ping timeout: 265 seconds]
jave has joined #ocaml
eizo has quit [Ping timeout: 240 seconds]
dapz has joined #ocaml
nikki93 has quit [Remote host closed the connection]
nikki93 has joined #ocaml
yacks has quit [Read error: Operation timed out]
rgrinberg has quit [Quit: Leaving.]
Kakadu has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
jwatzman|work has joined #ocaml
ygrek_ has joined #ocaml
philtor has joined #ocaml
rgrinberg has joined #ocaml
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
ollehar has joined #ocaml
nikki93 has quit [Remote host closed the connection]
ygrek_ has quit [Remote host closed the connection]
ygrek_ has joined #ocaml
clan has joined #ocaml
<_obad_> any existing convention for infix syntax for Int32.add, etc? I used to use: let (++) = Int32.add
<_obad_> and (+++) = Int64.add
<whitequark> Int32.(add x (mul y z))
<_obad_> damn that's new?
<whitequark> hm? it's equivalent to let open Int32 in ..., but shorter
brainacid has quit [Quit: Leaving]
<Kakadu> _obad_: >= 3.12.1 AFAIR
<jpdeplaix> _obad_: since 3.12 if I'm right
<_obad_> I've been using let open but I didn't know about that new syntax.
<_obad_> thx!!
nikki93 has joined #ocaml
q66 has quit [Quit: Leaving]
<mrvn> Int32 should have a +
<mrvn> Int32.(x + y * z)
q66 has joined #ocaml
q66 has quit [Changing host]
q66 has joined #ocaml
q66 has quit [Remote host closed the connection]
ygrek_ has quit [Remote host closed the connection]
arj has joined #ocaml
q66 has joined #ocaml
q66 has quit [Changing host]
q66 has joined #ocaml
<tautologico> all number modules should have +, * etc
<flux> hence, core, batteries, etc
<tautologico> yes
<flux> if they added + to Int32, programs that do 'open Int32' would cease to compile
<_obad_> Int32.Syntax
<flux> I've sometimes put an Ops module to my modules
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dsheets has joined #ocaml
<_obad_> Ops is good... shorter
ddosia has quit [Quit: Leaving.]
nikki93 has quit [Ping timeout: 255 seconds]
nikki93_ has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
Anarchos has joined #ocaml
lostcuaz has quit [Ping timeout: 240 seconds]
jao has quit [Ping timeout: 252 seconds]
lostcuaz has joined #ocaml
nikki93_ has quit [Remote host closed the connection]
<mrvn> flux: They should have had it from the start
jwatzman|work has joined #ocaml
nikki93 has joined #ocaml
claudiuc has quit [Remote host closed the connection]
nikki93 has quit [Remote host closed the connection]
nikki93 has joined #ocaml
nikki93 has quit [Remote host closed the connection]
arj has quit [Quit: Leaving.]
arj has joined #ocaml
ikaros has joined #ocaml
dapz has joined #ocaml
dapz has quit [Client Quit]
dapz has joined #ocaml
jonludlam has joined #ocaml
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
axiles has quit [Remote host closed the connection]
shinnya has quit [Ping timeout: 276 seconds]
claudiuc has joined #ocaml
Snark has quit [Read error: Operation timed out]
Submarine has quit [Ping timeout: 265 seconds]
nikki93 has joined #ocaml
<_obad_> goddamnit! camlp4 doesn't support sequences inside Module.(expr) constructs
<_obad_> List.(1;2) -> works with the built-in parser, gives Error: Failure: "expr; expr: not allowed here, use do {...} or [|...|] to surround them" with camlp4
dapz has joined #ocaml
divyanshu has quit [Quit: Computer has gone to sleep.]
S11001001 has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
clan has quit [Quit: clan]
<Drup> _obad_ time to use ppx instead :)
nlucaroni has quit [Quit: leaving]
clan has joined #ocaml
<_obad_> did someone write an lwt syntax for -ppx ?
<whitequark> not that I know of
<whitequark> (perhaps I should...)
<_obad_> what about sexp?
<Kakadu> btw, can I install labltk and ocamlbrowser in 4.02+trunk"
<Kakadu> ?
<tautologico> a lot of stuff will have to be rewritten to use ppx... but ppx is the future
<whitequark> rewriting type_conv-related stuff would be considerably harder.
<whitequark> the sexp.syntax thing is a few kloc of stuff I don't even understand
<_obad_> it's damn useful though... even if it's not the exact same syntax it should provide something similar. maybe not the inline quotation thing (which I never used)
<def-lkb> List.((1;2))
<def-lkb> elegant, lightweight, convenient, that's camlp4 :)
<castorks> :)
<_obad_> def-lkb: close enough
<_obad_> thx:)
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Drup> whitequark: the ppx for lwt is on my close todo list
<Drup> close as "I'm doing it soon"
<flux> what would it look like? different?
<Drup> let%lwt
<whitequark> Drup: cool
<whitequark> I'm going to use that
<_obad_> nice, but could it be shorter?
<Drup> not really
<_obad_> because otherwise it ends up being lightweight ;) let%t maybe?
<Drup> it's too short to be distinctive
<flux> by the power of unicode, I compel you?
j0sh has quit [Ping timeout: 255 seconds]
<Drup> flux: no unicode in ocaml except strings :)
<flux> drup, sad
<tautologico> will 2 characters make all that difference when writing? they make reading far worse
<flux> should replace lexer with ulex ;)
j0sh has joined #ocaml
<whitequark> no unicode even in strings
<_obad_> is let' possible?
<whitequark> s.(x) returns an ASCII character.
<whitequark> _obad_: no.
<Drup> _obad_if you want to fuck up every editor in the world, yes
<whitequark> _obad_: only let%alnum
<whitequark> and it's good.
<flux> whitequark, not really, it returns the nth octet of the sequence
<Drup> whitequark: technically, it's possible
<Drup> the parser will assume let' is a function
<whitequark> Drup: the = will screw things up
Drup has left #ocaml []
Drup has joined #ocaml
<whitequark> flux: well, whatever, still not unicode
<_obad_> whitequark: ok I still vote for let%t... pretty please?
<Drup> whitequark: not really, it will just be the equality operator
rgrinberg has quit [Quit: Leaving.]
<flux> whitequark, well, the compiler won't choke on it, which is already pretty good!
<Drup> whitequark: you will have to completly rewrite the ast locally
<tautologico> no, let%t it's too concise and confusing if other extensions want to use let% forms
<Drup> but it would work
<whitequark> _obad_: currently you have while_lwt, for_lwt, try_lwt
<whitequark> while%lwt, for%lwt, try%lwt and let%lwt are the right choice.
<Drup> _obad_in this case, I vote for regularity
<flux> so is that % some extension mechanism?
<_obad_> tautologico, whitequark: they're a bit too long for my linking.. how about while%t, for%t, etc.?
<tautologico> yes
<Drup> and %lwt everywhere is better
<whitequark> I'm not even that opposed to >>= fun x, except that it screws up flow
<_obad_> I mean, threads... you're using them everywhere
<whitequark> _obad_: you can always fork the extension for your own needs ;)
<tautologico> _obad_: lwt is not the only library that may want to use these forms
rgrinberg has joined #ocaml
<flux> at least if you see let%lwt in the code
<tautologico> not to mention that let%lwt makes it clear that this form is from lwt...
<flux> you have a slight possibility to find what it means :)
<_obad_> tautologico: I say first come first serve, there is a space that serves as a delimiter.
<tautologico> if you're reading some code and see let%t, what the hell is t?
Kakadu has quit [Quit: Konversation terminated!]
<tautologico> it confuses reading for everyone in exchange for a couple of characters less, I don't think it's worth it
<_obad_> tautologico: c'mon if you don't know what lwt is you won't have a better clue if you see let%lwt
<flux> I think it will
<whitequark> _obad_: you can google for let%lwt, but not for let%t.
<flux> more people know lwt than who use it
<tautologico> _obad_: but I'll know it's from lwt
<whitequark> I mean, try it now.
<whitequark> let%lwt: first link to ocsigen/lwt
<Drup> anyway, _obad_, it's not your call :]
<whitequark> let%t: first link to beatles
<_obad_> whitequark: I don't know what your browsing habits are but here I get something about linear transformations
<tautologico> let%t considered harmful :)
<_obad_> fine... only because lwt = is ugly and we already have match_lwt, etc.
<Drup> tautologico: one letter ppx extensions considered harmful :3
arj has quit [Quit: Leaving.]
<whitequark> _obad_: same in incognito mode
<tautologico> excessive terseness considered harmful
<whitequark> tautologico: use Java
<tautologico> whitequark: use perl :)
<flux> excssv trsnss cnsdrd hrmfl
<ggole> Use APL
<tautologico> or APL maybe
<tautologico> J
<ggole> ^
<whitequark> hey, I'm not arguing *for* terseness
<xenocons> did someone say J ?
<xenocons> :>
<tautologico> J is so terse even the language name is just one letter
<xenocons> haha
<whitequark> I use
<tautologico> but APL is nicer to look at with all the greek letters and weird symbols
<whitequark> is the tersest language possible.
<_obad_> while you're at it, is there a way to run some simple analysis to warn about try ... with blocks where ... contains lwt stuff?
<xenocons> i actually like J, its epic
<whitequark> _obad_: grep lwt ?
<tautologico> it's pretty interesting
<ggole> APL has some good ideas
<ggole> All the functional languages steal its operators.
<xenocons> hehe
<tautologico> they should steal more
<_obad_> whitequark: lol... sgrep maybe
<xenocons> so do we submit pull requests for batteries fixes?
<xenocons> or submit issues with fixes in them
<whitequark> sgrep?
<_obad_> structured grep... it allows you to define region expressions.
<tautologico> there's some FP stuff in the Backus Turing award talk that I wish we had in current functional languages
<whitequark> I never understood the odd obsession with grep variants. ag, whatever.
<whitequark> plain old grep works just swell
<flux> git grep ;)
<whitequark> same thing
steshaw1 has joined #ocaml
<_obad_> erm.. now I know grep has these funky backreferences but it's still finite automata
<_obad_> at heart, while sgrep allows you to define non-regular languages easily
<whitequark> why would I want that?
dapz has joined #ocaml
<tautologico> I think it's not actually implemented with automata but uses backtracking, and that's why it has exponential worst case time complexity
<whitequark> what the *hell* are you all trying to use grep for
<_obad_> whitequark: finding stuff between try and with that (explicitly) involves lwt constructs
<_obad_> to warn the user that maybe they want to use try_lwt instead
<_obad_> grep ain't gonna cut it
<whitequark> ah, got it. use compiler-libs, I guess
<_obad_> but the ast is handy
<def-lkb> I didn't know sgrep, that looks nice. But it shares barely more than its name with grep
rand000 has joined #ocaml
lostcuaz has quit [Ping timeout: 264 seconds]
parcs has left #ocaml []
Snark has joined #ocaml
lostcuaz has joined #ocaml
Rota has quit [Ping timeout: 276 seconds]
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
dapz has joined #ocaml
dapz has quit [Client Quit]
clan has quit [Quit: clan]
<_obad_> what about anonymous Lwt binding ? >> that should be possible using ppx I think
nikki93 has quit [Remote host closed the connection]
<adrien> _obad_: anonymous?
<_obad_> adrien: as in Lwt_io.printf "Hello," >> Lwt_io.printf " world" >> ...
<whitequark> >> ≡ >>= fun () ->
<adrien> let (>>=) = Lwt.(>>=)
<adrien> no need for more
<adrien> "open Lwt" or "let open Lwt in ..." would work too
<_obad_> you still have to type fun () ->
<adrien> not if you have partial application
<adrien> which also happens
<_obad_> not in general though... if you mix sequences with >>'s
dapz has joined #ocaml
<whitequark> >> is probably possible with ppx
nikki93 has joined #ocaml
<whitequark> there will be objections to purity, though
lostcuaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
WraithM has quit [Ping timeout: 240 seconds]
HomerSimpsoy has quit [Quit: Verlassend]
<adrien> if you're going to have "fun ()" you can as well make a list of functions or something like that
<adrien> I'm happy ocaml doesn't get too many operators everywhere
<whitequark> well, yeah, I'm not sequencing operations with a list of functions
<whitequark> >> should stay.
* whitequark should probably make an opam package first, in the situation that Drup objects to the above :p
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
studybot_ has quit [Read error: Connection reset by peer]
nikki93 has quit [Read error: Connection reset by peer]
dapz has joined #ocaml
dapz has quit [Client Quit]
<Drup> hum ?
<whitequark> objects to the inclusion of >>
araujo has quit [Ping timeout: 255 seconds]
<Drup> I'm not going to change the syntax
<Drup> the syntax extension*
<Drup> just translate it into ppx
<Drup> the only question is about the "finally"
<Drup> (I must say I don't like >> and I would never use it myself
<Drup> but that's another question)
saml has quit [Quit: Leaving]
<Drup> I would prefer something which doesn't look like a normal operator, to make it obvious that the execution order is not the same as the one you would expect from an oprator
jwatzman|work has quit [Quit: jwatzman|work]
<whitequark> I'm not opposed to that
<whitequark> but what?
Simn has quit [Read error: Connection reset by peer]
<Drup> that's an extremely good question
<Drup> I have no idea :D
<whitequark> same
<whitequark> [%seq e1; e2; e3] ?
<whitequark> oh! begin%lwt.
<whitequark> that should be perfect
<Drup> I would have to think about it, and ask lwt's maintainer their opinions.
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
rand000 has quit [Quit: leaving]
ikaros has quit [Quit: Ex-Chat]
studybot has joined #ocaml
clan has joined #ocaml
<jpdeplaix> whitequark: by the way, why did you choose to do an other library for llvm_X86, llvm_ARM, … instead of just putting those as sub-libraries in the llvm library ?
_alephlambda has joined #ocaml
<_alephlambda> Hi, I'm a student working with OCaml for a project. I'm trying to make a control flow graph, and I'm not sure what the most elegant way is. Right now, I'm just representing the graph as two maps, one of verticies to values and one of vecticies to edges. Is there a better way?
<companion_cube> #require "ocamlgraph";; ? :)
<Drup> _alephlambda: are you allowed to use external libraries ?
<_alephlambda> Drup: If I can, then companion_cube's suggestion is good. I need to check, though. Can we assume that I'm not allowed to and see where that takes us?
<Drup> it will be less good (and less beautiful) than ocamlgraph :D
<companion_cube> _alephlambda: I'd use one map only, from vertices to {edges, values}
<companion_cube> (using a record)
<_alephlambda> Drup: Ha, okay. I'm not saying ocamlgraph is bad and that I'm unwilling to use it. I'd just rather learn about options now than come back and bug you guys again :P
<_alephlambda> companion_cube: Ah, okay. I can do that.
<flux> I suppose in principle there are two ways
<flux> pure and impure :)
<companion_cube> well in any case you need to map vertices to edges and labels
<_alephlambda> companion_cube: Honestly, I was just wondering if there was some pure implementation more akin to C's structs. I can work with maps though.
<companion_cube> what do you mean by "pure implementation"?
<companion_cube> even in C, a graph needs some structure
<companion_cube> you may embed the {label, edges} into the vertices themselves, but still
<_alephlambda> companion_cube: Now that I typed that, I realize I was essentially thinking of a map :P
<Drup> how do you do a graph without some sort of mapping ? x)
dapz has joined #ocaml
<Drup> or a matrix
<whitequark> jpdeplaix: I had some trouble with the buildsystem
<Drup> but well, the matrix representation is not going to suit you, if you have control flow graphs
<whitequark> I do not like that and plan to make it llvm.X86 sometime.
<_alephlambda> Drup: It doesn't have to be an explicit map if you're willing to use pointers.
steshaw1 has quit [Quit: Leaving.]
<_alephlambda> Drup: But I wouldn't call that pure.
<Drup> that's still a map
<flux> an imperative approach could be: type 'a node = { value : 'a; mutable neighbours : 'a node list }
<flux> is that a mapping?
<companion_cube> flux: if you want to map 'a values to the corresponding vertex, then yes
steshaw1 has joined #ocaml
clan has quit [Quit: clan]
<flux> you can express the structure with just unit values :)
<_alephlambda> Drup: Sorry, I'm not being very precise with my words. I meant explicitly forming a map vs. forming a map by having each node store pointers. It's not a very good distinction.
<Drup> having a map explicitely is better imho, because you can actually use operations on map without having to reimplement them
<_alephlambda> Drup: Agreed. flux: Hm...I'll have to look up that mutable word. I haven't run across that yet.
<companion_cube> anyway, ocamlgraph mostly uses hashtables or maps, I think
<_alephlambda> companion_cube: Alright, cool. ocamlgraph is sounding like what I want.
<flux> the representation I gave is useful at times, not-so-useful at others
<_alephlambda> flux: I wrote it down!
<companion_cube> _alephlambda: you can implement your own graph if that's for learning
<flux> at least it's going to be beneficial to have some kind of unique integer for each node
<companion_cube> and if you don't need much
<Drup> ocamlgraph is everything. I'm sure you can encode a coffee machine into it's modules.
<_alephlambda> Drup: Can I quote you on that? :P
<Drup> :D
<Drup> _alephlambda: only after you have seen its beautiful fonctors :]
<jpdeplaix> whitequark: ok :)
<companion_cube> Drup: stop exhibiting your sexual preferences
<_alephlambda> Drup: I need to learn more about functional programming. Fonctors (functors?) are a bit out of my graph, at the moment.
<Drup> well, you will have to learn functors if you use ocamlgraph. Which is a good thing!
araujo has joined #ocaml
araujo has quit [Changing host]
araujo has joined #ocaml
<_alephlambda> Drup: slip of the tongue. replace 'graph' with 'grasp'
<Drup> not exactly have to, actually. There is a "ready to use" module, but still
<_alephlambda> Although....both words work in this context
nikki93 has joined #ocaml
<_alephlambda> Drup, companion_cube, flux: Thanks guys! I'm going to go off are learn some more stuff.
_alephlambda has left #ocaml []
<_obad_> whitequark: yes begin%lwt is perfect, I was just gonna suggest that
jwatzman|work has joined #ocaml
clan has joined #ocaml
<Drup> I'm not sure I want to implement a specific do notation for lwt
<Drup> (instead of having a generic one)
clan has quit [Client Quit]
NoNNaN has quit [Remote host closed the connection]
<whitequark> well, it won't hurt
NoNNaN has joined #ocaml
<Drup> sure
clan has joined #ocaml
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<jpdeplaix> whitequark: in foundry, the output file can be directly an executable or only an object file ?
<nicoo> Drup: You could have begin%monad with an implicit for >>=
<whitequark> jpdeplaix: only an object.
<whitequark> to make an executable, you currently have to execute a linker. there is no other way. clang does it, too
<jpdeplaix> do you know a way to pipe the resulting object file to the linker ?
dapz has joined #ocaml
clan has quit [Quit: clan]
fantasticsid has joined #ocaml
<whitequark> clang creates a temporary file. do you want to avoid that?
<whitequark> it would be more portable than pipe cleverness
jonludlam has quit [Ping timeout: 240 seconds]
<whitequark> GNU ld appears to not support "ld -". you could use /dev/stdin or /dev/fd/x, but that would be *nix or Linux-specific.
clan has joined #ocaml
<flux> it might do random access, so it might not work?
ggole has quit []
<whitequark> what flux says.
dapz has quit [Client Quit]
<whitequark> not "might", it definitely does. and probably mmaps the file, too.
dapz has joined #ocaml
<nicoo> whitequark: Does gold support using stdin ?
<nicoo> Ah, yes
madroach has quit [Ping timeout: 252 seconds]
<whitequark> also, requiring gold solely for piping would be absurd
madroach has joined #ocaml
dapz has quit [Client Quit]
mcclurmc has quit [Remote host closed the connection]
clan has quit [Client Quit]
<nicoo> whitequark: Caring about the overhead of file creation seems rather strange in the first place :)
<whitequark> well, it's slightly inelegant. I'd prefer using the in-development LLVM linker, it sounds as something that could be pretty great
<whitequark> but it doesn't exist yet so...
<whitequark> I'm of opinion that all toolchains must be embeddable as libraries.
<philtor> whitequark: are you working on an LLVM backend for OCaml?
<pippijn> I'm of opinion that everything should be built as libraries to begin with
<pippijn> everything I do is a library
<pippijn> and then small frontends to glue them together
darkf has joined #ocaml
<pippijn> and turn them into libraries if they grow too big
<whitequark> philtor: I worked on it for several days, made a prototype and got disappointed in the idea
<pippijn> why?
NoNNaN has quit [Remote host closed the connection]
NoNNaN has joined #ocaml
<whitequark> didn't want to rewrite Cmm
<pippijn> and cmm -> llvm doesn't work?
<whitequark> also the most practical benefit would probably be vectorization, but I don't write numeric code
<whitequark> it does, but cmm has all the wrong types
<whitequark> that inhibits optimizations
<whitequark> mostly because of wrong ABI
<pippijn> ok
<whitequark> I'll consider finding someone to sponsor the project, but for the time being I have more important/interesting stuff to do
<pippijn> and bytecode -> llvm?
<whitequark> you need to implement too much of lambda/ulambda/cmm yourself then
<pippijn> and lambda/ulambda -> llvm?
<whitequark> you would need a... Cmm'
<whitequark> as I've said, a Cmm rewrite :)
<whitequark> btw, can you even have ' in modules?
<whitequark> >> module M' = struct end
<whitequark> errr, no eval bot. should fix that.
<flux> I would expect so
<whitequark> anyone objects to having an eval bot in this channel?
<flux> not me.
fantasticsid has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
<tautologico> nop
<companion_cube> it'd be nice
<companion_cube> if it doesn't flood
fantasticsid has joined #ocaml
<whitequark> no, I'll be using http://eval.in
<pippijn> make it so it remembers stuff
<flux> there used to be
<flux> xavierbot
<whitequark> eval.in implements the sandboxing for me, and I'll cutoff with a link to it
<flux> but if you trust eval.in more, then go ahead, it's your machine :)
<whitequark> flux: eval.in is not on my machine
<flux> oh, right
<pippijn> like: >> let a = 3;; >> print_int a;;
<flux> you would just use that, yes
<whitequark> that's the point: it's not my headache
<pippijn> or without the ;;
<flux> xavierbot had the benefit that it remembered let-assignments
<flux> it was essentially an interactive ocaml session
<pippijn> flux: you *can* do that with eval.in, I guess
<whitequark> I can accumulate commands
<pippijn> right
<flux> and hack the responses away?
clan has joined #ocaml
<whitequark> if someone suggests a sane way to mark continuation (or resetting) the buffer
<flux> or get them regardless?
<nicoo> flux: xavier-bot shouldn't ever be ran outside a safe-ish container
<nicoo> though
clan has quit [Client Quit]
<flux> nicoo, yeah, I suppose I would use a blocked virtual machine
<whitequark> you shouldn't be able to DoS the bot itself
* nicoo had a dedicated FreeBSD jail to run it.
<whitequark> anyway. ideas for marking what to remember / resetting the buffer?
<whitequark> you have the time until I figure out ocaml-irc-client :p
<nicoo> whitequark: Yes, I had some draft implementation of something safer (or at least safe-ish)
<flux> another point that xavierbot did: it would give types of expressions
<flux> (just like toplevel)
<flux> but now, sleep
<flux> happy botting!
<philtor> whitequark: what does CMM stand for?
<whitequark> philtor: C-- (look it up)
<philtor> ah, ok, C-- yes, I've heard of it
<whitequark> Cmm is similar to C--, hence the name
<philtor> It seems that several folks have taken a run at an LLVM backend for OCaml and have given up.
<whitequark> we've used three different approaches
<pippijn> I think it's rather boring work
<whitequark> it absolutely is
<whitequark> is there an alternative to Arg that doesn't use Core?
<bernardofpc> asmanur> 1) equality for objects don't matter -> I'd say the contrary (and to support your 2 further down) that equality for your objects is given along with the set (or class) of objects you set up ; the exact same happens for functions (morphisms) : they come with a predefined notion of equality before you jumble all that into a category