ayrnieu changed the topic of #ocaml to: OCaml 3.08.4 available! Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
<lispy`> yeah, that's what i meant by tuples
<lispy`> oh, but in ocaml (+1) isn't automatically turned into a function of one argument
<lispy`> so it's not a big loss to use tuples all the time
<avlondono> lispy`: to save you some typing, you can just match x, y with 0, 0 -> blah | 0, 1 -> bleh ...
<beschmi> (+) 1 works if you need (fun y -> 1 + y), but there is no shortcut for (/ 3) e.g..
<lispy`> yeah, it looks like ocaml could benefit (at least in my opinion) from some of haskell's syntatic sugar
<lispy`> but perhaps that's because i already know haskell
<beschmi> the thing i miss most is `` for infix application
<monochrom> I keep forgetting that parentheses around tuples are optional.
<lispy`> monochrom: they are optional in haskell as well
<lispy`> i like the lambda notation in haskell, and what i refer to as automatic currying
<lispy`> \x -> x + 1 and (1+) are the same functions
<beschmi> lispy`: i don't think so. how does it handle [1,1]
<lispy`> beschmi: that's a list with two elements
<beschmi> (
<beschmi> that's (+1) ;)
<lispy`> but, that's just because lists use commas also, so you'd need parens there to deal with ambiguitiy
<monochrom> my ghci doesn't like let x,y = 0,0 in x
<lispy`> beschmi: strictly speaking yes, but (+) is commutative on integers
<pango> lists use ;
<lispy`> pango: not in haskell which was the context :)
<pango> ok
<lispy`> well, shoot i just updated my os and now emacs doesn't run...need to use a different editor for a bit
<sethk> lispy`, emacs doesn't run? what happened?
<lispy`> sethk: not sure, it segfaults after installing the latest updates from Appple, but really you wouldn't expect them to affect emacs
<sethk> lispy`, no, although I did have to upgrade emacs a while back, now that I think about it.
<sethk> lispy`, after upgrading osx
<lispy`> trying to upgrade darwinports to see if they have a newer version of emacs i can compile/install
<lispy`> using Xcode in the mean time (I found an ocaml plugin for it)
<sethk> lispy`, didn't know there was an ocaml plugin for it
<sethk> lispy`, thanks
<lispy`> np
<lispy`> i wish it were finished
<lispy`> it's a bit limiting in that it only generates bytecode for example
<lispy`> i tried to get some code to compile the other day that apparently wouldn't compile if i tried to compile to bytecode, I can only guess that there was a problem linking to one of the libraries
_fab has quit [Remote closed the connection]
<lispy`> recompiled emacs and all is well
<sethk> lispy`, I guess; it doesn't make sense that compiling to bytecode would fail when compile to native code succeeds
<sethk> lispy`, so it had to be a link issue
<sethk> lispy`, you mean emacs runs again?
<sethk> lispy`, after rebuilding?
<lispy`> ya
<lispy`> port clean --all emacs ; port install emacs
<lispy`> in haskell i can give a function a type signature separately from the file definition, is this possible in ocaml?
<lispy`> er not file definition but function definition
<Smerdyakov> Signatures and .mli files
<sethk> lispy`, you can specify the signature
<sethk> apart from the implementation
<sethk> oh, sorry, Smerdyakov already answered
<lispy`> okay, i'm not seeing the syntax what is it?
<Smerdyakov> Read the manual on the module system.
<Smerdyakov> The approach is fundamentally different from the way Haskell does it.
<sethk> manual004, section 2.2
<sethk> Smerdyakov, what's fundamentally different? There is at least one method that looks similar to me. What am I missing?
<lispy`> oh, does ocaml-mode in emacs not do syntax highlighting?
<lispy`> yeah, when i add "val foo : ..." on the line before the function definition i get a syntax error
<lispy`> also, i see the examples define the compose function, is there a builtin operator for function composition?
<sethk> lispy`, doesn't let f = g h work? that is, just naming the functions next to each other?
<lispy`> sethk: no, i get type errors
<lispy`> let foo x= true;;
<lispy`> let bar (y:bool) = "hi";;
<lispy`> let f = bar foo;;
<sethk> lispy`, hm. I've done it with integer functions.
<lispy`> oh
natv has quit ["Leaving"]
<lispy`> i need to do foo bar
<lispy`> but then i get the constant true
<lispy`> instead of a function
<lispy`> oh, right becasue foo can take anything
<sethk> lispy`, I believe you can stop that by giving explicit types for the functions
<lispy`> let f x = bar (foo x);; gives the expected function
<sethk> lispy`, ah, good.
<sethk> I'll have to figure out why. :)
<lispy`> i'll just define (%) as compose, that's good enough for me
<lispy`> so what is the normal way to convert a char to a string?
<lispy`> using Printf.sprintf?
<sethk> lispy`, there are other ways. I'll see if I can spot one. I suppose there is nothing wrong with using sprintf. I guess...
<lispy`> it was the only way i could come up with on my own searching the documentation
<lispy`> there is int_of_char and string_of_int but that's not what i want
<lispy`> haskell's view of strings being a special case of lists can be very nice, so i was trying to write a string_of_charlist function, i'll just use sprintf for now :)
<sethk> k
<beschmi> lispy`: there is String.of_char in extlib
<beschmi> there is also explode : string -> char list in there
<lispy`> beschmi: hm....shouldn't "open extlib;;" open it for me then?
<lispy`> oh, nice lib
<monochrom> There is String.iter. It may be good enough for most circumstances when you want a list of chars.
<lispy`> there is also map
<lispy`> too bad that lib is not in darwin ports, i hate installing manually
<beschmi> lispy`: the standard lib is pretty minimal, but most of the small functions you'd write yourself are already in extlib
<lispy`> beschmi: yeah, i want to install it
<lispy`> it will save me some time from converting over some of my utility functions
<lispy`> how do i choose the installation directory?
<beschmi> i'm using godi (http://godi.ocaml-programming.de/) for installing ocaml stuff
<lispy`> that's not in darwin either, but maybe i should install it
<beschmi> it's something like the ports system, but only for ocaml software
<lispy`> yeah, it's annoying to have a separate system for each tihng, but i don't have a choice other than manual installation
<lispy`> oh, i don't like the way godi installed
<lispy`> /opt/godi/bin
<lispy`> it shouldn't be in /opt/godi/bin
<beschmi> you can configure that ./bootstrap --prefix ..
<lispy`> yeah, but it really wasn't clear that it would put things in such weird places
<lispy`> usually the default is pretty sane
<lispy`> in fact, i can't install it to the normal place, it fails and says the directory exists
<lispy`> it also tells me to look at a file which doesn't exist
<lispy`> bootstrap.log
<lispy`> at this point i wonder if i can trust it to behave correctly at all
<beschmi> you can't install it to an existing directory (eg. /usr/local)
<lispy`> which is really annoying
<lispy`> i'm not going to put it in some obscure place and modify my path
<beschmi> i use symlinks for the binaries, but i agree that it's not really optimal. but beats installing everything manually for me since my distribution never has all the ocaml libraries i need
<beschmi> maybe someone should port cabal-get to ocaml
<lispy`> so, extlib is installed, how do i get access to that function?
<lispy`> that char_of function
<lispy`> i tried open ExtLib.String;;
<lispy`> but char_of is still unbound
<beschmi> ExtString.String
<lispy`> hmm....
<lispy`> same error
<lispy`> # ExtString.String.char_of;;
<lispy`> Unbound value ExtString.String.char_of
<beschmi> have you loaded extlib?
<lispy`> i typed open ExtString;;
<lispy`> and open ExtString.String;;
<beschmi> that just opens the module, eg. you can use char_of instead of ExtString.String.char_of
<lispy`> how do i load it?
<lispy`> (from the toplevel)
<beschmi> use #load "path/to/extLib.cma";;
<lispy`> argh, i have to give the path?
<lispy`> and the extension?
<beschmi> if you have installed findlib, then you don't have to remember any paths and just use #require "extlib"
<lispy`> i typed #load "extlib.cma" (hoping i wouldn'tneed the path), there was no error, but ExtString.String.char_of is stillunbound
<beschmi> seems like you have to add the directory where extlib is installed with #directory too if you don't use findlib
<beschmi> have to go now, bye
<monochrom> Is it really called ExtString.String.char_of ?
<lispy`> oh, it's of_char
<lispy`> okay works now
<lispy`> thanks for the sanity check
monochrom has quit ["good morning, sweet dream"]
y6cmE has joined #ocaml
mikeX has joined #ocaml
mikeX has quit ["Leaving"]
pango_ has joined #ocaml
pango has quit [Read error: 110 (Connection timed out)]
mflux has quit [Read error: 104 (Connection reset by peer)]
tom_p has joined #ocaml
mflux has joined #ocaml
vezenchio has joined #ocaml
<revision17_> I've created a binary with ocamlopt on a sparc solaris 9 system; it has some C code linked into it (after strip, the file is 117KiB); should it run on any sparc solaris 9 system (IE are all required libs built in)?
Skal has joined #ocaml
<mflux> I think it should, if it doesn't use for example gtk
<revision17_> no, other than the base libraries (like Str and Unix), it has no dependencies
pango_ has quit [Remote closed the connection]
pango has joined #ocaml
<mflux> try ;)
mlh has quit [Client Quit]
Revision17 has joined #ocaml
yozora has joined #ocaml
yozora has quit []
revision17_ has quit [Read error: 110 (Connection timed out)]
yozora has joined #ocaml
ski has joined #ocaml
ski_ has joined #ocaml
ski has quit [Nick collision from services.]
ski_ is now known as ski
Nate1975 has joined #ocaml
ski_ has joined #ocaml
ski has quit [Nick collision from services.]
ski_ is now known as ski
Nate1975 has quit ["using sirc version 2.211+KSIRC/1.3.11"]
__DL__ has joined #ocaml
ski_ has joined #ocaml
ski has quit [Nick collision from services.]
ski has joined #ocaml
ski_ has quit [Nick collision from services.]
ski has quit ["nmi"]
yozora has quit [Read error: 104 (Connection reset by peer)]
ski has joined #ocaml
y6cmE has quit [Read error: 110 (Connection timed out)]
Tachyon76 has joined #ocaml
ski_ has joined #ocaml
ski has quit [Nick collision from services.]
ski_ is now known as ski
chs_ has joined #ocaml
_fab has joined #ocaml
threeve has joined #ocaml
chs_ has quit []
mfurr has quit ["Client exiting"]
mfurr has joined #ocaml
ski has quit ["nmi"]
ski has joined #ocaml
Snark has joined #ocaml
mikeX has joined #ocaml
Tachyon76 has quit ["Leaving"]
_fab has quit [Read error: 113 (No route to host)]
mikeX has quit ["Leaving"]
Skal has quit [Read error: 60 (Operation timed out)]
mikeX has joined #ocaml
<mikeX> how can one specify a chunk of code whose compilation is optional?
<mikeX> as in an "ifdef ...somevar... <code> endif" in C
<pnou> there's a camlp4 extension which does that
<mikeX> pnou, I see.. thanks
<mikeX> it appears one can even use the C preprocessor :D
mikeX has quit ["Leaving"]
<pnou> for sure...
Skal has joined #ocaml
<Snark> I do conditional compilation differently, using autoconf
<Snark> I have a .ml.in with module FooImpl = @FOO_IMPL@
<Snark> and compile either fooA.ml or fooB.ml depending on what FOO_IMPL is chosen
<Smerdyakov> Is this conditional compilation where some code won't even compile under some conditions?
<Snark> yes
<Snark> I use FooImpl.generic_call
<Snark> and since FooImpl is either FooA or FooB (and only one of them is compiled in), it works as long as they share the right interface
<Smerdyakov> Relying on whole-program dead-code elimination is nice for cases when everything compiles fine.
<Snark> the problem is not only dead-code elimination
<Smerdyakov> In some cases, it is.
<Snark> in my case some implementations use ocaml base calls or C-bindings
Msandin has joined #ocaml
shirogane has joined #ocaml
pango has quit ["Leaving"]
pango has joined #ocaml
chs_ has joined #ocaml
Schmurtz has joined #ocaml
ski has quit ["Zzz"]
mrsolo has joined #ocaml
smimou has joined #ocaml
shirogane has quit [Remote closed the connection]
cmeme has quit [Remote closed the connection]
Msandin has quit [Read error: 104 (Connection reset by peer)]
Snark has quit ["Leaving"]
_fab has joined #ocaml
vezenchio has quit ["Free Tibet with each Asian nation of a lesser or equal value"]
_fab has quit [Remote closed the connection]
monochrom has joined #ocaml
__DL__ has quit ["Bye Bye"]
mikeX has joined #ocaml
monochrom has quit [Read error: 110 (Connection timed out)]
monochrom has joined #ocaml
threeve has quit []
pnou has quit ["cassos"]
monochrom has quit ["good morning, sweet dream"]
zigong has joined #ocaml
zigong has left #ocaml []
Skal has quit [Remote closed the connection]
mikeX has quit ["Leaving"]
threeve has joined #ocaml
threeve has quit []