<zmdkrbou>
not to use very_very_long_arguments_name_which_are_not_really_useful
<zmdkrbou>
+s
<twobitsprite>
zmdkrbou: you prefer let's?
<twobitsprite>
let arg1 = ver_long_argument_number_one in
<twobitsprite>
...?
bzzbzz has joined #ocaml
<zmdkrbou>
why not, but why the ver_long_argument_number_one ?
<twobitsprite>
zmdkrbou: it's the result of a long expression
<twobitsprite>
i.e.:
<zmdkrbou>
oh ok
<twobitsprite>
er, yeah
<zmdkrbou>
then let ... in rulez da world, as far as i'm concerned
<twobitsprite>
doesn't ocamlopt fold those kind of things?
<twobitsprite>
er, fold/inline/etc?
<twobitsprite>
(I know I'm probably prematurely-optomizing, but I'm just curious if this would use more RAM)
* zmdkrbou
doesn't write ugly code in order to get perfs, if he wanted perfs he'd use C
<twobitsprite>
well... this function is going to be used in one of my inner-most loops... and I don't know if you were here when I talked about it, but I'm doing a sort of long-term brute force AI program...
<zmdkrbou>
mmmh brute force AI program .... in ocaml. of course :)
* twobitsprite
tried to gauge the tone of that statement... :P
<zmdkrbou>
:)
<twobitsprite>
tries*
<twobitsprite>
do you disapprove? :P
<zmdkrbou>
i really don't try to get perfs when coding using ocaml, except for better algorithms
<zmdkrbou>
i mean this is not your work, it's the compiler's job
<twobitsprite>
I realize this... I just wouldn't mind inlining my expressions if it'll shave off a little bit of RAM/CPU... I'm not going to completely bastardize my code by any means, I find it quite readable to have function calls with long arguments so long as they're indented well...
<twobitsprite>
here's my function call as it stands:
<twobitsprite>
loop rest
<twobitsprite>
(power - 1)
<twobitsprite>
(res + (first * (base ^^ power)))
<twobitsprite>
(I've overloaded/shadowed/whatever the ^^ function to mean integer powers)
<zmdkrbou>
it's a matter of taste there :)
* zmdkrbou
would use a let
<zmdkrbou>
but i use millions of let in my code
<twobitsprite>
I'm just wondering if I should follow what my editor mode says which is to only indent the second and third arguments 2 more spaces, or if I should indented them as I have them...
<zmdkrbou>
depends on what's your editor :)
<twobitsprite>
vim + omlet mode
<twobitsprite>
and don't tell me to use emacs
<zmdkrbou>
huhu vodka-goo has done good marketing :)
<zmdkrbou>
ergl emacs
<twobitsprite>
eh?
* zmdkrbou
feels sick when hearing this name :)
<twobitsprite>
ahh
<twobitsprite>
:)
<twobitsprite>
what is vodka-goo?
<zmdkrbou>
a guy who hangs out here
<twobitsprite>
ahh... promotes vim?
<zmdkrbou>
and the author of omlet mode
<twobitsprite>
ahh
<twobitsprite>
I think someone else in here (or maybe #vim) suggested it...
<twobitsprite>
maybe I should talk to him about my indentation ideas...
<twobitsprite>
I dislike how it indents after let ... in
<zmdkrbou>
the problem is when it comes to personal habits and taste
<twobitsprite>
let f x =
<twobitsprite>
some_code in
sieni has quit [Read error: 110 (Connection timed out)]
<twobitsprite>
f 4 ;;
<zmdkrbou>
personally, i don't use omlet (i don't use automatic indentation in fact)
* zmdkrbou
agrees with this indentation, except he likes the "in" at the beginning of line
<twobitsprite>
zmdkrbou: I used to just use vim standard autoindent mode (which simply indents to the same as the previous line) and then add/remove spaces as need be...
<twobitsprite>
zmdkrbou: I tend to do that as well sometimes... my style shifts a lot... I spend a lot of time re-editing my code to change style... :P
<zmdkrbou>
hehe
<twobitsprite>
I'm sure I'll settle on a style I like eventually
<twobitsprite>
maybe I should just go back to my old way of indenting myself, and just letting vim keep the indent of the last line...
<twobitsprite>
also, how do you feel about putting ;; on a new line?
<zmdkrbou>
ergl
* zmdkrbou
*never* ever uses ;;
<twobitsprite>
zmd no?
<zmdkrbou>
(except in a toplevel ...)
<twobitsprite>
toplevel = repl?
<dylan>
yeah
<zmdkrbou>
gni ? wtf is repl ?
<twobitsprite>
(wasn't sure if you mean the top level scope...)
<twobitsprite>
read-eval-print loop
<dylan>
zmdkrbou: lisp term. read-eval-print-loop
* twobitsprite
wins
<zmdkrbou>
yep
<zmdkrbou>
the ;; is not meant to be use out of this read-eval-print-loop
<twobitsprite>
zmdkrbou: aren't there cases where ;; is necessary to prevent ambiguity?
<zmdkrbou>
nope
<twobitsprite>
I'm pretty sure ocaml-tutorial.com/org mentioned a few
<zmdkrbou>
look at the grammar definition in the manual
<twobitsprite>
half-way down under "Using and omitting ;; and ;"
<zmdkrbou>
where do you believe the ;; is not optional ?
<twobitsprite>
there's an example in the section... the code perfoms two function calls in the top-level scope which could be ambiguous...
<twobitsprite>
self_init ();;
<twobitsprite>
open_display " 1024x762";;
<twobitsprite>
something like that
<zmdkrbou>
mmmh
<zmdkrbou>
"calling" functions at toplevel is ugly :)
<dylan>
let _ =
<twobitsprite>
something tells me you would do "let _ = self_init ()"...
* twobitsprite
figured
<dylan>
self_init ();
<dylan>
...
<twobitsprite>
maybe you should edit that page... it is a wiki after all
<zmdkrbou>
yep, let _ = bla and let () = bli powa
<zmdkrbou>
boarf, i also don't agree with using open, but it's my choice
<dylan>
sometimes I do let rv = [ ... ], when I care about the read values.
<dylan>
zmdkrbou: not even for printf?
<zmdkrbou>
you mean the Printf module ?
<twobitsprite>
zmdkrbou: I typically don't like to taint my namespace either... but sometimes it's nice (and unambiguous)
<twobitsprite>
Printf might be a good example
<zmdkrbou>
why ? (i don't use the Printf module)
<dylan>
zmdkrbou: no, the function. printf is a lot nicer than Printf.printf
<zmdkrbou>
oh, ok
<dylan>
zmdkrbou: What about variant types for an Ast, when your evaluator is in another module?
* twobitsprite
's code is full of List.whatevers
<dylan>
writing match foo with Something ... | ...
<zmdkrbou>
i really have the habit of using Module.pouet
<zmdkrbou>
i do it mechanically :\
<dylan>
I hate using the shift key when coding.
<dylan>
well, at least in ocaml. I am natively a perl programmer...
<twobitsprite>
dylan: bucky keys tend to distract from my typing as well...
* zmdkrbou
thought dylan had a qwerty keyboard
<twobitsprite>
zmdkrbou: is shift somewhere else on a dvorak keyboard?
<zmdkrbou>
i dunno, never used a dvorak :)
<twobitsprite>
I'm trying to figure out what having a qwerty keyboard has to do with using shift...
<zmdkrbou>
if dylan has to use shift to get the dot, he doesn't have a us layout
<twobitsprite>
ohh... I figured he mean for the Module name...
<zmdkrbou>
oh, yep i forgot that :D
<twobitsprite>
heh
<twobitsprite>
although, I do think I'll take youre advise on the ;; thing... I didn't really like using them anyways, I just thought it was standard Good Style(tm)...
<twobitsprite>
zmdkrbou: do you also put -> on a new line like you do for "in"?
<twobitsprite>
match x with
<twobitsprite>
| Something
<twobitsprite>
-> do_it
<twobitsprite>
or
<zmdkrbou>
nope, -> on the same line
<twobitsprite>
| Something ->
<twobitsprite>
do_it
<zmdkrbou>
actually, i have ... my own private style :)
<zmdkrbou>
match x with
<zmdkrbou>
bla -> do something
<zmdkrbou>
and this
<zmdkrbou>
:)
<twobitsprite>
zmdkrbou: I find I hit the margain to quickly like that... but then again, I like to have long expressions as arguments :P
<twobitsprite>
let f x =
<twobitsprite>
let rec loop x y =
* zmdkrbou
uses arguments names such as ... a b y x z, etc. :D
<twobitsprite>
match x with
<twobitsprite>
first :: rest -> do something
<twobitsprite>
something else
joshcryer has joined #ocaml
<twobitsprite>
er... indent that last one firther... it's quite a ways out there
* twobitsprite
likes meaningful argument names
<twobitsprite>
zmdkrbou: you're starting to sound like a perl coder :P
<zmdkrbou>
yeah ! someone who doesn't use | for the first match case ! \o/
<zmdkrbou>
(i'm really no perl coder)
<twobitsprite>
zmdkrbou: I use | for the first.. I was just trying to mimic your style
<zmdkrbou>
:(
<zmdkrbou>
it has not meaning !
<twobitsprite>
if I don't have | on the first one, it looks like I've un-indented and I immediatly wonder why...
<twobitsprite>
although, I have played with:
<twobitsprite>
match x
<twobitsprite>
with something ->
<twobitsprite>
do_it
<twobitsprite>
| something_else ->
Anarchos has joined #ocaml
<twobitsprite>
er... bring that last one back a space
<zmdkrbou>
mmh, weird :)
<twobitsprite>
that way you can elide that first (meaningless) | while not looking like youre unindenting
<twobitsprite>
(bonus: if you're coding for a job, and they like to count line numbers, you look more productive... :P)
<zmdkrbou>
huhu
<twobitsprite>
btw, does anyone here actually use ocaml in production code?
<zmdkrbou>
muuhuhuhuhuhuhu
* zmdkrbou
looks at aaaallll these hands getting up
<zmdkrbou>
(or not)
<twobitsprite>
so, no?
<zmdkrbou>
twobitsprite: i don't even know how many people have a "real" job here
<twobitsprite>
lol
<twobitsprite>
I'm a sys-admin :P
* zmdkrbou
would say approximatively ... 1 (you) :p
<twobitsprite>
the only coding I get to do at work, as shell scripting so I can be even more outragiously slack
<zmdkrbou>
astonishing you're a sys-admin
<twobitsprite>
?
<zmdkrbou>
sys-admin are not the kind of people who like ocaml, in the common opinion
<zmdkrbou>
(and not the kind who speak here :p)
<twobitsprite>
I'm sure they also don't tend to be the kind of people that play Go or are into politics... :P
<zmdkrbou>
huhu, after all it seems wrong, as you're here :)
<twobitsprite>
heh
<twobitsprite>
is there a way to make an infix operator that has letters, a la "mod"?
<zmdkrbou>
nope
<Smerdyakov>
There is in SML, of course. ;)
<zmdkrbou>
(but with ocamlp4 yes)
* twobitsprite
tries to remember the other differences with SML...
<twobitsprite>
don't they like to pass tuples instead of using curried functions?
<Smerdyakov>
Yes. The only place that appears in the actual language definition is the types of binary operators, and in the fact that every datatype constructor takes exactly zero or one argument.
pcc has joined #ocaml
<twobitsprite>
why does camlp4 use the revised syntax?
pcc has left #ocaml []
Revision17 has quit ["Ex-Chat"]
<Anarchos>
twobitsprite isn't it because the author of camlp4 is the same of the revised syntax ?
Anarchos has quit ["Vision[0.8.5-0418]: i've been blurred!"]
<JosephRivers>
Suppose that you want to create a regular expression like Str.regexp "dog\|cat". This works but it generates a Illegal backslash warning. Is there a way to do it that won't generate the warning?
<zmdkrbou>
try Str.regexp "dog\\|cat"
<JosephRivers>
That works. Thanks
<JosephRivers>
Another question: I'm using ocamldep on source files that uses the extended stream syntax (e.g. match x with parser...). This causes ocamldep to produce Syntax Error messages. Is there a way to let ocamldep know about the extended syntax so that it won't produce the syntax error messges?
JosephRivers has quit [Remote closed the connection]
sieni has joined #ocaml
mrsolo_ has quit [Connection reset by peer]
mrsolo_ has joined #ocaml
Snark has joined #ocaml
Snark has quit ["Leaving"]
Smerdyakov has quit ["Leaving"]
ski has quit ["NMI"]
vodka-goo has joined #ocaml
ski has joined #ocaml
mrsolo__ has joined #ocaml
Skal has joined #ocaml
perspectivet has joined #ocaml
<perspectivet>
Does anyone compile their projects with "ocamlfind ocamlopt"?
m3ga has joined #ocaml
<vodka-goo>
yes
<vodka-goo>
our project used to have it optionally, but I now mostly use ocamlfind ocamlc
<perspectivet>
Cool. Is it possible to compile two ml files (one that depends on the other) with ocamlfind ocamlopt?
<perspectivet>
Single file with site-lib and stdlib dependencies is no problem.
<vodka-goo>
yes, should be possible
mrsolo_ has quit [Read error: 110 (Connection timed out)]
<vodka-goo>
but you must still put them on the cmdline in an order respecting dependencies
<perspectivet>
Yeah, I read that, tried that, didn't seem to make any difference.
<zmdkrbou>
(it would if defined in different modules)
<Zamk>
hmm that's a pity ;/
<zmdkrbou>
nope
<Zamk>
why not?
<zmdkrbou>
what kind of code uses the same names for different things ?
<zmdkrbou>
it's unreadable
<Zamk>
wouldn't mind a warning or something then on redefining
<zmdkrbou>
(btw, which None were you trying to print ? i can't say, why should the compiler do ?)
<zmdkrbou>
"redefining" .... is dirt
<Zamk>
yea but I could specify it with something like None:option
<zmdkrbou>
did you try with print_option (None : option) ?
<Zamk>
yea
<pango>
but option is not None's type
<pango>
None's type is 'a option
<zmdkrbou>
s/option/tst/ scuse me
<zmdkrbou>
or (None : something option)
<Zamk>
can something be anything?
<ski>
any type, yes
<Zamk>
tried different things like: print_option (None : 'a option)
<Zamk>
print_option (None : 1 option)
<zmdkrbou>
eeeeeeeeeuuuuh
<zmdkrbou>
1 is not a type ...
<zmdkrbou>
and 'a is not a valid type when it's unbound like this
<Zamk>
also Int and String ...
<zmdkrbou>
int, not Int, string, not String
<Zamk>
also tried those
<zmdkrbou>
what does the compiler say with print_option (None : int option) ?
<Zamk>
This pattern matches values of type 'a option
<Zamk>
but is here used to match values of type tst
<ski>
probably that that type doesn't match "tst" ..
<Zamk>
I guess I'll try to avoid redefining, shouldn't be too hard anyway
<ski>
(or use several, possibly local modules, if you must)
<pango>
what about type tst = int option ?
<Zamk>
yea that seems to work for this example, but then I'm not redefining None ;)
<Zamk>
thanks everyone for their responses, I'll continue to explore OCaml :)
<pango>
have you looked at polymorphic variants ?
<Zamk>
no I haven't I just stumbled on this and wondered about redefining constructors
demitar_ is now known as Demitar
<Demitar>
In short: Always use unique variant cases in the same module. :)
<Demitar>
Or use polymorphic variants. :)
<Zamk>
yea I guess I so :P
<pango>
the correct term is 'shadowing' a previous definition, as Smerdyakov told me :)
<pango>
the other definition still exists (otherwise some existing code could stop working), but it's no longer reachable
<Demitar>
Yes, C compilers usually have the option of warning about shadowing. In OCaml (or ML in general) it's much more common you shadow variables intentionally (especially with lexical scoping). :)
* Demitar
remembers this is not variables but type definitions and partially retracts his comment.
<Demitar>
I must say I'm slightly suprised OCaml allows shadowing of union type cases actually.
<Demitar>
(Since it - as previously noted - makes the code quite unreadable.)
<Zamk>
As was I, so I thought there would be a way to reach it and as a newbie I couldn't figure out how. :S
<zmdkrbou>
(it is never, except in the interpreter loop)
<Zamk>
hmm it does seem to to be necessary when I leave out the "let _ =" part on the last line though
<pango>
(just c&p from interpreter)
<zmdkrbou>
when not using let _ = or let () = it's necessary (but that's ugly)
<Zamk>
ahh ok
* Demitar
uses ;; when he feels there is a need to be explicit (to avoid sneaky ;-after-last-statement bugs).
vodka-goo has quit ["Connection reset by by pear"]
slipstream-- has joined #ocaml
<twobitsprite>
how do you use a record type that's in another module?
<twobitsprite>
(without opening it)
<zmdkrbou>
let bla = { Module.field = pouet ; etc. }
slipstream has quit [Read error: 104 (Connection reset by peer)]
<twobitsprite>
zmdkrbou: ahh
<flux__>
{ Module.field1 = foo; field = bar } is one recent shortcut, btw
<flux__>
so not atleast Module. for every field
<twobitsprite>
flux__: so, can I "let x = { Module.field1 = something ; ... } in { x with field1 = something_else }" or do I have to at least specify Module in the with construct?
<pango>
seems you need to specify it
<pango>
(I would have expected it could be inferred... oh well)
<ski>
(hm .. pouët .. ?)
slipstream-- has quit [Read error: 104 (Connection reset by peer)]
<dylan>
Brought to you in part by a very perverted build system written in ocaml. :)
slipstream has joined #ocaml
<zmdkrbou>
erf
* zmdkrbou
speaks too much
<dylan>
only 30ish lines more than Smerdyakov.
<zmdkrbou>
mmh, 69 days is not much
<pango>
dylan: what timezone is this ?
<dylan>
pango: hopefully GMT, once I fix something.
<dylan>
except pisq, being stupid, does not have an option for setting a timezone...
<dylan>
Eh. Adding this channel was just an exercise. I generate stats for another channel, and I was using make. Now I'm using my make replacement, and it's flexible enough for me to not suffer pain when adding new channels.
<twobitsprite>
very interesting
<twobitsprite>
appearantly I talk to myself a lot :P
mellum has quit [Read error: 110 (Connection timed out)]
ellisonch has quit [Client Quit]
ski has quit [Read error: 104 (Connection reset by peer)]
ski_ has joined #ocaml
ski_ is now known as ski
khaladan has quit [Read error: 104 (Connection reset by peer)]
Smerdyakov has joined #ocaml
Anarchos has joined #ocaml
slipstream-- has joined #ocaml
slipstream has quit [Connection timed out]
shrimpx has quit [Read error: 110 (Connection timed out)]
Anarchos has quit [Read error: 104 (Connection reset by peer)]
pango is now known as pangoafk
shrimpx has joined #ocaml
<twobitsprite>
what word would you use if you were discussing numeric systems of arbitrary base? i.e. when talking about functions you say "arity"... would it be the same word since, i.e. binary means for base-2 and 2-argument functions
<twobitsprite>
binary has a ____ of 2...
_JusSx_ has joined #ocaml
<dylan>
That sounds like homework
<twobitsprite>
I'm not in school... :P
<twobitsprite>
I'm trying to think of a variable name :P
<_JusSx_>
fu
<_JusSx_>
is a great name for a variable name
<mattam>
arity is good
<mattam>
a comment can help otherwise
<twobitsprite>
yar...
pangoafk is now known as pango
<twobitsprite>
it's radix, btw :P
<twobitsprite>
(in case anyone was going to loose sleep over it :P)
<pango>
or base
<twobitsprite>
right... radix sounds cooler :P
<dylan>
it's totally rad, man. :)
slipstream has joined #ocaml
_fab has quit [Remote closed the connection]
slipstre1m-- has joined #ocaml
Snark has joined #ocaml
slipstream-- has quit [Connection timed out]
slipstream has quit [Read error: 110 (Connection timed out)]
Submarine has joined #ocaml
slipstream has joined #ocaml
slipstre1m-- has quit [Read error: 110 (Connection timed out)]
<twobitsprite>
how does the pattern "[], []
<twobitsprite>
" match type 'a list list * a' list list?
<twobitsprite>
er... 'a list list * 'b list list
<Snark>
twobitsprite: are you sure it's that one which matches that ?