01:21
shawn has quit ["This computer has gone to sleep"]
01:34
<
dvorak >
hrm, do functions have to have an arg list?
01:36
<
dvorak >
well, if I do something like 'let hello_world = printf "Hello World\n";; then it's evaluated without being called
01:36
<
dylan >
functions do not have an arg list.
01:36
<
dylan >
All functions take one argument and return one value. :)
01:36
<
dylan >
you can, however, define that function like:
01:37
<
dylan >
let hello_world () = printf "I want my mommy!!!" ;;
01:37
<
dvorak >
that wasn't clear to me from the tutorial I read, thanks
01:37
<
mikeX >
there is one exception I think, object methods
01:37
<
dylan >
mikeX: ssh, and that isn't an exception.
01:38
<
dvorak >
ok, so it requires at least a unit parameter
01:38
<
mikeX >
indeed, you don't need to care about that yet dvorak (or ever, if you keep clear from OO programming in ocaml)
01:38
<
dvorak >
well, planning to stay clear of it now, just tying to get something simple done
02:17
<
dvorak >
what would be the best way to do something like perl's pack and unpack in ocaml?
02:22
<
mikeX >
what does that do?
02:23
<
dylan >
Unpacks or packs binary data strings.
02:23
<
dvorak >
what dylan said
02:23
<
dvorak >
I need to parse some dns packets
02:23
<
dylan >
to encode, say, an IP address into a string of 4 bytes.
02:23
<
dylan >
dvorak: for the love of monkeys, why? Isn't there a library for that?
02:24
<
dvorak >
for ocaml? maybe so, I don't know
02:24
<
dvorak >
it's kind of a niche need, so I assumed not
02:24
<
dylan >
is it something in POSIX?
02:24
<
dylan >
is there a C library that does it?
02:25
<
dvorak >
there are a few, none really do it especially well
02:25
<
dvorak >
I don't mind reinventing the wheel here though, since I'm just trying ot write some code to get familar with the language
02:26
<
dylan >
I wrote a CGI library to do the same.
02:26
<
dylan >
but parsing binary packets. hmm
02:26
<
dvorak >
dns packets aren't real complicated overall, so a c library ends up being pretty low level, and not real useful
02:26
<
dylan >
you'll have a few problems.
02:27
<
mikeX >
it seems a bit specialized and not too fitting to ocaml
02:28
<
dvorak >
definitely a bit specialized
02:28
<
dvorak >
but I've been doing some development at work on a in house dns server, so it's something I've got fresh in my mind
02:29
<
dvorak >
and I can do kind of apples to apples comparisons
02:31
<
dvorak >
hrm, apparently someone did an ssh implementation
02:31
<
dvorak >
which is not too different really
02:41
hikozaemon has joined #ocaml
02:47
mikeX has quit ["zz"]
03:11
bzzbzz has joined #ocaml
03:18
bzzbzz has quit ["leaving"]
03:25
khaladan has joined #ocaml
03:44
jcreigh has joined #ocaml
03:52
Revision17 has quit [Read error: 110 (Connection timed out)]
04:03
Revision17 has joined #ocaml
04:05
jcreigh has quit ["Do androids dream of electric sheep?"]
04:18
Smerdyakov has quit ["Leaving"]
05:41
WhatTheDeuce has left #ocaml []
05:44
shawn has joined #ocaml
05:47
shawn has quit [Client Quit]
05:49
shawn has joined #ocaml
06:36
ski has quit [Read error: 104 (Connection reset by peer)]
06:48
slipstream-- has joined #ocaml
06:52
ski_ has joined #ocaml
06:54
ski_ is now known as ski
07:01
slipstream has quit [Read error: 110 (Connection timed out)]
07:52
pango is now known as pangoafk
07:58
pangoafk is now known as pango
08:29
Skal has joined #ocaml
10:25
Revision17 has quit [Read error: 110 (Connection timed out)]
10:58
hikozaemon has quit ["Leaving..."]
11:29
_metaperl has joined #ocaml
11:46
mikeX has joined #ocaml
11:52
metaperl has quit [Read error: 110 (Connection timed out)]
12:00
<
_metaperl >
what is structural and physical equality? how do they differ?
12:01
<
flux__ >
physical equality -> same object
12:01
<
flux__ >
structural equality -> same content
12:02
<
flux__ >
I think those are orthogonal concepts
12:02
<
flux__ >
what is the context?
12:03
<
flux__ >
or actually(2), maybe they are related, but don't deal with values at all
12:03
<
flux__ >
but for example, these are structurally equivalent: type a = { a : int; b : int } and b = { c : int; d: int};
12:04
<
flux__ >
ok, it refers to what I said earlier
12:04
<
flux__ >
but actually I'm not convinced the book uses the proper term :-o
12:05
<
flux__ >
maybe someone can point me to the right direction..
12:41
<
mellum >
well, not really orthogonal, since physical equality implies structural equality
12:42
<
flux__ >
I was thinking structural equality being related only to types, but apparently not so then
12:53
<
pango >
probably some confusion between equality and equivalency (for "type compatibility" or some other relation)
12:55
<
flux__ >
well, there's a pair of words I haven't considered being much different
12:55
<
pango >
in my mind equality is a case of equivalency
12:59
<
flux__ >
ok, well, so there's no miscommunication there
13:41
yangsx has joined #ocaml
14:18
<
_metaperl >
I'm starting to get it actually. I think each tuple position corresponds to the type listed just above it
14:19
<
ketty >
are you refering to the type called state?
14:19
<
dvorak >
so I asked this question last night, but maybe someone around now will have an answer. is there some library or preferred technique for working with binary structures in ocaml? in perl I'd use pack and unpack, but there doesn't appear to be anything similar in the standard library. I'm trying to parse DNS packets
14:20
<
dvorak >
I can obviously take things byte by byte out of the string, but that's fairly tedious
14:21
<
ketty >
exactly what does pack and unpack do? is it posible to implement them in ocaml?
14:22
<
dvorak >
you provide a pattern to parse the binary structure with, for example, 'C4A60' would mean 4 single byte characters, then a 60 byte ascii string
14:22
<
dvorak >
it'd return a 5 element list
14:22
<
dvorak >
or, something like 'NNnC4' would be 2 network longs, a network short, and 4 individual bytes
14:23
<
dvorak >
so giving that to unpack along with a string with the data would give you a 7 element list
14:23
<
ketty >
what about writing separate functions for every data type?
14:23
<
ketty >
and put them in a module...
14:23
<
ketty >
would it be hard?
14:23
<
dvorak >
yeah, I could do that, I was just hoping someone else had ;)
14:24
<
dvorak >
perhaps I should look at the c binding stuff, it might have code for packing and unpacking c structures
14:25
<
dvorak >
which is really just about what I need
14:25
<
ketty >
yes, i think it has that..
14:26
<
dvorak >
hrm, according to the docs there, the Stream module does part of what I want, but most of that functionality has been moved into camlp4
14:27
<
pango >
maybe extlib IO module ?
14:27
<
dvorak >
I didn't see anything obvious there
14:28
<
dvorak >
let me look again
14:28
<
pango >
binary files, bits,...
14:28
<
dvorak >
yes, that's what I need ;)
14:29
<
dvorak >
hrm, so those all take an input channel?
14:29
<
dvorak >
can I turn a string into an input channel?
14:29
<
pango >
val input_string : string -> input
14:29
<
pango >
somewhere above
14:30
<
dvorak >
this looks workable
14:32
<
pango >
mldonkey uses Proto*.ml modules to convert back and forth between raw packets (in string buffers) to protocol messages (as variant type)
14:32
<
dvorak >
stuff they developed themselves?
14:33
<
pango >
and use simple functions like let value, new_pos = get_sometype buf pos to extract fields
14:33
<
pango >
(from memory)
14:33
<
dvorak >
ie, is the Proto stuff a library I can find somewhere, or something I'd have to pull out of the mldonkey source?
14:34
<
pango >
there's one module per network support (in fact often more, for example one for peer-to-peer, and one for peer-to-servers, etc.)
14:37
<
dvorak >
yeah, I see what you mean
14:37
<
dvorak >
they have some underlying library for doing that I imagine
14:38
<
pango >
most of them are trivial
14:38
<
dvorak >
looks like what I'm looking for
14:39
<
dvorak >
well, on something like get_int32_8, it looks like it returns an int32, but it's only creating it from a single byte
14:42
<
pango >
must have been some experiments, that code is commented out (thanks to syntax coloring ;) )
14:42
<
dvorak >
well, so what I don't see in there is get_int32
14:45
<
dvorak >
ah, so it's in littleEndian.ml
14:45
<
dvorak >
which makes sense, you need endian specific versions
14:53
yangsx has quit [Read error: 110 (Connection timed out)]
15:08
vin100 has joined #ocaml
15:11
vin100 has quit [Remote closed the connection]
15:23
khaladan has quit [Read error: 104 (Connection reset by peer)]
15:28
vincenz has quit [Client Quit]
15:31
Revision17 has joined #ocaml
16:32
Smerdyakov has joined #ocaml
16:32
work_metaperl has quit ["KVIrc 3.2.0 'Realia'"]
16:40
Revision17 has quit [Connection timed out]
17:06
finelemon has joined #ocaml
17:18
smimou has joined #ocaml
17:20
finelemo1 has quit [Read error: 110 (Connection timed out)]
17:20
shawn has quit [Connection timed out]
17:21
finelemo1 has joined #ocaml
17:23
pango is now known as pangoafk
17:27
finelemon has quit [Read error: 110 (Connection timed out)]
17:31
pangoafk is now known as pango
17:39
Snark has joined #ocaml
17:41
Lob-Sogular has quit ["Changing server"]
17:41
jbramley has joined #ocaml
18:03
shawn has joined #ocaml
18:16
shawn_ has joined #ocaml
18:27
shawn has quit [Connection timed out]
18:56
sidewinder has joined #ocaml
19:05
mikeX has quit ["later"]
19:32
Snark has quit ["Leaving"]
20:05
shawn_ has quit ["This computer has gone to sleep"]
20:26
shawn_ has joined #ocaml
20:33
dylan_ has joined #ocaml
20:37
dylan_ has quit [Client Quit]
20:37
dylan_ has joined #ocaml
20:38
dylan has quit ["Reconnecting"]
20:38
dylan_ is now known as dylan
21:09
Revision17 has joined #ocaml
21:09
rillig has joined #ocaml
22:19
shawn_ has quit ["This computer has gone to sleep"]
22:59
WhatTheDeuce has joined #ocaml
23:11
pango has quit [Read error: 145 (Connection timed out)]
23:25
pango has joined #ocaml
23:33
smimou has quit ["bli"]
23:35
WhatTheDeuce has left #ocaml []
23:35
mikeX has joined #ocaml