ayrnieu changed the topic of #ocaml to: OCaml 3.08.4 available! Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
vezenchio has quit [""The law, in its majestic equality, forbids the rich as well as the poor to sleep under bridges, to beg in the streets, and t]
natv has quit [Read error: 110 (Connection timed out)]
UziMonkey has quit [Remote closed the connection]
Korollary has joined #ocaml
twobitsprit1 has left #ocaml []
mrsolo has quit ["Leaving"]
Smerdyakov has joined #ocaml
elk has joined #ocaml
pango_ has joined #ocaml
Herrchen_ has joined #ocaml
Nutssh has joined #ocaml
pango has quit [Read error: 110 (Connection timed out)]
Herrchen has quit [Read error: 110 (Connection timed out)]
gim_ has joined #ocaml
gim has quit [Read error: 110 (Connection timed out)]
monochrom has quit ["good morning, sweet dream"]
threeve has quit []
Smerdyakov has quit ["good"]
joeytwiddle has quit ["Leaving"]
__DL__ has joined #ocaml
booyaa has quit ["leaving"]
pango_ has quit [Remote closed the connection]
pango has joined #ocaml
pango is now known as pangoafk
Korollary has quit [Read error: 110 (Connection timed out)]
mlh_ has quit [Client Quit]
Submarine has joined #ocaml
<ulfdoz> re
Demitar has quit [Read error: 110 (Connection timed out)]
Demitar has joined #ocaml
revision17 has quit [Read error: 110 (Connection timed out)]
__DL__ has left #ocaml []
Gueben has joined #ocaml
vezenchio has joined #ocaml
Benooit has joined #ocaml
Enig123 has joined #ocaml
Gueben has quit [Read error: 110 (Connection timed out)]
UziMonkey has joined #ocaml
CML has joined #ocaml
zhouwei_e has joined #ocaml
xidaux has joined #ocaml
xidaux is now known as Alpacasaurus
<vincenz> I pruned it down to 124 lines by removing unnecessary featurs, but it's as far as I can go
<vincenz> oops, wrong channel
Alpacasaurus is now known as xidaux
UziMonkey has quit [":q"]
xidaux has quit [Client Quit]
revision17 has joined #ocaml
Submarine has quit ["Leaving"]
Submarine has joined #ocaml
threeve has joined #ocaml
Benooit is now known as Gueben
Amorphous has quit [Read error: 110 (Connection timed out)]
Tachyon76 has joined #ocaml
meren[N\A] is now known as meren
meren is now known as meren[N\A]
Skal has joined #ocaml
elk has quit [Nick collision from services.]
elk has joined #ocaml
Amorphous has joined #ocaml
Tachyon76 has quit [Client Quit]
Snark has joined #ocaml
joeytwiddle has joined #ocaml
ronin_ has joined #ocaml
Enig123 has quit ["go sleeping now. bye~"]
Smerdyakov has joined #ocaml
ronin_ has quit ["Leaving"]
Korollary has joined #ocaml
TeXitoi has quit [Read error: 104 (Connection reset by peer)]
TeXitoi has joined #ocaml
meren[N\A] is now known as meren
xidaux has joined #ocaml
Korollary has quit [Read error: 110 (Connection timed out)]
UziMonkey has joined #ocaml
Gueben has quit [Read error: 104 (Connection reset by peer)]
Smerdyakov has quit []
CML has quit []
zhouwei_e has quit [Read error: 110 (Connection timed out)]
Gueben has joined #ocaml
pango has joined #ocaml
Nutssh has quit [Read error: 110 (Connection timed out)]
xidaux is now known as dodecahedron
twobitsp1ite has joined #ocaml
<twobitsp1ite> ok, so I'm sure there's a way to create infix operators in ocaml, but I can't remember the syntax, and I'm having a hard time finding in any of the tutorials I'm looking at...
monochrom has joined #ocaml
<pango> twobitsp1ite: IIRC, it depends on the first character of the operator
<pango> twobitsp1ite: (operators that start with +, -, ... are automatically infix)
<twobitsp1ite> pango: so... "let ( +# ) = ..."?
<pango> give it a try
<pango> seems # isn't allowed
<twobitsp1ite> what are the argument names? i.e. "let ( +- ) = something left right"?
<pango> just as another function definition
<pango> let ( +- ) a b = ...
<twobitsp1ite> ahh, I see
Submarine has quit ["in Soviet Russia, Céline Dion owns you"]
<twobitsp1ite> pango: awesome, it works... thanks :)
<twobitsp1ite> "let ( ^^ ) a b = List.fold_right ( * ) (repeat a b) 1;;" :)
<twobitsp1ite> (of course, I've defined "repeat" elsewhere)...
<twobitsp1ite> is that the best way to implement an integer exponent operator?
Msandin has joined #ocaml
<monochrom> yes
<monochrom> Definition: best = the first method that comes to your mind
<mflux> well you could propably use the fact that a ^^ y = a ^ (y / 2) * a ^^ y / 2 iff y % 2 = 0
<mflux> missint parentheses..
<twobitsp1ite> mflux: eh?
<mflux> and missing too ;)
<twobitsp1ite> mflux: did someone swap they keys on your keyboard?
<twobitsp1ite> :P
<mflux> lemme try this again: a ^^ y = a ^^ (y / 2) * a ^^ (y / 2), if y is divisible by 2
<twobitsp1ite> I see
<twobitsp1ite> I just didn't know if there was some kind of built-in or standard-lib repeat function...
<twobitsp1ite> there's no List.repeat or anything
<pango> creating a list for the only purpose to fold it is wasteful
<twobitsp1ite> pango: better idea?
<pango> recursive function ?
<monochrom> recall that ocaml is eager. if you call a function that generates an infinite list, it will return in the far distant future
<pango> (tail recursive, if possible)
UziMonkey has quit [":q"]
<twobitsp1ite> "let rec ( ^^ ) a b = if b == 1 then a else a * (a ^^ (b - 1));;
<twobitsp1ite> "
<twobitsp1ite> er... I guess that isn't tail-recursive...
<pango> yes
<avlondono> twobitsp1ite: and 4 ^^ 0 will fail if you keep that base case
<twobitsp1ite> avlondono: true... but I think it's fixed (without support for negative exponents...)
<monochrom> write a function that takes three parameters x y z and returns z*(x^^y). this can be done with tail recursion.
<twobitsp1ite> monochrom: that's what I just did
<twobitsp1ite> you have a paste site?
<monochrom> I don't need to see it.
<twobitsp1ite> ok, new question :) I know I can say "let f (first :: rest) = ..." but is there a way to do something like "let f (first :: rest) = ... | [] -> ..."?
Gueben has quit [Remote closed the connection]
Gueben has joined #ocaml
<pango> let f = function first :: rest -> ... | [] -> ... ?
Submarine has joined #ocaml
<twobitsp1ite> pango: i.e. have multiple patters without resorting to "match" or "function"...
<twobitsp1ite> ohh
<pango> not allowed
<twobitsp1ite> hmm... I would imagine that it wouldn't be hard to add some sugar to the function notation...
<pango> with little real benefit, however
<twobitsp1ite> well... sugar exists solely for the comfort of the programmer anyways...
<twobitsp1ite> I mean... I can do tail-calls in C, it's just not very pretty...
<pango> compile can complain of non-exhaustive matches, but if you can add cases later, it's no longer possible
<twobitsp1ite> it would work just like match...
<pango> or you'd have to add other restrictions (all alternatives must be grouped with 'and's...)
<twobitsp1ite> something like that...
<pango> I not sure I'd like that syntax better
<twobitsp1ite> maybe a "|="
<twobitsp1ite> or "let f (f :: r) = rest || [] = [];;"
<pango> || already exists however
<twobitsp1ite> well... something
<pango> it's probably just a matter of correct pre-processing, much like the revised syntax (http://caml.inria.fr/pub/docs/manual-camlp4/manual007.html)
<twobitsp1ite> ew... is the revised syntax going to be the next version of ocaml?
<pango> probably not, it's been around for a long time
<twobitsp1ite> I see
<twobitsp1ite> ok, so can you define unary operations? i.e. something that would be use like "+- 4;;"?
Snark has left #ocaml []
<Msandin> the revised syntax is an improvement, but it should be put to sleep, camlp4 lacks a lot of it's potential modularity because the exposed grammar stubs so few in order to keep them common to both syntaxes
<Msandin> ocaml+camlp4 united under one syntax would be a much more convinient environment for syntactic extensions, converting everyone to revised is a non-starter, and so it should be declared deprecated and done in
<twobitsp1ite> if they could just implement a macro system, or some way to influence the lexer at compile-time that would be nice
<Msandin> what do you want that camlp4 can't do?
<twobitsp1ite> er... I'm not familiar with camlp4... I was just assuming camlp4 was just another name for the "revized syntax"...
<twobitsp1ite> so, camlp4 is a macro system for ocaml?
<Msandin> camlp4 is a ocaml pre-processor/parser which can be used instead of the standard one when using ocamlc etc, it is extensible. ie camlp4 is a neat macro system for ocaml. the author of it used it to construct, among other things, the revised syntax
<twobitsp1ite> I see...
<Msandin> it's in the standard distribution, and people have done some quite neat syntactic extensions with it:-)
<twobitsp1ite> also... is there some kind of "main" function, or do I always just have to throw a naked expression at the bottom of my files to be evaluated thus starting the program?
<Msandin> well, you can always do let _ = expression anywhere in your file, not just at the bottom, but basically, yeah...
<twobitsp1ite> (sorry to jump topics on you, I'm just working on my project while talking to you, and new things come up)
<Msandin> n/p
<twobitsp1ite> hmm... so theoretically, you could write a camlp4 "application(?)" that would compile an existing language into ocaml...?
<twobitsp1ite> i.e. one could (if masochistic enough) write a Perl compiler in camlp4...
<Msandin> yeah on both accounts...
<Msandin> gtg, enjoy=)
<twobitsp1ite> that's amazing...
<twobitsp1ite> ok, later
Msandin has quit [Read error: 104 (Connection reset by peer)]
znutar has joined #ocaml
<pango> and compilers are amazing applications that do the same with asm
UziMonkey has joined #ocaml
Submarine has quit ["Leaving"]
pnou has quit ["ajoutage de disque dur"]
pnou has joined #ocaml
pnou_ has joined #ocaml
pnou has quit [Client Quit]
pnou_ has quit [Remote closed the connection]
pnou has joined #ocaml
Nutssh has joined #ocaml
Nutssh has quit ["Client exiting"]
pnou has quit ["brb"]
threeve has quit []
<ulfdoz> bye
Skal has quit ["Client exiting"]
pnou has joined #ocaml
mikeX has joined #ocaml
gim__ has joined #ocaml
threeve has joined #ocaml
UziMonkey has quit [Remote closed the connection]
dodecahedron has quit [Client Quit]
gim_ has quit [Read error: 110 (Connection timed out)]
mikeX has quit ["Leaving"]
twobitsp1ite has quit ["Lost terminal"]
meren is now known as meren[N\A]
monochrom has quit ["good morning, sweet dream"]