<please_help>
sgronblo: consider this dummy example: let rec fn = function | 0 -> !some_global | x -> for i = 0 to (List.length !some_global) do do_something () done; some_global := x :: !some_global; fn (x - 1);;
l1x has joined #ocaml
reynir has joined #ocaml
l1x has quit [Changing host]
l1x has joined #ocaml
c-c is now known as Guest8835
fraggle__ has joined #ocaml
mawuli has joined #ocaml
yminsky_ is now known as yminsky
fluter has joined #ocaml
cantstanya has joined #ocaml
NhanH_ is now known as NhanH
lpaste has joined #ocaml
kalzz has joined #ocaml
<sgronblo>
so for that case you have fn (x - 1) as the final return value so it should be tail recursive?
darius93 has joined #ocaml
<please_help>
yes, `fn` is tail recursive.
emmanueloga has joined #ocaml
pootler_ has joined #ocaml
<please_help>
except in do_something, that is.
jfntn has quit [Ping timeout: 264 seconds]
rfv has joined #ocaml
mariusae has joined #ocaml
S11001001 has joined #ocaml
cojy has joined #ocaml
ggherdov has joined #ocaml
stephe has joined #ocaml
<sgronblo>
well I feel like I am too stupid currently to figure out which part has a stack overflow...
lobo has quit [Quit: leaving]
<sgronblo>
if only i had a stack trace
<please_help>
Compile with -g and set environment variable OCAMLRUNPARAM=b
<sgronblo>
please_help: I'm running this in my web browser :(
jfntn has joined #ocaml
minus4 has joined #ocaml
<sgronblo>
would have liked to figure this out before going to bed but i guess i have to give up now
madroach has quit [Ping timeout: 246 seconds]
madroach has joined #ocaml
<please_help>
you might want to test your functions in isolation then.
<sgronblo>
pierpa: did you use your own find implementation in solve' ?
Sorella has quit [Quit: Connection closed for inactivity]
<sgronblo>
most of my functions seem tail recursive but i might be mistaken
<sgronblo>
not sure if anyone has the time to help but here is the solution: http://pastebin.com/vJ5Che06 i would love to have some hint about where to look to weed out the stack overflow
<sgronblo>
im gussing solve_klotski -> solve_puzzle -> solve_path' -> solve -> stack overflow but i am not sure
<sgronblo>
that should be solve'
kakadu has quit [Remote host closed the connection]
rpg has joined #ocaml
Leonidas_ is now known as Leonidas
jrslepak has quit [Quit: This computer has gone to sleep]
<please_help>
range_0's go is not tail-recursive, but I don't think it should matter.
govg has quit [Ping timeout: 276 seconds]
<please_help>
deoptionalize is not tail-recursive either
ryanartecona has quit [Quit: ryanartecona]
<please_help>
I don't see offhand anything that would cause a stackoverflow though.
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
rpg has quit [Quit: rpg]
<mrvn>
List.map in the stdlib isn't tail recursive I think
cody` has quit [Quit: Connection closed for inactivity]
<mrvn>
replace List.map with List.rev (List.map f l)
<mrvn>
rev_map I mean
Haudegen has quit [Ping timeout: 260 seconds]
struk|desk|away is now known as struk|desk
Stalkr_ has joined #ocaml
Stalkr^ has quit [Ping timeout: 265 seconds]
Haudegen has joined #ocaml
JacobEdelman has quit [Quit: Connection closed for inactivity]
Stalkr_ has quit [Quit: Leaving...]
jrslepak has joined #ocaml
<please_help>
Or, use Core (or batteries).
pyon has quit [Quit: Loops are hard, let's GOTO shopping!]
pyon has joined #ocaml
pyon has quit [Client Quit]
pyon has joined #ocaml
pyon has quit [Client Quit]
pyon has joined #ocaml
struk|desk2 has joined #ocaml
pyon has quit [Quit: Okay, this time for realsies.]
pyon has joined #ocaml
struk|desk has quit [Ping timeout: 245 seconds]
<pierpa>
sgronblo: yes
minus4 has quit [Quit: minus4.info]
struk|desk2 is now known as struk|desk|away
struk|desk|away is now known as struk|desk2
<pierpa>
sgronblo: I think the problem may be in your archive_map.
<pierpa>
Also, your final is wrong
govg has joined #ocaml
teknozulu has quit [Read error: Connection reset by peer]
teknozulu has joined #ocaml
JacobEdelman has joined #ocaml
teknozulu has quit [Read error: Connection reset by peer]
teknozulu has joined #ocaml
badon has quit [Quit: Leaving]
struk|desk2 is now known as struk|desk|away
jfntn has left #ocaml ["ERC (IRC client for Emacs 24.5.1)"]
badon has joined #ocaml
pyon has quit [Quit: Loops are hard, let's GOTO shopping!]
pyon has joined #ocaml
lostman has joined #ocaml
<lostman>
hi all. I'm trying to compile some packages but I'm getting "Error: Unbound module Conduit_async_ssl". I don't know how to compile conduit with that module included. Tried reinstalling several times but doesn't work
<jyc>
if you do `opam info` does it say something about optional dependencies? One of those might be required for that to be enabled
relrod_ is now known as relrod
<jyc>
I remember running into a similar problem
<lostman>
in depopts it says async async_ssl so I tried to do `DEPOPTS="async async_ssl" opam reinstall ssl conduit async` in hopes it'll pick up whatever it needs to pick up but that didn't work
<lostman>
also thrown in tls for good measure as it may be handy later
agumonkey has quit [Ping timeout: 255 seconds]
mac10688 has quit [Ping timeout: 260 seconds]
struk|desk|away is now known as struk|desk2
FreeBirdLjj has joined #ocaml
mcmillhj has quit [Quit: Lost terminal]
pierpa has quit [Ping timeout: 255 seconds]
troydm has quit [Ping timeout: 246 seconds]
darkf has joined #ocaml
troydm has joined #ocaml
ggole has joined #ocaml
ggole_ has joined #ocaml
ggole has quit [Ping timeout: 264 seconds]
ggole__ has joined #ocaml
ggole_ has quit [Ping timeout: 264 seconds]
ggole_ has joined #ocaml
ggole__ has quit [Ping timeout: 260 seconds]
philtor has joined #ocaml
struk|desk2 is now known as struk|desk|away
jrslepak has quit [Quit: This computer has gone to sleep]
<sigjuice>
I just pasted this IntPairs/PairsSet example in a file. http://caml.inria.fr/pub/docs/manual-ocaml/libref/Set.html , but Emacs tells me "Error: Unbound module Set". I am not sure what to do. Could someone please point me in the right direction?
<ggole__>
The stdlib List.map isn't tail recursive
<ggole__>
I think it's basically let rec map f = function [] -> [] | x::xs -> let elt = f x in elt::map f xs
<blub>
i noticed that a while ago..
<blub>
why isn't it tail recursive
<blub>
it seems like a really strange choice
struk|desk2 is now known as struk|desk|away
teknozulu has quit [Ping timeout: 246 seconds]
ggole_ has joined #ocaml
ggole__ has quit [Ping timeout: 240 seconds]
<sgronblo>
oh no pierpa went offline, wanted to ask more about what was wrong with my klotski.
MercurialAlchemi has quit [Ping timeout: 240 seconds]
struk|desk|away is now known as struk|desk2
ggole__ has joined #ocaml
JacobEdelman has quit [Quit: Connection closed for inactivity]
ggole_ has quit [Ping timeout: 265 seconds]
struk|desk2 is now known as struk|desk|away
agumonkey has joined #ocaml
mort___ has joined #ocaml
agumonkey has quit [Read error: No route to host]
mcc has quit [Quit: Connection closed for inactivity]
agumonkey has joined #ocaml
agumonkey has quit [Ping timeout: 260 seconds]
<sgronblo>
does ocaml have something like runocaml?
zpe has joined #ocaml
lostman has quit [Quit: Connection closed for inactivity]
ggole__ is now known as ggole
<jyc>
Do you mean something like runhaskell? :p
<jyc>
I looked it up and it looks like a program you can pass the path to a Haskell script to and have it just run
<sgronblo>
yep
<ggole>
ocaml foo.ml
<jyc>
It'll even ignore a #! comment so you can put #!/usr/bin/env ocaml at the top of your file, maybe even put #require "package" directives after if your ocamlinit sets up the ocamlfind support
<ggole>
Once you start using multiple files it's time to compile the program, really
<sgronblo>
also, i tried installing merlin and integrate it with vim but am getting an error: vim.error: Vim(echoerr):ocamlmerlin not found!
<sgronblo>
ggole: ok, thanks
<ggole>
sgronblo: how did you install merlin?
mort___ has quit [Quit: Leaving.]
<sgronblo>
ggole: through opam
<ggole>
Did you run the little config env thing afterwards?
<sgronblo>
i think I followed all the required commands
<ggole>
You may need to either run that, or if you ran that, start your vim from the environment in which you ran it.
<sgronblo>
ggole: you mean "opam config env" ?
<ggole>
Yes, eval `opam config env`
<sgronblo>
ggole: ok, works in a new terminal tab
<ggole>
Due to the nature of Unix environments, you'll need to use vim from there (until you logout and back in or something, at which time the desktop environment should be updated again)
<ggole>
It's annoying.
<sgronblo>
does merlin integrate with syntastic or something?
<ggole>
I don't know what that is.
<ggole>
Oh a vim thing... perhaps somebody else could answer that, then.
<sgronblo>
weird, this thing that works in the web version of ocaml doesnt work when i run the program through ocaml
<sgronblo>
even though the type seems just fine
octachron has joined #ocaml
<ggole>
More info than "doesn't work"?
<sgronblo>
Error: This function has type
<sgronblo>
('a, 'b) puzzle -> ('a list, 'c) set_operations -> 'a -> 'a list
<sgronblo>
It is applied to too many arguments; maybe you forgot a `;'.
<sgronblo>
the function call is: let solve_klotski initial_board = solve_puzzle klotski klotski_ops initial_board
<sgronblo>
and let solve_puzzle p opset configuration =
<sgronblo>
looks like solve_puzzle is being applied to the right amount of args to me
<ggole>
I can't tell without the code, but it seems likely that the code was referring to an old version of solve_puzzle
<sgronblo>
shouldnt ocaml recompile every time if necessary?
<sgronblo>
i tried removing the binary i compiled before as well as the cmi and cmo files and run ocaml klotski.ml again but still getting the same shit
<ggole>
Paste it
<sgronblo>
ah, i figured it out
<ggole>
(Not in the channel.)
<sgronblo>
did ocaml have some way of printing any structure, like haskell Show can convert an a -> string?
<ggole>
Sadly, no.
<sgronblo>
ah ok
<sgronblo>
I miss my top level type signatures in ML
<ggole>
You can annotate with let f : 'a -> 'b -> zonk = fun a b -> ..., although it is a bit annoying
<ggole>
An alternative is to write an mli
<sgronblo>
ggole: but i like having the signature in the source file right above the definition
govg has quit [Ping timeout: 272 seconds]
<sgronblo>
I don't get why this line let print_board board = (Array.iter print_row board; print_newline ())
<sgronblo>
results in this Error: This expression has type unit This is not a function; it cannot be applied.
<sgronblo>
the board should be a piece array array and print_row should have type piece array -> unit...
<octachron>
the error might be on the line after this one
<sgronblo>
would be nice if it didnt just say "this is wrong" but intead explicitly say what this is
govg has joined #ocaml
<sgronblo>
I mean its true that (Array.iter f a; print_newline ()) is an expression of type unit, but I don't see that I am trying to use this unit as a function...
<sgronblo>
my print_board looks good doesn't it?
<sgronblo>
then im calling it like this: print_board (List.hd (solve_klotski initial_board_trivial))
<octachron>
without the context; a common error would be to have something like an expression or a "let ... in" on the next line
<sgronblo>
wait... it seems like that function definition is wrong somehow
<sgronblo>
the next line is indented automatically
<lyxia>
what is the next line?
<sgronblo>
its the call to print_board
<sgronblo>
im trying to define the function print_board and then call it on the next line
<octachron>
which is a toplevel expression isn'it?
<sgronblo>
yeah
<octachron>
you need to have a ";;" before this expression
<sgronblo>
i mean there is no main : string list -> unit right?
<sgronblo>
octachron: aah, thanks
lokien has joined #ocaml
<lokien>
hello! best resources to learn ocaml? I'm coming from haskell and clojure
<octachron>
sgronblo, the other solution is to use "let () = ..." to enclose side-effect only expressions
lokien has left #ocaml ["Leaving"]
tmtwd has quit [Ping timeout: 260 seconds]
lokien has joined #ocaml
<lokien>
hello?..
<octachron>
lokien, I have no idea what is the best resource for a beginner even less so for haskeller, however real world ocaml seems to be quite praised
<octachron>
(even if it is a little too Core centric for my taste)
<lokien>
octachron: it can be language-agnostic, I said about haskell because I don't want those "hey, in imperative it's like that, let me show you functional" books
<lokien>
octachron: anyway, real world ocaml looks good, thank you :)
<lokien>
by the way - do you have two core libraries?
<octachron>
two core libraries??
mort___ has joined #ocaml
<lokien>
jane street one and.. standard one? or is jane street's the standard one?
<lokien>
octachron: which compiler is the best? ocamlopt?
Stalkr_ has joined #ocaml
<octachron>
ocamlopt is the native compiler, ocamlc is the bytecode one
<mrvn>
ocamlopt.opt
<lokien>
why do you have two? is it necessary, handy?
<mrvn>
bycode can be compiled on one architecture and run on another. and not all architectures have native code.
<octachron>
(and ocamlopt.opt is the native compiler compiled by the native compiler)
<mrvn>
native code is a bit faster but most of the time that doesn't matter
<lokien>
oh, yeah, I didn't think of that
<lokien>
windows is limited to 32-bit?
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
<octachron>
lokien, no? At least, I don't think so
Haudegen has quit [Ping timeout: 272 seconds]
<lokien>
octachron: uhh, I had this site opened but I closed it and now I can't find it. it said 64-bit windows architecture is more community-supported, only linux and mac are officially supported in 64-bit world
lobo has joined #ocaml
Haudegen has joined #ocaml
<octachron>
lokien, 64-bit windows is listed as tier 1 support on the compiler readme.
<lokien>
octachron: so it was outdated. thanks :)
tane has joined #ocaml
mort___ has quit [Quit: Leaving.]
nicooo is now known as nicoo
Sorella has joined #ocaml
mac10688 has joined #ocaml
jrslepak has joined #ocaml
tani has joined #ocaml
tane has quit [Killed (orwell.freenode.net (Nickname regained by services))]
tani is now known as tane
pierpa has joined #ocaml
zerusski has joined #ocaml
zerusski has quit [Remote host closed the connection]
zerusski has joined #ocaml
sfri has quit [Quit: No Ping reply in 180 seconds.]
please_help has quit [Ping timeout: 276 seconds]
mort___ has joined #ocaml
lokien has quit [Quit: Leaving]
please_help has joined #ocaml
thorsten` has quit [Ping timeout: 250 seconds]
sfri has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
thorsten` has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 246 seconds]
ncthom91 has joined #ocaml
ncthom91 has quit [Client Quit]
please_help has quit [Ping timeout: 265 seconds]
struk|desk|away is now known as struk|desk2
please_help has joined #ocaml
<blub>
hi please_help
mac10688 has quit [Ping timeout: 276 seconds]
zerusski has quit [Remote host closed the connection]
jgjl has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jrslepak has quit [Quit: This computer has gone to sleep]
struk|desk|away is now known as struk|desk2
mort___ has quit [Quit: Leaving.]
FreeBirdLjj has quit [Remote host closed the connection]
mort___ has joined #ocaml
<cojy>
what's the proper way to remove a specific version of ocaml with opam switch?
<Druup>
opam switch remove ?
jrslepak has joined #ocaml
octachron has joined #ocaml
Druup is now known as Drup
rpg has quit [Quit: rpg]
jrslepak has quit [Quit: This computer has gone to sleep]
govg has joined #ocaml
struk|desk2 is now known as struk|desk|away
groovy2shoes has quit [Quit: Leaving]
<flux>
soo, apparently freenom.com provides free domain names. of particular interest may be the .ml tld ;-).
ggole has quit []
<cojy>
it fails on a couple i have :/
<cojy>
i just had had to manualy update the aliases file
struk|desk|away is now known as struk|desk2
jgjl has joined #ocaml
Haudegen has quit [Ping timeout: 255 seconds]
rpg has joined #ocaml
struk|desk2 is now known as struk|desk|away
Haudegen has joined #ocaml
tmtwd has joined #ocaml
rpg has quit [Ping timeout: 272 seconds]
octachron has quit [Quit: Leaving]
groovy2shoes has joined #ocaml
<johnelse>
sadly oca.ml is already owned and full of ads :(
MercurialAlchemi has quit [Ping timeout: 250 seconds]
<Drup>
the price for 3 letters words in .ml was ridiculous, iirc
<Drup>
but you can still get bigger words free !
jrslepak has joined #ocaml
<asmanur>
objectiveca.ml ?
<please_help>
any bigger than objca.ml is no good.
<fds>
typecore.ml has been got
Armael has joined #ocaml
Armael has left #ocaml [#ocaml]
struk|desk|away is now known as struk|desk2
ryanartecona has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
rpg has joined #ocaml
rpg has quit [Ping timeout: 276 seconds]
struk|desk2 is now known as struk|desk|away
zpe has quit [Remote host closed the connection]
teknozulu has joined #ocaml
jgjl has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
teknozulu has quit [Ping timeout: 255 seconds]
NingaLeaf has joined #ocaml
Armael has joined #ocaml
Armael has left #ocaml [#ocaml]
teknozulu has joined #ocaml
rpg has joined #ocaml
Simn has quit [Quit: Leaving]
rpg has quit [Ping timeout: 272 seconds]
jgjl has joined #ocaml
d0nn1e has joined #ocaml
lokien_ has joined #ocaml
ygrek has joined #ocaml
Guest38 has joined #ocaml
<lokien_>
Do you have another channel or something? It's so quiet here
<companion_cube>
it's saturday evening :D
<lokien_>
Perfect time for hacking
<lokien_>
Isn't it?
<companion_cube>
or gaming :p
<lokien_>
Is there a game in ocaml?
<companion_cube>
no idea
<lokien_>
Oh, so it's time for one.
<mrvn>
does tic-tac-toe count?
<lokien_>
Anyway, can I make my main imperative? Every other funtion would be pure, only main'd be imperative.
<lokien_>
Yeah, mrvn
<mrvn>
lokien_: I don't know. can you?
<lokien_>
mrvn: I came here to talk about it, since I'm too lazy to read a book
<lokien_>
And I can't exit utop, it's still running on my laptop
<fds>
What is this 'main'?
<fds>
;-)
<lokien_>
A.. Funtion? Method? Don't know what you call it
<mrvn>
a value
<mrvn>
a binding
<lokien_>
Module? Damn, I'll google it
<lokien_>
You.. Do you have no main function?
<mrvn>
no
<lokien_>
Oh, it's not that bad then. Can I omit all this oop stuff, writing ocaml? Are you tied to it?
<mrvn>
yes. no. if you can.
<lokien_>
You mean?
<Drup>
yes you can avoid the oop stuff
<mrvn>
yes
<lokien_>
Thank God. I'll be doing (trying to do) some advent of code exercises in ocaml tomorrow. Can I write here, or is this channel more.. Mature? Strict?
<Drup>
it's fine :)
<lokien_>
Aww, great. I'll look at some books and be here tomorrow :)
<lokien_>
Shh.. How to close utop? Exit doesn't work, ctrl+z is useless too
<mrvn>
ctrl-d
<lokien_>
Eof?
<mrvn>
yep
<lokien_>
Thanks
ryanartecona has quit [Quit: ryanartecona]
<zozozo>
lokien_: #quit;; also works
<lokien_>
With a hashtag?
<lyxia>
exit 0;;
struk|desk|away is now known as struk|desk2
<lokien_>
Uh, so many ways I didn't think of
<zozozo>
lokien_: yes, with the hashtag
<fds>
It's a hash symbol, not a hashtag.
<lyxia>
if you type exit;; the interpreter tells you it's a function, so give it an argument :)
<blub>
what is '#quit', i haven't seen that syntax
* fds
mutters about kids and lawns
<lokien_>
fds: sorry, I'm a little bit tired
<zozozo>
blub: it's a toplevel directive
rpg has joined #ocaml
<zozozo>
fds: sorry, I never remember the correct names of most symbols, :p
<lokien_>
zozozo: so I use names with hashes on toplevel only?