ttamttam has quit [Remote host closed the connection]
Snark has joined #ocaml
avsm has joined #ocaml
th5 has joined #ocaml
accel has left #ocaml []
theDroggl has quit [Read error: Connection reset by peer]
theDroggl has joined #ocaml
ttamttam has joined #ocaml
sdj has joined #ocaml
Amorphous has quit [Ping timeout: 272 seconds]
coucou747 has quit [Quit: 0x2a]
zzz_ has joined #ocaml
Amorphous has joined #ocaml
sdj has quit []
ccasin has joined #ocaml
boscop has joined #ocaml
drunK has joined #ocaml
ikaros has joined #ocaml
lamawithonel_ has quit [Remote host closed the connection]
lamawithonel_ has joined #ocaml
oriba has joined #ocaml
gnuvince_ has quit [Quit: ""]
<albacker>
is there a NULL char in ocaml?
<rwmjones>
what is a "NULL char"?
<rwmjones>
you mean ASCII NUL, that is '\000'
<flux>
it doesn't of course terminate strings or anything such silly things
<flux>
..except when you use them in certain contexts, such as when calling operator system calls that assume \000 terminates something
<flux>
such as opening a file
<flux>
that hasn't been fixed, has it?
<flux>
(throwing Invalid_argument when \0 detected in an argument to open_file would be fixing in my book)
<albacker>
i wanted something that wouldn't be found in a 'norma' .txt file to start an array with.
<albacker>
normal*
drunK has quit [Remote host closed the connection]
<albacker>
but i found another solution, and thanks rwmjones flux :)
<albacker>
flux: you have written a book?
<flux>
nope
<flux>
well, I wrote my thesis and it was bind as a book, so I guess yes.. ;)
<albacker>
cool :)
<albacker>
can a fun tell me if there's x present in the list L, and if yes return x, otherwise return false (or something like this). Should i use None, Some?
<adrien>
List.mem?
<albacker>
because using List.exists and then iterating throught the list a 2nd time, seems not intelligent.
zzz_ has quit [Quit: zhengli]
<albacker>
Hell yeah.
<albacker>
thanks
<adrien>
=)
zzz_ has joined #ocaml
<kerneis>
albacker: if you want to return x, then you'd rather use List.find
<kerneis>
(and catch the exception it's not there)
<adrien>
argh, right, hadn't read correctly /o\
<albacker>
kerneis: i see, thanks.
<albacker>
adrien: i'm sorry, kerneis wins :p
<adrien>
;-)
<adrien>
it's ok, I can blame it on pkgconfig, windows and the fact that I'm having lunch at 4:30pm
<albacker>
ha!
<albacker>
i had to que 45 minutes to eat lunch (Student resto)
<albacker>
42 minutes to be exact.
<adrien>
and 3 minutes to eat?
<albacker>
4.2 to eat.
<albacker>
it takes more time queuing than eating, that's for sure.
<albacker>
unless you go there first, (11:30am).
<albacker>
but that means that around 4:30pm, i'll be hungry again.
<adrien>
yeah, student restaurants always get crowded pretty suddently
<adrien>
hmmm, I'm using the native backtraces, there's no way to get arguments to functions printed I guess
<albacker>
List.find doesn't return _the_ list entry?
<kerneis>
albacker: sorry
<kerneis>
as a matter of fact, what you want is:
<kerneis>
let mylist = [ref ('a',1); ref ('b',2)];
<kerneis>
let ch = List.find (fun x->(fst !x)='a') mylist;;
<kerneis>
each time you use "ref", you have a new reference with no relationship with the old one
<albacker>
and if i ever want to add new entries to mylist i'll have to add a ref before the [ ] no ?
ftrvxmtrx has quit [Read error: Connection reset by peer]
ftrvxmtrx has joined #ocaml
<adrien>
depends on how you code: if you want to update your list, you'll have to but typically, in ocaml, you'd simply build a new list with 'your_new_element :: your_list' (it'll share everything, it's a very lightweight operation)
<adrien>
really depends on what you want and how you're doing things
joewilliams_away is now known as joewilliams
<albacker>
thanks.
<albacker>
this is what i was trying to do http://pastebin.com/Z6xpQYAS by going throught the list/string the less possible.
<adrien>
you can use str.[i] to access the i-th element of a string btw
<albacker>
theres a small error on line12, [ ] shouldnt be there.
<adrien>
ah, you want to count the number of occurences of a character
<albacker>
adrien: :)
<albacker>
i was thinking on how to have a small complexity of the function.
<albacker>
i think i have O(n^2) now.
<adrien>
why not use an array to store the frequencies?
<albacker>
i dont know the number of different characters in advance.
<adrien>
you know the maximum number of characters: 256
<albacker>
true
<albacker>
i started with an array (null char question i asked above)
<adrien>
why were you trying to "start" an array with? or were you thinking about using a "(char*int) array ref" and recreate an area for each new character?
<albacker>
well i was thinking about creating the array at the beggining like let freqs = array.make 256 ('_', 0)
<albacker>
in place of '_' have a null char or smth.
<albacker>
but since there's 0, i don't even need a null char.
<adrien>
Char.code / Char.chr and use the index of the element in the array to find the corresponding character
<adrien>
and I made a mistake: I should have used ( and ) instead of [ and ] ten minutes ago
<albacker>
yes you're right, i dont need the extra char.
<albacker>
even though the only problem of using the array is chars like 'ç'
<adrien>
why? ;-)
<albacker>
is that ascii?
<albacker>
i mean unicode chars for example.
<adrien>
nope but it's ok in iso8859-1(5)
<adrien>
you won't get unicode with String anyway
<albacker>
OK
<adrien>
you can get unicode however, but not with the base ocaml runtime (camomille)
<albacker>
ok thanks for clarifying.
sdj has joined #ocaml
sdj has quit [Client Quit]
sdj has joined #ocaml
sdj has quit [Ping timeout: 260 seconds]
sdj has joined #ocaml
ulfdoz has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
sdj has quit [Ping timeout: 240 seconds]
ttamttam has quit [Remote host closed the connection]
zzz_ has quit [Quit: zhengli]
zzz_ has joined #ocaml
th5 has quit [Quit: th5]
init1 has joined #ocaml
Modius has joined #ocaml
Tobu has joined #ocaml
sdj has joined #ocaml
Tobu has quit [Ping timeout: 265 seconds]
fraggle_ has quit [Read error: Connection reset by peer]
ulfdoz has quit [Ping timeout: 265 seconds]
ulfdoz has joined #ocaml
rn114_ has joined #ocaml
fraggle_ has joined #ocaml
<hcarty>
Does Batteries have a string_printer-like function which does not quote strings? I'm looking for an equivalent to "let str_printer tuple out s = IO.nwrite out s"
Snark has quit [Quit: Ex-Chat]
rikta06 has joined #ocaml
<rikta06>
How to create a directory in ocaml ?
<adrien>
rikta06: Unix.mkdir
<adrien>
rikta06: if you're going to work with files a lot, you might want to look at ocaml-fileutils
<rikta06>
oh, on which OSs does this work ?
<adrien>
everywhere
<adrien>
I use ocaml-fileutils on windows and unix actually
<rikta06>
Oh, nice, thanks for the pointer.
<adrien>
thanks gildor for the library :P
olauzon has joined #ocaml
rn114_ has quit [Remote host closed the connection]
Anarchos has joined #ocaml
sdj has quit []
sdj has joined #ocaml
Modius has quit [Ping timeout: 240 seconds]
init1 has quit [Quit: Quitte]
fraggle_ has quit [Read error: Connection timed out]
yezariaely has joined #ocaml
ulfdoz has quit [Ping timeout: 250 seconds]
fraggle_ has joined #ocaml
seafood has joined #ocaml
seafood has quit [Quit: seafood]
seafood has joined #ocaml
yezariaely has left #ocaml []
[root] has joined #ocaml
ccasin has quit [Ping timeout: 264 seconds]
ccasin has joined #ocaml
seafood has quit [Ping timeout: 245 seconds]
[root] has quit [Quit: good night]
ccasin has quit [Ping timeout: 264 seconds]
Tobu has joined #ocaml
Yoric has quit [Quit: Yoric]
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
rn114_ has joined #ocaml
sdj has quit []
ikaros has quit [Quit: Leave the magic to Houdini]