|marius| has quit [Remote host closed the connection]
<qwr>
it would work on integers and chars because they are unboxed
|marius| has joined #ocaml
joewilliams is now known as joewilliams_away
travisbrady has quit [Quit: travisbrady]
elehack has joined #ocaml
jakedouglas has quit [Quit: Leaving.]
|marius| has quit [Remote host closed the connection]
|marius| has joined #ocaml
liftM has quit [Ping timeout: 252 seconds]
|marius| has quit [Remote host closed the connection]
elehack has quit [Quit: not a typewriter]
|marius| has joined #ocaml
|marius| has quit [Remote host closed the connection]
joewilliams_away is now known as joewilliams
jakedouglas has joined #ocaml
_unK has quit [Remote host closed the connection]
dark has quit [Ping timeout: 265 seconds]
joewilliams is now known as joewilliams_away
dark has joined #ocaml
Associat0r has quit [Quit: Associat0r]
mjonsson has quit [Ping timeout: 240 seconds]
dskippy has joined #ocaml
valross has quit [Remote host closed the connection]
ulfdoz has joined #ocaml
mjonsson has joined #ocaml
hyperboreean has quit [Ping timeout: 276 seconds]
hyperboreean has joined #ocaml
alpounet has quit [Quit: Bye.]
alp_ has joined #ocaml
alp_ is now known as alpounet
sgnb has quit [Remote host closed the connection]
jakedouglas has quit [Quit: Leaving.]
sgnb has joined #ocaml
valross has joined #ocaml
valross has quit [Client Quit]
mjonsson has quit [Ping timeout: 258 seconds]
|marius| has joined #ocaml
Modius has joined #ocaml
Modius has quit [Max SendQ exceeded]
Modius has joined #ocaml
ulfdoz has quit [Ping timeout: 265 seconds]
ygrek has joined #ocaml
chee has quit [Ping timeout: 276 seconds]
<theDroggl>
hi all
<theDroggl>
is there any standarized iterator concept in ocaml?
<theDroggl>
ie say i want to write something that stores a number of values although it should be implementation specific wheter these values are stored in a list or in an array
<theDroggl>
but nevertheless the user should have a way of getting all values, preferably without having to copy everything to an arbitrary data structure
Yoric has joined #ocaml
<theDroggl>
i could easily come up with iterator mechanisms myself but before that i would like to know if there is something standarized or so (ie something like STL iterators in c++0
<theDroggl>
s/0/)/
Amorphous has quit [Ping timeout: 260 seconds]
<qwr>
theDroggl: lambda should be good for that?
<qwr>
theDroggl: generator function...
<theDroggl>
sry I should have added that I'm new to ocaml/functional programming. But I assume youre talking about a function that returns an element and a function for the next element?
<qwr>
theDroggl: simpler is to have function, that returns new element on each call
<theDroggl>
thats what I'd come up with, but again, before I wanted to check if there is some "standard iterator interface" in some way I should respect
<qwr>
theDroggl: not-so-pure, though
<theDroggl>
oh ic
<theDroggl>
yeah
<theDroggl>
does ocaml notice when a function is pure and exploits that for optimization in some way?
ttamttam has joined #ocaml
<qwr>
theDroggl: as far as i know, it doesn't, if you don't count inlineing some local functions
<qwr>
theDroggl: and converting recursion to loop when possible
<theDroggl>
ok so doing it the pure way would more or less just be for my own pleasure ^^
<flux>
obviously one writes code for others to read, the fact that computer can read it as well is just a happy coincidence :)
<theDroggl>
hehe
<theDroggl>
yeah in this case its just a little experiment for myself that should have the side effect of learning ocaml a little
<theDroggl>
(as in: having done more with ocaml than reading a number of tutorials)
Amorphous has joined #ocaml
Vassia has joined #ocaml
Vassia has quit [Ping timeout: 260 seconds]
Yoric has quit [Quit: Yoric]
|marius| has quit [Remote host closed the connection]
ftrvxmtrx has quit [Quit: Leaving]
ztfw` has joined #ocaml
ztfw has quit [Ping timeout: 246 seconds]
Asmadeus has quit [Ping timeout: 260 seconds]
Asmadeus has joined #ocaml
Vassia has joined #ocaml
Vassia has quit [Ping timeout: 240 seconds]
verte has joined #ocaml
Yoric has joined #ocaml
sdschulze has joined #ocaml
<sdschulze>
just for quick understand feedback: Functors are what theory calls "existential types"?
<sdschulze>
You can't do that in OCaml, though, can you?
ygrek has quit [Ping timeout: 245 seconds]
ikaros has joined #ocaml
ftrvxmtrx has joined #ocaml
<flux>
apparently there exist encoding of existential types for ocaml (google will find), however for that kind of situation I would likely use the object system
ikaros has quit [Quit: Leave the magic to Houdini]
<sdschulze>
flux: I was just surprised that Haskell can apparently type a heterogenous list.
<sdschulze>
polymorphic record fields?
verte has quit [Quit: ~~~ Crash in JIT!]
<theDroggl>
I want a set of integer-pairs, but obviously Set.Make(int * int) doesn't work. Do I have to write an implementation of OrderedType or is there an easier way?
<sdschulze>
But as OCaml has polymorphic compare, it's gonna be easy.
<sdschulze>
or use PSet from Batteries
rossberg_ has joined #ocaml
<theDroggl>
oh ic, polymorphic compare is nice
rossberg_ has quit [Client Quit]
<sdschulze>
slightly dirty but nice, yeah
<rossberg>
sdschulze: no, functors are rather associated with universal types
<theDroggl>
why dirty?
<rossberg>
existential types is what you get when you hide a type behind a signature
<sdschulze>
rossberg: similarly to the structural tying of objects?
<sdschulze>
theDroggl: because it relies on the internal representation of data
<rossberg>
hm, not sure what you mean
<sdschulze>
that a typechecker accepts an object whenever it provides the required methods
<sdschulze>
without looking at the name
<rossberg>
well, that's a different story
<rossberg>
with OO, you typically don't have existential types
<sdschulze>
So is it like: my code has no clue how a Hash table is represented internally, but it knows that some functions accept it as an argument?
Associat0r has joined #ocaml
<theDroggl>
ic so it does what python coders would call duck typing in a way
<rossberg>
roughly, yes. quite literally, there exists some type you can use, though you don't know what it is
<theDroggl>
ic
<sdschulze>
rossberg: I still don't see why this allows me to type a heterogenous list as in Haskell.
<sdschulze>
rossberg: Were you responding to theDroggl or to me last time, BTW?
verte has joined #ocaml
<theDroggl>
yeah its a pity that in so many languages there is this notion of "primitive types" like here int or tuples for example that are not really integrated into the type system (ie. does not implement OrderedType for example)
<rossberg>
no, actually, i was responding to you
<sdschulze>
theDroggl: Dynamic typing is cheating. :)
<rossberg>
with plain modules, you cannot build heterogeneous lists
<rossberg>
that's because they are second class
<rossberg>
citizens
<theDroggl>
I'm not talking about dynamic typing but about complete type systems
<rossberg>
however, with OCaml 3.12 you can promote modules to first-class values, whcih in fact allows you to build heterogeneous lists
<theDroggl>
for example it would be thinkable that int is defined in a way that it implements OrderedType (as there is an obvious order), and creating a tuple would be - similar to a functor - creating an OrderedType out of a number of OrderedTypes
<theDroggl>
naturally that doesn't work with the syntax of haskell since you can't write 5.compare
<theDroggl>
err int.compare
<theDroggl>
although that would be quite imaginable
<verte>
int is an instance of Ord
<verte>
what are you getting at?
<theDroggl>
oh ok than nevermind ^^
<theDroggl>
<- newb
* sdschulze
slowly understands what this is all about.
<sdschulze>
TaPL is so much easier to read if you know how the respective feature is implemented in OCaml.
Vassia has joined #ocaml
<sdschulze>
So the idea is to achive what OO theorists call "capsuling" using the type system?
<rossberg>
yes, existential types provide abstract types provide encapsulation
Vassia has quit [Ping timeout: 265 seconds]
<sdschulze>
OK, so nothing magic
xmarteo has joined #ocaml
Anarchos has joined #ocaml
ttamttam has quit [Remote host closed the connection]
ygrek has joined #ocaml
fraggle_ has quit [Remote host closed the connection]
dskippy has quit [Ping timeout: 246 seconds]
_andre has joined #ocaml
dskippy has joined #ocaml
ttamttam has joined #ocaml
fraggle_ has joined #ocaml
sdschulz` has joined #ocaml
sdschulze has quit [Ping timeout: 276 seconds]
Tianon has quit [Remote host closed the connection]
Tianon has joined #ocaml
Tianon has quit [Changing host]
Tianon has joined #ocaml
sdschulz` has left #ocaml []
barismetin has joined #ocaml
<theDroggl>
which archlinux package contains the "Graph" library? I can't seem to find it
<adrien>
I don't use arch linux but it's in the base ocaml distrib, they might have split it however
<adrien>
are you sure it's not included in the base package? (does 'ocaml graph.cma' fail?)
<flux>
Graph?
<flux>
isn't it Graphics or something?
<adrien>
damn
<theDroggl>
ok then its likely I'm just doing the linking/including stuff wrong
<adrien>
yeah, Graphics
<adrien>
(haven't used it in a loooooooong time ;-) )
<flux>
so thedroggl is talking about a graph manipulating library
<theDroggl>
no i'm talking about the graph package
<theDroggl>
exactly flux
<theDroggl>
graph as in computer science, e.g. trees
<adrien>
yeah, my bad
<theDroggl>
$ ocaml graph.cma
<adrien>
(I don't know if it's very widespread...)
<theDroggl>
Cannot find file graph.cma.
Vassia has joined #ocaml
<theDroggl>
also in /usr/lib/ocaml there doesnt seem to be a file that has the name "graph" in it (execept for the stuff belonging to the graphics library)
<adrien>
looks like there is a package named "ocamlgraph"
<theDroggl>
what the...
<theDroggl>
why didn't I find that
<theDroggl>
I searched for "ocaml" and "graph" like 10 times
<theDroggl>
thnx anyway ^^
<adrien>
no dash? ;-)
<theDroggl>
no idea, must have been to early in the morning or so ^^
<theDroggl>
how do I tell the "ocaml" command to "link" (or whatever the corresponding ocaml term is) the graph module?
<adrien>
to make a complete compile+link, use findlib/ocamlfind: ocamlfind ocamlc -package graph -linkpkg yourcode.ml
<adrien>
for the toplevel...
Vassia has quit [Ping timeout: 260 seconds]
<theDroggl>
ic
<theDroggl>
and to just execute it in the runtime?
<adrien>
oh, silly me, the easier way is to run 'ocaml', then '#use "topfind";;' (keep the # and "), then '#require "graph";;'
<adrien>
(for the toplevel)
<adrien>
(I was looking for a complicated way but that one is easy and always works)
<theDroggl>
k thnx
Yoric has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
<theDroggl>
is there an operator or something that lets me "throw away" the result of an expression (to get () instead)
<theDroggl>
ie I'm getting "Warning S: this expression should have type unit." for a function that I call purely because of its side effects
ygrek has quit [Ping timeout: 245 seconds]
<theDroggl>
ok, i guess thats just too easily self-written ^^
<adrien>
theDroggl: you can use the 'ignore' function, or use: 'let _ = <not_unit>'
<theDroggl>
yeah found it meanwhile but thanks
<gildor>
theDroggl: I recommend at let _x : <type expected) = <not_unit>
<gildor>
theDroggl: this will made more typesafe and prevent in errors in the future
<theDroggl>
ic
<adrien>
I can only back that
<gildor>
theDroggl: (like when you add a paramater to <not_unit> and that the function just get unapplied due to the ignore
<gildor>
)
<adrien>
having an '_' as the first letter in the identifier name will prevent the "unused variable" warning
mjonsson has joined #ocaml
joewilliams_away is now known as joewilliams
Vassia has joined #ocaml
Vassia has left #ocaml []
ccasin has joined #ocaml
mjonsson has quit [Ping timeout: 240 seconds]
ygrek has joined #ocaml
ccasin has quit [Quit: Leaving]
seafood has joined #ocaml
jakedouglas has joined #ocaml
verte has quit [Quit: ~~~ Crash in JIT!]
chee1 has joined #ocaml
chee1 has quit [Changing host]
chee1 has joined #ocaml
chee1 is now known as petal
petal is now known as iloveyou
iloveyou is now known as chee
liftM has joined #ocaml
|marius| has joined #ocaml
Vassia has joined #ocaml
Vassia has left #ocaml []
<|marius|>
theDroggl: batteries/extlib has an "enum" type
|marius| has quit [Remote host closed the connection]
ftrvxmtrx has quit [Quit: Leaving]
liftM has quit [Ping timeout: 252 seconds]
dest has quit [Quit: leaving]
ChristopheT has joined #ocaml
ChristopheT has left #ocaml []
barismetin has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 245 seconds]
joewilliams is now known as joewilliams_away
jonafan has joined #ocaml
<adrien>
I just found out that 3.12's ocamlbuild included findlib support, I wonder how I missed that...
|marius| has quit [Remote host closed the connection]
|marius| has joined #ocaml
ygrek has joined #ocaml
iratsu has joined #ocaml
Yoric has quit [Read error: Connection reset by peer]
f[x] has quit [Ping timeout: 265 seconds]
Yoric has joined #ocaml
<dskippy>
Are there any OCaml audio programmers around? I am trying to create a simple program that will take two audio files and play them at the same time by adding their channels together. I am looking around the liquidsoap and savonet code to try to find code that functions as a mixer. The liquidsoap domain-specific language is not powerful enough to do what I want to eventually do so I'm trying to write my code using the libraries that were use
travisbrady has joined #ocaml
<gildor>
dskippy: you should have a look at ocaml-pulseaudio (from liquidsoap)
<gildor>
dskippy: you can create two stream and play it at the same time, pulseaudio will mix them
<gildor>
(and you will even be able to change audio level output independtly et al)
ygrek has quit [Remote host closed the connection]
<dskippy>
gildor: Looks like pulse audio is a sound daemon like enlightenment. They almost certainly have a mixer though.
<gildor>
dskippy: they have a mixer and your program can create 2 independant stream with it
<dskippy>
gildor: What I'm trying to do, in the end, is take a few audio stream, and a many sound files (30 second recordings) and play them randomly all at once over an icecast stream.
<dskippy>
It doesn't look like pulseaudio really jives with what I'm trying to do. This lets me play sound to the pulseaudio daemon.
<adrien>
it's used for many (all?) audio apps (mixing, editing...), and I think the savonet project made bindings to it
<dskippy>
adrien: Looks like they did.
<dskippy>
Looks like jack is a service running outside my program that I ask it to mix stuff for me.
<dskippy>
I guess that's fine. I really do wish that there was some library function that would just accept a list of streams it could read bytes from and produce one stream by writing bytes to it. Seems like that's pretty simple and doesn't require running additional services on the machine.
liftM has joined #ocaml
Vassia has joined #ocaml
Vassia has quit [Ping timeout: 265 seconds]
Yoric has quit [Quit: Yoric]
joewilliams is now known as joewilliams_away
ztfw`` has joined #ocaml
ztfw` has quit [Ping timeout: 276 seconds]
philtor has quit [Ping timeout: 260 seconds]
bzzbzz has quit [Ping timeout: 240 seconds]
<adrien>
thelema: just noticed that (new) batteries has a config-time option for the web browser: I don't know where "x-www-browser" is from but on linux systems, xdg-open will probably work better, you might also want to see htmlview (which is a symlink to the default browser on my slackware system) or the BROWSER env var (sorry, no time to make a patch or anything else)
philtor has joined #ocaml
ygrek has joined #ocaml
ygrek has quit [Client Quit]
ulfdoz has joined #ocaml
philtor has quit [Ping timeout: 260 seconds]
ygrek has joined #ocaml
joewilliams_away is now known as joewilliams
Yoric has joined #ocaml
liftM has quit [Ping timeout: 252 seconds]
ygrek_ has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
Vassia has joined #ocaml
Vassia has quit [Ping timeout: 276 seconds]
joewilliams is now known as joewilliams_away
<krankkatze>
hey, my program is raising the "not found" exception and I don't know where it's coming from
<krankkatze>
Iḿ not using List.assoc :/
<hcarty>
krankkatze: Compile with -g and run the program after setting the environment variable OCAMLRUNPARAM to "b"
<adrien>
krankkatze: run it as: OCAMLRUNPARAM="b" ./a.out
<adrien>
and as hcarty said: -g
<adrien>
;p
<hcarty>
adrien: I think that's pretty much a tie :-)
<adrien>
well, you were definitely faster, and with a longer message ;-)
Yoric has quit [Ping timeout: 260 seconds]
lulinha has joined #ocaml
lulinha has left #ocaml []
<adrien>
bbah
philtor has joined #ocaml
<hcarty>
camlp4 3.12+rc1 still plays badly with the toplevel... that's disappointing.
lulinha has joined #ocaml
lulinha has left #ocaml []
<hcarty>
Looking at the Subversion repository, it doesn't appear to have been touched since somewhere around the beta1 release.
<adrien>
heh, mikmatch-pcre *just* failed building in godi because of camlp4 ;-)
<adrien>
and lulinha is most probably a spammer so if needed, don't hesitate to kick him (joined an awful lot of channels)
lulinha has joined #ocaml
lulinha has left #ocaml []
ztfw`` has left #ocaml []
ztfw has joined #ocaml
ftrvxmtrx has joined #ocaml
_andre has quit [Quit: leaving]
philtor has quit [Ping timeout: 240 seconds]
ygrek_ has quit [Ping timeout: 245 seconds]
jonafan_ has joined #ocaml
jonafan has quit [Ping timeout: 276 seconds]
philtor has joined #ocaml
sepp2k has joined #ocaml
philtor has quit [Ping timeout: 246 seconds]
Vassia has joined #ocaml
Vassia has quit [Ping timeout: 260 seconds]
ttamttam has joined #ocaml
ttamttam has quit [Client Quit]
dskippy has quit [Read error: Operation timed out]
<Anarchos>
i compile ocaml with gcc -g and i get assembly source while debugging ocamlrun, why ?
|marius| has quit [Remote host closed the connection]
|marius| has joined #ocaml
liftM has joined #ocaml
dskippy has joined #ocaml
xmarteo has quit [Quit: Debian GNU/Hurd is Good.]
dskippy has left #ocaml []
seafood has quit [Quit: seafood]
|marius|_ has joined #ocaml
seafood has joined #ocaml
|marius| has quit [Read error: Connection reset by peer]
sepp2k has quit [Quit: Leaving.]
ulfdoz has quit [Ping timeout: 264 seconds]
|marius|_ has quit [Remote host closed the connection]
Modius has quit [Ping timeout: 260 seconds]
|marius| has joined #ocaml
philtor has joined #ocaml
<dark>
Anarchos, -g? what about -ggdb?
|marius| has quit [Remote host closed the connection]
<Anarchos>
dark what is this option ?
<dark>
Anarchos, you are compiling C code, right?
<dark>
-ggdb includes more debugging information
<Anarchos>
dark right : the ocaml byterun :)
<dark>
that will only be available with gdb
<Anarchos>
dark i will try
<dark>
(others debuggers might see garbage, not sure)
<dark>
Anarchos, maybe ocaml has some weird calling convention, or some weird post-processing, or some weird/non-standard other thing?
<Anarchos>
dark maybe it is the -fno-defer-pop which confuses my debugger ?
<dark>
noid
<dark>
no idea, but #gcc might be theplace to ask
<dark>
or maybe someone knowledgeable might reply here =)
<Anarchos>
dark i mixes ocaml code and c++ multithread so difficult bugs to track !
<dark>
*you*?
<dark>
and why would you do something like that?
<dark>
Anarchos, I have a suggestion: petri net
<dark>
if you can't prove your threading model is theoretically sound, don't bother implementing it on a low-level, error-prone language
<Anarchos>
dark i am linking ocaml to the C++ api of my os
<Anarchos>
in order to program my windows since the toplevel :)
<Anarchos>
it works but some bugs are still present
|marius| has joined #ocaml
mfp has quit [Read error: Connection reset by peer]
liftM has quit [Ping timeout: 252 seconds]
<Anarchos>
dark well time to go to bed
<dark>
Anarchos, you may post on the mailing list
<dark>
there are people there that knows the internals of ocamlrun
<Anarchos>
dark i know but i never got answers to my questions about mixing ocaml c++ and threads
<dark>
it's better to post and look on the other day anyway
<dark>
Anarchos, hmm.. well ask about this -g
<Anarchos>
yes :)
<dark>
it's likely to be a simple reason
<Anarchos>
dark i wonder although why there is no semaphore but this weird handling of signal to protect the gc
|marius| has quit [Remote host closed the connection]
<dark>
handling of signal?
<Anarchos>
yes this caml_enter/leave_blocking_section