<poet>
I'm trying to append two lists and the error message I am getting is: Error: This expression has type 'a -> ('a * 'b) list -> 'b
<poet>
but an expression was expected of type 'c list
<poet>
clearly one of the variables I am trying to append with is not of type list, however, I'm having a hard time understanding what extacly it is. Can someone help me understand what 'a -> ('a * 'b) list -> 'b means?
<poet>
nevermind
mal`` has quit [Quit: Coyote finally caught me]
mal`` has joined #ocaml
valross has joined #ocaml
djanderson has quit [Quit: djanderson]
djanderson has joined #ocaml
elehack has joined #ocaml
djanderson has quit [Client Quit]
boscop has quit [Read error: Connection reset by peer]
mutew has quit [Ping timeout: 260 seconds]
boscop has joined #ocaml
maskd has quit [Quit: leaving]
mutew has joined #ocaml
tmaedaZ is now known as tmaeda
<poet>
how do you create a block of code where multiple statments are executed and the return value is that of the last statment?
joewilliams is now known as joewilliams_away
hiptobecubic has joined #ocaml
<hiptobecubic>
I'm not very well versed in the theories behind functional programming, but wouldn't having objects and methods (mutable?) be clearly outside the bounds of 'stateless' functional programming?
pad has quit [Remote host closed the connection]
mutew has quit [Read error: Connection reset by peer]
boscop has quit [Read error: Connection reset by peer]
<elehack>
hiptobecubic yes, mutable state does go outside stateless functional programming
<elehack>
However, that's one of the niceities of OCaml - it doesn't force you into a single paradigm.
<hiptobecubic>
elehack, i see...
<hiptobecubic>
elehack, this fuss about monads in haskell to deal with state... ocaml doesn't need this then?
<elehack>
hiptobecubic: correct. Some people use monads sometimes, but those are typically for special cases or particular frameworks/paradigms. Core OCaml I/O is done with mutable state.
<elehack>
and you can have mutable state directly with references, mutable fields, etc.
<hiptobecubic>
elehack, ok thanks :) I'm still working on understanding this whole approach.
<elehack>
no problem. welcome :)
<orbitz>
note, mutable stae is often slower in Ocaml
<orbitz>
and a lo tof peopel seem ot be preferring monadic thing sin Ocaml, or at least that is the imrpession I'm getting
elehack has quit [Quit: off for the evening]
yziquel has quit [Ping timeout: 248 seconds]
djanderson has joined #ocaml
qwertycute has quit [Ping timeout: 246 seconds]
qwertycute has joined #ocaml
djanderson has quit [Quit: djanderson]
joewilliams_away is now known as joewilliams
poet has quit [Quit: poet]
jorgenpt has left #ocaml []
Amorphous has quit [Ping timeout: 272 seconds]
Amorphous has joined #ocaml
det has quit [Remote host closed the connection]
det has joined #ocaml
spicey has quit [Remote host closed the connection]
ulfdoz has joined #ocaml
joewilliams is now known as joewilliams_away
Yoric has joined #ocaml
ttamttam has joined #ocaml
ttamttam has quit [Quit: Leaving.]
ulfdoz has quit [Ping timeout: 260 seconds]
valross has quit [Ping timeout: 240 seconds]
_unK has quit [Remote host closed the connection]
valross has joined #ocaml
ttamttam has joined #ocaml
Yoric has quit [Quit: Yoric]
jfkjqer has joined #ocaml
jfkjqer has quit [Quit: Page closed]
_zack has joined #ocaml
yakischloba has quit [Quit: Leaving.]
fx_ has joined #ocaml
jcaose has joined #ocaml
ski_ has joined #ocaml
Submarine has joined #ocaml
avsm has joined #ocaml
Yoric has joined #ocaml
avsm has left #ocaml []
munga_ has joined #ocaml
ikaros has joined #ocaml
valross has quit [Quit: Ex-Chat]
ikaros_ has joined #ocaml
ikaros has quit [Ping timeout: 248 seconds]
ikaros_ has quit [Ping timeout: 265 seconds]
pimmhogeling has joined #ocaml
avsm has joined #ocaml
avsm has quit [Client Quit]
ikaros has joined #ocaml
avsm has joined #ocaml
pimmhogeling has quit [Read error: Connection reset by peer]
pimmhogeling has joined #ocaml
rbancroft has quit [Ping timeout: 256 seconds]
_andre has joined #ocaml
rbancroft has joined #ocaml
_zack has quit [Quit: Leaving.]
maskd has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
<Gertm>
anyone know what the ocsigen package is in fedora?
<mfp>
rwmjones should know (he maintains Fedora's packages)
det has quit [Read error: Connection reset by peer]
det has joined #ocaml
<Gertm>
thanks
<Gertm>
Ok, so from source then I guess?
tmaeda has quit [Ping timeout: 256 seconds]
noj has joined #ocaml
<rwmjones>
Gertm, we don't have a package for that in Fedora. It's looking for someone to step forward and do the packaging work.
tmaeda has joined #ocaml
derdon has joined #ocaml
pimmhogeling has quit [Ping timeout: 272 seconds]
avsm1 has joined #ocaml
<Gertm>
I see. Wish I could do that but I have no idea where to start.
avsm has quit [Ping timeout: 264 seconds]
fx_ has joined #ocaml
<flux>
hey, nice, Oo.id (object end) infact is almost twice as fast as a mutex-protected incrementing integer
<flux>
although, it's only twice as fast :)
<flux>
non-mutex-locked integers still beat both by a wide margin
<flux>
like 10x the speed of Oo.id-approach
* thelema
wouldn't have tought of that
fx_ has left #ocaml []
* thelema
wonders if enough people would use this for it to go in batteries... dictionaries, that is
<flux>
they are useful at times. I suppose it's rare.
<flux>
although, if it's going to be almost as simple as the three-code example with 3.12, then I wonder if it's worth the trouble
Smerdyakov has joined #ocaml
fx_ has joined #ocaml
pimmhogeling has joined #ocaml
Smerdyakov has quit [Quit: Leaving]
<flux>
is there a way to output XML in ocsigen without doing the quoting etc myself?
<flux>
it appears XML-light which I used for outputting raw data doesn't do that kind of quoting
<mfp>
flux: doesn't XHTML count? :)
<flux>
mfp, well, how do I put my own XML into XHTML.M?
<flux>
no wait, I already did that :)
<mfp>
with toelt ?
<flux>
argh, I had just forgotten :)
<flux>
in any case: avoid XML-light if you are producing XML :)
<flux>
I just noticed its to_string isn't thread safe either
<flux>
it uses a global Buffer.t :-o
<mfp>
oh, it's the other way around, tot : XML.elt -> 'a XHTML.M.elt
<flux>
iir it has both ways
<mfp>
yes
<mfp>
toelt is 'a XHTML.M.elt -> XML.elt
<mfp>
so you want the former
<mfp>
* XHTML.M.t
<flux>
the list of doctypes doesn't have 'plain old XML'
<flux>
I wonder if I should care about that
ski_ has quit [Remote host closed the connection]
<mfp>
you can gsub the doctype if you really need to, I guess
_unK has joined #ocaml
ski_ has joined #ocaml
<mfp>
Ocsigen's printers do a couple XHTML-specific things: some empty tags are rendered as <x></x> (following xhtml1 compat guidelines), and an extra "name" attribute is added for some tags with the same value as "id2 (XHTML 1.0 appendix C.8)
<mfp>
but there's a bug heh if doid2name && XML.attrib_name attr = "id" then (add_string b " id="; add_string b (XML.attrib_value_to_string encode attr));
<mfp>
should be name=
<flux>
ah, but now my chat can handle everything you can throw at it! (hopefully) http://masyn.org/chat/
<flux>
hmph, scrolling doesn't work properly on my n900
<flux>
I actually wonder if this is a bug (or a feature?) as well:
<flux>
val xhtml_list_print : ?header:string -> ?version:[< XHTML.M.doctypes > `XHTML_01_01 ] -> ?encode:(string -> string) -> ?html_compat:bool -> 'a XHTML.M.elt list -> string
<flux>
notice the [ `Html ] going to 'a
<flux>
maybe it's a feature, atleast I had to use xhtml_list_print although I have only one (root) node :)
<mfp>
it is
<mfp>
allows you to gen chunks of doc instead of full HTML trees
<flux>
but why limit the first function?
<mfp>
flux: how are you doing the Comet? iframe?
<flux>
I have a concurrent wait-request always in
<flux>
and it returns a value whenever something happens, or when a timeout hits
<flux>
on timeout the javascript retries the query
<mfp>
ic
<flux>
the javascript client has an index number of seen messages and it provides that number to the server
ikaros has joined #ocaml
pimmhogeling has quit [Ping timeout: 245 seconds]
thelema_ has joined #ocaml
<flux>
it'd be interesting to write a robot client for that to benchmark how many reqs/s that approach can handle
<flux>
it appears that ocsigen itself uses select, so that might be a problem..
<flux>
how come it doesn't use poll or similar?
thelema_ has quit [Remote host closed the connection]
thelema has quit [Ping timeout: 276 seconds]
thelema_ has joined #ocaml
pimmhogeling has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
thelema_ has left #ocaml []
thelema has joined #ocaml
<mfp>
flux: lack of stable libev bindings? ;)
<mfp>
it's not directly attributable to Ocsigen in fact
<mfp>
if somebody added epoll/etc. support to Lwt, Ocsigen would get it automatically
thelema has quit [Remote host closed the connection]
thelema has joined #ocaml
<mfp>
I once tried to create a Lwt branch using Core's epoll func., didn't get it to work (but only gave it a couple afternoons or so)
<Gertm>
When I do #require <anything> I get this error message: No such package: lablgtk2 - Required by `equeue-gtk2' How can I solve this? (lablgtk2 is installed)
<thelema>
Gertm: ocamlfind list | grep lablgtk2
<Gertm>
yeah, apparently I needed the -devel libs aswell..
<thelema>
you should have a line like this: lablgtk2 (version: 2.10.0)
<Gertm>
thanks!
<thelema>
n/p
thelema has quit [Remote host closed the connection]
thelema has joined #ocaml
<Gertm>
Is there a good guide somewhere on how "#require", "open" and the compile options all relate and work together?
thelema_ has joined #ocaml
<Gertm>
I find that to be the most confusing part of OCaml so far. #require in the toplevel, "open" in the source, and some other stuff to compile
<Gertm>
surely there's a good guide on that somewhere?
thelema has quit [Ping timeout: 245 seconds]
thelema_ has left #ocaml []
thelema has joined #ocaml
<thelema>
Gertm: my master plan involves squashing that by having an ocamlbuild plugin that does the right thing with #require in the source.
<Gertm>
that would be awesome
<Gertm>
so, when can we have it?
<Gertm>
:p
<thelema>
when it's ready.
<Gertm>
hmpf
<thelema>
I'm still in the theory stage, sadly.
<Gertm>
so how do I do those things until you're ready?
<Gertm>
there has to be a logic to it
<thelema>
yes, use ocamlbuild with a findlib-aware myocamlbuild.ml file and put pkg_foo in your _tags to enable findlib package foo
fx_ has left #ocaml []
<Gertm>
now I have a headache
fx___ has joined #ocaml
<Gertm>
what's myocamlbuild.ml and where do I find the _tags?
<thelema>
You can copy the myocamlbuild.ml directly, you'll want to make a _tags file for your project
<thelema>
and the makefile just allows me to type make opt to build the .native file
<thelema>
and make clean to clean
<Gertm>
thanks, I'll check that out.
avsm has joined #ocaml
avsm1 has quit [Read error: Connection reset by peer]
hiptobecubic has quit [Quit: For a holy stint, a moth of the cloth gave up his woolens for lint.]
thelema has quit [Remote host closed the connection]
thelema has joined #ocaml
thelema has quit [Remote host closed the connection]
thelema has joined #ocaml
thelema has quit [Remote host closed the connection]
thelema has joined #ocaml
thelema has quit [Remote host closed the connection]
thelema has joined #ocaml
thelema has quit [Remote host closed the connection]
thelema has joined #ocaml
thelema has quit [Remote host closed the connection]
yakischloba has joined #ocaml
avsm has quit [Quit: Leaving.]
thelema has joined #ocaml
pimmhogeling has quit [Ping timeout: 245 seconds]
joewilliams_away is now known as joewilliams
Drk-Sd has joined #ocaml
thelema has quit [Remote host closed the connection]
thelema has joined #ocaml
thelema has quit [Remote host closed the connection]
ulfdoz has joined #ocaml
thelema has joined #ocaml
thelema has quit [Remote host closed the connection]
ikaros has joined #ocaml
thelema has joined #ocaml
thelema has quit [Remote host closed the connection]
thelema has joined #ocaml
smimou has quit [Quit: bli]
thelema has quit [Client Quit]
thelema has joined #ocaml
ttamttam has quit [Quit: Leaving.]
thelema has quit [Remote host closed the connection]
thelema has joined #ocaml
thelema has quit [Ping timeout: 240 seconds]
thelema has joined #ocaml
tarbo2 has quit [Read error: Connection reset by peer]
avsm has joined #ocaml
pimmhogeling has joined #ocaml
Submarine has quit [Quit: Leaving]
thelema has quit [Ping timeout: 264 seconds]
thelema has joined #ocaml
Smerdyakov has joined #ocaml
Yoric has quit [Quit: Yoric]
Yoric has joined #ocaml
_zack has joined #ocaml
pimmhogeling has quit [Ping timeout: 272 seconds]
<flux>
mfp, maybe I'll need to pick up where I left at, I wrote some TODO-entries reminding what could be the issues :)
tmaeda is now known as tmaedaZ
<mfp>
flux: fwiw, the lwt guy expressed interest in it, so you can probably get him to help you debug it
ikaros has quit [Quit: Leave the magic to Houdini]
Yoric has quit [Quit: Yoric]
smimou has joined #ocaml
Drk-Sd has quit [Quit: {'EXIT', Drk-Sd, "bye"}]
avsm has quit [Quit: Leaving.]
myst has joined #ocaml
dsylexic has joined #ocaml
Submarine has joined #ocaml
ergodick has joined #ocaml
ergodick has left #ocaml []
myst has quit [Remote host closed the connection]
pad has joined #ocaml
jcaose has quit [Ping timeout: 272 seconds]
Yoric has joined #ocaml
_andre has quit [Quit: *puff*]
brendan has quit [Quit: leaving]
brendan has joined #ocaml
yakischloba1 has joined #ocaml
yakischloba has quit [Ping timeout: 248 seconds]
yakischloba has joined #ocaml
yakischloba1 has quit [Ping timeout: 258 seconds]
avsm has joined #ocaml
_zack has quit [Quit: Leaving.]
joewilliams is now known as joewilliams_away
ttamttam has joined #ocaml
joewilliams_away is now known as joewilliams
dsylexic has quit [Quit: leaving]
Smerdyakov has quit [Quit: Leaving]
ikaros has joined #ocaml
<flux>
mfp, do you have insight on what those "very exciting features" will be in ocsigen 2.0?-)
avsm1 has joined #ocaml
avsm has quit [Ping timeout: 265 seconds]
<mfp>
flux: some obrowser thing, I suspect
jcaose has joined #ocaml
Submarine has quit [Ping timeout: 260 seconds]
pimmhogeling has joined #ocaml
ttamttam has quit [Remote host closed the connection]
Submarine has joined #ocaml
pad has quit [Read error: Connection reset by peer]
jcaose has quit [Ping timeout: 272 seconds]
pimmhogeling has quit [Ping timeout: 256 seconds]
Submarine has quit [Ping timeout: 258 seconds]
djanderson has joined #ocaml
valross has joined #ocaml
avsm1 has quit [Quit: Leaving.]
filz has joined #ocaml
ulfdoz has quit [Ping timeout: 260 seconds]
filz has quit [Quit: Leaving]
joewilliams is now known as joewilliams_away
djanderson has quit [Quit: djanderson]
joewilliams_away is now known as joewilliams
dobby has joined #ocaml
dobby has left #ocaml []
dobby has joined #ocaml
<dobby>
hey guys
<dobby>
anybody there? i've got this ocaml task and i just don't get it! ;)
ikaros has quit [Quit: Leave the magic to Houdini]
Drk-Sd has joined #ocaml
boscop has quit [Quit: Gxis revido!]
<dobby>
anybody? :)
<derdon>
I'm here, but only a beginner
<dobby>
that's what i am :), i just can't seem to work out Threads in ocaml
<derdon>
I'm still far away from threads and parallel programming
<derdon>
and btw: I don't think that I'll ever come in contact with threads
avsm has joined #ocaml
<dobby>
so did I, but my prof just started with it, in ocaml threads are just artificial so i don't really get why we have to learn it
<derdon>
evil prof!
Associat0r has joined #ocaml
<dobby>
indeed
<Alpounet>
dobby, 'OCaml bytecode and native code programs can be written in a multithreaded style, with preemptive context switching. However, because the garbage collector is not designed for concurrency, symmetric multiprocessing is not supported[3]. OCaml threads in the same process execute by time sharing only.'
<dobby>
thanks, i could get a traffic light working with people stopping and waiting, but now they want me do program a house that randomly bursts into fire and the firefighters on standy waiting for a mission ;)
<Alpounet>
I'll let you guess whether it belongs to (1), (2) or (3) in Leroy's email
<dobby>
i'd say that'd be nr. 2
<dobby>
are you familiar with threads? because i might actually need some help with this task? :)
<dobby>
haven't done a lot of functional programming
<Drk-Sd>
functional programming isn't related to "concurrency" you know
Alpounet has quit [Ping timeout: 264 seconds]
<Drk-Sd>
but if you'ven't got a lot of experience with any of these two, it's probably better you don't use them (both) for now :/
<Drk-Sd>
hmm
Alpounet has joined #ocaml
<Drk-Sd>
i didn't read, it's for school ok
<Drk-Sd>
so forget what i said :D
<dobby>
well that's my problem, i don't have a choice, i have to get this task done :)
<dobby>
alright :D
<Drk-Sd>
may i ask what studies you're doing? :)
<dobby>
information systems
<Drk-Sd>
hmm
<dobby>
it's my seconds, so sometimes i'm still allowed to ask stupid things i guess :D
<dobby>
i meant second year
<dobby>
^^
<Drk-Sd>
yeah, i guessed
<Drk-Sd>
but it's kinda weird that they show you threads in caml
<Drk-Sd>
and it's even more surprising if you haven't got much experience in caml
<dobby>
i know that's what the people that have done caml before say too
<Drk-Sd>
but well, i'm not a specialist :°
<dobby>
would you be able to implement threads though? they've created a template for me to just put in all the functions
<Alpounet>
dobby, yeah
<dobby>
you are? :D
<Alpounet>
YOU are too ;)
<dobby>
i don't think so
<dobby>
:)
<Alpounet>
try, and ask here for help
<Alpounet>
you'll see
<dobby>
okay hold on
q[mrw] has joined #ocaml
q[mrw] has left #ocaml []
<dobby>
i think it would be a good idea to try and explain the template to you a bit, so you know what i'm talking about
<dobby>
which doesn't mean that i'm actually able to use it too
<Alpounet>
heh
<Alpounet>
you just have to practice a bit
<Alpounet>
to master that module
<Alpounet>
after that, it's just about organizing some lines of code in the right way
<dobby>
easy to say :D
<dobby>
let _ =
<dobby>
is that what creates all the actual threads?
orbitz has quit [Ping timeout: 245 seconds]
<Alpounet>
what d'you mean ?
<dobby>
in java it always looked for a run() method, and somehow this let _ = (followed by a couple of thread-names) appears in both programs we already studied
<Drk-Sd>
dobby: the let _ = is similar to the « main » function you'd see in programs done in C for example
<Drk-Sd>
(and there probably is a main method in Java too i guess)
<dobby>
there is
<dobby>
thanks
<Alpounet>
dobby, however, let _ = something is equivalent to let x = something, except that we won't need x after that, so we just put "_" because we don't care of the result, we just need it (the 'something') to be executed
<Alpounet>
it's not about a main function or whatever
<Drk-Sd>
(i simplified a bit :°)
<dobby>
alright
<derdon>
``let _ = ...`` is used to avoid the ;; and optionally some ;
<derdon>
Drk-Sd: "let _ = expression means "calculate the value of the expression (with all the side-effects that may entail), but throw away the result"."
<derdon>
Drk-Sd: that's what you said
<Drk-Sd>
right
<derdon>
Drk-Sd: but I have something with laziness of ocaml programmers in my mind