<_habnabit>
1) compared to what? 2) premature optimization is the root of all evil.
<_habnabit>
shaleh, pasting to the channel is kinda rude.
<shaleh>
_habnabit: yeah, sorry about that, missed the window I meant
<shaleh>
that said, using the tuple trick made the pattern match turn out ok
<_habnabit>
a lot of your parentheses are redundant.
<shaleh>
_habnabit: I hate remembering precedence (-:
<_habnabit>
, has pretty low precedence.
<_habnabit>
I don't know the order offhand, though.
<everyonemines>
I'm with shaleh, extra parens are faster than debugging if you're not sure.
<everyonemines>
I mean, philosophically.
<shaleh>
one can go overboard for sure, but I did not think I did.
<shaleh>
how close to ocaml style is that code? I have been playing in haskell and just started trying out ML
<_habnabit>
leaving off the first | in a match always looks strange to me.
<everyonemines>
I leave it off, but it really doesn't matter
<shaleh>
_habnabit: that is how both the O'Reilly and "Think OCaml" do it
<shaleh>
_habnabit: so I was just following along
<everyonemines>
shaleh: ocaml is multi-paradigm. You can program in a more functional or imperative style, or even (ugh) object-oriented.
<everyonemines>
If you're from a haskell background, then you'll probably use a functional style.
<shaleh>
everyonemines: yeah, I tend to functional, even in my C
<_habnabit>
those aren't all mutually exclusive.
<everyonemines>
Personally I'm a fan of recursion combined with array mutation.
<shaleh>
I wanted to try out ML. I like haskell but I find trying all of the choices makes for a more well rounded result
<everyonemines>
shaleh: Memoization and IO in haskell seems painful. It's also slower in practice.
<shaleh>
"slower" is relative and often not what I am concerned with. That said it is way to easy to hit stack explosion in Haskell.
<shaleh>
I wrote a really simple brainfuck interpreter and on really complex code it never really finished
flux has quit [Read error: Connection reset by peer]
<everyonemines>
Adding extra layers makes it harder to understand what the machine is doing, and sometimes you must. I find ML to be a happy medium, for now.
<shaleh>
ML is a little syntax heavy for me. The explicit match, rec, let, etc. make the code less elegant than the haskell I am used to readng
<everyonemines>
You mean, the keywords are visual clutter?
<everyonemines>
Meh, maybe you just get used to it. I like that it's easy to understand how something will be parsed, myself.
flux has joined #ocaml
<shaleh>
I never found Haskell hard to parse. Reason about is another story.
<shaleh>
f . g . h x is nice and I miss it
<shaleh>
Is there a haskell <-> ocaml functions like somewhere? I keep looking for the equiv of things like "words".
<everyonemines>
rosettacode
<shaleh>
words "this is a string" -> [this, is, a, string]
<everyonemines>
read through the standard library for stuff like that
<shaleh>
everyonemines: where is the easy place to do that online?
<shaleh>
or better, where is a reasonable online starting place? The inria site is not all that well put together
<everyonemines>
hmm, I guess exceptions in ocaml are faster than I thought
ulfdoz has quit [Ping timeout: 258 seconds]
joewilliams is now known as joewilliams_away
<shaleh>
how does one rip a string apart? In haskell a string is a [char] so I can pattern match on (c:cs) and test for [].
<_habnabit>
'rip it apart' how? there's string methods.
joewilliams_away is now known as joewilliams
<shaleh>
_habnabit: let rec foo str = match str with c :: cs -> op c :: foo cs
<_habnabit>
yeah, you have to index it and/or use String.sub
<shaleh>
the string methods seem more C 'esque with loop or index variable to walk the string
<_habnabit>
eh?
<shaleh>
_habnabit: I just have not found a tutorial I am happy with yet so I am floundering around with my Haskell knowledge and the ref combined with the O'Reilly text
ankit9 has quit [Quit: Leaving]
<shaleh>
write now I would like a function to split a string into a list of words --> "this is a test" should become ["this", "is", "a", "test"] like perl or python's split or Haskell's words. Hmm, I just found Str (as opposed to String)
joewilliams is now known as joewilliams_away
<everyonemines>
Use Str.split
<everyonemines>
you need to use Str.regex on the split string.
<everyonemines>
Strings being lists instead of arrays seems dumb to me.
<shaleh>
everyonemines: choices, choices. I do not mind either way. I am just learning enough of the vocabulary to think straight.
<everyonemines>
Seriously though, random access of substrings is important.
<shaleh>
Not being able to pattern match directly on strings just feels foreign right now
<everyonemines>
I feel like I'm starting to understand why Haskell is slow.
avsm has joined #ocaml
bitbckt has quit [Quit: out]
Cyanure has joined #ocaml
bitbckt has joined #ocaml
ankit9 has joined #ocaml
thomasga has joined #ocaml
edwin has joined #ocaml
Cyanure has quit [Remote host closed the connection]
ikaros has joined #ocaml
Boscop has joined #ocaml
avsm has quit [Quit: Leaving.]
PiepScuim has joined #ocaml
Cyanure has joined #ocaml
everyonemines has quit [Quit: Leaving.]
shaleh has quit [Quit: shaleh]
avsm has joined #ocaml
avsm has quit [Quit: Leaving.]
fracek has joined #ocaml
avsm has joined #ocaml
surikator has joined #ocaml
Kakadu has joined #ocaml
<flux>
shachaf, if you're feeling you don't need performance, iirc batteries comes with an explode function
<flux>
(or perhaps it's list String.to_list or something)
surikator has quit [Read error: Connection reset by peer]
surikator_ has joined #ocaml
<rixed>
shaleh: in batteries, you have BatString.nsplit "this is a test" " " -> ["this"; "is"; "a"; "test"]
<rixed>
flux BatString.to_list will make a string a list of chars.
<flux>
oh yes, I was just looking the discussion about the difference of choosing string as an array vs string as a list of chars
<rixed>
flux: string as a list of chars would be unpractical for sharing them with C, and would be quite innefective. I like Ocaml compromise, although I'd like to be abble to pattern match them anyway. Surely there is a syntax extention for that?
<flux>
rixed, not quite, but almost, and perhaps even better: mikmatch
<flux>
(hm, was is micmatch or mikmatch which was more recent? I never remember ;-))
flux has quit [Remote host closed the connection]
flux has joined #ocaml
flux has quit [Remote host closed the connection]
flux has joined #ocaml
flux has quit [Remote host closed the connection]
Boscop has quit [Quit: OutOfTimeException: Allocation of TimeFrame failed due to lack of time. Free up time by cancelling unimportant events.]
everyonemines has joined #ocaml
bitbckt has quit [Quit: out]
bitbckt has joined #ocaml
flux has joined #ocaml
ttamttam has joined #ocaml
lopex has joined #ocaml
larhat has joined #ocaml
flux has quit [Ping timeout: 260 seconds]
_andre has joined #ocaml
emmanuelux has joined #ocaml
fracek has quit [Quit: fracek]
everyonemines has left #ocaml []
flux has joined #ocaml
Cyanure has quit [Remote host closed the connection]
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
PiepScuim has quit [Read error: Connection reset by peer]
mjonsson has joined #ocaml
Cyanure has joined #ocaml
<adrien>
gildor: I'm going to make lablgtk-react use oasis; should I take the 0.2.0, 0.2.1 alpha or latest in source control
<adrien>
?
<adrien>
ah, I won't be able to really chose the latest darcs
foocraft has quit [Read error: Connection reset by peer]
foocraft has joined #ocaml
<gildor>
adrien: go for 0.2.1~alpha, it is quite safe
<adrien>
ok, thanks =)
<sgnb>
gildor: btw, how about a proper release?
<adrien>
I'm going to install ocamlify-0.0.1, and the version number is quite low :P
<adrien>
hmmmm
<adrien>
File "src/pa_odn.ml", line 47, characters 2-9:
<adrien>
Error: Unbound value Gen.idp
<adrien>
gildor: does ODN work with type-conv 3.0.4?
<adrien>
I've updated my libraries for the new version of Core and changed quite a lot of things (that was really annoying and frustrating to do) and I think I changed type-conv too
ankit9 has quit [Quit: Leaving]
<gildor>
adrien: I am not sure about type-conv and ODN
<gildor>
adrien: there is a lot of things changed in type-conv
<gildor>
sgnb: I am all for a proper release, I expect to resume my OCaml related works ~1st November
* gildor
busy painting shelves and walls at his house since 3 months
<hcarty>
My oasis conversions have generally gone along the lines of: git checkout -b oasis && rm build_system_files && oasis quickstart && vim _oasis && oasis setup
<adrien>
ah, branching, that's not stupid :P
<hcarty>
adrien: With several repetitions of the last two steps in order to get everything working properly
<hcarty>
:-) They do serve a purpose from time to time
<adrien>
if I have "Library \"minifrp\"", do I need to add a FindlibName option?
<adrien>
but lablgtk-react is zomg-leet bleeding-edge, you have to be bleeding-edge and uber-cool to use it too: no branches! safety is for wimps!
<gildor>
adrien: I tend to keep the _tags at the beginning and just add # OASIS_START \n # OASIS_STOP then see what oasis setup adds and remove the duplicate lines
<hcarty>
adrien: Branch, but immediately after branching delete the original branch. Burning bridges, all the cool kids are doing it.
<hcarty>
gildor: That's an even better plan :-) Thanks for the tip!
<gildor>
hcarty, adrien: oh, and of course, when I see some tags missing, I fix the generation process directly in oasis ;-)
<hcarty>
adrien: I think you do need to add FindlibName if you want one. I think this is in part to support nested findlib names.
<gildor>
(and submit a patch upstream ;-)
<hcarty>
gildor: Of course :-)
<adrien>
gildor: oh, right, I had forgotten about that :p
<adrien>
hcarty: and rebase, amend commits, rewrite history, delete branches and replace them with different ones which only share the name
<adrien>
how do I give "-thread" to ocamlfind?
<gildor>
adrien: pkg_thread
<gildor>
or BuildDepends: thread
<adrien>
thanks, also found it in lwt's oasis
fracek has joined #ocaml
lopex has joined #ocaml
testcocoon has joined #ocaml
<edwin>
gildor: btw did you notice that lately ocamlbuild doesn't show the error messages from ocamldep, just that it exited with error code 2? (when the .ml/.mli files have a syntax error)
<edwin>
do you know of a way to work around that with myocamlbuild.ml, or should I open a bug in mantis?
<sgnb>
(don't know if ocamlbuild is at fault, though)
<sgnb>
oh, didn't pay attentention to the "when the .ml/.mli files have a syntax error" part
<sgnb>
well, printing to stderr is indeed involved...
<edwin>
if I run the ocamlfind ocamldep command manually it prints the message
<edwin>
from ocamlbuild it doesn't
<sgnb>
I observed the same behaviour in aforementioned bugreport
<edwin>
let me try upgrading dash though
<sgnb>
I wasn't able to reproduce the behaviour outside of ocamlbuild
<edwin>
yay its working now
<edwin>
sgnb: thanks for the hint
<sgnb>
it would be nice to understant what was going on, though
<sgnb>
I've never been so clueless about a bug I "solved" myself
<edwin>
would probably involve digging into dash
<edwin>
maybe some buffer doesn't get flushed that should
<edwin>
and looses stderr
<edwin>
did upstream revert that patch too?
<sgnb>
the problem is still not understood and the revert remains Debian-specific
joewilliams_away is now known as joewilliams
<edwin>
sgnb: interesting, looking through strace and apparently its a problem with file descriptor 2 in the parent, which is a pipe and in one case its closed already
<edwin>
scratching my head on the why
<edwin>
sgnb: although there is something seemingly silly there: dup(0) = 3, close(0), dup2(3,0) = 0, close(3)
<edwin>
sgnb: maybe that helps shed some light, in the bad case (5.7.2-1) it creates a pipe on fd 8,9, and then closes fd 8
<edwin>
sgnb: in the good case it closes fd 8, and then creates a pipe on fd 8,9
<edwin>
would be interesting to know where that close(8) comes from in the bad case
__marius__ has joined #ocaml
ulfdoz has joined #ocaml
<sgnb>
the original patch doesn't make any sense to me w.r.t. its description in the first place
larhat has quit [Quit: Leaving.]
larhat has joined #ocaml
larhat has quit [Client Quit]
surikator_ has quit [Quit: Computer is sleeping. I'm probably not.]
ttamttam has quit [Remote host closed the connection]
avsm has quit [Quit: Leaving.]
junsuijin has joined #ocaml
fracek has quit [Quit: You are not prepared!]
avsm has joined #ocaml
thomasga has quit [Quit: Leaving.]
lpereira has joined #ocaml
jamii has joined #ocaml
_andre has quit [Quit: leaving]
ulfdoz has quit [Ping timeout: 256 seconds]
Kakadu has quit [Ping timeout: 276 seconds]
<sgnb>
edwin: after looking closer, it seems that ocamlbuild does misbehave... the "if m = 0" branch in ocamlbuild_executor is blatantly wrong in the 5.7.2-1 case
<sgnb>
IIUC, it assumes a job is finished if reading from an fd returned as ready-to-read by select, which is not true with dash 5.7.2-1
edwin has quit [Remote host closed the connection]
ikaros has quit [Quit: Ex-Chat]
lpereira has quit [Quit: Leaving.]
avsm has quit [Quit: Leaving.]
thomasga has joined #ocaml
thomasga has quit [Client Quit]
__marius__ has quit [Remote host closed the connection]
Amorphous has quit [Ping timeout: 256 seconds]
Amorphous has joined #ocaml
dnolen has joined #ocaml
Cyanure has quit [Read error: Operation timed out]