<stef_>
grammar.ml is not the ouput of some yacc program
<TheDracle>
You said it was autogenerated.
* monochrom
re-defines "parser generator" in a convoluted way so as to include camlp4 :D
<stef_>
I suspect it the translation in std ocaml of some file in an extended ocaml
<Smerdyakov>
Include the C preprocessor, too.
<stef_>
s/it/it is/
<TheDracle>
Hm.. Does anybody here have any good artificial intelligence resources oriented around using Ocaml?
<kuribas>
That's a huge subject.
<TheDracle>
Yes, I know.
<TheDracle>
I don't mean anything like template-etc.
<TheDracle>
More like neural networks.
<Smerdyakov>
I doubt there are any.
<TheDracle>
Yeah, I did a web-search, I was surprised.
<Smerdyakov>
Why? What would be OCaml-specific?
<kuribas>
Do they solve real problems with neural networks?
<TheDracle>
Well, it doesn't 'need' to be Ocaml specific.
<TheDracle>
Kuribas: yes.
<kuribas>
like?
<TheDracle>
But, I'd like for it to be.
<TheDracle>
Hm, identifying enemy tanks.
<TheDracle>
Shooting down planes...
<Smerdyakov>
Is that what you do at work?
<TheDracle>
No.
<TheDracle>
Thankfully :)
<TheDracle>
Heh.
<Smerdyakov>
Liar/baby killer.
<stef_>
cool, trying to feed people is so boring
<TheDracle>
Not a chance.. I know some guys who work for L3 though doing satellite communications.
<stef_>
fragmentation bombs are so cool
<TheDracle>
stef_: Yeah, 35 million dollars boring, compared to 80 billion dollars FUN.
<TheDracle>
I know there is a game AI section in the Ocaml-ora book.
<stef_>
speak with an american and you got a amount of money very soon
<TheDracle>
Like, there's a friggen section of everything.
<TheDracle>
I am, sadly, an American :p
vinvin has joined #ocaml
<vinvin>
hello
<stef_>
and the next logical step is some god invocation "In God we trust"
<TheDracle>
stef_: Yeah, that shit didn't appear on our money until the McCarthy era.
<TheDracle>
And people act like it's been there forever.
<stef_>
thx TheDracle, I learnt something today :)
<TheDracle>
Lol.
<vinvin>
i dont understand how to write a recursive function with several args, what is the syntax of that ?
<TheDracle>
let rec myFunc arg1 arg2 arg3 = Blah.
<vinvin>
thats what i made, you can use | with that ?
<TheDracle>
|? If you're pattern matching, yes.
<vinvin>
i need the equivalent of scheme's (cond ...)
<Smerdyakov>
vinvin, what's wrong with nested if..then..else?
<vinvin>
isn't it done with | ?
<TheDracle>
Hm, do you mean you want the function to pattern match on the arguments, and have an | statement?
<TheDracle>
I know SML can do that, I don't think Ocaml can.
<vinvin>
not really a pattern match but stuff like | i < 0 && j > i -> f (i+1) j for example
<Smerdyakov>
vinvin, use if..then..else if you're not really using pattern matching.
<vinvin>
Smerdyakov i dont want to make 5 levels of if then else
<Smerdyakov>
vinvin, why not?
<vinvin>
if then ... else if then ... else if blabla
<vinvin>
that's not ...
<vinvin>
clean
<Smerdyakov>
vinvin, how not?
<vinvin>
indentation
<Smerdyakov>
vinvin, you must have a bad indenter. :)
<kuribas>
I believe Haskell can do that
<vinvin>
lol
<Smerdyakov>
kuribas, everything can... it's just a matter of automatic indenters getting confused.
<vinvin>
is there a special if with no else like scheme's when ?
<Smerdyakov>
vinvin, yes, when the type is unit; I don't know if that's the same as Scheme 'when' semantics.
<Riastradh>
There is no form called WHEN in Scheme.
<kuribas>
I mean using boolean expressions in pattern matching
<vinvin>
hi Riastradh :)
<vinvin>
ok must be only in plt scheme
<vinvin>
allright so i'll use if statements that's actually not so bad
<Smerdyakov>
kuribas, you mean guard expressions?
<kuribas>
Smerdyakov: yes
<Smerdyakov>
kuribas, OCaml supports it, too.
<Riastradh>
It is a frivolous & trivial bit of syntactic nutrasweet. OCaml's 'if' with no alternative clause has semantics roughly analogous to Scheme's IF.
<Riastradh>
(...Scheme's IF with no alternative clause.)
<vinvin>
ok
<vinvin>
thanks
<kuribas>
How do I append a character to a string?
<monochrom>
"abc" ++ "d"
<monochrom>
"abc" ++ ['d'] works too. you probably like this more.
<Smerdyakov>
That's not OCaml.
<kuribas>
monochrom: that's Haskell, right?
<monochrom>
oops
<monochrom>
"wrong window" :D
<mbh>
str ^ (Char.escaped c)
fab__ has quit [Read error: 60 (Operation timed out)]
<Smerdyakov>
If you're appending characters to strings, you should slap yourself on the wrist.
<Smerdyakov>
Try accumulating characters in a list and only building a string at the end.
<Smerdyakov>
Or pre-allocating a string and using destructive update.
<kuribas>
That looks very low-level
<kuribas>
I thought ocaml was a high-level language ;)
<Riastradh>
So use the Buffer module.
<kuribas>
ok
drewr has joined #ocaml
fab__ has joined #ocaml
zzorn_away has quit ["They are coming to take me away ha ha"]
Smerdyakov has quit []
<vinvin>
what is comment syntax ? :p
<pango>
(* *)
<vinvin>
thx
<kuribas>
Does ocaml have something like named-let in scheme?
<Riastradh>
No. Use let rec.
<vinvin>
great my program works
<vinvin>
time to sleep cya
vinvin has quit ["((lambda L (apply string L)) #\c #\y #\a)"]
det_ is now known as det
m3ga has joined #ocaml
kuribas has quit ["Leaving"]
m3ga has quit ["Client exiting"]
kinners has joined #ocaml
monochrom has quit ["Few people understand "understanding"."]
mlh has quit [Client Quit]
KrispyKr1ngle has joined #ocaml
KrispyKr1ngle has quit [Client Quit]
KrispyKringle_ has joined #ocaml
KrispyKringle has quit [Read error: 60 (Operation timed out)]
KrispyKringle_ is now known as KrispyKringle
kinners has quit [Read error: 60 (Operation timed out)]
mrsolo has joined #ocaml
mrsolo has quit [Read error: 54 (Connection reset by peer)]
mrsolo has joined #ocaml
fsc has joined #ocaml
kinners has joined #ocaml
Herrchen_ has joined #ocaml
mlh has joined #ocaml
Herrchen has quit [Read error: 60 (Operation timed out)]
drewr has quit ["ERC Version 4.0 $Revision: 1.719 $ (IRC client for Emacs)"]
monochrom has joined #ocaml
tintin has joined #ocaml
kinners has quit [Read error: 110 (Connection timed out)]
mbh has quit [Read error: 110 (Connection timed out)]
<KrispyKringle>
one can use match to parse a string, right? like:
<KrispyKringle>
match str with ("SOMETHING: " ^ foo) -> (* do something with foo *)
<KrispyKringle>
guess i should try it and see.
<KrispyKringle>
looks like not.
vezenchio has quit ["Greenspun's Tenth Rule of Programming: any sufficiently complicated C or Fortran program contains an ad hoc informally-specif]
<Hadaka>
if I have a record type specified inside a module, can I access the fields of that record without opening the module?
<mflux>
variable.Module.record.field
<mflux>
it can become tiresome at some point..
<Hadaka>
ah, it works that way, thanks
<Hadaka>
man, it is truly bothersome to have records that have overlapping field names
<mflux>
yes
Demitar has quit [Read error: 60 (Operation timed out)]
<Hadaka>
what also bothers me that there is no way to make a record type in a variant constructor
Submarine has joined #ocaml
<pango>
Hadaka: type fields = { a : int } and sum = Const | Var of fields
<pango>
or am I misunderstanding what you want to do
<mflux>
he wants to write (well, so do I :-)) type bar = Bar of { a : int }
<pango>
yes, don't know what it's not allowed... On the other hand, using the two steps workaround is not a big problem
<pango>
s/what/why/
<Hadaka>
pango: yes, I know I can write it separately
<pango>
"constr-decl ::= constr-name
<pango>
| constr-name of typexpr" (...) "There are no type expressions describing (defined) variant types nor record types, since those are always named, i.e. defined before use and referred to by name."
<pango>
so it's indeed not possible
Demitar has joined #ocaml
mflux has quit [tolkien.freenode.net irc.freenode.net]
mflux has joined #ocaml
vezenchio has joined #ocaml
drewr has joined #ocaml
James_123 has joined #ocaml
<James_123>
How do I compile a dll with ocamlopt?
<vincenz>
can't
<vincenz>
but look at dynlink
<James_123>
Thanks. I will look at it. Any good learning recommendations for OCAML? I have seen a few online tutorials so far.
<vincenz>
the book by oreilly shown on the website of ocaml is very good
<vincenz>
it's downloadable
<James_123>
I have it but have been jumping from to tutorial to tutorial. Will try to stick to it.
James_123 has quit ["Chatzilla 0.9.66 [Mozilla rv:1.7.5/20041107]"]
lodewijk has quit [Read error: 60 (Operation timed out)]
lodewijk has joined #ocaml
kuribas has joined #ocaml
demitar_ has joined #ocaml
Demitar has quit [Read error: 110 (Connection timed out)]
tintin has quit [Remote closed the connection]
Submarine has quit [Remote closed the connection]
lmbdwr has quit [Remote closed the connection]
Smerdyakov has quit []
kuribas has quit ["Leaving"]
<mbh>
does 3.06 have the Str library?
<smimou>
I think so
demitar__ has joined #ocaml
Submarine has joined #ocaml
demitar_ has quit [Read error: 110 (Connection timed out)]
pango has quit [Remote closed the connection]
pango has joined #ocaml
demitar__ is now known as Demitar
mrvn has joined #ocaml
mrvn_ has quit [Read error: 60 (Operation timed out)]
Submarine has quit ["Leaving"]
mrsolo_ has joined #ocaml
karryall has joined #ocaml
mrsolo has quit [Read error: 60 (Operation timed out)]
monochrom has joined #ocaml
Submarine has joined #ocaml
KrispyKringle has joined #ocaml
_JusSx_ has joined #ocaml
lmbdwr has joined #ocaml
Submarine has quit ["Leaving"]
monochrom has quit ["Few people understand "understanding"."]
monochrom has joined #ocaml
<KrispyKringle>
so i'm curious, for a small task, is there a drawback (performance hit?) to using ocamllex/ocamlyacc?
<KrispyKringle>
like, it's small enough that i could use regexps myself fairly easily. and if i were using C, I wouldn't use YACC here, becaues it seems an unnecessary overhead. Should I be similarly concerned with ocaml, or no?
<lodewijk>
why would a yacc parser be slower than a regex based one?
<KrispyKringle>
well, in C, you have to dynamically link to the yacc library, at the least, though that's certainly not a huge concern.
<KrispyKringle>
in C, i wouldn't do it because of the added code complexity, but ocamllex/ocamlyacc look pretty nice.
<lodewijk>
the stream parsers look nicer, but I haven't tried anything substantial with them yet
<KrispyKringle>
stream parsers? ill look into them.
<lodewijk>
the camlp4-based LL(1) parsers
<KrispyKringle>
i much prefer the yacc/lex style to just writing regexps, myself, but i think a lot of people would think im being silly to use it :P
<KrispyKringle>
ill look into them.
<lodewijk>
let me see if there's a tasty URL in my browser history.
<KrispyKringle>
thanks
<Riastradh>
KrispyKringle, what are you parsing?
<KrispyKringle>
Riastradh: for shits and giggles, I'm writing a simple http server.
<KrispyKringle>
so just about the simplest thing i could be parsing :P
<Riastradh>
HTTP headers?
<KrispyKringle>
right
<KrispyKringle>
what's the best way to go about this?
<Riastradh>
Probably write a manual parser. This is indeed extremely trivial.
<KrispyKringle>
yeah
<KrispyKringle>
what are these stream parsers i hear about?
<Riastradh>
No, I mean that it would probably be easiest just to read input characters from a channel and parse them manually.
<KrispyKringle>
ah.
<KrispyKringle>
i suppose. i find it easier to write grammars than manually writing parsers.
<Excedrin>
have you looked at the http server in the ora book?
<KrispyKringle>
no. which is the ora book?
<KrispyKringle>
oh, the oreilly book?
<Excedrin>
yes
<KrispyKringle>
i've been reading it, but i didn't see that example yet.
<KrispyKringle>
ill go look for it now :)
<TheDracle>
Which example?
<TheDracle>
The Compiler one?
<KrispyKringle>
he says there's an http server.
<KrispyKringle>
example, that is.
<TheDracle>
Oh. God.. Probably somewhere in there.
<Excedrin>
chapter 21
<TheDracle>
Lol.
<KrispyKringle>
oh. im on like 5 :P
<Excedrin>
http servlets
<TheDracle>
I probably skimmed over it.
<TheDracle>
I'm on the shortest path thing right now.
_JusSx_ has quit ["leaving"]
avlondono has quit [Read error: 110 (Connection timed out)]
xkb has quit []
<KrispyKringle>
thanks, Excedrin
monochrom has quit ["Few people understand "understanding"."]
mattam has joined #ocaml
lyceen has joined #ocaml
<lyceen>
hello
<KrispyKringle>
hi
<lyceen>
this is my first time here lol
<lyceen>
:)
<Riastradh>
Hmmmm. Is 'lol' some new punctuation mark?
<lyceen>
hey i like it :D
<lyceen>
give it a fair chance
<Excedrin>
list of lists
<TheDracle>
Ria: You forgot to place a semi-wink at the end of that sentence >:B
<lyceen>
is ria a bot?
mlh has joined #ocaml
<TheDracle>
lyceen: Depends on what you mean by 'bot'.
<lyceen>
something that's not made of flesh and bones
<Excedrin>
it's more of an association for the recording industry afaik
<TheDracle>
So.. A can of cola is a bot?
<lyceen>
it depends on what you mean by 'bot'
<lyceen>
;)
<TheDracle>
Pfft.. According to your logical definition, it is :p
<TheDracle>
lyceen: He doesn't seem to understand human emotions, so...
<lyceen>
well i don't want to talk stuff about turing and so on..
<Demitar>
Are there any restrictions against using ocamlmklib for pure-bytecode libraries?
<lyceen>
hell how should i know i'm a noob
<Demitar>
lyceen, if you don't have a clue then you can safely assume it wasn't primarily targeted at you, no? ;)
<Demitar>
(When linking against a library built with ocamlmklib it starts looking for dll*.so, which obviously doesn't exist.)
<lyceen>
yeah :) i know :p sorry couldn't resist it
<lyceen>
are there female o'caml programmers lol?
<Demitar>
No, all ocaml programmers are french.
<Excedrin>
no, the hump scares them away
<TheDracle>
No, part of the public liscense for Ocaml explicitly states that the gender of the user must be male.
<lyceen>
that way i see
<lyceen>
well i'm belgian, but eh it's a neighbouring country of france, and I speak french as well
<KrispyKringle>
not good enough
<vincenz>
lyceen: I'm belgian too
<lyceen>
Are you flemish?
<Demitar>
Noo! The belgians are invading! To the defences! *rings alarm bell*
kuribas has joined #ocaml
<vincenz>
lyceen: yes
<lyceen>
and then, the belgians came lol
<lyceen>
waaw
<TheDracle>
I'm an American trying to adopt Ocaml, kind of like how the neanderthals adopted cromagnon tools before they were wiped out.
<lyceen>
i'm from bruges
<vincenz>
leuven
<lyceen>
how old are you?
<vincenz>
25
<vincenz>
you?
<lyceen>
i'm sweet sixteen
<lyceen>
;)
<KrispyKringle>
ooh...jailbait
<vincenz>
he's a guy
<KrispyKringle>
eh...i take what i can get.
<TheDracle>
... Lol.
<KrispyKringle>
just kidding!
<KrispyKringle>
geeze!
<lyceen>
hey leave me alone
<TheDracle>
How many guys claim to be 'sweet sixteen' though?
<KrispyKringle>
not that there's anything wrong with that...
<KrispyKringle>
TheDracle: exactly!
<TheDracle>
I was confused for a moment as well.
<vincenz>
TheDracle: gay ones
<TheDracle>
Uh oh.
<Demitar>
Hey, you're distracting me from my code. This is supposed to be a silent channel! ;-)
<lyceen>
what's wrong with sweet sixteen,
<lyceen>
?
<TheDracle>
Nah, Gay guys are probably something like "Delicious Sixteen," or "Fantabulous Sixteen".
<vincenz>
lol
<TheDracle>
Demitar: Don't worry, we're not talking about anything having to do with Ocaml.
<TheDracle>
I'm serious though.. You French people need to watch yourself, or we're sending that damn statue back!
<Demitar>
I wonder how many french there are here anyway.
<lyceen>
lol that damn statue :p
<lyceen>
your american people need to watch yourself, or we'll send some iraqi's to chop your head off lol
<TheDracle>
The apropriate English term is apparently 'Frenchies.'
<TheDracle>
At least, according to Fox News.
<Riastradh>
Damn Frenchies!
<vincenz>
damn americans
<TheDracle>
Ahem, appropriate.
<lyceen>
idd vincenz
<Riastradh>
Idd? Is this some other new punctuation mark?
<TheDracle>
Yeah.. I want to move to Canada, but I'm too poor.
<vincenz>
it's short for indeed in our language
<TheDracle>
And, London doesn't have any jobs.
vinvin has joined #ocaml
<TheDracle>
And, Germany is too populated.
<vinvin>
hi :)
<lyceen>
germany too populated?
<lyceen>
lol
<TheDracle>
Yes!
<lyceen>
you must be kidding
<TheDracle>
Like, the big cities.
* Demitar
gets some code done while the "frenchies", americans and belgians do battle.
<Riastradh>
TheDracle, what about Glasgow? That is, after all, where the Glasgow Haskell Compiler is from...
<lyceen>
well, take a look at flanders
<lyceen>
or the netherlands
<TheDracle>
O.o
<lyceen>
they are overpopulated
<TheDracle>
For some reason, going from Utah, to the Netherlands could be a bit akward.
<lyceen>
like 360 people par square kilometer
<TheDracle>
I don't think Europeans really have a concept of what a sheer vacant hole the midwestern U.S. is.
<TheDracle>
Like.. Nothing grows here.. It's just desert as far as the eye can see.
<lyceen>
yeah a desolate place probably
<TheDracle>
Desolate on many levels, not just population wise.
<Riastradh>
I think I'd rather be in the overpopulated Netherlands than Utah.
<TheDracle>
Ria: I think so too.
<lyceen>
eh?
mrsolo_ has quit [Read error: 110 (Connection timed out)]
<TheDracle>
So.. How is immigration to France?
<lyceen>
quite easy for me
<TheDracle>
Heh, I was told nobody would talk to me for like, a year-- until I learned to speak French.
<TheDracle>
Pfft... Show off.
<lyceen>
sorry
<lyceen>
was it hard for you to learn to speak french,
<lyceen>
?
<TheDracle>
I haven't learned to.
<TheDracle>
I can speak ein bischen Deutsch, aber ;p
<TheDracle>
Blah blah blah.
<mbh>
when i was in france, and i tried to speak french, people gave me dirty looks and started speaking english
<TheDracle>
But, in a remedial out of a text-book sort of way.
<lyceen>
Ich kann ein bisschen Deutsch sprechen
<TheDracle>
Lol.
<TheDracle>
Yeah, I just started mixing and matching there Lyc :p
<lyceen>
well yeah in school i have to learn dutch french german and english
cmeme has quit ["Client terminated by server"]
<TheDracle>
In school, I have to learn to stay awake while having my back bent out of proportion.
<lyceen>
well, I don't have that problem
<lyceen>
there are enough interlocuteurs in my class
cmeme has joined #ocaml
<TheDracle>
Lol.
<TheDracle>
I think the teachers in my classes would fit that definition.
<TheDracle>
Like, playing solitaire.
<lyceen>
really?
<TheDracle>
Do the assignment on the board!
<lyceen>
lol
<TheDracle>
Yeah.
<TheDracle>
The school system here is a complete joke.
<lyceen>
well we have to be attentive, else they kick our ass
<lyceen>
it's just the opposite of ours
<lyceen>
why is this world so cruel?
<TheDracle>
Are you in highschool?
<lyceen>
yup
<TheDracle>
Lol, I'd actually rather be in your situation.
<TheDracle>
Just.. Knowing that you're in a prison void of any intellectual stimulation for the majority of your childhood.
<lyceen>
hehe
<TheDracle>
College is a lot better, because it's funded directly.
<TheDracle>
This is what you get for being in a nearely raw-capitalist system with a dwindleing social system.
<lyceen>
the social system is fine here
<TheDracle>
They're much more willing to spend 80-billion dollars sending poor people like me off to kill innocents for their narrow economic interests, than to fund the public school system.
Herrchen has quit ["bye"]
<TheDracle>
And, it's disproportionately funded. The funds for a school comes from the surrounding area. So ghetto areas of the city have very little revenue, where as more afluent areas have much better schools.
<lyceen>
in which country do you live,
<lyceen>
?
<TheDracle>
The United States.
<lyceen>
aah that way
<TheDracle>
Hm?
<lyceen>
well, here the situation is different (in belgium)
<TheDracle>
Yes, I know. The situation is different in most other first world countries.
<TheDracle>
There's just a heavy nationalist propeganda machine here-- and people are duped into electing people who focus on their own economic interests.
<lyceen>
that doesn't sounds fun
<TheDracle>
It's not :p Makes for good political science papers though ;)
<lyceen>
hehe
<TheDracle>
How old are you?
<lyceen>
16
<TheDracle>
Wow, do you know Ocaml?
<TheDracle>
Do they teach it to you in school?
<lyceen>
eeeeh no
<lyceen>
woow that would be nice
<TheDracle>
Yeah, it would.
<TheDracle>
They still teach C++/Java in highschool here.
<lyceen>
i'm just reading some tutorials online
<lyceen>
ow well, they teach me pascal and javascript
<TheDracle>
My C++ teacher in highschool was just a vocational teacher though, it was really poor quality.
<lyceen>
you know! pascal! that's sooo old
<TheDracle>
Basically just basic C syntax.
<TheDracle>
Lol, Pascal is a good language for learning to program in though.
<mbh>
the language doesn't matter, really
<TheDracle>
Maybe..
<TheDracle>
mbh: The syntax doesn't matter :p
<TheDracle>
mbh: Obviously there are semantics that do. For instance, C++ Vs. Ocaml, LISP and so on.
<Riastradh>
The best language for learning about computer science is one whose syntax does not get in the way and whose semantics are very flexible & yet simple to grasp.
<TheDracle>
LISP.
<TheDracle>
hehe.
<lyceen>
well, ocaml is so much better than pascal
<Riastradh>
Scheme, more specifically.
<TheDracle>
Hm, from a syntax perspective, Ocaml is a bit akward I think.
<vincenz>
that's what I had in first year of college
<TheDracle>
But, it's easy to get a hang of.
<vincenz>
now they switched to java
<TheDracle>
LISP from a syntax perspective is beautiful.
<TheDracle>
I really like that Ocaml-ora book though, because it realizes the syntax is secondary to everything else.
lyceen has quit ["going to sleep"]
<KrispyKringle>
they teach javascript in high school?