gim_ has quit ["zz.."]
cjohnson has quit ["Got to be good lookin' 'cause he's so hard to see."]
async has joined #ocaml
ayrnieu has quit ["grr."]
<
async>
can you use patterns with = ?
<
async>
like "let a = Some 12 in if a = Some x then ...."
<
async>
or something similar that works
<
mattam>
no, only let Some x = f l i think
<
mattam>
ie. you can bind a pattern but not compare patterns
<
async>
that would be a cool feature
<
Smerdyakov>
Would not.
<
Smerdyakov>
Just use match.
<
mattam>
too late :)
<
async>
yeah but i have an type with like 8 different cases
<
async>
so i need 8 different selectors
<
async>
instead of one nice higher-order selector
<
Smerdyakov>
How does a way of doing it with if help things?
<
mattam>
what do you want to do ?
<
Smerdyakov>
Maybe async doesn't know about the _ pattern..?
<
async>
im doing pattern matching righ tnow
<
async>
type descriptor =
<
async>
| Number of int
<
async>
| Symbol of string
<
async>
| Operation of string
<
async>
| Coefficient of descriptor list
<
async>
| Exponent of descriptor list
<
async>
| Left of descriptor list
<
async>
| Right of descriptor list
<
async>
now, let's say i have a descriptor which could be any of those cases
<
async>
and i want to make a universal selector - such as "let desc = get_descriptor Number"
<
Smerdyakov>
What does it mean?
<
async>
instead, i have to make 8 differnt selectors
<
Smerdyakov>
I don't understand what you're saying.
<
mattam>
desc should be an int ?
<
async>
well that depends on the case
<
mattam>
for Number
<
async>
i guess this is a bad exaple
<
Smerdyakov>
It doesn't even seem to be a valid example....
ayrnieu has joined #ocaml
<
Smerdyakov>
async, are you sure you're thinking of a language addition that makes sense with the type system?
<
Riastradh>
async, you're making no sense.
<
async>
im trying to write what i was thinking a while ago
<
async>
if i have something like "Number 12", i would like to test if it is a number without doing "match v with Number x -> true | _ -> false"
<
Smerdyakov>
You can always write a function that does that....
<
ayrnieu>
async - what would you rather do?
<
async>
well, something like "let a = Number 12 in if a = Number x then ...."
<
async>
but mattam said that doesnt work
<
Smerdyakov>
Just write functions that encapsulate the pattern matching.
<
ayrnieu>
let a = Number 12 in match a with Number x -> then-part;; if you want to do this silly thing.
<
Smerdyakov>
Obviously what you want can't be done, since it already has a meaning in OCaml.
<
mattam>
async: why don't you want to use the match construct ?
<
async>
if i have a list of those things and i want to extract the "number" or the "symbol"
<
Riastradh>
async, List.map (function Number x -> x)
<
async>
so if i have [Number 12; Symbol x; ...], and i want to get "Number 12"
<
mattam>
Riastradh: doesn't it throw on non-numbers ?
<
ayrnieu>
async - or "Symbol x"? write a string_of_foo, where your foo type has those constructors.
<
async>
but i dont want a string
<
async>
i want Symbol x
<
Riastradh>
If there were a List.filter_map: List.filter_map (function Number x -> Some x; _ -> None)
<
ayrnieu>
async - you just said that you wanted to get "Number 12"
<
ayrnieu>
async - please make up your mind.
<
Riastradh>
...oh, do you just want to remove everything that isn't a {Symbol,Number,...}?
<
mattam>
and then take the head of the list
<
async>
Riastradh something like that
<
async>
but i want to make it like "remove_descriptor list Number"
<
Riastradh>
async, suppose the function is called 'f'. What does 'f [Number 12; Symbol "hello"; Operation "+"]' return?
<
Riastradh>
Yes, that's what I was afraid of.
<
Riastradh>
I don't think you can do that.
<
async>
i know i can make like 8 different selectors
<
async>
(which is what i do).. but i want to do a higher-order thing
<
Riastradh>
OK, you could do something like this:
<
Riastradh>
f : descriptor list -> [ `Number | `Symbol | ... ] -> descriptor list
<
Riastradh>
let f l = function
<
Riastradh>
`Number -> number_version_of_f l
<
Riastradh>
| `Symbol -> symbol_version_of_f l
<
async>
that syntax confuses me
<
Riastradh>
It's polymorphic variants.
<
Riastradh>
I may have gotten the syntax wrong.
<
async>
thanks Riastradh, ill look into it
<
Smerdyakov>
Don't use those things.
<
Smerdyakov>
They're disgusting.
<
Riastradh>
What would you rather use?
<
async>
Riastradh thats exactly what i was looking for, thanks
tomasso has quit [Read error: 110 (Connection timed out)]
Herrchen has quit [Read error: 110 (Connection timed out)]
async has quit [Read error: 104 (Connection reset by peer)]
wazze has joined #ocaml
Herrchen has joined #ocaml
mattam_ has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
__DL__ has quit [Read error: 110 (Connection timed out)]
__DL__ has joined #ocaml
mattam_ is now known as mattam
ayrnieu has quit [Read error: 104 (Connection reset by peer)]
ayrnieu has joined #ocaml
gim_ has joined #ocaml
Heimdall has joined #ocaml
<
Heimdall>
Is this chan a french or an english one ?
_JusSx_ has joined #ocaml
<
ayrnieu>
I hear more English than French, but you may get away with using either.
<
_JusSx_>
wuuru : heya
Heimdall has quit []
ayrnieu has quit ["screen"]
ayrnieu has joined #ocaml
two-face has joined #ocaml
<
_JusSx_>
hi two-face :
<
_JusSx_>
wuuru : hyea
ayrnieu has quit [Read error: 110 (Connection timed out)]
<
_JusSx_>
Smerdyakov : hi
<
_JusSx_>
winkle : hi
Chimp has joined #ocaml
two-face has quit [Read error: 110 (Connection timed out)]
two-face has joined #ocaml
cprokt has joined #ocaml
cprokt has quit ["Leaving"]
madroach has joined #ocaml
Chimp has quit ["leaving"]
<
madroach>
Hello, does anyone here use tuareg mode for syntax highlighting on the console ? I get only the quoted strings highlighted.
<
mattam>
tuareg uses an highliting mechanism that's only available in X, sadly
<
mattam>
the caml mode in ocaml sources work for both OTOH
<
madroach>
mattam: Where do I get them ?
<
mattam>
caml.inria.fr
two-face has quit [Read error: 110 (Connection timed out)]
wazze is now known as afkts
two-face has joined #ocaml
madroach has quit ["leaving"]
maihem has joined #ocaml
tomasso has joined #ocaml
<
tomasso>
does anyone use the ocaml ide cameleon?
async has joined #ocaml
two-face has quit [Read error: 110 (Connection timed out)]
maihem has quit ["Client exiting"]
vect is now known as gl
gl is now known as vect
_JusSx_ has quit [Read error: 110 (Connection timed out)]
_JusSx_ has joined #ocaml
two-face has joined #ocaml
<
_JusSx_>
wuuru : heya
<
_JusSx_>
Smerdyakov : heya
__DL__ has quit [Read error: 104 (Connection reset by peer)]
Iorek has joined #ocaml
two-face has quit [Read error: 60 (Operation timed out)]
cjohnson has joined #ocaml
<
tomasso>
is there any source code example using almost everything defined in the language to see how to use the language not reading a huge manual...
<
Iorek>
I don't know about using everything
srv has quit [Read error: 60 (Operation timed out)]
<
Iorek>
but if you want to see classes and labels in action, take a look at LablGTK
<
Smerdyakov>
tomasso, there is a tutorial in the manual that should be small enough for you....
<
tomasso>
hmhm just a snnipet if posible...
<
tomasso>
Smerdyakov, i started reading a manual some days ago but i stopped and dont remember!! hahahaha
<
Iorek>
the first section of the manual is sort of a tutorial
<
Iorek>
OCaml has a lot of stuff... it will be difficult to find a snippet using everything in the language :)
<
tomasso>
question, does anyone use or used the cameleon ide for ocaml?
<
Iorek>
I tried to install it, but I guess emacs serves my needs well
<
tomasso>
Iorek, could you compile it?
<
Iorek>
as I recall, I had some problems with it... can't remember what exactly
<
tomasso>
hmhm me too.. and not only with the last version
<
tomasso>
could be interesting to have it working...
two-face has joined #ocaml
two-face has quit [Client Quit]
<
Iorek>
tomasso: have you tried the tutorial on the topic ?
<
tomasso>
its nice, but dont remember the language :(
srv has joined #ocaml
afkts is now known as wazze
wazze has quit ["If we don't believe in freedom of expression for people we despise, we don't believe in it at all -- Noam Chomsky"]
karryall has joined #ocaml
buggs has joined #ocaml
gim has quit [Read error: 54 (Connection reset by peer)]
gim|570 has joined #ocaml
malc has joined #ocaml