<ollehar>
how do I get only a single \ in sprintf format string?
<ollehar>
like
<ollehar>
sprintf "show only \\" ---> "show only \\"
dav has quit [Ping timeout: 272 seconds]
mietek_ is now known as mietek
yomimono has quit [Ping timeout: 264 seconds]
<ollehar>
hm, maybe a problem with exception printing
s1n4 has quit [Ping timeout: 240 seconds]
peterbb_ has quit [Ping timeout: 256 seconds]
<ollehar>
yep, it is. damn.
peterbb has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
struktured has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 265 seconds]
asQuirreL has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
mort___ has quit [Quit: Leaving.]
ollehar has quit [Remote host closed the connection]
ohama has joined #ocaml
struktured has quit [Ping timeout: 265 seconds]
pyon has quit [Quit: fix config]
pyon has joined #ocaml
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
osa1 has quit [Ping timeout: 256 seconds]
ilia has joined #ocaml
darkf has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
rgrinberg has quit [Ping timeout: 276 seconds]
kapil___ has quit [Quit: Connection closed for inactivity]
ygrek has joined #ocaml
Denommus has quit [Quit: going home]
palomer has joined #ocaml
osa1 has joined #ocaml
ygrek_ has joined #ocaml
rgrinberg has joined #ocaml
ygrek has quit [Ping timeout: 252 seconds]
javamonn has joined #ocaml
psy_ has quit [Quit: Leaving]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
javamonn_ has joined #ocaml
javamonn has quit [Read error: Connection reset by peer]
BitPuffin|osx has quit [Ping timeout: 255 seconds]
<ilia>
how to use 'match .. with' and regular expressions together?
<ilia>
reading a file line by line recursively and want to read and parse at the same time
<ilia>
it looks like it is not doable
ncthom91 has joined #ocaml
manizzle has quit [Ping timeout: 272 seconds]
jabesed has quit [Ping timeout: 256 seconds]
Algebr` has quit [Ping timeout: 264 seconds]
palomer has quit [Quit: palomer]
psy has joined #ocaml
palomer has joined #ocaml
s1n4 has joined #ocaml
<ilia>
I have a question about match .. with and regexp
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
manizzle has joined #ocaml
javamonn_ has quit [Read error: Connection reset by peer]
ygrek_ has quit [Ping timeout: 240 seconds]
javamonn has joined #ocaml
idegen has quit [Quit: Leaving.]
javamonn has quit [Read error: Connection reset by peer]
<jyc>
ilia: go ahead and ask it! an unasked question can't be answered :P
<jyc>
oh, I see you have written it out above.
javamonn has joined #ocaml
<jyc>
do you mean you would like to pattern match on groups matched by the regexp?
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jyc>
it is definitely doable, but you will probably have to write some helper functions.
hilquias has joined #ocaml
javamonn has quit [Remote host closed the connection]
struktured has joined #ocaml
osa1 has quit [Ping timeout: 255 seconds]
javamonn has joined #ocaml
nopf has quit [Read error: Connection reset by peer]
ncthom91 has joined #ocaml
ygrek has joined #ocaml
javamonn has quit [Remote host closed the connection]
vpm has quit [Ping timeout: 264 seconds]
kdef has joined #ocaml
javamonn has joined #ocaml
ygrek has quit [Ping timeout: 256 seconds]
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
osa1 has joined #ocaml
psy has quit [Disconnected by services]
psy_ has joined #ocaml
kdef has quit [Quit: Leaving]
javamonn has quit [Remote host closed the connection]
Tekilla has quit [Ping timeout: 264 seconds]
ncthom91 has joined #ocaml
struktured has quit [Ping timeout: 264 seconds]
osa1 has quit [Ping timeout: 256 seconds]
ygrek has joined #ocaml
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
psy_ has quit [Ping timeout: 246 seconds]
c74d3 is now known as _8680_
_8680_ is now known as c74d
psy_ has joined #ocaml
ncthom91 has joined #ocaml
hilquias has quit [Ping timeout: 264 seconds]
swgillespie has joined #ocaml
kushal has joined #ocaml
palomer has quit [Quit: palomer]
palomer has joined #ocaml
<ilia>
question still stays: how to use 'match..with' and regular expressions together?
palomer has quit [Client Quit]
<ilia>
suppose, I want to read a file line by line in a recursive way, and I want to parse what is read at the same time
<ilia>
is it possible?
nojb has joined #ocaml
<dmbaturin>
ilia: Well, regular expression matching functionality is provided by library functions. You can use expressions that involve those functions in match ... with, just like any other expressions.
<ilia>
so, people do it all the time and it is an ocaml way of doing things, right?
<flux>
there are camlp4-based syntax extensions for regular expression 'match', but I guess since it's camlp4 it's no longer favored ;)
<flux>
ilia, parser combinators or parser generators might be more ocamly
<nojb>
you could use sedlex, but is more geared towards lexers than pure regular expressions ...
<flux>
my latest contact has been using the great pcre module and just use it for splitting, matching, extracting substrings, etc..
Leonidas_ is now known as Leonidas
<flux>
it worked nice.
<ilia>
it is an overkill, with perl or python I do not do this yacc/lex to parse a file
<dmbaturin>
ilia: Also, Str is not the most extensive or easy to use library, there are ocamlre and PCRE bindings.
<flux>
so for a short example of code I've used: let split_mask mask = match Pcre.split ~pat:"@" mask with | [user; host] -> (user, host) | _ -> ("*", mask)
<flux>
or: List.map trim (Pcre.split ~pat:"," str)
<flux>
so I guess the code looks pretty similar in other languages using regular expressions
<flux>
and a "parsing" one: let parse_command ~murmelo_nick channel msg = match channel, try_extract ~pat:"^!?([^ ]*)(?: (.+))?$" msg with | nick, Some [|_; cmd; args|] when nick = murmelo_nick -> Some (true, cmd, args) | _ -> ..
<ilia>
I have to install pcre module?
<flux>
(oh and let try_extract ?pat msg = try Some (Pcre.extract ?pat msg) with Not_found -> None)
<flux>
for example, yes
<flux>
since I've written that code there have been other regular expression matchers introduced
<flux>
I understand 're' is decent, but I haven't used it
<dmbaturin>
I know a guy who uses hand-coded lexers with parser generators. When it comes to formal languages, there is no least crazy thing to do. ;)
<flux>
but if you have anything sort of a language, I would personally consider lexer/parser generators. it's really quite simple after all.
<dmbaturin>
Yes, Pcre is not a part of the standard library (both re, the pure ocaml library, and PCRE bindings are in opam).
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ilia>
ok, let me try "re"
palomer has joined #ocaml
<flux>
I would indeed suggest against the Str module, it will leave a sour taste ;)
<flux>
not to mention impossible threading bugs if you ever go that way
<ilia>
I just want to parse a file line by line and put whatever parsed in lists, it is so difficult comparing with loops technique I used to
nojb has quit [Quit: nojb]
<dmbaturin>
ilia: What is the file format like?
<ilia>
X X123 A:12 B:333 C:44
<ilia>
many lines of this
<flux>
so first or the two first fields are special?
<dmbaturin>
What are you going to do with that data?
<ilia>
I've been told to use recursive way of reading a file line by line
<ilia>
it is a point in a 3d space
<ilia>
I want to map a set of points to another set of points
<ilia>
so, it is actually X Y Z instead of A B C
mengu has joined #ocaml
mengu has joined #ocaml
pobivan has joined #ocaml
<dmbaturin>
So you need to load it first and manipulate it later?
<flux>
using the syntax I know it could be something like let parse input = match Pcre.split ~pat:" " input with [special1; special2]::rest -> return proper data | _ -> failwith ("failed to parse: " ^ input)
<ilia>
yes, then I create some sort of a tree
<flux>
and then somewhere else you might use Enum.map on that function and the input
<flux>
and the input you could get with Batteries' File.lines_of function (?)
<ilia>
flux, I am copying and pasting your code
<flux>
well good luck with that.. ;-)
<ilia>
I have to install Batteries as well
<flux>
well, you can do without, but why not.
<ilia>
I tried to do this with a stock OCaml
rgrinberg has quit [Ping timeout: 276 seconds]
mal`` has quit [Ping timeout: 248 seconds]
mengu__ has joined #ocaml
<dmbaturin>
There's relatively little you can _easily_ do with stock ocaml. :)
<ilia>
is there any list of must-have-goodies?
<ilia>
or good-to-have ones
<dmbaturin>
Have you installed opam already?
<ilia>
yes
<flux>
well, lwt and ocamlnet are some good-to-know libraries.
<flux>
containers has some useful data structures you might miss
<ilia>
I do not have ocamlnet
<flux>
cmdliner rocks for command line parsing, though it has a steep learning curve
<dmbaturin>
utop is a nice replacement for the default REPL.
<ilia>
utop installed
<flux>
before utop rlwrap and ledit provided command line editing facilities to the toplevel
<flux>
so if utop is too multimedia for you then perhaps they are nice ;)
<dmbaturin>
menhir is the most commonly user LR(1) parser generator.
<dmbaturin>
* used
mengu has quit [Ping timeout: 272 seconds]
<flux>
if you're doing 3d manipulation, you will probably appreciate gg
<flux>
other libraries I've commonly used: xmlm, calendar (and I would perhaps say iso8601, because that maybe covers the use case I most often use the calendar module for, but the Calendar module has mmmmuch more functionality)
<ilia>
it is going to be N dimensional
<flux>
I don't think gg does n-dimensional sadly
<ilia>
people can comprehend 3d more easily than 26d
<flux>
does n=2..4 though
<flux>
and matrices
<flux>
..of n=2..4 ;-)
mal`` has joined #ocaml
<flux>
well, perhaps lacaml lapack bindings are then appropriate for you, whatever you're doing :)
<ilia>
installed, thanks
rand000 has joined #ocaml
dubst3pp4 has joined #ocaml
mengu has joined #ocaml
mengu has joined #ocaml
nojb has joined #ocaml
wildsebastian has joined #ocaml
mengu__ has quit [Ping timeout: 245 seconds]
nojb has quit [Client Quit]
dav- is now known as dav
mort___ has joined #ocaml
mengu has quit []
nojb has joined #ocaml
psy_ has quit [Ping timeout: 256 seconds]
rgrinberg has joined #ocaml
OnkV has quit [Ping timeout: 264 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
rgrinberg has quit [Ping timeout: 265 seconds]
palomer has quit [Quit: palomer]
palomer has joined #ocaml
swgillespie has joined #ocaml
<ilia>
I have 8 lines in a file, ocamlc complains about line #9 and characters 0-0. What it could be?
<flux>
perhaps unclosed something?
<nojb>
post the code
<ilia>
I fixed, it was related to a number of semicolons after statements
Haudegen has joined #ocaml
nojb has quit [Quit: nojb]
octachron has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<flux>
I've written one relatively big OCaml program that used a CPS/monadic-based 'threading' framework similar to Lwt but with more Event-kind of interface with it
<flux>
I understand it could be called actor-based concurrency or perhaps something that Erlang has
<companion_cube>
with asynchronous message passing?
<flux>
yes
<flux>
Event is synchronous, but I found async much easier to deal with
<flux>
of course, there are rists of getting huge queues
<flux>
..though I don't think that never happened
<companion_cube>
I don't know, Go aficionados seem to like blocking message passing
<flux>
my experience with that project was nice, it was just so easy to spin off a 'worker' for any particular task that needed to be attended to
<companion_cube>
but of course you need some way to wait on several channels
<flux>
obviously, it was practically the key
ggole has joined #ocaml
<flux>
let rec server () = match select [map (fun msg -> `Q1 msg) q1; map (fun _ -> `Abort) abort; map (fun x -> `SomethingElse x)] with .. -> server () was basically the core of it
<companion_cube>
seems very redundant :/
<flux>
and then some ways to shut down channels and ensure that no channel is written to if it's closed and no messages are lost when the channel is closed
gal_bolle has joined #ocaml
<companion_cube>
can't you attach continuations to each possible event?
<flux>
so basically callbacks?
<flux>
well, it's seemed quite easier to me to manage when a single server was in a single loop
<companion_cube>
well, for select, yes
<flux>
and there was no question of in which order things would be done
freling has joined #ocaml
ollehar has joined #ocaml
milosn has quit [Quit: leaving]
rgrinberg has joined #ocaml
pobivan has quit [Quit: pobivan]
rgrinberg has quit [Ping timeout: 240 seconds]
jonludlam has joined #ocaml
manizzle has quit [*.net *.split]
cdidd has quit [*.net *.split]
ddub has quit [*.net *.split]
zaquest has quit [*.net *.split]
brendan has quit [*.net *.split]
vodkaInferno has quit [*.net *.split]
Lasher` has quit [*.net *.split]
manizzle has joined #ocaml
cdidd has joined #ocaml
ddub has joined #ocaml
zaquest has joined #ocaml
brendan has joined #ocaml
Lasher` has joined #ocaml
vodkaInferno has joined #ocaml
jonludlam has quit [Ping timeout: 264 seconds]
Submarine has joined #ocaml
Submarine has joined #ocaml
destrius has joined #ocaml
yomimono has joined #ocaml
asQuirreL has joined #ocaml
jonludlam has joined #ocaml
martintrojer has quit [Ping timeout: 256 seconds]
kakadu has joined #ocaml
martintrojer has joined #ocaml
freling1 has joined #ocaml
freling has quit [Ping timeout: 272 seconds]
freling1 has quit [Ping timeout: 276 seconds]
Gama11_ has joined #ocaml
Gama11_ has quit [Read error: Connection reset by peer]
<Drup>
flux: I can't test, I lack the API module
<flux>
just replace them with strings
<flux>
you can replace json as well with strings :)
kushal has quit [Ping timeout: 245 seconds]
<Drup>
lot's of things to replace
rgrinberg has joined #ocaml
<Drup>
flux: a good amount of stuff comes from API
rgrinberg has quit [Ping timeout: 272 seconds]
manizzle has quit [Ping timeout: 256 seconds]
rand000 has quit [Quit: leaving]
Haudegen has quit [Ping timeout: 264 seconds]
rand000 has joined #ocaml
jonludlam has quit [Ping timeout: 264 seconds]
Gama11 has joined #ocaml
Gama11 has quit [Read error: Connection reset by peer]
Hannibal_Smith has joined #ocaml
TheLemonMan has joined #ocaml
jonludlam has joined #ocaml
Haudegen has joined #ocaml
nojb has quit [Quit: nojb]
rand000 has quit [Ping timeout: 264 seconds]
Gama11 has joined #ocaml
dubst3pp4 has quit [Quit: Ĝis la revido!]
dubst3pp4 has joined #ocaml
<apache2>
does anyone have a link to a good resource on GADTs in OCAML?
<mac_>
I am using ocamlbuild to compile an ocaml script, and i have added lwt.syntax to the -pkgs. I get unbound value for "return" and >>= what to add to the packages, or -tags?
<nojb>
nothing. you have to open Lwt to bring those values into scope
kushal has joined #ocaml
<flux>
apache2, I think googing for site:reddit.com ocaml gadt will find you a few pointers on it
calderonth has joined #ocaml
johnelse has quit [Read error: No route to host]
jonludlam has quit [Read error: Connection reset by peer]
jludlam_ has joined #ocaml
sdothum has joined #ocaml
<calderonth>
Hi !
<calderonth>
Anyone tried using the TLS stack of Ocamlnet 4.x ?
siddharthv_away has quit [Ping timeout: 252 seconds]
Simn has joined #ocaml
johnelse has joined #ocaml
siddharthv_away has joined #ocaml
johnelse is now known as Guest92425
<xificurC>
mac_: is there even a lwt.syntax package?
<Drup>
apache2: as flux said, you can search or the ocaml reddit, you will have several links and discussion on the subject
<Drup>
flux: I just said, in another discussion "I will believe in purity annotation in OCaml only when I see them"
<flux>
is 'effects' really that or something else..
<Drup>
yeah
javamonn has quit [Read error: Connection reset by peer]
<Drup>
but considering the context, I think it is
<flux>
it has documentation like [val perform : 'a eff -> 'a] performs an effect
<flux>
doesn't look like side effect annotation to me?
sepp2k has joined #ocaml
<flux>
given the simple return type :)
<flux>
gotta love this fragment:
<flux>
- empty_env)))))))))))))))))))))))))))
<flux>
+ empty_env)))))))))))))))))))))))))))))
<Drup>
there is exactly the same line in MetaOCaml's patch
<flux>
certainly those opening parens shouldn't be replaced with @@
<Drup>
with a comment
<Drup>
#Add a paren
<Drup>
:D
<flux>
what is this, lisp?
<Drup>
olisp*
<flux>
lispective caml
<ggole>
Nice.
<ggole>
Did you know that in some lisps ] used to close any number of parens?
<Drup>
and that in some lisps, extra parens are not an error
<flux>
yes, I knew that! woohoo :)
javamonn has joined #ocaml
<flux>
it's funny how I can scroll through that entire patch and not really get any solid idea what it's trying to achieve..
<flux>
and why :)
<Drup>
ggole: any number of all the ones that are open ?
<Drup>
or*
<ggole>
Yeah.
<ggole>
All the ones that are open.
<Drup>
right
<Drup>
the other would be ... tricky
<mac_>
I am using "Lwt_io.with_connection sock fun". I observer that when this line of code executes, a connection to the server is created and immediately terminated.
<mac_>
fun never executes. I have a printf inside that never prints anything
<nojb>
maybe post the code ?
<mac_>
the line after Lwt_io.with_connection is not reached (another print for debugging)
matason has quit [Remote host closed the connection]
matason has joined #ocaml
<mac_>
by the way, as i remember, print_endline flushes stdout, which I am using inside the function
agarie has joined #ocaml
<nojb>
sorry - your problem is much simpler
<nojb>
the program is exiting before your threads are done
<mac_>
omg!
<nojb>
add: let () = Lwt_main.run main at the end
<mac_>
you are right
kdef has joined #ocaml
<mac_>
yep, working now
<mac_>
thanks nojb
larhat has quit [Quit: Leaving.]
larhat has joined #ocaml
larhat has quit [Client Quit]
darkf has quit [Quit: Leaving]
larhat has joined #ocaml
larhat has quit [Client Quit]
rgrinberg has joined #ocaml
mort___ has joined #ocaml
gal_bolle has quit [Quit: Konversation terminated!]
s1n4 has quit [Ping timeout: 244 seconds]
johnelse has joined #ocaml
javamonn has quit [Remote host closed the connection]
johnelse is now known as Guest42068
johnelse_ has quit [Read error: Connection reset by peer]
javamonn has joined #ocaml
jonludlam has joined #ocaml
johnelse_ has joined #ocaml
palomer has joined #ocaml
siddharthv_away has quit [Ping timeout: 265 seconds]
Guest42068 has quit [Ping timeout: 255 seconds]
siddharthv_away has joined #ocaml
javamonn has quit [Ping timeout: 252 seconds]
uris77 has joined #ocaml
ollehar has quit [Remote host closed the connection]
ollehar has joined #ocaml
javamonn has joined #ocaml
acieroid` has quit [Quit: Bye.]
agarwal1975 has joined #ocaml
divyanshu has joined #ocaml
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
Denommus has joined #ocaml
rgrinberg has quit [Ping timeout: 255 seconds]
rgrinberg has joined #ocaml
slash^ has joined #ocaml
octachron has quit [Quit: Leaving]
acieroid has joined #ocaml
acieroid has quit [Client Quit]
acieroid has joined #ocaml
nojb has quit [Quit: nojb]
ygrek has joined #ocaml
ncthom91 has joined #ocaml
nojb has joined #ocaml
freling1 has joined #ocaml
larhat has joined #ocaml
freling2 has joined #ocaml
freling1 has quit [Read error: Connection reset by peer]
javamonn has quit [Remote host closed the connection]
s1n4 has joined #ocaml
mort___ has quit [Quit: Leaving.]
javamonn has joined #ocaml
freling has quit [Ping timeout: 272 seconds]
palomer has quit [Quit: palomer]
swgillespie has joined #ocaml
lordkryss has quit [Quit: Connection closed for inactivity]
mort___ has joined #ocaml
swgillespie has quit [Ping timeout: 244 seconds]
thomasga has joined #ocaml
palomer has joined #ocaml
divyanshu has quit [Ping timeout: 240 seconds]
palomer has quit [Client Quit]
BitPuffin|osx has quit [Ping timeout: 256 seconds]
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
divyanshu has joined #ocaml
ncthom91 has joined #ocaml
larhat has quit [Quit: Leaving.]
mort___ has left #ocaml [#ocaml]
robink has quit [Ping timeout: 244 seconds]
Submarine has quit [Remote host closed the connection]
robink_ has joined #ocaml
javamonn has quit [Remote host closed the connection]
nojb has quit [Quit: nojb]
javamonn has joined #ocaml
yomimono has quit [Ping timeout: 246 seconds]
nojb has joined #ocaml
larhat has joined #ocaml
shinnya has quit [Ping timeout: 264 seconds]
Haudegen has quit [Ping timeout: 240 seconds]
jonludlam has quit [Ping timeout: 264 seconds]
<smondet_>
hi all! Oasis seems to be ordering findlib packages on the command-line alphabetically, is there a way to bypass that and force the order? (reason: the order of application of ppx transformations is relevant)
<ggole>
let filter_rev pred list = let rec loop acc = function | [] -> acc | x::xs -> loop (if pred x then x::acc else acc) xs in loop [] (List.rev list)
ontologiae has joined #ocaml
TheLemonMan has joined #ocaml
<ggole>
Or a fold_left, I guess
djellemah has quit [Ping timeout: 276 seconds]
Haudegen has quit [Ping timeout: 246 seconds]
MercurialAlchemi has quit [Ping timeout: 264 seconds]
MercurialAlchemi has joined #ocaml
<ggole>
Ooh, TRMC is sneaking in?
javamonn has quit [Read error: Connection reset by peer]
<MercurialAlchemi>
RMC?
mengu has joined #ocaml
<ggole>
tail recursion modulo cons
<ggole>
Lets you write let rec map f = function [] -> [] | x::xs -> f x::map f xs and get tail recursive code
<ggole>
(As an example.)
javamonn has joined #ocaml
kakadu has quit [Quit: Page closed]
nojb has joined #ocaml
<MercurialAlchemi>
sweet
nojb has quit [Client Quit]
destrius has quit [*.net *.split]
cdidd has quit [*.net *.split]
ddub has quit [*.net *.split]
zaquest has quit [*.net *.split]
brendan has quit [*.net *.split]
vodkaInferno has quit [*.net *.split]
Lasher` has quit [*.net *.split]
ollehar has quit [*.net *.split]
idegen has quit [*.net *.split]
dav has quit [*.net *.split]
jave_ has quit [*.net *.split]
teiresias has quit [*.net *.split]
pdewacht has quit [*.net *.split]
companion_cube has quit [*.net *.split]
w1gz has quit [*.net *.split]
lobo has joined #ocaml
Haudegen has joined #ocaml
ollehar has joined #ocaml
idegen has joined #ocaml
dav has joined #ocaml
jave_ has joined #ocaml
teiresias has joined #ocaml
companion_cube has joined #ocaml
pdewacht has joined #ocaml
w1gz has joined #ocaml
ollehar has quit [Ping timeout: 240 seconds]
destrius has joined #ocaml
cdidd has joined #ocaml
ddub has joined #ocaml
zaquest has joined #ocaml
brendan has joined #ocaml
vodkaInferno has joined #ocaml
Lasher` has joined #ocaml
manizzle has joined #ocaml
jonludlam has joined #ocaml
ollehar has joined #ocaml
Erylisia has joined #ocaml
Anarchos has joined #ocaml
s1n4 has joined #ocaml
Tekilla has joined #ocaml
ygrek has joined #ocaml
uris77` has joined #ocaml
Cyanure has joined #ocaml
uris77 has quit [Ping timeout: 265 seconds]
matason has quit []
cschneid has joined #ocaml
<cschneid>
So how do I go about learning ocaml as a intermediate haskeller?
<cschneid>
specifically I'd like to start playing with mirageos and its unikernel ideas :)
<seako>
Same author wrote ocaml from the very beginning which provides lots more examples of language basics.
<seako>
I'm currently using More Ocaml and Real World Ocaml to get up to speed to start getting involved with mirageos and unikernels too
rgrinberg has quit [Ping timeout: 246 seconds]
mort___ has quit [Quit: Leaving.]
<seako>
cschneid: ^
uris77` has joined #ocaml
<cschneid>
seako: there's a haskell unikernel too but seems much younger than mirage
javamonn has quit [Read error: Connection reset by peer]
<cschneid>
also an erlang one.
<cschneid>
its such a cool idea
t4nk532 has left #ocaml [#ocaml]
<cmtptr>
say I have a foo.mli with "type t" and "val empty : t", and in foo.ml "let empty = []". now, in the main file I do "let x = ref Foo.empty in...". this binds a ref to Foo.empty, which isn't what I wanted. How do I create a ref to a new value that is initialized with the value of Foo.empty?
<Drup>
that's exactly what you did
<Drup>
what is the issue ?
<cmtptr>
I thought that I found "x :=" was changing the value of Foo.empty
<cmtptr>
I must have mitested
<Drup>
Foo.empty can't possible change
<Drup>
it's immutable
<Drup>
possibly*
javamonn has joined #ocaml
<Drup>
that would be a very spooky action at cross module distance =')
<cmtptr>
you are right, it didn't change
<cmtptr>
what the eff did I do that made me thing otherwise...
<Drup>
bitbckt: and you catch the internet with an inter net ? :]
<bitbckt>
:)
<dmbaturin>
cschneid: You can't catch the internet there though, it's flying too high on the low earh orbit.
<bitbckt>
Drup: wild packets roam the forest
ygrek has quit [Remote host closed the connection]
<Denommus>
cschneid: a "sig" declares a signature for modules - like a type for modules. Below the PERMUT_CONTAINER sig, there is a functor (don't mistake it for the Functor typeclass), which is similar to a function that takes a module by parameter and produces a new module
rgrinberg has joined #ocaml
<Denommus>
cschneid: in this case, PERMUT_CONTAINER is filling the role of a type class, while the Permutations functor is filling the role of code that depends on that typeclass
<Drup>
Denommus: you could minimize that a lot.
<Denommus>
Drup: probably
<cschneid>
Denommus: yeah, that makes sense based on the functor chaptor of the book recommended earlier
<Denommus>
Drup: singleton could be defined as cons x empty, for instance, right?
<bitbckt>
well, now I have to click.
Hannibal_Smith has quit [Quit: Leaving]
<Drup>
and personally, I think the abstraction is not really the good one
<cschneid>
is there the idea of haskell's Functor type class? (apply a function to the inside of some sort of "container" type)
<Drup>
it's leaning too much on the immutable side
<Drup>
cschneid: no
<Denommus>
Drup: I did it more for didactic purposes
<Denommus>
cschneid: any type 'a t in a module with a val map: ('a -> 'b) -> 'a t -> 'b t can be treated as a Haskell functor
ygrek has joined #ocaml
<Denommus>
cschneid: you could even create something like module type FUNCTOR = sig type 'a t val map: ('a -> 'b) -> 'a t -> 'b t end
<Denommus>
cschneid: if you really wanted to
<cschneid>
:)
<cschneid>
ok. I'll have to poke around more to figure out idioms
<cschneid>
and how stuff ends up looking like when you actually use it
<bitbckt>
it's usually best to place the 'a t arg first, to curry nicely.
<Denommus>
cschneid: it's just that most of the time you don't need to worry about that. As I said, there isn't such a problem as orphan instances, so if there isn't a sig that fills your need, you can always create it and put your generic code in a functor that uses it
<Denommus>
cschneid: and then you create an "anonymous module" with struct ... end and pass it to the functor
<cschneid>
cool, ok.
<Denommus>
cschneid: like I did
s1n4 has joined #ocaml
javamonn has joined #ocaml
s1n4 has quit [Ping timeout: 256 seconds]
agarie has quit []
asQuirreL has joined #ocaml
<thomasga>
cschneid: it's back now
uris77` has quit [Remote host closed the connection]
uris77` has joined #ocaml
<jyc>
is there a way to have -I somedir in my ocamlbuild _tags file?