<thelema>
the last line says that the functor "Make" takes as argument a module M of type S and returns a module of type S where the key is "M.key list"
<warlockwinning>
it confuses me how M.key is not key, and how 'a t is not M.t
<thelema>
ok, think about a concrete application - one thing you could use as M is an integer map.
<thelema>
this has key = Int and 'a M.t = maps from ints to 'a
<thelema>
when you apply Trie.Make to this, you get a module where key is "int list", and 'a t is a trie structure mapping int lists to 'a
<warlockwinning>
how can 'a M.t do any mapping? is it a function?
<thelema>
it's a type, just as 'a array is a type
<warlockwinning>
so by integer map, do you mean Map int?
<thelema>
if that's how it's written in f#, then yes
<warlockwinning>
I thought the trie was suppoed to handle the mapping?
<thelema>
in ocaml, one creates it with another functor; Map.Make(Int)
<thelema>
the trie handles the mapping from int list to 'a, but this implementation is parameterized on an implementation that is int to 'a
<thelema>
(or whatever your key is)
<thelema>
maybe a different example would be useful - one common use of tries is in dictionaries
<thelema>
each node has 256 children, one for each ascii code
<warlockwinning>
ok
<thelema>
instead of using a Map, one can use a 256 entry array
<thelema>
so M.key is char
<warlockwinning>
ok
<thelema>
and 'a M.t is 'a array
Cyanure has quit [Remote host closed the connection]
<thelema>
the rest of the functions have to be defined so that they work on this array
<thelema>
but only for a single character
<warlockwinning>
how are those functions defined?
<warlockwinning>
with a new struct?
<thelema>
then, one applies the Trie.Make functor to the module with key=int, 'a t='a array
<warlockwinning>
ok
<thelema>
in ocaml, one uses a module for them
<thelema>
module CharArray = type key = char type 'a t = 'a option array let empty = Array.create 256 None let is_empty a = Array.find (not null) a ... end
<warlockwinning>
so I understand now how to create a Trie of the correct type parameters, but I don't understand how to give the function definitions for how to work on that specifical type
<warlockwinning>
ok, keep going
<thelema>
in ocaml, one defines a module that holds types and values
<thelema>
hmm, actually the array example won't work for this S because the signatures won't end up matching
<thelema>
but anyway...
<thelema>
Maybe you need to start with a simpler functor example
<thelema>
have a look at this - it's the definition of sets from the ocaml stdlib
cdidd has quit [Remote host closed the connection]
<thelema>
In this example, S is the output type of the functor and OrderedType is the input type
<thelema>
(module type)
<warlockwinning>
well, I think I almost got it
<warlockwinning>
say that the CharArray module worked, how would we pass it as a parameter to the functor?
<thelema>
ocaml doesn't use objects or structs for carrying functions along with types, it uses modules and functors
<warlockwinning>
i thought ocaml used structs
<thelema>
module CharTrie = Trie.Make(CharArray)
<warlockwinning>
(not like F# structs)
<thelema>
ocaml has records, which I think correspond to structs better than modules
<warlockwinning>
ya, I mean the actual struct keyword in ocaml
<warlockwinning>
module Make(Ord: OrderedType) =
<warlockwinning>
struct
<thelema>
yes, struct just begins a module definition
<warlockwinning>
ya
<thelema>
just as "sig" begins a module type definition
<thelema>
but it defines a module, not a struct
<warlockwinning>
ya, I understood that :)
<warlockwinning>
so, could we make Trie with some type of CharTrie?
<warlockwinning>
that is, could we make its signatures match?
<warlockwinning>
I don't understand why your signatures didn't match - was it just an accident?
<thelema>
my signatures aren't going to match because 1) the variance annotation; arrays are not covariant, iirc
<thelema>
and 2) the definition of empty - "val empty : 'a t"; using arrays either requires copying the array each time you perform an operation or creating different arrays and mutating them; the first is inefficient and the second is (unit -> 'a t)
<warlockwinning>
ya, I'm trying to keep it persistent
<warlockwinning>
so instead of an array I would use a list
<thelema>
so then you just use a persistent structure
mort___ has quit [Quit: Leaving.]
<warlockwinning>
ya
<warlockwinning>
unfortunately list has slow look up
<warlockwinning>
perhaps I should use a Map
<thelema>
yup, so the best is a Map
<warlockwinning>
ok, now I think I get it ;)
<warlockwinning>
thank you thelema
<thelema>
you're welcome
Cyanure has joined #ocaml
mrm has joined #ocaml
eni has quit [Ping timeout: 248 seconds]
diego_diego has quit [Quit: diego_diego]
diego_diego has joined #ocaml
silver_ has quit [Read error: Connection reset by peer]
diego_diego has quit [Client Quit]
mcclurmc has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
xcombelle has joined #ocaml
err404 has joined #ocaml
mcclurmc has joined #ocaml
avsm has quit [Quit: Leaving.]
Yoric has quit [Ping timeout: 265 seconds]
Yoric has joined #ocaml
mrm has quit [Read error: Operation timed out]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
_andre has quit [Ping timeout: 265 seconds]
Yoric has quit [Ping timeout: 250 seconds]
_andre has joined #ocaml
ftrvxmtrx has joined #ocaml
pangoafk is now known as pango
err404 has quit [Remote host closed the connection]
avsm has joined #ocaml
Reventlov has quit [Remote host closed the connection]
_andre_ has joined #ocaml
<fasta>
===> PCRE not found
<fasta>
Consider adding GODI_BASEPKG_PCRE=yes to godi.conf
<fasta>
How can that be fixed besides adding what it says to godi.conf?
<orbitz>
Is there a specific reason you'r elookign to not do the obvious solution?
<fasta>
orbitz: well, I would like to know what the programmer was thinking.
<fasta>
orbitz: because I don't see how he could have messed this up.
<orbitz>
messed what up/
<fasta>
It's not exactly rocket science.
<fasta>
Finding PCRE.
_andre has quit [Ping timeout: 250 seconds]
<fasta>
So, either it exists, or he should say 'it doesn't exist, please install it'.
<fasta>
Or it should just auto fall back to whatever that option says.
<orbitz>
what are you installing?
<fasta>
orbitz: I am bootstrapping godi.
<avsm>
godi has a builtin version of pcre
<avsm>
or you can use the system pcre
<avsm>
and the option sets which one is in use. whats the issue?
<fasta>
avsm: yes, that's what that variable says.
<fasta>
avsm: the issue is that it doesn't work out of the box.
<avsm>
well, do you have a system pcre installed?
<orbitz>
what doesn't work? does the bootstrap fail or is it just letting you knwo PCRE wasn't found so it'll use the builtin?
<fasta>
avsm: If I don't have a system PCRE, it should inform me of that.
<adrien>
fasta: you just have to install the libpcre-dev packages
<adrien>
also, german people speak english but with weird ideas
<fasta>
adrien: who is German?
<orbitz>
If you set teh variable does it use the the installed oned?
<adrien>
godi's author
<fasta>
adrien: better than people who still write manuals in German.
<fasta>
Just out of interest: how do you manage your development machines?
<fasta>
I.e., how do you make sure that they have similar packages, etc.?
<adrien>
godi_console -> update
<fasta>
No, beyond godi.
<fasta>
Unless you only use Ocaml.
<adrien>
when the distribution packages have changed and I need a rebuild, godi_console -> rebuild
<fasta>
Let's say someone destroys your machine, can you get up and running with the push of a button?
<orbitz>
fasta: I imagine most of us here don't manage machines
<orbitz>
In place I have worked we use chef, puppet, or cfengine
<adrien>
reinstall linux distribution, reinstall godi or ocaml packages from the distribution, copy back the few bits of configuration; so, "yes" but I'm not sure I'm the general case
<fasta>
orbitz: well, often developers get root.
<orbitz>
Honestly I haven't had much luck with godi, I make scripts to install what I want from the internet or use odb
<orbitz>
fasta: having root doesn't make you a sysadmin
<fasta>
orbitz: it does when the system admins lag.
<fasta>
orbitz: if doing it myself takes 5 minutes and asking the system admin takes hours, then it's quite easy what is going to happen.
<orbitz>
Maybe, in any reasonable sized organismaiton devs don't have root
<orbitz>
I can't even get to our prod machines
<orbitz>
fasta: I also install ocaml to its own dir, and all deps in there, so as long as I know all the machines are teh same, i can just tarball that and push it everywhere
<fasta>
orbitz: I think the best is some combination of tools.
<fasta>
orbitz: e.g. use puppet for whatever they have already automated quite well.
<fasta>
orbitz: and custom scripts for the rest which might or might not be called from puppet.
<orbitz>
fasta: With teh tarball thing, chef can just install the tarball i made
Reventlov has joined #ocaml
<fasta>
orbitz: I think a full workstation requires thousands of packages.
<fasta>
orbitz: which is something chef, etc. generally doesn't do.
<fasta>
It's more targeted at managing a bunch of servers.
<fasta>
You can make it do other things, of course, but the tools themselves only help when you can make use of existing scripts.
<fasta>
Or recipes or whatever they call it :P
<fasta>
I would always call my next tool Shit and running a program would be called eating.
<fasta>
Eating Shit works really well!
<fasta>
er almost
<orbitz>
fasta: I'm not sure hwy chef can not handle thosuands of packaegs
<fasta>
orbitz: sure, it can, but it wouldn't help anything.
<orbitz>
fasta: you would setup a workstateion role in teh chef server and ocne you boostrap it to running chef it will just isntall all of it
<orbitz>
what wouldn't it help?
<fasta>
orbitz: what does it more dan apt-get -q=2 install $(cat list_of_packages) ?
<fasta>
than*
<adrien>
btw, my linux distribution is slackware: installs are "full", i.e. I don't have only runtime stuff but also developer tools and files, and servers
<adrien>
saves a lot of time
<orbitz>
fasta: doing that would be sufficient, if you have a workstation role it is nice to have all of them be the same, and when you add a new package you can push out changes trivially to all of them. But chef also has a lot of support for playing with config files on the fly
<fasta>
orbitz: I wrote scripts to setup my usb over ethernet networking for example.
<fasta>
orbitz: I think such things are much harder to setup in Chef.
<orbitz>
I don't see why
<orbitz>
Chef is really just a wrapper around ruby
<fasta>
orbitz: so how could that be done then?
<fasta>
orbitz: or do you mean to just write something custom in ruby?
<fasta>
orbitz: it's basically a matter of just called 'sed' for lots of these things.
<fasta>
calling*
<orbitz>
fasta: I'm not sure what the exact problem is, clearly you need a network connecitn touse chef, but a chef recipe is jus ta ruby script so I don't see why it would not be possible to implement our USB setup thing in it
<fasta>
orbitz: ok, so then it is possible, but does it do anything better than scripts?
<orbitz>
It depends on your use case obviously
<orbitz>
a Chef server isn't that useful for me on my home laptop, but if I were managing 1000 workstations it is
<fasta>
orbitz: for example, I would like to install godi in multiple chroots.
<fasta>
orbitz: or I would like to have the latest ruby installed and have Debian's standard ruby pointing at this latest version.
avsm has quit [Quit: Leaving.]
<fasta>
Debian doesn't have any way to automate that via an API.
<orbitz>
fasta: Like any tool its specific viability depends on specifics. Chef is made for managing hosts, not a host. So if your usecase falls inot that area then chef is probably useful, if not it ins't
<fasta>
Speaking of OCaml: is it possible to write a parallel accessible data structure in OCaml?
<fasta>
AFAIK, the answer is basically 'no'.
<thelema>
fasta: parallel as in accessed by threads running on different processors?
<fasta>
thelema: is there any other kind?
<fasta>
thelema: because the data is in some in memory data structure.
<fasta>
thelema: if you want to synchronize that, I don't think you can do that in any other way.