mattam has quit [Read error: 110 (Connection timed out)]
jonka has joined #ocaml
bk_ has quit ["Terminated with extreme prejudice - dircproxy 1.0.5"]
bk_ has joined #ocaml
Kinners has left #ocaml []
<ski>
sorry for this stupid question, but is there a pattern-matching shorthand for a match on arguments as the top-level body of a function ?
<ski>
or should i just go find the lang docs ? :)
<Hadaka>
let f = function Foo x -> ... | Bar x -> xxx;;
<ski>
ok
<ski>
(just a fun,match merge, then)
<Hadaka>
I didn't understand that part
<Hadaka>
# let f x = match x with _ -> "foo";;
<Hadaka>
val f : 'a -> string = <fun>
<Hadaka>
# let f = function _ -> "foo";;
<Hadaka>
val f : 'a -> string = <fun>
<ski>
function is sortof a merge of the uses of fun and match, no ?
<Hadaka>
more or less
<ski>
let f = fun x -> match x with _ -> "foo";;
<Hadaka>
yes
<ski>
hmm, can one use function to dispatch on curried arguments ?
<ski>
function x y z -> x + y + z ?
<Hadaka>
'function' is only for matches - but fun x y z -> x + y + z works and is a shorthand for fun x -> fun y -> fun z -> x + y + z
<ski>
ok
<ski>
so no curried-multi-arg-match with function, then
<Hadaka>
no - nor is there any way to access the variable being matched directly
<ski>
i.e. ("function e::l -> ..." works, instead of only "function (e::l) -> ...")
<ski>
hasn't O'Caml "as"-patterns ?
<Hadaka>
so let f x = match x with _ -> x;; needs to be written as let f = function _ as x -> x;;
<ski>
right, ok
<ski>
IIRC, in GHC Core syntax, one names the thing being matched
<ski>
perhaps "case ... as x of .. -> ... | ...", or something
<ski>
(don't remember)
mattam_ is now known as mattam
<Hadaka>
I said a mistake earlier actually - 'function' is not just for matches
<ski>
(but that is of course Haskell stuff, and not O'Caml)
<ski>
no ?
<Hadaka>
'function x' is equivalent to 'fun x'
<ski>
so ?
<ski>
what's the mistake ?
<Hadaka>
so fun x y z -> is actually function x -> function y -> function z ->
<Hadaka>
that the word 'function' would only be used for matches, as it is the basic form of all functions it seems
<ski>
so fun is the derived form, and function is not ?
<ski>
oh, sorry
<ski>
i meant the other way around, of course
<ski>
no
<ski>
now i'm just confusing myself
<Hadaka>
um, fun is a multiargument shorthand for function in that context yes
<ski>
just ignore what i said, ok
<drworm>
what's Revised Syntax for (http://caml.inria.fr/camlp4/manual/manual007.html)? it's an attempt to change the caml syntax (in some ways i really liked and others i thought looked cumbersome) -- is it a plan for a future ocaml or something?
<mattam>
just an option drworm
fjb has left #ocaml []
<drworm>
mattam: can i use it today somehow?
<Hadaka>
drworm: as far as I know it is not too actively maintained or developed right now
<Hadaka>
drworm: you can use it through camlp4 extension - and you can convert between normal syntax and revised syntax
<drworm>
i see
<drworm>
it seems to make a lot of things prettier and less error prone, but the list syntax was way too elaborate imho :)
<drworm>
i came to think of it now when fun/function was brought up, since function is removed in the revised syntax
mimosa has quit ["J'ai fini."]
gim has quit ["boom"]
Deffina is now known as Defcon7
<pattern>
Understanding Object Oriented Programming: "The problem to be solved is to output a value judgment about operating systems. The assumptions being (of course) that UNIX is good and Windows is bad." http://csis.pace.edu/~bergin/patterns/ppoop.html
<ski>
heh :)
blaap has joined #ocaml
blaap has quit ["Leaving"]
blaap has joined #ocaml
right_lurk has left #ocaml []
blaap has quit ["Leaving"]
blueshoe has quit [Read error: 104 (Connection reset by peer)]
wazze has quit ["--- reality is that which, when you stop believing in it, doesn't go away ---"]
Demitar has quit [Read error: 110 (Connection timed out)]
CosmicRay has joined #ocaml
<CosmicRay>
Is there any nice way that I can find a generic function capable of printing out many sorts of things, similar to the way the toplevel can?
<Riastradh>
Magic.
<Riastradh>
Other than that, no.
<CosmicRay>
rats.
<CosmicRay>
that would be Very Useful.
<Riastradh>
Typeclasses would be Very Useful.
bk_ has quit ["I'll be back"]
jdmarshall has joined #ocaml
kinners has joined #ocaml
blueshoe has joined #ocaml
blueshoe has quit [Read error: 104 (Connection reset by peer)]
taaz has joined #ocaml
CosmicRay has quit ["Leaving"]
taaz has left #ocaml []
mlh has joined #ocaml
buggs has quit [Connection reset by peer]
Nutssh has joined #ocaml
mlh has quit ["I'm outta here"]
blueshoe has joined #ocaml
kinners has quit [Read error: 60 (Operation timed out)]
blueshoe has quit [Read error: 104 (Connection reset by peer)]
lam has joined #ocaml
jdmarshall has quit ["ChatZilla 0.9.52B [Mozilla rv:1.6/20040113]"]
systems has joined #ocaml
Hipo has quit ["leaving"]
Nutssh has quit ["Client exiting"]
systems has left #ocaml []
blueshoe has joined #ocaml
SpookRijder has joined #ocaml
srv has quit ["leaving"]
srv has joined #ocaml
srv has quit [Client Quit]
srv has joined #ocaml
karryall has joined #ocaml
andrewb has quit ["Leaving"]
andrewb has joined #ocaml
Hipo has joined #ocaml
Demitar has joined #ocaml
ski has quit ["food for thought"]
blueshoe has quit [Read error: 104 (Connection reset by peer)]
mimosa has joined #ocaml
gim has joined #ocaml
The-Fixer has quit []
The-Fixer has joined #ocaml
blueshoe has joined #ocaml
The-Fixer has quit [kornbluth.freenode.net irc.freenode.net]
lam has quit [kornbluth.freenode.net irc.freenode.net]
cmeme has quit [kornbluth.freenode.net irc.freenode.net]
Smerdyakov has quit [kornbluth.freenode.net irc.freenode.net]
blueshoe has quit [Read error: 104 (Connection reset by peer)]
The-Fixer has joined #ocaml
lam has joined #ocaml
cmeme has joined #ocaml
Smerdyakov has joined #ocaml
SpookRijder has quit ["ni!"]
blueshoe has joined #ocaml
bk_ has joined #ocaml
whiskas has joined #ocaml
buggs has joined #ocaml
wazze has joined #ocaml
LordJ|m has joined #ocaml
Axioplase has joined #ocaml
<Axioplase>
Hi
karryall has quit ["go"]
Godeke has joined #ocaml
whiskas has quit ["Pa / Bye."]
Nutssh has joined #ocaml
Nutssh has quit [Read error: 54 (Connection reset by peer)]
Nutssh has joined #ocaml
<Axioplase>
what's wrong with open_graph " "^largeur^"x"^hauteur;; ??
blueshoe has quit [Read error: 104 (Connection reset by peer)]
<andrewb>
It tries to apply open_graph to " ". You need to put parenthesis around the string expression.
Nutssh has quit ["Client exiting"]
Nutssh has joined #ocaml
<Axioplase>
ok
<Axioplase>
this? open_graph (" "^largeur^"x"^hauteur); cause it doesn't work either...
<andrewb>
Okay. Your bindings "largeur" and "hauteur" .. they have to be strings. If you've set them up with "let largeur = 100", then you will need to call string_of_int to convert them to strings.
<Axioplase>
argh! stuypid me!
<Axioplase>
thanks!
<andrewb>
:-)
Nutssh has quit ["Client exiting"]
Axioplase is now known as Axio|Fac
blueshoe has joined #ocaml
maihem has joined #ocaml
andrewb has quit ["Yay for Real Fridays (tm)"]
pluton_ has joined #ocaml
<pluton_>
english ??
<Smerdyakov>
Please!
bernard has quit [Read error: 110 (Connection timed out)]
<pluton_>
ok by
<pluton_>
et VIVE LA FRANCE
<pluton_>
dsl
pluton_ has left #ocaml []
<Maddas>
That was rather bizarre
Godeke has quit [Client Quit]
<bk_>
definitely
_JusSx_ has joined #ocaml
_JusSx_ has quit [Remote closed the connection]
<mattam>
oh
_JusSx_ has joined #ocaml
Skal has joined #ocaml
pattern has quit [Read error: 60 (Operation timed out)]
cjohnson has joined #ocaml
_JusSx_ has quit ["My damn controlling terminal disappeared!"]
Axio|Fac is now known as snickers
snickers is now known as Axioplase
Godeke has joined #ocaml
pattern has joined #ocaml
Banana has quit [Read error: 110 (Connection timed out)]
async has quit [Read error: 60 (Operation timed out)]
<Axioplase>
can i convert a char to a string ?
<mellum>
String.make 1 'a'
<Axioplase>
thx.
<Axioplase>
now, i know that the char i m looking for is "superior or equal" but i have no idea on how to write it in a match...
<Axioplase>
in fact, i want to match "escape"....
<mellum>
use int_of_char
<Axioplase>
hum.
<Axioplase>
match char with (char_o_int 27)-> quit() | _-> foo();; ?
bernard has joined #ocaml
Axioplase has quit ["error 8.6 (Connection reset by beer)"]