<sponge45>
if findlib is installed properly, it should work (but I use godi so I don't know)
<dark_light>
how can i verify it?
<sponge45>
ocamlfind list
<dark_light>
the file installed by package was /usr/lib/ocaml/3.09.1/stublibs/dllpcre_stubs.so
<dark_light>
there are no pcre in ocamlfind list
<sponge45>
that's too bad...
<dark_light>
Hmmmmm
<dark_light>
ahhhhh
<dark_light>
i installed only the runtime support
<dark_light>
maybe there are a -dev too
<dark_light>
libpcre-ocaml-dev :)
<sponge45>
good to know...
<pango_>
there's libregexp-pp-ocaml-dev too, but it seems not to be micmatch, just something similar...
<sponge45>
yeah, it existed before micmatch.
<dark_light>
sponge45, what was the motivation for building micmatch, then?
<sponge45>
1) the syntax of regexps
<sponge45>
2) an incorporation into the regular match ... with
<dark_light>
syntax is the most important thing of a module like this..
<sponge45>
I much prefer the ocamllex-like syntax, so here it is
delamarche has quit []
<sponge45>
micmatch actually relies on some code from the regexp-pp package. This is the camlp4 stuff which allows to move the command which compiles the regexp to a place where it will be executed only once.
<dark_light>
sponge45, your 'a'-'z' is very verbose, what is bad, but the no need of escaping metacharacters in strings is good..
<sponge45>
you can use the POSIX patterns: lower, upper, alpha, alnum, etc.
<dark_light>
maybe a new syntax like 'a-z' equivalent for 'a'-'z' would make this better..
<dark_light>
sponge45, hmmmmmmmmmmmm.. ah
<dark_light>
with [:lower:] ?
<sponge45>
no, just lower
<dark_light>
Hmmm.. ok
<dark_light>
errr.. :)
<sponge45>
and you can define your own:
<sponge45>
RE lower2 = lower | '_'
<sponge45>
then you can use lower2 in the rest of the program
<dark_light>
Hmmm..
<dark_light>
in the rest of match or the rest of program?
<sponge45>
any pattern-match which comes later in the program
<dark_light>
i can define it as a statment? outside all lets?
<sponge45>
yes
<dark_light>
ah
<sponge45>
actually you cannot define it locally
<dark_light>
hm
<dark_light>
sponge45, very very nice :~~ congrats
<sponge45>
the definition of shortcuts is derived directly from ocamllex
<sponge45>
but thank you :-)
<dark_light>
Parse error: '>' expected after [meth_list] (in [type])
<dark_light>
my parse.mli is only a val incoming : < join : '_a -> unit; list_autojoin : '_a list; privmsg : unit; _.. > -> string -> unit
<sponge45>
I don't think you can compile 2 files on the same command line (parse.mli and parse.ml)
<dark_light>
ah
<dark_light>
errr
<dark_light>
i meant to compile only parse.ml
<dark_light>
to parse.cma
<sponge45>
ok, pizza is waiting
<dark_light>
:)
<dark_light>
ok
<dark_light>
The type of this expression, < join : '_a -> unit; list_autojoin : '_a list; privmsg : string -> string -> unit; _.. > -> string -> unit, contains type variables that cannot be generalized
<dark_light>
anyone knows what this can means?
<Smerdyakov>
All polymorphism in objects must be at the top level. Polymorphic methods are not allowed.
<dark_light>
ah
<dark_light>
fine, it's just a matter of defining better the types
<dark_light>
Parse error: [label] expected after '#' (in [expr])
<dark_light>
ah
<dark_light>
forget
<Smerdyakov>
I think you've spent enough on this that is would be reasonable to switch to using the module system now.. :)
<dark_light>
not before i get this working :)
<dark_light>
i am having really odd problems with type inference and methods, but i am so far that i must see this working....
descender has quit [Remote closed the connection]
descender has joined #ocaml
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
julien has quit [Remote closed the connection]
julien has joined #ocaml
sponge45 has left #ocaml []
<dark_light>
what means the _ in the type < join : string -> unit; privmsg : string -> string -> unit; _.. > ?
<dark_light>
it is a object that has the method join of type string->unit, a privmsg of type string->string->unit, and..?
<dark_light>
and why this type contains type variables that cannot be generalized?
<Smerdyakov>
I think most of us don't use OO, so you may be waiting a while for an answer...
<dark_light>
hmmmm.. yes
<dark_light>
Smerdyakov, but, hmmm.. ocaml is named after OO.. objective caml
<Smerdyakov>
I think you already observed yourself that OCaml suffers from being maintained by researchers.
<Smerdyakov>
The fact that a novel language feature appears in the name doesn't mean that you should use that feature.
<dark_light>
hum:)
<dark_light>
well, it was only a matter of changing the parse.mli file.. rather trivial
luca83 has quit [Read error: 110 (Connection timed out)]
DRMacIve1 has joined #ocaml
pango_ has quit [Remote closed the connection]
RSi has joined #ocaml
<RSi>
when using the ocaml interactive toplevel, i cant use backspace, it just gives me a ^H, anyone know how to fix that?
DRMacIver has quit [Read error: 110 (Connection timed out)]
<dark_light>
there are some approaches, but i don't know them
jeremy_c has quit [Client Quit]
<dark_light>
one is like running ocaml in emacs
<dan2>
RSi: use a better terminal
<RSi>
dan2: haha thanks for the advice, but any solutions?
<dan2>
what terminal are you using right now?
<RSi>
on my machine, or what shell on the server?
<RSi>
using mac's terminal (i think its officially xterm) and bash
<RSi>
no worries, i just fixed it in stty
<RSi>
thanks anyway
RSi has left #ocaml []
dark_light has quit ["Ex-Chat"]
ramkrsna has quit [Read error: 110 (Connection timed out)]
ramkrsna has joined #ocaml
danly has quit [Read error: 110 (Connection timed out)]
jeremy_c has joined #ocaml
<jeremy_c>
Is there no way to get around recursive dependencies? I have two classes. "Company" and "Product". If I have a company, I want to be able to say my_company#products ... that will return a list of products. However, if I have a product, I want to be able to say product#company to get the company.
<levi_home>
I don't know about objects, but you can make type definitions recursive by using 'and' between them.
<jeremy_c>
or a 1 to 1 match, company#sales_rep
<jeremy_c>
levi_home: I am speaking of having product.ml require company.ml and company.ml requiring product.ml
<levi_home>
There is probably a way to do that with the module language.
<jeremy_c>
there's a simple sample. How would you compile that?
bzzbzz has quit ["leaving"]
<dan2>
jeremy_c: functors?
<Smerdyakov>
jeremy_c, I would recommend not using OO.
<dan2>
jeremy_c: define a sigtype for person and reference that
<jeremy_c>
Smerdyakov: I am open to why no OO?
<dan2>
jeremy_c: he wants you to use SML
<dan2>
jeremy_c: you'd actually be better off making a person a record
<dan2>
the whole thing can be done structurally with functional techinques
descender has quit ["Why has elegance found so little following? Elegance has the disadvantage that hard work is needed to achieve it and a good e]
<Smerdyakov>
jeremy_c, I couldn't parse your last line.
<jeremy_c>
dan2: p#get_name is just so much nicer to type than p.Person.name, and more important, extending the base class (which is auto-generated from db schema) is important. i.e. base class has first_name, last_name but extended class has full_name which is obviously combo of the two. I could then do Person.full_name p ;; (full_name being a function in Person module.
<dan2>
jeremy_c: create a module that operates on the data set
<jeremy_c>
dan2: when would you use classes?
<dan2>
jeremy_c: when dealing with XML
<dan2>
which is basically the only reason to use object oriented anywhere
<jeremy_c>
dan2: ok, so how then do you have the person data set (type person = {name:string; company:company}; and then type company {name:string; employees: person list;}
<jeremy_c>
dan2: you'd run into the same thing, right?
<dan2>
jeremy_c: not really
<jeremy_c>
type company cannot be created w/o type person, type person cannot be created w/o type company
<dan2>
jeremy_c: I would have a class CompanyFactory that would return an object for a company
<dan2>
by name
<dan2>
a hashtable would also work
<dan2>
anyway
<dan2>
gotta go to bed
<jeremy_c>
ok. but your returned object contains a person.
<jeremy_c>
dan2: ok. gn.
<dan2>
jeremy_c: use a "company" identifier so you can lookup the company
<dan2>
that way only Company depends onf Person
<jeremy_c>
dan2: but person will require the company factory in order to look up which company they work for, and therefore, company factory will require company type.
<Smerdyakov>
jeremy_c, what's so bad about declaring these tiny types simultaneously?
<jeremy_c>
Smerdyakov: how?
<Smerdyakov>
type a = { foo : int; bar : b option ref} and b = { baz : string; bonk : a option ref }
<dan2>
good point
<jeremy_c>
Smerdyakov: hm. didn't realize that would solve the problem.
<jeremy_c>
Is my problem that unique or am I going about the thing all wrong?
<jeremy_c>
Seems everyone will have relations in this manner, my problem can't be that unique.
<Smerdyakov>
Did you repeat "name clashes" because you don't think having anonymous record types solves the problem?
<jeremy_c>
Smerdyakov: I don't know Standard ML.
<jeremy_c>
Smerdyakov: I barely know OCaml.
<Smerdyakov>
Well, it does solve the problem.
<jeremy_c>
Smerdyakov: do you have a place I can read about this solution?
<Smerdyakov>
No.
danly_ is now known as danly
<Smerdyakov>
Record types in SML are simple.
<Smerdyakov>
They are like syntactic sugar for tuples.
<Smerdyakov>
Any {l1 : t1, ..., ln : tn} is a type.
descender has joined #ocaml
<Smerdyakov>
#l is the type of the selector function from a value of some record type with a label l.
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- IRC for those that like to be different"]
<Smerdyakov>
{l1 = e1, ..., ln = en} builds a record of type {l1 : t1, ..., ln : tn}, where each ei has type ti.
<Smerdyakov>
s/is the type of the selector/is the selector/
<jeremy_c>
Smerdyakov: does OCaml do SML? This seems anti-OCaml, anonymous types.
<Smerdyakov>
SML is another language. I don't know what it would mean for OCaml to "do" SML.
<Smerdyakov>
And it's ridiculous to say that anonymous types are anti-OCaml. Almost all types in OCaml are anonymoys.
<Smerdyakov>
The only exceptions are variants.
<jeremy_c>
I know OCaml is a type of ML. Didn't know if OCaml was built ontop of SML like C++/C
<Smerdyakov>
(And records)
<Smerdyakov>
(And the weird extra recursive stuff OCaml supports)
<Smerdyakov>
No, they are two incomparable languages.
<jeremy_c>
Smerdyakov: OCaml is my first functional language. The reason I choose to learn it is that it seems to have a good following, it's available on every platform I use (I'm not exotic, only OS X, Windows and Linux), and it's speed is fantastic.
<jeremy_c>
what about support for say databases? pgsql/mysql
jeremy_c has quit [Read error: 104 (Connection reset by peer)]
jeremy_c has joined #ocaml
<jeremy_c>
hm, that was strange. dropped my wireless router for some reason. What about support for say databases? pgsql/mysql?
<Smerdyakov>
All easy to implement yourself, and there are several interfaces out there already.
descender has quit ["Why has elegance found so little following? Elegance has the disadvantage that hard work is needed to achieve it and a good e]
<jeremy_c>
SML/NJ or MLton to try?
descender has joined #ocaml
<Smerdyakov>
SML/NJ for development, MLton to compile release versions.
Smerdyakov has quit ["Leaving"]
jeremy_c has left #ocaml []
jewel has joined #ocaml
<buggs>
SML is dead
shawn_ has quit [Connection timed out]
jewel has quit [Connection timed out]
jewel has joined #ocaml
love-pingoo has joined #ocaml
smimou has joined #ocaml
shawn_ has joined #ocaml
vadimtk has joined #ocaml
smimou has quit ["bli"]
slipstream has joined #ocaml
slipstream-- has quit [Read error: 145 (Connection timed out)]
Ballin_05 has joined #ocaml
<Ballin_05>
<< is back
Ballin_05 has quit [Remote closed the connection]
pango has joined #ocaml
shekmalhen has quit ["Snakes on Crack!!"]
gonnet has quit [Remote closed the connection]
gonnet has joined #ocaml
love-pingoo has quit ["Leaving"]
joshcryer has quit [Client Quit]
Ballin_05 has joined #ocaml
<Ballin_05>
anyone up
DRMacIve1 is now known as DRMacIver
ppsmimou has quit ["Leaving"]
mikeX has joined #ocaml
jeremy_c has joined #ocaml
descender has quit [Remote closed the connection]
pango has quit [Remote closed the connection]
descender has joined #ocaml
pango has joined #ocaml
mikeX_ has joined #ocaml
mikeX_ has quit [Client Quit]
mikeX has quit [Read error: 145 (Connection timed out)]
ppsmimou has joined #ocaml
jewel has quit [Read error: 110 (Connection timed out)]
vadimtk has quit [Read error: 145 (Connection timed out)]
delamarche has quit []
jajs has joined #ocaml
ktne has joined #ocaml
<ktne>
hello
<ktne>
anyone here?
<ktne>
i've observed something and i might be wrong so give me feedback
<ktne>
i have observed that in a lot of instances in order to get reasonable resource consumption people use tail recursion
<ktne>
this seems to be common to a lot of pure functional programming language
<ktne>
but the thing is..
<ktne>
isn't a tail recursive function that takes an accumulator as parameter a virtual machine in disguise?
<flux__>
no?-)
<mellum>
ktne: no.
<ktne>
basically the tail recursive function will implement a virtual machine and execute imperativelly some code there
<ktne>
the accumulator is the state of the machine and the rest of the function params are the machine control state
<ktne>
(euqivalent to instruction pointer in a hardware machine)
<mellum>
Oh, you mean a state machine.
<mellum>
a virtual machine would be something turing-complete.
pango has quit [Remote closed the connection]
<ktne>
well it's a quasi virtual machine, what i mean is that the programming *inside* this virtual machie is as imperative as you can get, i can't see any difference at least at theoretical level between a tail recursive state machine and imperative programming
<mellum>
So your point is that functional code can be converted to imperative code? That's not exactly surprising, given that it can be executed by imperative CPUs :)
<ktne>
no, what i meant is that all those pure functional purists write imperative code all the time without realising it :)
pango has joined #ocaml
<ktne>
hi pango
<flux__>
ktne, well, it's still a function that depends in (only) its inputs
<mellum>
Yeah, and I have been speaking Chinese all my life, just I haven't translated it yet!
<flux__>
s/in /on /
shekmalhen has joined #ocaml
<ktne>
mellum :)
chessguy has joined #ocaml
chessguy2 has joined #ocaml
_fab has joined #ocaml
chessguy has quit [Nick collision from services.]
chessguy2 is now known as chessguy
Smerdyakov has joined #ocaml
<ktne>
flux__ unless you use an internal random generator device, a function will always depend only on it's own inputs
<pango>
# let f =
<pango>
let x = ref 0 in
<pango>
fun () -> incr x; !x ;;
<ktne>
pango ?
<pango>
of course it's no longer a "function" by the mathematical definition
<ktne>
pango that still depends only on the greater input called environment
<pango>
that looks like a specious argument
<flux__>
random generators also depend on the greater input called the universe..
<ktne>
not necesarly
<ktne>
there are truly random values that don't depend on anything
<flux__>
hmm.. such as?
<ktne>
it doesn't come cheap but there are some PCI devices that use quantum effects, they are used for machines that use SSL auth
<flux__>
well, just because we cannot measure the inputs doesn't mean it isn't a result of it
<flux__>
although my understanding of quantum mechanics is very limited
<ktne>
no, quantum are truly random
<ktne>
meaning that they don't depend on external things, they are not fully determinstic
<flux__>
so they depend on nothing?
<ktne>
the determinism of the macro world comes as an emergent property, just like a society made of a large enough number of rather random acting individuals behaves in a quite determined way
<pango>
either define what you mean by function clearly, or define what you mean by input clearly, otherwise just {any,no}thing can be said
<Smerdyakov>
What on earth is this discussion about? I can't imagine how it could have any practical relevance.
<pango>
if you mean function in the mathematical meaning, I agree
<ktne>
pango yes but an imperative instruction is a pure mathematical/deterministic operation of it's input (the state of the machine)
<ktne>
(excepting for the above random generator use thing)
<ktne>
*on it's input
<pango>
or function in a purely functional language, it's usually true
<ktne>
yes
<pango>
But ML languages are not purely functional
<ktne>
but anyway my point was (paraphrasing) that every complex pure functional program ends up implmenting it's own imperative lisp machine on top of a tail recursive virtual machine :)
<Smerdyakov>
ktne, I'd hate to have to maintain a purely functional program written by you, then.
<ktne>
Smerdyakov :)
<ktne>
yes but i just meant that a lot of pure functional things are quasy imperative, most recursive stuff that uses a state for example
<ktne>
an accumulator for state
<Smerdyakov>
I don't know of any objective definition of "relative imperativity" that gives useful meaning to what you just said.
<flux__>
ktne, btw, have you taken a look at haskell?
<ktne>
imperative would something that depends on order of execution, by quasi imperative i meant something that uses the recursive call mechanism in order to enforce order of execution, even if the function appears to be pure functional
<Smerdyakov>
ktne, how does that concept have any practical importance?
<ktne>
i'm thinking about an imperative programming language where functions don't have side effects
<chessguy>
like what?
<ktne>
there seems to be this idea that pure functional is the way to remove side effects, i can't see too many references to imperative languages without side effects
<ktne>
actually i couldn't find any such reference
<chessguy>
that's because no such language exists
<ktne>
the idea would be to use a function call that has semantics similar to fork() that destroys the called environment on return and keeps just the return value
<ktne>
so on function call the semantic effect would be a fork(), the return value gets computed, the function returns and the forked environment gets destroyed
<Smerdyakov>
OK, so ktne seems deliberately to be ignoring questions to why anyone should care about what he's talking about. I take that as an admission that the topic is pointless.
<flux__>
I think that's sort of interesting
<flux__>
but I wonder how it would be different from an actual functional language
<chessguy>
flux__, i was just thinking the same thing
<flux__>
would i++ work in that language?
<chessguy>
you're not a clone of me, are you?
<ktne>
flux__ yes but only until function return
<ktne>
flux__ so i++ would be used inside the function
<chessguy>
well, functional languages have local definitions
<chessguy>
that's what let is for
<ktne>
chessguy you can't redefine the local vars in a pure functional language
<flux__>
it just seems it is arbitrary to put the fork() exactly to function calls
<ktne>
flux__ well the idea is that the fork will prevent side effects, while the function can still use imperative style in order to compute the result
<ktne>
flux__ that's why fork() would be the semantic effect of function calls, (but not a real fork() because that would be way too expensive)
<ktne>
by fork() i mean a COW mechanism
<ktne>
this would be optimised by statical analysis so it won't be slow using paging or anything like that
<flux__>
well, you would still need to 'copy' stuff like arrays
<flux__>
or atleast resort to COW on those
<ktne>
only if you actually have to reuse the value on return
<ktne>
after return i mean
<ktne>
for example i++ would be equivalent to i = i+1, this would be done in-place since the old value doesn't have to be used
<ktne>
the thing is that in most cases you don't actually need to keep the old value, think for example about sorting an array
<ktne>
in most cases you overwrite the old value
<flux__>
threading will complicate things
<flux__>
maybe
<flux__>
:)
<ktne>
well if you use threads then you have to copy the value currently too
<ktne>
because you can't just modify the shared array
<ktne>
(if the old value of the shared array is needed)
<ktne>
if the access is locked then you can do safelly a in-place operation
<ktne>
only when you have to keep unlocked access you have to do a copy, which would be done automatically by the compiler
<ktne>
which is sort of similar with what you do with current tools, just manually
shekmalhen has quit ["workie"]
<ktne>
flux__ eventually you could chose 2 types of function calls and those would work for all functions
<ktne>
pure or impure
<ktne>
so for example "f(a,b)" could mean to call f in pure/fork way, while "f[a,b]" could mean to call f in impure way
vadimtk has joined #ocaml
chessguy has quit [Connection timed out]
smimou has joined #ocaml
pango has quit [Read error: 104 (Connection reset by peer)]
delamarche has joined #ocaml
ktne has left #ocaml []
david_koontz has quit [Read error: 110 (Connection timed out)]
delamarche has quit []
pango has joined #ocaml
Snark has joined #ocaml
shawn_ has quit ["This computer has gone to sleep"]
vadimtk has quit []
DRMacIve1 has joined #ocaml
shawn_ has joined #ocaml
jajs has quit ["Leaving"]
ramkrsna has quit [Read error: 110 (Connection timed out)]
shawn_ has quit [Client Quit]
shawn_ has joined #ocaml
DRMacIver has quit [Read error: 110 (Connection timed out)]
<dan2>
Smerdyakov: what's the major differences between programming in SML v. Ocaml?
chessguy has joined #ocaml
jajs has joined #ocaml
Snark has quit [Remote closed the connection]
<dbueno>
dan2, I know it's rude to answer the question you posed to someone else, but, some major differences I find:
<dan2>
dbueno: go for it
<dbueno>
1. SML has CM (compilation manager), which is way better than make(1)+ocamldep, in my opinion.
<dbueno>
It works from the toplevel, inside SML, and dynamically recompiles exactly what you want & loads it into the current toplevel.
<dan2>
nice
<dan2>
but that's just aesthetics
<dan2>
I'm mean real language changes
<dbueno>
2. All library functions in SML are tupled, not curried, like they are in OCaml. OCaml is much better in this regard.
<dan2>
currying is much better
<dbueno>
3. The system/data structure APIs are different, but not conceptually.
<dan2>
I'm such a fan of Concurrent ML interface from SML that I used it for my java PostOffice component
<dan2>
designed to model it
<dbueno>
dan2: I've never used Concurrent ML.
<dan2>
dbueno: really high quality concurrency tools
<dan2>
dbueno: I ported necessary code to Ocaml to satisfy my needs
<dbueno>
dan2, I haven't done any concurrent programming in either SML or OCaml.
<dbueno>
It seems like a good idea, given that a major selling point of applicative programming is that it's easy to parallelise.
<dan2>
dbueno: concurrent programming in both languages are great I can only imagine because almost everything is immutable
<dan2>
the "synchronized" keyword in java was the biggest screwup of the whole language
<dbueno>
Perhaps. Many of the cases I've run into would have been fixed if Object.wait/notify took an extra "mutex" argument.
<dbueno>
dan2, What concurrent programming have you done in SML/OCaml?
<dan2>
I ran a massively scalable text processing communications project that interfaced with Asterisk PBX via TCPIP and used a thread worker model
<dan2>
it was damn fast
<dan2>
dbueno: quick question, (I don't usually do this)
<dan2>
when you override a constructor in java that's from an abstract class that was prefilled, will the overrided method call the overrided constructor?
<dan2>
I've always assumed it doesn't
<DRMacIver>
I thought Java constructors were not inherited, even from abstract classes.
<DRMacIver>
But possibly I'm wrong. :)
<dbueno>
dan2, was that OCaml or SML?
<dan2>
DRMacIver: I think you are right, I was just thinking about this
<dbueno>
dan2, You can't override constructors.
<dbueno>
Although if you mix types in a weird (and conflicting) way, you can get compile errors, I believe.
<dbueno>
I could be wrong about that.
<dan2>
dbueno: ocaml
jajs has quit ["Leaving"]
_fab has quit [Read error: 110 (Connection timed out)]