<cornihilio>
ousado: thanks for pointing that out!
nixfreak has joined #ocaml
<cornihilio>
also, I'm using tuareg in emacs, but when I have an error it reports the characters x-y instead of the line numbers. how do I fix that?
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
eikke has quit [Ping timeout: 255 seconds]
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
emmanuelux has quit [Quit: emmanuelux]
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
<cornihilio>
can someone help me understand how to use print_endline for debugging? I am trying to double check this function is working https://gist.github.com/4138019 and the print_endline is changing the type of the function for some reason
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
BiDOrD has joined #ocaml
<cornihilio>
I thought print_endline worked by side effects so it wouldn't do that...
BiDOrD_ has quit [Ping timeout: 276 seconds]
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
madroach has quit [Ping timeout: 244 seconds]
madroach has joined #ocaml
<cornihilio>
hello/
vbmithr has quit [Ping timeout: 245 seconds]
vbmithr has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
<Ptival>
cornihilio: print_endline : string -> unit
<Ptival>
but your p seems to have type list int or something
nixfreak has quit [Ping timeout: 252 seconds]
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
<Ptival>
so instead you want to do something like... print_endline (String.concat ", " (List.map string_of_int p)); (* for instance... *)
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
Yoric has joined #ocaml
nixfreak has joined #ocaml
lolcathost has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
hongboz has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
sivoais has quit [Ping timeout: 245 seconds]
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
<cornihilio>
Ptival: thank you for your help!
<cornihilio>
why does the print_endline require a semicolon?
mattrepl has quit [Quit: mattrepl]
dwmw2_gone has quit [Excess Flood]
<Ptival>
cornihilio: in some sense, you use a semicolon to sequence actions, the last of which returns its value for the whole sequence
<cornihilio>
it seems like I can only put print statements right after the initial let declaration/before the immediate next one at the top of my functions
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
<cornihilio>
also, why do I have to do String.length and List.length instead of just length? Doesn't parametric polymorphism make that unnecessary?
<cornihilio>
exist instead*
<Ptival>
so
<Ptival>
1. the problem in the code you put is that things are parsed differently than what you expect
<Ptival>
namely
<Ptival>
if foo then bar; baz else qux is parsed (if foo then bar); baz else qux which does not make sense
<Ptival>
you want to write:
<Ptival>
if foo then (bar; baz) else qux
<Ptival>
or
<Ptival>
if foo then begin bar; baz end else qux
<Ptival>
2. No, String.length and List.length are computationally different, because OCaml strings are not represented as lists of asciis, but as something more clever/efficient
<Ptival>
What could solve the problem would be some sort of ad-hoc polymorphism à la Haskell (with a typeclass for things which have a length...), but it does not exist in OCaml and is not that interesting even then
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
<cornihilio>
Ptival: thank you so much! those answers really help clear things up for me.
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
lolcathost has quit [Ping timeout: 245 seconds]
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
lolcathost has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
wormphlegm has quit [Read error: Connection reset by peer]
wormphlegm has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
Playground has joined #ocaml
lolcathost has quit [Read error: Connection reset by peer]
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
answer_42 has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
nixfreak has quit [Ping timeout: 245 seconds]
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
everyonemines has joined #ocaml
wormphlegm has quit [Read error: Connection reset by peer]
wormphlegm has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
hongboz has quit [Ping timeout: 252 seconds]
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
Cyanure has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
<cornihilio>
why is a ref [] being turned into a Hashtbl?
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
astertronistic has joined #ocaml
<adrien>
dwmw2_gone: you need to fix your connection
<adrien>
dwmw2_gone: actually, not your connection but your client so that it doesn't flood on reconnections
dwmw2_gone has quit [Excess Flood]
dwmw2_gone has joined #ocaml
dwmw2_gone was kicked from #ocaml by adrien [please fix your client so that it doesn't "excess flood"]
Cyanure has quit [Remote host closed the connection]
k0001 has joined #ocaml
Kakadu has joined #ocaml
<cornihilio>
why am I getting "| n -> (fib_slow (n - 1)) + (fib_slow (n - 2)) Error: This expression is not a function; it cannot be applied" in this code: https://gist.github.com/4138798?
<cornihilio>
it seems like the last part "print_endline (string_of_int (fib_slow 10000))" causes flymake to highlight an error in the earlier function definition, which makes no sense to me
cdidd has joined #ocaml
<adrien>
cornihilio: the issue is that you're mixing two styles of inputing ocaml code
<adrien>
first you define a function and write code "script-like"
<adrien>
well, that was clearer in my head
<adrien>
anyway, you need to either put ";;" between the two blocks of code, or prepend "let () = " to the last line
<adrien>
there's nothing that tells it there is a break in your current code
<cornihilio>
adrien: thank you so much for that explanation!
Yoric has quit [Ping timeout: 252 seconds]
Playground has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
lolcathost has joined #ocaml
k0001 has quit [Ping timeout: 244 seconds]
<cornihilio>
if I have a context-free grammar like this: https://gist.github.com/4138860 how do I represent it in the ocaml type system? is there an example of something similar to this? my google-fu is incredibly weak today
everyonemines_ has joined #ocaml
everyonemines_ has quit [Client Quit]
everyonemines has quit [Ping timeout: 260 seconds]
<cornihilio>
man after haskell ocaml seemed really easy to learn but now I've run up against the same wall I think :(
<cornihilio>
I guess I really don't understand the type system as well as I should
<adrien>
well, you can ask questions about it
<adrien>
I'm going to leave soonish but other people will wake up
<Kakadu>
cornihilio: So what is problem in representing grammar in type system?
leoncamel has quit [Ping timeout: 252 seconds]
k0001 has joined #ocaml
<cornihilio>
err.. it's not intuitive for me
<cornihilio>
I'm still trying though, I think I've almost got it
<cornihilio>
also... if a constructor isn't a function, than what is it?
<Kakadu>
The was long time ago a big discussion where X.Leroy eplained why constructors are not functions in OCaml
<Kakadu>
explained*
<Kakadu>
s/explined/was explaining/
Yoric has joined #ocaml
k0001 has quit [Ping timeout: 256 seconds]
rixed has quit [Ping timeout: 255 seconds]
cornihilio has quit [Ping timeout: 264 seconds]
Neros has quit [Remote host closed the connection]
Cyanure has joined #ocaml
justdit has joined #ocaml
andreypopp has joined #ocaml
tane has joined #ocaml
tane has quit [Remote host closed the connection]
Snark has joined #ocaml
Anarchos has joined #ocaml
astertronistic has quit [Ping timeout: 245 seconds]
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
xavierm02 has joined #ocaml
Anarchos has joined #ocaml
emmanuelux has joined #ocaml
iratsu is now known as alang_
tane has joined #ocaml
xavierm02 has quit [Ping timeout: 255 seconds]
sepp2k has joined #ocaml
mye has joined #ocaml
xavierm02 has joined #ocaml
spearalot has joined #ocaml
Yoric has quit [Ping timeout: 244 seconds]
lolcathost has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
Kakadu has quit []
mye has quit [Quit: mye]
bru has joined #ocaml
mye has joined #ocaml
lolcathost has joined #ocaml
lolcathost has quit [Ping timeout: 264 seconds]
leoncamel has joined #ocaml
sivoais has joined #ocaml
<bru>
Hi! I'm still having problems with omake… (actually, the same as the other day)
<bru>
There's this types.mli that defines types used in several parts of my project
<bru>
it was basically in src/
<bru>
Several files in src/ require it
<bru>
There's also the subdir src/parser/ which needs it
<bru>
so I put INCLUDES += .. in src/parser/OMakefile, but it did not succeed: I need a .cmi file, not a .mli
<bru>
How can I produce this .cmi? in shell, just typing "ocamlc types.mli" will do it, but not through OMakefiles (with OCamlProgram(types, types) or OCamlLibrary(types,types) for example)
<bru>
I decided to put types.mli in its own folder, and try to compile it by itself, and then include types/ in src/OMakefile and src/parser/OMakefile… but without success
<bru>
Does anyone know how I can fix this problem?
<bru>
I went through the docs without finding a solution
mye has quit [Quit: mye]
iZsh has quit [Quit: Coyote finally caught me]
cornihilio has joined #ocaml
andreypopp has quit [Quit: sleep]
andreypopp has joined #ocaml
eikke has joined #ocaml
jr`` has joined #ocaml
SpiceGuid has joined #ocaml
andreypopp has quit [Quit: sleep]
ousado is now known as opportunist
andreypopp has joined #ocaml
leoncamel has quit [Ping timeout: 255 seconds]
nixfreak has joined #ocaml
andreypopp has quit [Quit: sleep]
Yoric has joined #ocaml
pango has quit [Ping timeout: 244 seconds]
SpiceGuid has quit [Quit: Page closed]
<cornihilio>
I'm trying to create a function to work with a context-free grammar and I'm really screwing something up... this is what I have right now: https://gist.github.com/4140279
pango has joined #ocaml
nixfreak has quit [Quit: Lost terminal]
leoncamel has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
mattrepl has joined #ocaml
opportunist is now known as ousado
<cornihilio>
huh... it works actually, but for some reason flymake is erroneously complaining about a syntax error that ocamlc can't find.
<cornihilio>
I want to say it's a bug of tuareg-mode, but I'm still pretty sure I'm doing something wrong
astertronistic has joined #ocaml
UncleVasya has joined #ocaml
astertronistic has quit [Quit: Leaving]
walter has quit [Ping timeout: 265 seconds]
walter|r has joined #ocaml
<ousado>
cornihilio: you probably wanna use pattern matching there
tac has joined #ocaml
ontologiae has joined #ocaml
<cornihilio>
ousado: thanks for the suggestion, but could you be more specific?
<ousado>
cornihilio: match lst with [] -> (*empty*) | head::tail -> (*whatever*)
<ousado>
instead of if else List.hd etc.
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
<ousado>
also you might prefer String.iter over that loop
gnuvince has quit [Quit: Remember when men were men and regular expressions recognized regular languages?]