gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.0 http://bit.ly/aNZBUp
boscop has quit [Ping timeout: 240 seconds]
accel has joined #ocaml
<accel> besides http://pauillac.inria.fr/~ddr/camlp5/doc/html/scheme.html is there any effort to create a language w/ lisp syntax ocaml semantics?
Associat0r has quit [Quit: Associat0r]
Associat0r has joined #ocaml
julm has quit [Ping timeout: 265 seconds]
fremo__ has quit [Ping timeout: 240 seconds]
julm has joined #ocaml
yroeht has joined #ocaml
fremo__ has joined #ocaml
Associat0r has quit [Quit: Associat0r]
cyanure has quit [Ping timeout: 265 seconds]
mjonsson has joined #ocaml
joewilliams is now known as joewilliams_away
joewilliams_away is now known as joewilliams
accel has quit [Quit: leaving]
<alexyk> thelema: why isn't there a Set.map2?
<alexyk> there's one for Array or List
<thelema> alexyk: taking two sets of the same size and mapping the lowest values in each set to a new set, and the next lowest values, etc?
<thelema> I don't see much call for it.
<alexyk> thelema: probably
<thelema> E.repeat ~times 10 |> E.reduce (*)
<thelema> Array and List are ordered other than by value, set is only ordered by value
<alexyk> thelema: I also thought of reduce, but it will fail for times = 0
<alexyk> and fold ( * ) 1 will work
<thelema> true.
<thelema> ("1e" ^ string_of_int times) |> float_of_string |> int_of_float
<alexyk> huh
cthuluh has quit [Quit: .]
<thelema> sadly ocaml doesn't accept scientific notation for ints
cthuluh has joined #ocaml
Amorphous has quit [Ping timeout: 272 seconds]
drunK has quit [Remote host closed the connection]
Amorphous has joined #ocaml
myu2 has quit [Remote host closed the connection]
thatch__ has joined #ocaml
thatch__ has quit [Remote host closed the connection]
alexyk has quit [Quit: alexyk]
seafood has joined #ocaml
seafood has quit [Quit: seafood]
noisymouse has quit [Remote host closed the connection]
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
thatch__ has joined #ocaml
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
ulfdoz has joined #ocaml
mjonsson has quit [Remote host closed the connection]
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
BiDOrD has joined #ocaml
alexyk has joined #ocaml
thatch__ has quit [Remote host closed the connection]
snarkyboojum has quit [Read error: Connection reset by peer]
cyanure has joined #ocaml
myu2 has joined #ocaml
tnguyen has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
ulfdoz has quit [Ping timeout: 250 seconds]
joewilliams is now known as joewilliams_away
ygrek has joined #ocaml
thieusoai has joined #ocaml
<thieusoai> exit
thieusoai has quit [Client Quit]
tnguyen has quit [Remote host closed the connection]
tnguyen has joined #ocaml
cyanure has quit [Remote host closed the connection]
Yoric has joined #ocaml
mnabil has quit [Remote host closed the connection]
accel has joined #ocaml
<accel> is it possible to write iphone apps in ocaml?
<accel> or does ocaml's VM vioolate the agreements ?
<adrien> condition lifted, see the caml-list archives
<adrien> iirc last post was this month
<accel> yeah; but doesn't ocaml
<accel> still only generate x86?
<accel> looking at google
boscop has joined #ocaml
<accel> it appears there some japanese group that ported it to arm
<accel> but taht's it?
<adrien> https://sympa-roc.inria.fr/wws/arc/caml-list/2011-01/msg00023.html , that's the most recent but the licence might be closed-source
<adrien> I know http://web.yl.is.s.u-tokyo.ac.jp/~tosh/ocaml-on-iphone/ is working however: you "simply" have to cross-compile to arm
<accel> yeah; taht's the japanese group I was referring to
<accel> it actually doesn't look _too_ bad
<accel> compared to, say, cross compiling gcc
<adrien> it definitely look simple as long as you're willing to follow the instructions and think a little
<adrien> looks*
<gildor> accel: ocaml generates native executable for a lot of different arches
<gildor> accel: including amd64, i386, powerpc, sparc and arm
<accel> gildor: they why does getting it to run on iphone require more work?
<accel> (not trolling, serious question; isn't the iphone/ipad an arm chip?)
<gildor> accel: but arm has different way to handle endianess
<gildor> and float
<accel> but ocamo supports arm
<accel> (as you stated earlier)
<gildor> accel: this mainly a question of interacting with the OS
<gildor> accel: i.e. be able to open a terminal for example
<accel> gildor: so the 'difficulty' is mainly iOs bindings ?
<gildor> though iOS is more or less UNIX like, you cannot really use the command line
<gildor> accel: part of it, there are probably other tricks -- that the japanese team has already solved
<gildor> accel: just read one the patch from http://web.yl.is.s.u-tokyo.ac.jp/~tosh/ocaml-on-iphone/
<gildor> accel: they added a symbol "global_dir" in the code generated
<gildor> accel: and renames some label all around
<gildor> e.g .Lcaml_last_return_address -> Lcaml_last_return_address
<gildor> the patch is 630 lines, which is very short
<accel> noted
<accel> gildor: thanks
BiDOrD has quit [Ping timeout: 250 seconds]
<gildor> accel: the iOS binding is less than what I thought
<accel> actually, the really useful clarification to me was
<accel> i used to think the hard part was getting ocaml to generaet arm
<accel> whereas it appears the ahrd part is just having it talk to ios
<gildor> I think the global_dir stuff is the part needed to talk to iOS
Yoric has quit [Quit: Yoric]
ikaros has joined #ocaml
Snark has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
coucou747 has joined #ocaml
chicco has joined #ocaml
accel has quit [Quit: leaving]
ttamttam has joined #ocaml
Yoric has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
smerz has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
_andre has joined #ocaml
avsm has joined #ocaml
menace has joined #ocaml
ygrek has joined #ocaml
ftrvxmtrx has joined #ocaml
seafood has joined #ocaml
<f[x]> gildor, is smth like this -> http://paste.in.ua/1666/ <- possible?
jado has joined #ocaml
<jado> hi, i'm trying to compile for time profiling (ocamlopt -p) with ocamlbuild, but 'ocamlbuild -use-ocamlfind -cflag -p main.native' tries to compile with ocamlc -p :/
<jado> it works with-lflag
BiDOrD has joined #ocaml
Associat0r has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
myu2 has quit [Ping timeout: 240 seconds]
<adrien> jado: don't use cflag(s)
<adrien> add "profile" in your _tags, juste like you'd add "debug" or package tags "<*>: profile, debug, whatever"
jm has joined #ocaml
seafood has quit [Ping timeout: 240 seconds]
jonafan_ has joined #ocaml
jonafan has quit [Ping timeout: 276 seconds]
myu2 has joined #ocaml
Yoric has quit [Quit: Yoric]
Yoric has joined #ocaml
<f[x]> ok, I see
fraggle_ has quit [Quit: -ENOBRAIN]
adrien has quit [Ping timeout: 276 seconds]
adrien has joined #ocaml
elehack has joined #ocaml
<thelema> elehack: I wonder if there's anything to do to cut down the number of places a new module has to be added to integrate it with the rest of batteries
<elehack> thelema: good question
<elehack> for the mllib files, we could generate them.
<elehack> might be able to generate batteries.ml and batteries_uni.ml as well
<thelema> elehack: generating mllib is complicated by dependency order, iirc
<elehack> hmm.
<thelema> and batteries_uni.ml seems like a good place to strt the generation from, if possible.
<elehack> How about a 'manifest' file that lists all the modules, in proper order, with flags.
<thelema> I don't think generating batteries_uni.ml is worth it.
<elehack> So 'BatUTF8' will mean to include BatUTF8
<thelema> That might work...
<elehack> 'BatMutex +thread' means only include BatMutex for threaded build
<elehack> We can maintain batteries.ml as a improvement on batteries_uni.ml (with include or open), so the only thing to generate is.mllib files.
<elehack> and the manifest file can do that.
<thelema> well, for the moment I'm okay doing things by hand, although I'll have to put in some doc somewhere all the files that should be changed to add a new module.
<elehack> yeah
<elehack> What needs to happen to get my commit on the release-1.3 branch? Just merge or rebase it over?
<thelema> probably the github wiki
<elehack> sounds like a good idea
<thelema> I'd just cherry pick it. do you want me to do that?
<elehack> sure
<thelema> btw, it'd probably be better to have committed the fix there in the first place - that branch will be merged back with master when it ships
<elehack> ok.
<thelema> I like gitk for ease of cherry picking
<elehack> I haven't tried cherry picking with git; didn't know gitk could help.
* elehack will have to remember that
<elehack> You probably also noticed my push of the lazy list syntax feature branch - the syntax I implemented is quite debatable; it isn't consistent with BatLazyList operators, but I find % more aesthetically pleasing than ^
<elehack> I don't remember if there were technical reasons to prefer % to ^
alexyk has joined #ocaml
<thelema> elehack: right-click on target branch and check it out, then right-click on commit and choose cherry-pick
<elehack> nice
<thelema> I'm find with [% and %:: for lazy lists
<thelema> *fine
<elehack> ok. I think I'll add %:: and %@ (or %@%) operators to BatlazyList in that branch as well then.
<elehack> Should the be added to Pervasives also?
<elehack> *they
<thelema> i.e. let %:: = LazyList.cons?
<thelema> so it's usable outside pattern matches? sounds like a breat idea to me, although what type is the left hand side? a lazy value, a unit function, etc?
<thelema> *great
<elehack> left hand side is just a value
<elehack> at least that's the way it works in my code (I have that definition locally in the code I'm using the syntax extension in)
<thelema> seems reasonable.
<thelema> if anyone wants to improve, they can argue for the improvements
<thelema> I've gotta go, cheers
<elehack> ttylater
joewilliams_away is now known as joewilliams
hnrgrgr has joined #ocaml
hnrgrgr has quit [Client Quit]
hnrgrgr has joined #ocaml
elehack has quit [Quit: Farewell, programs.]
fraggle_ has joined #ocaml
alexyk has quit [Ping timeout: 240 seconds]
trigen has joined #ocaml
menace has quit [Remote host closed the connection]
alexyk has joined #ocaml
ftrvxmtrx has quit [Remote host closed the connection]
Associat0r has quit [Quit: Associat0r]
<alexyk> forgot how to factor out types into .mli: is .mli automatically available to .ml? or do you include it?
<hcarty> alexyk: Types need to be duplicated between the .ml and .mli, with the exception that anything you want to be hidden from outside use shouldn't be exposed in the .mli
<alexyk> hcarty: arrgh... is there a way to somehow include .mli without duplication??
<hcarty> alexyk: Someone posted a camlp5 syntax extension on the mailing list recently
<alexyk> horrors! so ocaml doesn't support specification vs. implementation separation out of the box?
<hcarty> alexyk: That's something of what a .ml and .mli separation provides
gl has joined #ocaml
<alexyk> ah yes, I saw it
<gl> 'lo
ttamttam has quit [Remote host closed the connection]
<alexyk> hmm -- what precludes one to separate types into ziggle_types.ml, and then, from both ziggle.ml and ziggle.mli, include Ziggle_types?
<hcarty> alexyk: 3.12 may offer the ability to do something like that ... create a module from a module type if the module type does not contain any values.
infoe has joined #ocaml
jonafan_ is now known as jonafan
<thelema> hcarty: that's been possible since before 3.12
<thelema> alexyk: if you want to do that, there's no problem.
infoe has quit [Quit: WeeChat 0.3.2]
<alexyk> kk
Yoric has quit [Quit: Yoric]
ikaros has joined #ocaml
<mrvn> I would love to have "type foo = protected ..." to say the type is public in the modules struct but private in the signature.
Associat0r has joined #ocaml
<hcarty> thelema: Ah, cool. I thought that had been added in 3.12.
<hcarty> mrvn: Agreed. That would be really handy.
<mrvn> let protected foo x y = ... too.
<thelema> hcarty: nope, I have used this trick, and I'm not up to 3.12 yet
<mrvn> I basically don't like mli files.
<thelema> mrvn: I just don't like the duplication from mli to ml
<mrvn> or module M : sig ... end = struct ... end where both blocks basically say the same.
<thelema> It violates the DRY principle
<mrvn> yep
orbitz has quit [Ping timeout: 240 seconds]
ulfdoz has joined #ocaml
drunK has joined #ocaml
ftrvxmtrx has joined #ocaml
ftrvxmtrx has quit [Ping timeout: 240 seconds]
avsm has quit [Quit: Leaving.]
ftrvxmtrx has joined #ocaml
jado has quit [Remote host closed the connection]
Edward__ has joined #ocaml
_andre has quit [Quit: leaving]
yezariaely has joined #ocaml
yezariaely has left #ocaml []
<flux> eliom 2.0 seems interesting
<hcarty> flux: Lots of large changes. It sounds impressive.
lpereira has joined #ocaml
<gildor> flux: indeed, just read the announce
<gildor> the removal of ~sp is a big thing
<flux> and they didn't do it with a new monad ;)
<thelema> I'm not so impressed by 9 lines of code to do a simple html page saying hello!, when most web frameworks have that down to 2
<flux> it is true that getting back to writing ocsigen/eliom services always makes me read up documentation
<flux> the way eliom makes links type-check is nice, though
<gildor> thelema: ocsigen is not as mature as other RoR
<gildor> thelema: but it is improving
<flux> but even that basically restricts you into using tuples
<gildor> I like the typed HTML form
<gildor> the action and a lot of other nice small stuff
ygrek has joined #ocaml
Snark has quit [Quit: Ex-Chat]
explodus has quit [Ping timeout: 276 seconds]
explodus has joined #ocaml
orbitz has joined #ocaml
gmarik has joined #ocaml
gmarik has quit [Quit: Leaving.]
gmarik has joined #ocaml
<gmarik> Hey all! Is there a channel for newbies? Reading book now and would like to be able to ask questions
<alpounet> just ask your question
<alpounet> whether it's a tough or easy one
myu2 has quit [Read error: Connection reset by peer]
<gmarik> So basicly i have problem undestanding/parsing this phrase let app = function f -> function x -> f x;;
<alpounet> okay
<alpounet> do you understand this:
<alpounet> let app f x = f x;;
<alpounet> ?
<gmarik> yup, that's what that phrase is equal to
<thelema> app (fun y -> y+1) 3
<alpounet> yes gmarik
<alpounet> now
<alpounet> well, given some f
<alpounet> what would you say `app f' is ?
<thelema> alpounet: probably too early to assume currying
<alpounet> hm, right
<alpounet> gmarik, generally speaking
tnguyen has quit [Read error: Connection reset by peer]
<alpounet> let foo = function a -> something
<gmarik> alpounet: as far as understand it's a partially applied function
<alpounet> *is equivalent to* let foo a = something
<alpounet> alright?
<gmarik> yup
<alpounet> ok so here
<thelema> probably more interesting is app with some side effect: let app f x = let t0 = Sys.time () in let ret = f x in printf "took %4.2f seconds" (Sys.time () -. t0) in ret
<alpounet> let app = function -> f -> function x -> f x
<alpounet> is equivalent to
<alpounet> let app f = function x -> f x
<alpounet> [...] function f -> [...] sorry
<alpounet> itself equivalent to: let app f x = f x
<alpounet> now, the phrase you gave at the beginning can be read as : "app is a function of some f which returns a function of some x that returns `f x'
<gmarik> so my confusion is that in first notation x looks like a function when in the last totation it's not, and what val app : ('a -> 'b) -> 'a -> 'b = <fun> tells
<alpounet> so, you'd think app is just a function of 2 arguments, but actually, as you've seen above, it takes one arguments (f) and when applied to that argument, it returns a function of one argument (x), which when applied to some x returns a value
<alpounet> gmarik, function foo -> bar just means "function taking an argument named 'foo' and returning the expression 'bar'"
<thelema> gm: f:('a->'b) -> x:'a -> 'b
<alpounet> that's all there is to know about this, really
<alpounet> with us so far? :P
<gmarik> i think i get it now! )
<alpounet> now i just want you to notice something about the types
<thelema> gmarik: this shows the value of beating your head on a wall - you can understand ocaml types in this way. :)
<gmarik> Too me it looked like function named x…while is just a function that has a parameter x
<alpounet> you have to be aware that what i said about "seems to take 2 arguments" can be seen on the types directly
<alpounet> so for example
<thelema> # let app ~f ~x = f x;;
<thelema> val app : f:('a -> 'b) -> x:'a -> 'b = <fun>
<alpounet> `(a -> b) -> a -> b' is equivalent to `(a -> b) -> (a -> b)`
<alpounet> that is, it takes a function "from a to b" and returns a function "from a to be"
<alpounet> b*
<gmarik> alpounet: wow…that's kinda confusing...
<alpounet> that's exactly what i said earlier
<alpounet> and can be made clearer with this version of app : let app f = function x -> f x
<alpounet> it takes a function 'f' and returns... a function :)
<alpounet> for a given 'f', 'app f' *is* a function :)
<alpounet> (that's partial application as you said earlier)
<thelema> alpounet: this isn't uncommon, as (+) x is a function
<thelema> for any x
<alpounet> indeed
<alpounet> a good example of such a situation is "the function that always adds 3", that we can write `(+) 3' in OCaml
<gmarik> it's confusing and in same time mind blowing how same function can be expressed in *different* ways. Need to play more with that. Thanks for explanations!
<thelema> gmarik: it's just some syntax sugar
<thelema> it's fundamentally the same
<thelema> (unless you're referring to something other than fun/function/let foo x y =
<alpounet> yeah, practice a lot, that will definitely help you getting your head around this
<alpounet> i would have shown you if i still had mlbot around
<alpounet> but well, just fire the ocaml toplevel and play with simple examples
Edward__ has quit []
mnabil has joined #ocaml
ulfdoz has quit [Ping timeout: 240 seconds]
mnabil has quit [Remote host closed the connection]
Associat0r has quit [Ping timeout: 240 seconds]
ygrek has quit [Ping timeout: 240 seconds]
ikaros has quit [Quit: Leave the magic to Houdini]
gmarik has quit [Ping timeout: 250 seconds]
smerz has quit [Quit: Ex-Chat]
jm has quit [Remote host closed the connection]
<alexyk> thelema: where do I get functions for List.print, those (BatInnerIO.output 'a -> 'b -> unit) -> BatInnerIO.output 'a? Say, for float list and in general?
gmarik has joined #ocaml
gmarik has quit [Client Quit]
gmarik has joined #ocaml
<alexyk> got that -- but how do we control significant digits with Float.print?
groovy2shoes has joined #ocaml
gmarik has quit [Quit: Leaving.]
ccasin has joined #ocaml
boscop has quit [Ping timeout: 240 seconds]
vk0 has quit [Ping timeout: 260 seconds]
vk0 has joined #ocaml
BiDOrD has quit [Ping timeout: 276 seconds]
lpereira has quit [Quit: Leaving.]
<thelema> alexyk: hmm, I remember adding a way in the print syntax extension...
<thelema> you're right, we need similar in Float.print
<alexyk> thelema: so for now I have to fall back on printf "%5.3f" or such?
ccasin has quit [Ping timeout: 255 seconds]