<flux>
and who knows what monstrosity we'll get in a few years!
Yoric has quit [Ping timeout: 252 seconds]
<hcarty>
flux: If people want to, they could make the complaints about camlp4 look minor and insignificant when compared to the modifications done with compiler-libs :-)
<adrien>
:P
chambart has quit [Ping timeout: 260 seconds]
<adrien>
new hevea version \\o
eni has quit [Ping timeout: 260 seconds]
Ptival has joined #ocaml
<Drakken>
What's the standard way of dealing with really big data structures that have to be mutated a lot?
<adrien>
like what?
<Drakken>
like a search tree
<Drakken>
It uses up all available memory, so you can't just copy it.
<emias>
[A
<emias>
(Sorry.)
hongboz has joined #ocaml
notdan has joined #ocaml
<Drakken>
Do mutable elements use more memory than immutable ones?
<hcarty>
Drakken: Mutable elements in a record?
<Drakken>
yes
<Drakken>
hcarty or an array
<hcarty>
Drakken: I don't think so... there was discussion about this at some point.
<hcarty>
Drakken: Not for an array
<hcarty>
And I think the answer is the same for a record
<arsatiki>
I may be overthinking it, but I just can't figure out how to use pattern matching in that excercise
testcocoon has quit [Quit: Coyote finally caught me]
<arsatiki>
If you are familiar with the excercise, I'd appreciate a small hint
<thelema>
arsatiki: you could implement the substitution table as a pattern match
<arsatiki>
But then raising the exception becomes awkward?
<flux>
association lists handle the 'raise exception' requirement automatically
<thelema>
| _ -> invalid_arg "Not a plaintext string"
<thelema>
or if you really want you can leave the pattern match incomplete, and OCaml will raise an exception for you
<arsatiki>
ahmm
<arsatiki>
I'll probably have to peek ahead and use tuples
<thelema>
arsatiki: what for?
<flux>
(for association lists?)
<arsatiki>
thelema: My only idea so far is to make a recursive checker that checks the first letter. It'd be great to express the stopping conditions with a tuple match
<thelema>
arsatiki: or just do nested matches
<thelema>
match a with | ... -> | ... -> match b with | ... -> ...
<thelema>
but in this case, an if/then/else makes more sense for the stopping condition
<arsatiki>
Learning a new language is clumsy business :(
<thelema>
yup, sometimes it is.
<flux>
it's not that bad, although one wouldn't do that in actual programs
<thelema>
instead of stringtail, maybe use another argument to check that is the position.
<flux>
arsatiki, if you know about pattern matching guards, here's an opportunity to use them
<thelema>
and instead of matching both s1 and s2 against "", just check if that position is past their length
<arsatiki>
right
<arsatiki>
thanks
<thelema>
flux: quite right; the last case in `check` is probably better broken into two
<thelema>
another approach would be to explode the strings first: string -> char list
<thelema>
then your strategy would be more natural
<arsatiki>
yeah
<arsatiki>
But given that I know only 35 pages of ocaml my options are limited :)
<flux>
arsatiki, btw, you can also combine cases: | ("", _) | (_, "") -> false
<thelema>
let explode s = let rec loop i = if i >= String.length s then [] else s.[i] :: loop (i+1) in loop 0
<Drakken>
thelema or put the loop directly in the check function.
<Drakken>
This is a place where it's nice to know how to iterate with recursion.
<Drakken>
arsatiki your best bet is to write something like the loop in thelema's explode function, except with your crypto maching instead of consing.
<Drakken>
maTching
<arsatiki>
hmm
<arsatiki>
I'll add a note of that if I decided to revisit the exercises at some point
<arsatiki>
I already spent 90 minutes on that one =)
ankit9 has quit [Quit: Leaving]
thomasga has joined #ocaml
ocp has quit [Ping timeout: 245 seconds]
cdidd has joined #ocaml
avsm has joined #ocaml
smondet has joined #ocaml
cago has quit [Quit: Leaving.]
cago has joined #ocaml
bzzbzz has joined #ocaml
eni has joined #ocaml
chambart has quit [Ping timeout: 246 seconds]
avsm has quit [Quit: Leaving.]
ftrvxmtrx has quit [Quit: Leaving]
Submarine has quit [Ping timeout: 240 seconds]
ontologiae has quit [Read error: Connection reset by peer]
ontologiae has joined #ocaml
sepp2k has quit [Quit: Leaving.]
ontologiae has quit [Read error: Connection reset by peer]
ontologiae has joined #ocaml
ontologiae has quit [Read error: Connection reset by peer]
chambart has joined #ocaml
ontologiae has joined #ocaml
avsm has joined #ocaml
mattrepl has joined #ocaml
avsm has quit [Client Quit]
mika1 has quit [Quit: Leaving.]
cago has quit [Quit: Leaving.]
Tobu has quit [Remote host closed the connection]
djcoin has quit [Ping timeout: 246 seconds]
Tobu has joined #ocaml
ontologiae has quit [Ping timeout: 244 seconds]
Kakadu has joined #ocaml
Kakadu_ has joined #ocaml
Kakadu has quit [Read error: Operation timed out]
djcoin has joined #ocaml
sepp2k has joined #ocaml
djcoin has quit [Ping timeout: 252 seconds]
sepp2k has quit [Ping timeout: 246 seconds]
sepp2k has joined #ocaml
Ptival has quit [Quit: Quat]
Ptival has joined #ocaml
iago has joined #ocaml
leoncamel has joined #ocaml
leoncamel has quit [Ping timeout: 260 seconds]
chambart has quit [Ping timeout: 252 seconds]
Tobu has quit [Remote host closed the connection]
Tobu has joined #ocaml
Tobu has quit [Remote host closed the connection]
avsm has joined #ocaml
<hcarty>
adrien: I wrote a (hopefully simple) _oasis file for lablgtk2 2.16.0 so that it could be properly uploaded to oasis-db
<hcarty>
adrien: I can send it over if you are interested. It doesn't do much, just providing a wrapper around the "actual" build system.
<thelema>
wmeyer: I was about to say it looks auto-generated
<wmeyer>
but I like the idea.
<thelema>
It's the boilerplate for mapping typed trees to typed trees
<thelema>
being able to tweak some internals
<wmeyer>
all the visitors do the same thing use OBJECTS for that
<wmeyer>
yes, I know why it's there :-)
<wmeyer>
Camlp4, CIL and so on, also reuse this concept
<wmeyer>
I think late binding is damn useful and well justified here
<thelema>
afaict, the main reason for OO on this is the ability to nicely replace part of the logic of a recursive function...
<thelema>
which I guess requires the late binding you're talking about
<wmeyer>
thelema: yes, agreed. I think apart from GUI this is the another place where objects shine
<wmeyer>
thelema: FoldGenerator filter in Camlp4, is generating this stuff
<thelema>
ah, neat.
<thelema>
I wonder if these kind of tools shouldn't be camlp4, but instead... hmm, not sure. want to have it generated once
<thelema>
but it would have to be tweakable as internals change...
<thelema>
so it needs a text representation
<wmeyer>
thelema: I think it would be fair to use new -ppx for this purpose, it just brings more power and reliability. Although my personal opinion is that Camlp4 does the job done too. Ultimately you want a -ppx style code generator with OCaml quotations.
<wmeyer>
thelema: The only drawback I see with the compiler-libs is instability, the internals are internals they might just change withing each release..
<wmeyer>
where is Camlp4 interface is now rock solid, whethever it sounds convincing or is good in general might be debatable
hjk has joined #ocaml
<thelema>
there seems always to be a bunch of camlp4 bugs that crop up after any syntax change in the compiler
<thelema>
they usually get fixed in the next compiler release
<wmeyer>
true
avsm has quit [Quit: Leaving.]
hjk has quit [Quit: Page closed]
<adrien>
hcarty: thanks for making the files
<adrien>
hcarty: however I don't think I can include that in lablgtk2 for now
<adrien>
need to fix and check some slight build system breakage first
_andre has quit [Quit: leaving]
tlockney_ is now known as tlockney
sivoais has quit [Quit: Lost terminal]
sivoais has joined #ocaml
avsm has joined #ocaml
ontologiae has joined #ocaml
Yoric has joined #ocaml
osa1 has quit [Quit: Konversation terminated!]
hongboz has quit [Ping timeout: 276 seconds]
Yoric has quit [Remote host closed the connection]
Yoric has joined #ocaml
Anarchos has joined #ocaml
Kakadu_ has quit [Quit: Konversation terminated!]
emmanuelux has joined #ocaml
smondet has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
pango is now known as pangoafk
eni has quit [Quit: .]
emmanuelux has quit [Remote host closed the connection]
ontologiae has quit [Ping timeout: 240 seconds]
Yoric has quit [Ping timeout: 260 seconds]
ChristopheT has joined #ocaml
avsm has quit [Quit: Leaving.]
Ptival has quit [Read error: Connection reset by peer]
ChristopheT has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]