Tianon has quit [Remote host closed the connection]
Tianon has joined #ocaml
Tianon has quit [Changing host]
Tianon has joined #ocaml
Tianon has quit [Ping timeout: 240 seconds]
Tianon has joined #ocaml
Tianon has quit [Changing host]
Tianon has joined #ocaml
arubin has joined #ocaml
sebz has joined #ocaml
dnolen has joined #ocaml
joewilliams is now known as joewilliams_away
<thelema>
everyonemines: `(x,y as foo)`; and yes. Of course you also have to avoid anything that treats the pair as a single value, such as most higher order functions.
<thelema>
jimi_hendrix: match obj_list with [] -> None | hd::tl -> List.fold_left (fun ...) (hd, dist hd) tl
<jimi_hendrix>
thelema, alright
<jimi_hendrix>
got to get used to those matches :)
<jimi_hendrix>
they are pretty cool
ttamttam has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
sebz has joined #ocaml
Julien_T has quit [Ping timeout: 258 seconds]
<thelema>
jimi_hendrix: yes, they are
Skolem has quit [Quit: Skolem]
ttamttam has quit [Remote host closed the connection]
arubin has quit [Quit: arubin]
sebz has quit [Quit: Computer has gone to sleep.]
philtor has joined #ocaml
<philtor>
Installed ocaml from godi. When I start the toplevel and type: #use "topfind" ;; I don't see the "successfully loaded" message.
clog has quit [Ping timeout: 244 seconds]
clog has joined #ocaml
<thelema>
philtor: does `#require "unix";;` work?
<philtor>
I'm on Ubuntu. I got rid of /etc/ocamlfind.conf to make sure findlib isn't using that.
<philtor>
Not sure... I don't see any message after entering it.
<philtor>
#list;; lists things like findlib being present.
<thelema>
sounds like findlib is being quiet
<philtor>
batteries is listed as well as a bunch of others.
<thelema>
then topfind is loaded
<philtor>
well, when I try #use "topfind" ;; and then try #camlp4o I don't see anything either.
<thelema>
try `Sys.interactive := true`
<thelema>
and then something
<philtor>
still not reporting anything when I do #use "topfind" ;;
<thelema>
`Topfind.announce;;` ?
rwmjones_afk has quit [Ping timeout: 252 seconds]
rwmjones_afk has joined #ocaml
<philtor>
Nope.
<philtor>
But it does seem to be working.
<philtor>
I'm tyring to use bitstring and had to load that and the syntax for it and it does seem to be working.
<philtor>
rwmjones_afk : bitstring question.
<philtor>
(odd about the non-responsiveness from topfind - On a Suse machine I installed OCaml and I see the "successfully loaded" messages" )
<thelema>
btw, batteries has a script that loads itself into the toplevel with some fun addins
<philtor>
I get: # Error: This expression has type unit BatIO.output = unit BatInnerIO.output
<philtor>
but an expression was expected of type out_channel
<philtor>
(whereas on the other Suse machine I can just specify stdout)
joewilliams_away is now known as joewilliams
<thelema>
yes, batteries does replace the usual stdout
<thelema>
try Legacy.stdout instead
<thelema>
I've used bitstring
sebz has joined #ocaml
bobry has joined #ocaml
<philtor>
that's better.
<philtor>
thelema: I notice that when using Bitstring.concat that the resulting bitstring doesn't have the right length.
<philtor>
This seems especially to be a problem if Bitstring.subbitstring is used to create the bitstrings.
<philtor>
So for example, I take one bitstring with length 66 and another with length 67 and the length of the resulting bitstring should be 133 (at least that's what I would expect)
<philtor>
# let bb0 = Bitstring.subbitstring bigbs 0 66 ;;
<philtor>
val bb0 : Bitstring.bitstring = ("ZZZZZZZZZZZZZZZZ]---------------", 0, 66)
<thelema>
Yes, I think there's a known problem in concat
<philtor>
Ah, yes seems to be.
<thelema>
Bitstring isn't efficient for this kind of operation
<philtor>
which kind of operation? concat?
<thelema>
are you sure you want to use it for concat
<philtor>
Yes, I need to extract some fields from a binary file and then concat them before hexdumping them back out.
<thelema>
and the fields are bit-indexed?
<philtor>
Basically, there is extraneous data in between some fields which I do not care about and I want to combine the remaining fields which I do care about.
<philtor>
so the bitmatch is pretty handy for that, I would think...
<abdallah>
Why doesn't the Set module in the standard library provide a polymorphic implementation?
<thelema>
abdallah: because it doesn't. Batteries does.
<abdallah>
:-)
<abdallah>
Is there any persisting reason why Hashtbl and Set are treated differently in the std library? Or is it just legacy?
edwin has quit [Remote host closed the connection]
<adrien>
differently? you mean Set using functors and not Hashtbl?
<thelema>
just legacy. I'm guessing they needed a polymorphic hashtable to build ocamlc, but didn't need a polymorphic set and map, so just built nice functorial ones
<abdallah>
I see thanks.
<abdallah>
I need to build sets of 'a t with my own comparator (independant of 'a), what is the best way to go?
<abdallah>
I cannot use the functorial set because 'a is unbound and I cannot use directly a polymorphic set because I do not want to use Pervasive.compare.
<thelema>
abdallah: 1) implement your sets on top of hashtbl or 2) depend on batteries or 3) copy batteries' polymorphic set implementation
<thelema>
(batteries' polymorphic sets still allows custom compare functions)
<abdallah>
Ah ok, that's good !
<abdallah>
I had my own polymorphic set but it did not allow custom compare functions.
<abdallah>
What is the licensing effect of copying one of batteries' file and using it in my project?
Julien_T has joined #ocaml
<thelema>
LGPL - if you modify the batteries set, you have to release the modifications
ulfdoz has joined #ocaml
edwin has joined #ocaml
Julien_T has quit [Ping timeout: 255 seconds]
_andre_ is now known as _andre
emmanuelux has joined #ocaml
larhat has quit [Quit: Leaving.]
edwin has quit [Remote host closed the connection]
Boscop has joined #ocaml
<abdallah>
thelema: ok. If I include and use it without modification, am I allowed to release a single executable, or should I release the executable as well as the source of the LGPL files (which are otherwise available on batteries project site)?
<thelema>
if you include and use it w/o modification, you can release just an executable
<abdallah>
ok
<thelema>
It probably won't hurt to say that you used batteries for some stuff and point to our web site, I'm not certain whether that's required
<abdallah>
If I make any modification and send them upstream, do I need to provide source with my exectuables? Does it depend on whether my patch is accepted?
<thelema>
you can put a link to the modified source as part of the attribution
<thelema>
We're pretty liberal about accepting patches
<abdallah>
What if I wish to release my whole project under BSD licence? I suppose I'll have to mark the batteries' files as external library so that it does not interfere?!
<thelema>
If you just want to use Set, poke bluestorm - he re-wrote the current version in ite entirety, he can give you a more permissive license
<thelema>
abdallah: and as much as I appreciate you worrying about licensing, just take the batteries files wholesale, and keep their headers, and I don't think there'll be any problems
<abdallah>
Ok perfect, thanks!
Boscop_ has joined #ocaml
<thelema>
especially if you point to your repo in the docs that come with the binary
<_habnabit>
everyone should just be using BSD
<_habnabit>
(the OS and the license)
<thelema>
_habnabit: which BSD?
<_habnabit>
yes!
<thelema>
and which license? 2-clause? 3-clause? other variant?
<_habnabit>
it was mostly a joke, though I do use 2-clause BSD for my personal projects
Julien_T has joined #ocaml
Boscop has quit [Ping timeout: 260 seconds]
<mfp>
abdallah: you can also build polymorphic sets atop the functional ones by using 1st class modules
<thelema>
mfp: isn't scope a problem for that?
<abdallah>
mfp: Ok, sounds interesting. Unfortunately I have to stick with 3.11 as my project doesn't build with 3.12.
<mfp>
AFAIK it works; in fact, I might have it done before :P
<thelema>
mfp: okay then.
<mfp>
thelema: you basically carry a value of type (module Set.S with type elt = 'a)
<thelema>
ah, that could make it work
<mfp>
and then each op is implemented by unpacking the 1st class module
<thelema>
if you put that into your map value
edwin has joined #ocaml
<mfp>
right
<mfp>
in fact you might need to wrap the set itself in the module, as in (module (sig include Set.S val s : t end with type elt = 'a))
<mfp>
then let make (type a) cmp = (struct include Set.Make(struct type elt = a let compare = cmp) let s = empty end : sig include Set.S val s : t end with type elt = 'a))
<mfp>
or so modulo typos and stuff (you'd define an aux. module type for that too)
<thelema>
eww
<thelema>
ugly hackery
<mfp>
and e.g. let add (type a) (x : a) s = let module S : S' with type elt = a in (module struct include S let s = add x s end : S' with type elt = a)
<mfp>
you have to unpack and repack on each op, which is far from elegant
bobry has quit [Remote host closed the connection]
bobry has joined #ocaml
Boscop has joined #ocaml
<mfp>
you can omit most type annotations in 3.13, however
Boscop_ has quit [Ping timeout: 244 seconds]
Anarchos has joined #ocaml
edwin has quit [Remote host closed the connection]
tlockney_ is now known as tlockney
lpereira has joined #ocaml
edwin has joined #ocaml
Julien_T has quit [Ping timeout: 245 seconds]
ttamttam has quit [Remote host closed the connection]
Boscop_ has joined #ocaml
Boscop has quit [Ping timeout: 276 seconds]
Boscop has joined #ocaml
Boscop_ has quit [Ping timeout: 252 seconds]
Boscop_ has joined #ocaml
ankit9 has joined #ocaml
ygrek has joined #ocaml
Boscop has quit [Ping timeout: 244 seconds]
Boscop has joined #ocaml
Boscop_ has quit [Ping timeout: 244 seconds]
fschwidom has joined #ocaml
ygrek has quit [Quit: Leaving]
Boscop has quit [Ping timeout: 260 seconds]
ygrek has joined #ocaml
Kakadu has quit [Quit: Konversation terminated!]
_andre has quit [Quit: leaving]
fschwidom has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 248 seconds]
ygrek has joined #ocaml
everyonemines has joined #ocaml
ulfdoz has quit [Ping timeout: 256 seconds]
edwin has quit [Quit: Leaving.]
edwin has joined #ocaml
Cyanure has quit [Ping timeout: 258 seconds]
oriba has joined #ocaml
Cyanure has joined #ocaml
liteblackk has joined #ocaml
liteblackk has quit [Quit: Ухожу я от вас]
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
edwin has quit [Remote host closed the connection]
<malouin>
any recommendations on how to manage ocaml libraries on OS X? godi? macports? homebrew?
rferranti has left #ocaml []
<_habnabit>
malouin, I do godi + oasis
<_habnabit>
macports is bad, and homebrew has the (generally correct) philosophy of declaring that language-specific packages are Someone Else's Problem
<malouin>
ok.
<malouin>
it sounds like I should not try to do ocaml through macports at all.
<malouin>
at least, it has been breaking for me a lot.
<_habnabit>
you should not use macports at all.
<malouin>
which I don't mind too much, but it is driving my advisor nuts.
<malouin>
_habnabit: because homebrew is the future?
<_habnabit>
well, mostly because macports is terrible.
<malouin>
I haven't had the best experience so far.
ikaros has quit [Quit: Ex-Chat]
lpereira has quit [Quit: Leaving.]
Cyanure has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 248 seconds]
flapjackery has joined #ocaml
flapjackery has quit [Client Quit]
Amorphous has quit [Ping timeout: 248 seconds]
<abdallah>
How am I suppose to profile my code if I make intensive use of higher order functions?
Amorphous has joined #ocaml
lopex has quit []
dgbaley27 has joined #ocaml
<dgbaley27>
Sorry if I'm using the wrong terminology. Is there any way to get the components of a type without match? Like if I have "type foo = int * bool" and a foo is passed to a function, can I get at each "member" without matching the function argument?
<_habnabit>
dgbaley27, `let f ((x, y): foo) = if y then x else ~-x`
<_habnabit>
actually, I remembered the other syntax for signatures
<_habnabit>
let f: foo -> int = fun (x, y) -> if y then x else ~-x
<dgbaley27>
Lets say I the type contains 50 elements, and it's generally convenient for me to treat the argument as the type as a whole, but for one small thing, I just need one of the elements.
<_habnabit>
okay, 'type' is the wrong word here. you're talking about tuples.
<dgbaley27>
ok
<_habnabit>
and if you have >2 elements, you more than likely want a record type instead of a tuple.
<_habnabit>
since x.f50 is easier than `let _, _, _, _, [...], _, y = x`
<dgbaley27>
I have, for example, "type lambda = var * exp". And it's generally more convenient to treat the lambda as a single variable, but sometimes I need to get at just the "var" part. I find it cumbersome to have to then match the lambda to break it up
<dgbaley27>
Ok, I will look up record types
<_habnabit>
again, you don't need to match
<_habnabit>
you can do it as part of defining the function, or `let _, y = x`
<dgbaley27>
Yeah but then I lose the ability to also treat it as a single thing
<_habnabit>
no?
<_habnabit>
in that example, you have both x and y
<_habnabit>
also, `let f (_, y as x) = ...`
<dgbaley27>
let f (a: mytype) and let f ((x,y): mytype)... I can either have "a" or "x,y" but I'm not seeing how I can have both
<_habnabit>
then read what I just said
<dgbaley27>
x gives me the sequence and y gives me just the second element?