mbishop changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab OCaml 3.10.2 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
ikaros has joined #ocaml
loufoque has quit [Remote closed the connection]
mwc has left #ocaml []
Axioplase has quit ["night"]
mwc has joined #ocaml
_PenPen_ has quit ["Ex-Chat"]
bzzbzz has quit ["leaving"]
ikatz has joined #ocaml
ikaros has quit ["segfault"]
thelema has joined #ocaml
|Catch22| has quit []
mwc has quit ["Leaving"]
jlouis has quit [Remote closed the connection]
StoneNote has quit [Read error: 104 (Connection reset by peer)]
coucou747 has quit ["bye ca veut dire tchao en anglais"]
Smerdyakov has quit ["Leaving"]
middayc_ has joined #ocaml
middayc has quit [Read error: 110 (Connection timed out)]
|Catch22| has joined #ocaml
cbrannon has joined #ocaml
middayc_ has quit []
schme has joined #ocaml
AxleLonghorn has joined #ocaml
schme has quit ["bfirc sucks."]
musically_ut has quit [Remote closed the connection]
mwc has joined #ocaml
<palomer> is it possible to pattern match the start of a string like in haskell?
<palomer> like head_of_string "foo" :: x = "foo"
<thelema> palomer: match "string" with x when String.starts_with x "str" -> true
<palomer> what about
<palomer> head_of_string (x::xs) = x (* haskell syntax*)
<cbrannon> palomer: The obvious first try is ... let head x = match x with "" -> failwith "empty" | hd ^ tl -> hd;; but that doesn't work.
<palomer> righto!
<palomer> can when take many clauses?
<palomer> yes, it can!
<palomer> so the head_of_string can't be implemented with pattern matching?
<thelema> strings aren't lists.
<thelema> I'm not sure what you want to do. :: generates a list.
<cbrannon> palomer: I think the reason it works in Haskell is that a string is just a synonym for [char]
<thelema> when takes one argument, but that argument can compound as much as you want with && and ||
<palomer> cbrannon, yeah
<palomer> what's the difference between when and if?
<thelema> palomer: when goes inside a match clause
<palomer> ahh
<palomer> so it's like haskell guards
<thelema> and restricts when that branch of the match applies.
<thelema> probably.
<mwc> thelema, exactly, actually
<palomer> what's the official function definition syntax?
<mwc> let foo a b = ... IMAO
<palomer> but then you have patterns
<mwc> there's fun for lambdas, and function which saves you a match ... with
<palomer> let foo (a::b) c = ... | a [] = ...
<thelema> three syntaxes:
<thelema> (fun patt1 ... pattn = expr)
<mwc> ie: let foo a = match a with ... => let foo = function ...
<thelema> (function patt1 -> expr1 | patt2 -> expr2 | ... | pattn -> exprn)
<thelema> and let name patt1 .. pattn = expr (shortcut for binding first pattern)
<thelema> (fun patt1 ... pattn -> expr) (should be ->, not =)
<palomer> when patt1 .. pattn starts with |
<palomer> (optional in patt1)
<thelema> ?
<thelema> optional | when doing [function | patt1 -> expr1 ...]
<thelema> no | in either fun or let.
<palomer> ahh, my bad
<thelema> If I felt really reductionist, there's only (fun patt1 -> expr), with multiple arguments just as syntactic sugar.
AxleLonghorn has left #ocaml []
hkBst has joined #ocaml
pants2 has joined #ocaml
pants1 has quit [Read error: 110 (Connection timed out)]
mwc has quit [Remote closed the connection]
Mr_Awesome has joined #ocaml
hkBst has quit [brown.freenode.net irc.freenode.net]
cbrannon has quit [brown.freenode.net irc.freenode.net]
dibblego has quit [brown.freenode.net irc.freenode.net]
yminsky_ has quit [brown.freenode.net irc.freenode.net]
jdev has quit [brown.freenode.net irc.freenode.net]
ikatz has quit [brown.freenode.net irc.freenode.net]
szell has quit [brown.freenode.net irc.freenode.net]
neale has quit [brown.freenode.net irc.freenode.net]
zmdkrbou has quit [brown.freenode.net irc.freenode.net]
petchema has quit [brown.freenode.net irc.freenode.net]
pattern has quit [brown.freenode.net irc.freenode.net]
authentic has quit [brown.freenode.net irc.freenode.net]
ozzloy_ has quit [brown.freenode.net irc.freenode.net]
evn_ has quit [brown.freenode.net irc.freenode.net]
evn has quit [brown.freenode.net irc.freenode.net]
palomer has quit [brown.freenode.net irc.freenode.net]
rwmjones has quit [brown.freenode.net irc.freenode.net]
mattam has quit [brown.freenode.net irc.freenode.net]
fremo has quit [brown.freenode.net irc.freenode.net]
jeremiah has quit [brown.freenode.net irc.freenode.net]
cmeme has quit [brown.freenode.net irc.freenode.net]
Oatschool has quit [brown.freenode.net irc.freenode.net]
bla has quit [brown.freenode.net irc.freenode.net]
unfo- has quit [brown.freenode.net irc.freenode.net]
vincenz has quit [brown.freenode.net irc.freenode.net]
mbishop has quit [brown.freenode.net irc.freenode.net]
donny__ has quit [brown.freenode.net irc.freenode.net]
gim has quit [brown.freenode.net irc.freenode.net]
netx has quit [brown.freenode.net irc.freenode.net]
ulfdoz has quit [brown.freenode.net irc.freenode.net]
thelema has quit [brown.freenode.net irc.freenode.net]
r0bby has quit [brown.freenode.net irc.freenode.net]
__suri_ has quit [brown.freenode.net irc.freenode.net]
det has quit [brown.freenode.net irc.freenode.net]
seafood has quit [brown.freenode.net irc.freenode.net]
Dazhbog has quit [brown.freenode.net irc.freenode.net]
Naked has quit [brown.freenode.net irc.freenode.net]
qwr has quit [brown.freenode.net irc.freenode.net]
flux has quit [brown.freenode.net irc.freenode.net]
|Catch22| has quit [brown.freenode.net irc.freenode.net]
shortcircuit has quit [brown.freenode.net irc.freenode.net]
ertai has quit [brown.freenode.net irc.freenode.net]
romanoffi has quit [brown.freenode.net irc.freenode.net]
svenl has quit [brown.freenode.net irc.freenode.net]
guyzmo has quit [brown.freenode.net irc.freenode.net]
dwmw2_gone has quit [brown.freenode.net irc.freenode.net]
Ugarte has quit [brown.freenode.net irc.freenode.net]
goalieca has quit [brown.freenode.net irc.freenode.net]
pango_ has quit [brown.freenode.net irc.freenode.net]
Jedai has quit [brown.freenode.net irc.freenode.net]
TaXules has quit [brown.freenode.net irc.freenode.net]
hcarty has quit [brown.freenode.net irc.freenode.net]
acatout has quit [brown.freenode.net irc.freenode.net]
bebui has quit [brown.freenode.net irc.freenode.net]
ahf has quit [brown.freenode.net irc.freenode.net]
pants2 has quit [brown.freenode.net irc.freenode.net]
rey_ has quit [brown.freenode.net irc.freenode.net]
tsuyoshi has quit [brown.freenode.net irc.freenode.net]
huh_ has quit [brown.freenode.net irc.freenode.net]
pants2 has joined #ocaml
hkBst has joined #ocaml
cbrannon has joined #ocaml
thelema has joined #ocaml
ikatz has joined #ocaml
authentic has joined #ocaml
goalieca has joined #ocaml
Oatschool has joined #ocaml
unfo- has joined #ocaml
bla has joined #ocaml
mbishop has joined #ocaml
ozzloy_ has joined #ocaml
evn_ has joined #ocaml
evn has joined #ocaml
pango_ has joined #ocaml
r0bby has joined #ocaml
Jedai has joined #ocaml
szell has joined #ocaml
palomer has joined #ocaml
ulfdoz has joined #ocaml
rwmjones has joined #ocaml
donny__ has joined #ocaml
dibblego has joined #ocaml
Naked has joined #ocaml
gim has joined #ocaml
vincenz has joined #ocaml
yminsky_ has joined #ocaml
rey_ has joined #ocaml
neale has joined #ocaml
shortcircuit has joined #ocaml
__suri_ has joined #ocaml
ertai has joined #ocaml
jdev has joined #ocaml
det has joined #ocaml
mattam has joined #ocaml
fremo has joined #ocaml
zmdkrbou has joined #ocaml
jeremiah has joined #ocaml
netx has joined #ocaml
pattern has joined #ocaml
petchema has joined #ocaml
ahf has joined #ocaml
cmeme has joined #ocaml
qwr has joined #ocaml
seafood has joined #ocaml
Dazhbog has joined #ocaml
Ugarte has joined #ocaml
svenl has joined #ocaml
dwmw2_gone has joined #ocaml
romanoffi has joined #ocaml
flux has joined #ocaml
guyzmo has joined #ocaml
bebui has joined #ocaml
hcarty has joined #ocaml
huh_ has joined #ocaml
acatout has joined #ocaml
TaXules has joined #ocaml
tsuyoshi has joined #ocaml
kelaouchi has quit [Connection reset by peer]
l_a_m has joined #ocaml
kelaouchi has joined #ocaml
det has quit ["Leaving"]
ikaros has joined #ocaml
cbrannon has quit ["leaving"]
jsk has joined #ocaml
<rwmjones> is there a way to assert *at compile time* that the code must be compiled on a 64 bit arch?
<rwmjones> best I've come up with is to add a 16M+1 length string constant, which is obviously not ideal
evn_ has quit []
<rwmjones> hcarty, thanks for those bug reports, I'll take a look at them later today
Oatschool has quit [brown.freenode.net irc.freenode.net]
bla has quit [brown.freenode.net irc.freenode.net]
unfo- has quit [brown.freenode.net irc.freenode.net]
ttamttam has joined #ocaml
unfo- has joined #ocaml
bla has joined #ocaml
Oatschool has joined #ocaml
coucou747 has joined #ocaml
Oatschool has quit [brown.freenode.net irc.freenode.net]
bla has quit [brown.freenode.net irc.freenode.net]
bla has joined #ocaml
Oatschool has joined #ocaml
ygrek has joined #ocaml
OChameau has joined #ocaml
goalieca has quit [Remote closed the connection]
mqtt has joined #ocaml
pants2 has quit [Read error: 110 (Connection timed out)]
pants1 has joined #ocaml
Yoric[DT] has joined #ocaml
donny has joined #ocaml
middayc has joined #ocaml
donny__ has quit [Read error: 110 (Connection timed out)]
Tetsuo has joined #ocaml
ikaros_ has joined #ocaml
det has joined #ocaml
ikaros has quit [Read error: 110 (Connection timed out)]
ikaros_ has quit [Remote closed the connection]
kelaouch1 has joined #ocaml
prince has joined #ocaml
kelaouch1 has quit [Read error: 110 (Connection timed out)]
jlouis has joined #ocaml
<petchema> rwmjones: Sys.word_size would be slightly better, otherwise I'd use `ocamlc -where`/caml/config.h
<rwmjones> i want the compile to fail though
<petchema> Makefile could involve compiling then running some C program to check if ARCH_SIXTYFOUR is defined... I can't think of a better way atm
Smerdyakov has joined #ocaml
bongy has joined #ocaml
bongy has quit [Client Quit]
<flux> rwmjones, how about a simple 60-bit integer literal?
<flux> shouldn't the compiler say that integer literal exceeds platform precision or something to that effect..
<rwmjones> hmmm yes that might work
Smerdyakov has quit ["Leaving"]
ttamtta1 has joined #ocaml
ttamttam has quit [Read error: 110 (Connection timed out)]
<rwmjones> flux yes that works, thanks!
<rwmjones> let test = 5_000_000_000;;
<rwmjones> on 32 bit: Integer literal exceeds the range of representable integers of type int
middayc_ has joined #ocaml
middayc has quit [Read error: 110 (Connection timed out)]
bongy has joined #ocaml
ikaros has joined #ocaml
<hcarty> rwmjones: You are welcome re: the bug reports. Thanks for the quick replies/fixes.
<rwmjones> hcarty, no problem, but I think the CIL report needs to go upstream. OTOH it requires fixing their build system which is going to be a major effort for anyone who undertakes it
<rwmjones> so maybe best just to leave it :-)
bluestorm has joined #ocaml
ttamtta1 has left #ocaml []
pango_ has quit [Remote closed the connection]
jlouis has quit ["brb, new kernel"]
pango_ has joined #ocaml
jlouis has joined #ocaml
ygrek has quit [Remote closed the connection]
thelema has quit [Read error: 110 (Connection timed out)]
ygrek has joined #ocaml
marmottine has joined #ocaml
bongy has quit ["Leaving"]
mqtt has quit ["Leaving."]
^authentic has joined #ocaml
authentic has quit [Read error: 110 (Connection timed out)]
^authentic is now known as authentic
jonafan has joined #ocaml
bongy has joined #ocaml
zkincai1 has joined #ocaml
middayc_ has quit []
<zkincai1> yminksy_: Hi, are you around?
thelema has joined #ocaml
postalchris has joined #ocaml
<rwmjones> No level labelled ";" in entry "expr"
<rwmjones> expr: LEVEL ";" [ ... ]
<rwmjones> first is an error message, second is a camlp4 fragment
<rwmjones> any idea how to list the levels?
<bluestorm> don't you need an additionnal bracket level ?
<bluestorm> rwmjones: try expr: LEVEL ";" [[ ... ]]
<rwmjones> sorry, yes I have that
<rwmjones> the error is produced when compiling a source file which is trying to use the syntax extension
<bluestorm> hm
<bluestorm> then your compile command must be wrong
<bluestorm> have you loaded any ocaml syntax before your code ?
<bluestorm> (you should have)
<rwmjones> camlp4 pa_bitmatch.cmo -printer pr_o.cmo foo.ml
<rwmjones> ah ha, camlp4o instead of camlp4
<rwmjones> thanks :-)
<bluestorm> btw, camlp4 pr_o.cmo would work too
<bluestorm> hm, pa_o.cmo
<flux> as a part of a school assignment I'm writing a smallish (common) lisp program.. and I must say its macro facilities are quite a bit more easy to use than ocaml's
<flux> the syntax explains it, naturally
<bluestorm> of course
<bluestorm> as caml syntax has lot of structure, it is heavier to manipulate
<bluestorm> flux: on the other hand, it's "safer" in some sense
<bluestorm> because some part of the information is encoded through the syntax, and checked (eg. that what your macro put there is a correct pattern, and not an expression)
evn has left #ocaml []
<bluestorm> flux: there is a camlp5 lisp/scheme syntax
<bluestorm> it may be possible to create lispish macros for these syntax
<bluestorm> (iirc the Liskell guys managed to add macros)
r0bby has quit [Read error: 104 (Connection reset by peer)]
bongy has quit ["Leaving"]
goalieca has joined #ocaml
OChameau has quit [Read error: 113 (No route to host)]
<rwmjones> ok, here's another camlp4 question ...
<rwmjones> qualifiers: [
<rwmjones> [ LIST0 [ q = LIDENT -> q ] SEP "," ]
<rwmjones> ];
<rwmjones> field: [
<rwmjones> [ name = LIDENT; ":"; len = expr LEVEL "top";
<rwmjones> qs = OPT [ ","; qualifiers ] ->
<rwmjones> output_field _loc name len qs
<rwmjones> ]
<rwmjones> ];
<rwmjones> in the above, 'qs' has type unit option
<rwmjones> (according to the compiler)
<rwmjones> how do I extract the list of identifiers?
Smerdyakov has joined #ocaml
<bluestorm> hm
<bluestorm> rwmjones: qs = OPT [ ","; qs = qualifiers -> qs ] ?
<rwmjones> I've tried a million different variations, let me try that one now
<rwmjones> ah that works, thanks
<rwmjones> I think my previous variation was somethng like:
<rwmjones> qs = OPT [ ","; [ qs = qualifiers -> qs ] ]
<rwmjones> the extra [ .. ] stopped it from working
<rwmjones> this stuff needs documentation ......
<bluestorm> rwmjones: there is a wiki (now you should feel responsible for not updating it, hehe)
derenrich has joined #ocaml
Demitar has joined #ocaml
<derenrich> I have a tuple x which is "int ref * float = ({contents = 2}, 2.) ", why doesn't x := 3,3.0;; work?
jdev has quit [Read error: 104 (Connection reset by peer)]
<flux> it should be (int * float) ref for that to work
<pango_> because x is not a reference?
<derenrich> ah, ok
<flux> with your type fst x := 3 would work
middayc has joined #ocaml
r0bby has joined #ocaml
ttamttam has joined #ocaml
schme has joined #ocaml
jlouis_ has joined #ocaml
jdev has joined #ocaml
middayc has quit []
zkincai1 has left #ocaml []
jlouis has quit [Read error: 110 (Connection timed out)]
derenrich has quit [Read error: 110 (Connection timed out)]
<rwmjones> the revised syntax is driving me up the wall
<rwmjones> try
<rwmjones> ()
<rwmjones> with [ Exit -> () ];
<rwmjones> #File "pa_bitmatch.ml", line 127, characters 11-15:
<rwmjones> While expanding quotation "expr" in a position of "expr":
<rwmjones> Parse error: "]" or [sem_patt_for_list] expected after "[" (in [patt])
<rwmjones> (at the 'Exit' part)
schme has quit ["bfirc sucks."]
<bluestorm> rwmjones: you code sample is correct
<bluestorm> (wrt. ocaml camlp4r.cma at least)
jlouis__ has joined #ocaml
<rwmjones> ok this is my code:
<rwmjones> error is at the first Exit
<rwmjones> File "pa_bitmatch.ml", line 131, characters 13-17:
<rwmjones> While expanding quotation "expr" in a position of "expr":
<rwmjones> Parse error: "]" or [sem_patt_for_list] expected after "[" (in [patt])
<rwmjones> or rather, at the only 'Exit'
<bluestorm> hm
<rwmjones> maybe I shouldn't be using the revised syntax here?
<bluestorm> ok, so this is an expression
<bluestorm> rwmjones: how do you compile ?
<rwmjones> ocamlc -I +camlp4 camlp4lib.cma -pp camlp4of.opt -c pa_bitmatch.ml -o pa_bitmatch.cmo
<bluestorm> you can use both revised or classical syntax in quotes
<bluestorm> hmm
<rwmjones> how does it know which to use?
<bluestorm> i'm sure that camlpoof use the classical, and ocalmorf the revised
<bluestorm> (and camlp4rf the revised for both the outside and the inside)
<bluestorm> not sure about camlp4of though
<rwmjones> yes ... I think the original syntax is ok
<rwmjones> which is good
* rwmjones despises the revised syntax
<bluestorm> i quite like the revised syntax actually
<bluestorm> the additionnal curryfication at variant constructors, types and functors is really nice
bongy has joined #ocaml
<bluestorm> other things (ugly list syntax, tanglified ';'-sequences) are not so good but it's a matter of compromise :p
thermoplyae has joined #ocaml
jlouis_ has quit [Read error: 110 (Connection timed out)]
brooksbp has joined #ocaml
<palomer> http://ocaml.pastebin.com/m1f6fb468 <--how could I possibly be getting this error message?
middayc has joined #ocaml
<palomer> I thought the methods would be inherited
ygrek has quit [Remote closed the connection]
<thelema> where do "get_right_sibling" and "get_left_sibling" come from?
<palomer> ahhh, i only defined the setters
^authentic has joined #ocaml
<palomer> (a sure sign that I shouldn't be programming right now)
bongy has quit ["Leaving"]
authentic has quit [Read error: 110 (Connection timed out)]
^authentic is now known as authentic
marmottine has quit [Remote closed the connection]
Snark has joined #ocaml
Snark has quit [Read error: 104 (Connection reset by peer)]
brooksbp has quit []
Axioplase has joined #ocaml
ttamttam has left #ocaml []
Morphous_ has joined #ocaml
ita has joined #ocaml
brooksbp has joined #ocaml
brooksbp has quit []
jlouis_ has joined #ocaml
Morphous has quit [Read error: 110 (Connection timed out)]
psnively has joined #ocaml
brooksbp has joined #ocaml
jlouis__ has quit [Connection timed out]
brooksbp has quit [Read error: 104 (Connection reset by peer)]
brooksbp has joined #ocaml
hkBst has quit ["Konversation terminated!"]
pmdboi has joined #ocaml
|Catch22| has joined #ocaml
<pmdboi> hey, can someone help me with an ocaml scoping thing?
<pmdboi> is what i'm working on
<pmdboi> and it's essentially complaining that it can't unify the types "Lang.stm" and "stm" within the file "lang.ml"...
<pmdboi> there's a function in another file that returns Lang.stm list
brooksbp has quit []
middayc has left #ocaml []
<pango_> I'm not sure, but I think there's a dependancy loop between Lang and Parser... I'm move the Lang types in their own module
<pango_> s/I'm/I'd/
<pmdboi> yeah, i think that's probably right
<pmdboi> i think this is a minimal example of the problem
<pmdboi> i'll shift stuff around :)
<pango_> If that's the case, the compiler message is not particularly enlighting
<pmdboi> hehe, true
ofaurax has joined #ocaml
evn has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
evn has left #ocaml []
Axioplase has quit ["you touch my tralalambda"]
cbrannon has joined #ocaml
ikaros has quit ["segfault"]
middayc_ has joined #ocaml
Tetsuo has quit ["Leaving"]
ofaurax has quit ["Leaving"]
postalchris has quit [Connection timed out]
brooksbp has joined #ocaml
psnively has quit []
jlouis_ has quit ["Leaving"]
coucou747 has quit ["bye ca veut dire tchao en anglais"]
brooksbp has quit []