<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]
<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>
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
<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
<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
<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
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)
<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)]
<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