<taw>
are there sobe deconstructing when clauses ?
<taw>
| Foo x when y = Bar z -> ???
foxen has joined #ocaml
<mrvn>
???
<mrvn>
Whats y supposed to be and whats your question?
<mrvn>
and whats z?
<mrvn>
There should be at least another x in there
<taw>
y some variable
<taw>
z - binding for contents of y
<taw>
of course my syntax is just example
<mrvn>
z doesn't get bound there.
<taw>
| Foo x when (match y with Bar z -> true | _ -> false) -> ???
<taw>
how to get z bound on the right side ?
<mrvn>
s/z/_/
<taw>
that's probably a better question
<mrvn>
match (a,y) with (Foo x, Bar z) ->
<taw>
repeating that sure works
<taw>
mmm
<mrvn>
If you need the z later
<taw>
putting another var in match for each such when kinda sucks
<taw>
ah, whatever
foxster has quit [Client Quit]
phubuh has quit [Read error: 110 (Connection timed out)]
phubuh has joined #ocaml
taw has left #ocaml []
<mrvn>
# let print_s = Printf.printf "s='%s'\n";;
<mrvn>
s='val print_s : string -> unit = <fun>
<mrvn>
# print_s "1";;
<mrvn>
1'
<mrvn>
- : unit = ()
<mrvn>
Is that intentional?
* baader
has no idea
<mrvn>
I would expect print_s to be a function that prints s='%s' each time.
<baader>
hm
Kinners has joined #ocaml
<Verbed>
mrvn: That's just not how printf works.
<Verbed>
I'm not familiar with O'Caml so rendering an explanation is difficulty..
<Verbed>
The function doesn't curry as normal. It scans through the format string, printing whatever is immediately accessible, and when encountering a % flag, it returns a function. This function is called with the appropriate argument, which is then printed. This continues until the format string has been processed.
<Verbed>
It acts so strangely due to 'magic' calls to the OCaml type system.
<Verbed>
Otherwise such a function would not be typable.
<Verbed>
( typeable )
<Verbed>
It would be appropriate to call it a kludge.
<Verbed>
I believe the new beta adds true support for format types.
<Smerdyakov>
Template Haskell does it even better. :-)
<Verbed>
I favour Scheme anyways.
<mrvn>
Verbed: printf prints the strings after the first % correctly. It could do the same for before the first %.
<Verbed>
Yes, it still won't ask as you want it to.
<Verbed>
s/ask/act
<mrvn>
it would.
<Verbed>
And what exactly do you want from it?
<mrvn>
It would have to do the same it does for "string after %?" for "string before %?"
<Verbed>
I don't understand that statement.
<Verbed>
Perhaps you could illustrate it with some code?
<mrvn>
let print_s = fun str -> Printf.printf "s='%s'\n" str;;
<Verbed>
Let me provide you with some code.
<mrvn>
Thats what it should do.
<Verbed>
Yes, you might do that explicitly if you like.
<mrvn>
Implementation wise I would like an uncurried printf.
<Smerdyakov>
mrvn, the OCaml docs tell you to eta-expand your curried call to get the result you want.
<Smerdyakov>
mrvn, so you should have known. ;)
<mrvn>
yeah, still not what I had expected.
<Verbed>
Do you feel that you understand its behaviour now?
<mrvn>
And converting printf into a printf that acts like an uncurried one but still is curried is pretty complex.
<mrvn>
Verbed: I know why printf does what it does. I just don#t like it :)
<mrvn>
In a setuid prog how would you execute some function of the proram as the actual user (most likely not root)?
<mrvn>
Do I realy have to fork, setuid and waitpid?
<Smerdyakov>
Feh on Unix :P
<mrvn>
Why doesn't ocaml have seteuid bindings?
<Verbed>
It doesn't?
<Smerdyakov>
Perhaps that function isn't standard enough?
<Smerdyakov>
The 2002 SML Basis doesn't have it, either.
<mrvn>
seteuid is conforming to BSD 4.3
<Smerdyakov>
What's the first ANSI or POSIX standard it appears in?
<mrvn>
aparently none
<Smerdyakov>
Question answered ;)
<mrvn>
But I guess any unix system has it
<mrvn>
or at least most
<Kinners>
the qnx docs say POSIX 1003.1a Draft 15
foxen has quit [Client Quit]
<mrvn>
Does Unix.truncate create the file if non existent?
<phubuh>
mrvn: truncate(3) doesn't
phubuh has quit [Remote closed the connection]
phubuh has joined #ocaml
foxster has joined #ocaml
brwill is now known as brwill|zzz
baader has quit ["I'll be back"]
baader has joined #ocaml
baader has quit ["I'll be back"]
baader has joined #ocaml
baader has left #ocaml []
baader has joined #ocaml
brwill|zzz has quit [Remote closed the connection]
brwill|zzz has joined #ocaml
baader is now known as bk_
bk_ has quit ["I'll be back"]
baader has joined #ocaml
two-face has joined #ocaml
<two-face>
yo
Kinners has left #ocaml []
themus has quit [Read error: 104 (Connection reset by peer)]
docelic has joined #ocaml
docelic has quit ["Client Exiting"]
rox has quit ["Client exiting"]
rox has joined #ocaml
brwill|zzz is now known as brwill|work
two-face has left #ocaml []
baader has quit ["I'll be back"]
baader has joined #ocaml
docelic has joined #ocaml
mrvn_ has joined #ocaml
mrvn has quit [Read error: 110 (Connection timed out)]
mr_bubbs has joined #ocaml
docelic has quit ["Client Exiting"]
docelic has joined #ocaml
docelic has quit ["l8r"]
rzoz has joined #ocaml
rzoz has quit ["Client Exiting"]
CybeRDukE has joined #ocaml
docelic has joined #ocaml
CybeRDukE has quit ["Home is where you hang your @"]
docelic has quit ["later"]
CybeRDukE has joined #ocaml
CybeRDukE has quit ["A program is a device used to convert data into error messages."]
mrvn_ is now known as mrvn
phubuh has quit ["Client exiting"]
phubuh has joined #ocaml
mattam has joined #ocaml
mattam_ has quit [Read error: 110 (Connection timed out)]
polin8 has quit ["Lost terminal"]
polin8 has joined #ocaml
CybeRDukE has joined #ocaml
CybeRDukE has quit ["My software never has bugs. It just develops random features."]
teratorn has quit [Read error: 60 (Operation timed out)]