adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.06.0 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.06/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
barcabuona has quit [Ping timeout: 248 seconds]
ygrek has quit [Ping timeout: 248 seconds]
sh0t has joined #ocaml
orbifx has quit [Ping timeout: 250 seconds]
snhmib has quit [Ping timeout: 268 seconds]
gpietro has joined #ocaml
sh0t has quit [Ping timeout: 255 seconds]
enterprisey has quit [Read error: Connection reset by peer]
sh0t has joined #ocaml
gpietro has quit [Ping timeout: 268 seconds]
gpietro has joined #ocaml
sh0t has quit [Ping timeout: 250 seconds]
aciniglio has quit [Ping timeout: 248 seconds]
jao has quit [Ping timeout: 240 seconds]
ziyourenxiang has joined #ocaml
jao has joined #ocaml
zolk3ri has quit [Remote host closed the connection]
malina has quit [Quit: Throwing apples of Montserrat]
jao has quit [Ping timeout: 248 seconds]
silver has quit [Read error: Connection reset by peer]
wxyzzyrd has joined #ocaml
kerrhau has quit [Read error: Connection reset by peer]
kerrhau has joined #ocaml
rossberg has quit [Ping timeout: 255 seconds]
mfp has quit [Ping timeout: 248 seconds]
zv has joined #ocaml
jmsaunde has left #ocaml [#ocaml]
<wxyzzyrd> Is #ocaml dead?
rossberg has joined #ocaml
jmiven has quit [Quit: co'o]
jmiven has joined #ocaml
p1n34ppl3 has quit [Quit: Lost terminal]
<lyxia> Totally
<whoman> ppl busy being productive. talk about ocaml
cobreadmonster has joined #ocaml
shinnya has joined #ocaml
aciniglio has joined #ocaml
aciniglio has quit [Ping timeout: 260 seconds]
pierpa has quit [Quit: Page closed]
raphaelss has joined #ocaml
kerrhau has quit [Ping timeout: 268 seconds]
infinity0_ has joined #ocaml
infinity0_ has quit [Changing host]
infinity0_ has joined #ocaml
infinity0 is now known as Guest57
Guest57 has quit [Killed (tolkien.freenode.net (Nickname regained by services))]
infinity0_ is now known as infinity0
wxyzzyrd has quit [Ping timeout: 248 seconds]
spew has joined #ocaml
jbrown has quit [Ping timeout: 260 seconds]
cobreadmonster has quit [Quit: Connection closed for inactivity]
gpietro has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
spew has quit [Read error: Connection reset by peer]
aciniglio has joined #ocaml
aciniglio has quit [Ping timeout: 240 seconds]
aciniglio has joined #ocaml
aciniglio has quit [Remote host closed the connection]
greyfacenospace has joined #ocaml
<greyfacenospace> hello
slash^ has joined #ocaml
snhmib has joined #ocaml
<greyfacenospace> i have a question
<greyfacenospace> the last function tail
<greyfacenospace> currently has this val: val tail : 'a t -> 'a t t option = <fun>
<greyfacenospace> i want it to have val tail : 'a t -> 'a t option = <fun>
<greyfacenospace> how can i change my function?
<tane> GreyFaceNoSpace, what's this second match in tail p for?
<tane> you're constructing "Nil" with y, which has type 'a t already, yielding 'a t t
<tane> why not just make it |Cons(x,y) -> Some(y)
<greyfacenospace> in the second match?
<tane> skip the second match completely
<tane> the second part of a "Cons" is already 'a t
<greyfacenospace> oh ok, the reason i added the second match was so that i return none if the list has one element
enterprisey has joined #ocaml
<greyfacenospace> tane, your suggestion makes the function have to correct val , however its not working as intended.
<greyfacenospace> tane, sorry i'm still learning ocaml
<tane> GreyFaceNoSpace, what is your intention?
<greyfacenospace> tane, i want it so that if i get Nil (a) as input i return None. otherwise i return the last Nil in the input
<greyfacenospace> example: tail (Cons(1,Cons (2,Nil 3))) should return Nil(3)
<greyfacenospace> tail Nil(3) should return None
<tane> then it's along Cons(x,y) -> tail y
<tane> well, I see the problem
<greyfacenospace> tane, no this is the reason i did the second match
<tane> yes
<greyfacenospace> if i get Nil in the first recursive call
<greyfacenospace> i return None
<tane> I'd recommend splitting this
<greyfacenospace> in to two functions?
<tane> yes
<tane> build one function that simply returns the LAST Nil
<tane> you can call this then, instead of the second match
<greyfacenospace> oh
<greyfacenospace> good idea
<greyfacenospace> thanks
<greyfacenospace> tane, hey sorry its not working. https://pastebin.com/DqJDFT3G
<greyfacenospace> this is what i tried
<tane> it does not compile, right?
<greyfacenospace> no it doesn't
<tane> have a look at function `tail` and see whether all branches return the same type
<greyfacenospace> first branch returns an option (None) second one returns a Nil
<tane> btw, you don't need parenthesis for function application unless you need to group arguments
<tane> GreyFaceNoSpace, that doesn't see right then
<tane> Nil is not of type 'a option
<greyfacenospace> should i right |Cons(x,y)-> Some(tailHelp y)
<tane> right
<greyfacenospace> yea Nil is not an option
<greyfacenospace> Thank you very much!
<greyfacenospace> it works now
<greyfacenospace> quick question. is there a friendly debugger for ocaml?
<greyfacenospace> currently i am using atom + utop
<tane> hm, I don't know, there's ocamldebug, but I don't know how whether there are nice interfaces
madroach has quit [Read error: Connection reset by peer]
snhmib has quit [Ping timeout: 255 seconds]
zmt00 has quit [Quit: Leaving]
madroach has joined #ocaml
snhmib has joined #ocaml
donflopez has joined #ocaml
donflopez has quit [Client Quit]
kakadu has joined #ocaml
donflopez has joined #ocaml
cbot has quit [Quit: Leaving]
mk9 has joined #ocaml
mk9 has quit [Quit: mk9]
sapristi has joined #ocaml
TarVanimelde has joined #ocaml
mk9 has joined #ocaml
mk9 has quit [Client Quit]
p1n34ppl3 has joined #ocaml
BitPuffin|osx has joined #ocaml
zolk3ri has joined #ocaml
orbifx has joined #ocaml
mfp has joined #ocaml
orbifx has quit [Ping timeout: 268 seconds]
BitPuffin|osx has quit [Ping timeout: 248 seconds]
donflopez has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
donflopez has joined #ocaml
nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
enterprisey has quit [Remote host closed the connection]
madroach has quit [Quit: leaving]
TarVanimelde has quit [Quit: TarVanimelde]
<greyfacenospace> hello... how do i let my function access a list in a module with out passing the list as a parameter to the function?
jnavila has joined #ocaml
<tane> GreyFaceNoSpace, could you provide some example code, that illustrates what you mean, especially "list in a module"
enterprisey has joined #ocaml
<greyfacenospace> tane, yea sure. https://pastebin.com/XwmVikay lets say i have this module
<greyfacenospace> and want to create the function find_student with out passing the list student as a parameter
<greyfacenospace> the list students*
<tane> GreyFaceNoSpace, then just do that
<greyfacenospace> basically i want my function find_student to take a string as parameter and compare that string to all the student names in the list
<tane> yes, you can just do that
<greyfacenospace> ok thanks! :)
FreeBirdLjj has quit [Remote host closed the connection]
jnavila has quit [Ping timeout: 240 seconds]
barcabuona has joined #ocaml
jnavila has joined #ocaml
kakadu has quit [Remote host closed the connection]
jnavila has quit [Ping timeout: 240 seconds]
jnavila has joined #ocaml
BitPuffin|osx has joined #ocaml
enterprisey has quit [Remote host closed the connection]
ski has quit [Quit: Lost terminal]
jnavila has quit [Ping timeout: 240 seconds]
donflopez has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
silver has joined #ocaml
FreeBirdLjj has joined #ocaml
donflopez has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
donflopez has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mk9 has joined #ocaml
mk9 has quit [Client Quit]
TheLemonMan has joined #ocaml
mk9 has joined #ocaml
FreeBirdLjj has joined #ocaml
donflopez has joined #ocaml
mk9 has quit [Ping timeout: 276 seconds]
mk9 has joined #ocaml
mk9 has quit [Quit: mk9]
moei has quit [Quit: Leaving...]
shinnya has quit [Ping timeout: 260 seconds]
donflopez has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
TheLemonMan has quit [Ping timeout: 248 seconds]
sh0t has joined #ocaml
jao has joined #ocaml
j0sh has joined #ocaml
greyfacenospace has quit [Quit: Ex-Chat]
sh0t has quit [Remote host closed the connection]
sh0t has joined #ocaml
mk9 has joined #ocaml
moei has joined #ocaml
mk9 has quit [Quit: mk9]
KeyJoo has joined #ocaml
spew has joined #ocaml
malina has joined #ocaml
spew has quit [Remote host closed the connection]
spew has joined #ocaml
Siegfried has joined #ocaml
KeyJoo has quit [Remote host closed the connection]
jao has quit [Ping timeout: 248 seconds]
spew has quit [Ping timeout: 276 seconds]
wxyzzyrd has joined #ocaml
spew has joined #ocaml
ayxih_ has quit [Quit: Leaving]
ayxih has joined #ocaml
malina has quit [Ping timeout: 240 seconds]
spew has quit [Quit: Leaving]
donflopez has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
ziyourenxiang has quit [Ping timeout: 240 seconds]
donflopez has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
andreas___ has quit [Quit: Connection closed for inactivity]
zmt00 has joined #ocaml
donflopez has joined #ocaml
sh0t has quit [Ping timeout: 248 seconds]
sh0t has joined #ocaml
malina has joined #ocaml
kakadu has joined #ocaml
donflopez has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sh0t has quit [Remote host closed the connection]
jbrown has joined #ocaml
KeyJoo has joined #ocaml
timclassic has left #ocaml ["User left"]
wxyzzyrd has quit [Ping timeout: 258 seconds]
cbot has joined #ocaml
osa1 has joined #ocaml
<osa1> looking at this page https://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html how do I know what exceptions are these functions throwing? more specificically I'm wondering about read_line
<osa1> another question is I can't use Str module; ocaml-language-server lets me use that module, but ocamlc says "Required module `Str' is unavailable". any ideas?
<companion_cube> maybe you've added `str` to .merlin but not to your build system
<osa1> I don't even have a .merlin
<osa1> oh wow I added `str.cma` argument and it worked. I don't even know where that file is.
<osa1> just saw that command on SO and gave it a try
Jesin has joined #ocaml
<companion_cube> ah, you call ocamlc by youself?
<osa1> I don't understand why I need extra params to use a stdlib module
<osa1> yeah I don't use a build system just yet
<companion_cube> well, str is not really in the stdlib anymore :-)
<osa1> https://caml.inria.fr/pub/docs/manual-ocaml/libref/Str.html is this not the stdlib documentation?
<companion_cube> it is, but I mean that some parts of the stdlib are being put in separate packages
<companion_cube> num, str
<companion_cube> becaues there are better alternatives on opam, and no one is working on them anymore
davs has joined #ocaml
<octachron> Str, num, unix, threads, graph, dynlink and bigarray were never part of the standard library, but just extra libaries provided with the compilr distribution
<octachron> https://caml.inria.fr/pub/docs/manual-ocaml/libref/ is not the stdlib documentation, it is the documentation for all libraries provided with the compiler
<companion_cube> graphics, you mean :)
<octachron> in particular, it includes the compiler-libs documentation
<octachron> companion_cube, yes, thanks :)
<octachron> osa1, also if you need an entry point to the stdlib proper, https://caml.inria.fr/pub/docs/manual-ocaml/stdlib.html is *far* better
BitPuffin|osx has quit [Ping timeout: 276 seconds]
<osa1> thanks octachron. I was wondering why there are two similar pages (libref and stdlib)...
<osa1> is there a format string for printing a list of .. formattable values? (I have an `int list` right now)
<companion_cube> you need to use a combinator for printing lists
<companion_cube> (or write one yourself, but it's very tedious)
<companion_cube> the `fmt` library provides such a printer, or Format.pp_print_list
Cheery has joined #ocaml
<companion_cube> Format.printf "some list: %a@." (Format.pp_print_list Format.pp_print_int) [1;2;3]
sh0t has joined #ocaml
<osa1> nice, thanks
Cheery has left #ocaml [#ocaml]
greyfacenospace has joined #ocaml
<companion_cube> for more complicated printers you might want to use Fmt, or some other similar library
<greyfacenospace> how can i recursively access elements in a list of lists ?
<companion_cube> List.iter (fun l -> List.iter print_int l) [[1;2];[3;4]]
<companion_cube> ?
<greyfacenospace> yea but with out using library functions. i wanna get the median for each index in the lists.
<greyfacenospace> for a normal list i would match with |x::xs -> ...
<greyfacenospace> what do we do in case of list of lists?
wxyzzyrd has joined #ocaml
malina has quit [Remote host closed the connection]
<companion_cube> same, but you can match with x as a list
<companion_cube> you'll probably need multiple recursive functions
<companion_cube> one for the outer list, and one for trversing each inner list
<companion_cube> that you call on `x` in your code sample
p1n34ppl3 has quit [Quit: Lost terminal]
<greyfacenospace> oh...i'll try that out
<greyfacenospace> thanks
slash^ has quit [Read error: Connection reset by peer]
barcabuona has quit [Quit: WeeChat 1.9.1]
mengu has joined #ocaml
jbrown has quit [Remote host closed the connection]
andreas___ has joined #ocaml
osa1 has quit [Ping timeout: 246 seconds]
davs has quit [Ping timeout: 240 seconds]
davs has joined #ocaml
sz0 has quit [Quit: Connection closed for inactivity]
kakadu_ has joined #ocaml
kakadu has quit [Ping timeout: 260 seconds]
greyfacenospace has quit [Quit: Ex-Chat]
tane has quit [Quit: Leaving]
argent_smith has joined #ocaml
jnavila has joined #ocaml
mengu has quit [Remote host closed the connection]
sapristi has quit [Ping timeout: 260 seconds]
mengu has joined #ocaml
kerrhau has joined #ocaml
davs has quit [Ping timeout: 255 seconds]
davs has joined #ocaml
groovy2shoes has quit [Quit: moritura te saluto]
groovy2shoes has joined #ocaml
mengu has quit [Remote host closed the connection]
malina has joined #ocaml
Siegfried has quit [Ping timeout: 276 seconds]
pierpa has joined #ocaml
argent_smith has quit [Quit: Leaving.]
mengu has joined #ocaml
malina has quit [Remote host closed the connection]
davs has quit [Ping timeout: 248 seconds]
jimmyrcom has joined #ocaml
mengu has quit [Remote host closed the connection]
jimmyrcom has quit [Ping timeout: 268 seconds]
jimmyrcom has joined #ocaml
jao has joined #ocaml
andreas___ has quit [Quit: Connection closed for inactivity]
jnavila has quit [Ping timeout: 240 seconds]
jao has quit [Remote host closed the connection]
orbifx has joined #ocaml
jao has joined #ocaml
ShalokShalom has joined #ocaml
VermillionAzure has joined #ocaml
kakadu_ has quit [Remote host closed the connection]
mengu has joined #ocaml
mengu has quit [Ping timeout: 248 seconds]
mengu has joined #ocaml
mengu has quit [Ping timeout: 260 seconds]
mengu has joined #ocaml
mengu has quit [Ping timeout: 255 seconds]