<flux>
sometimes it bites to /ignore parts/quits/nicks. but not too often :)
<sgnb>
I guess uho_ is the same person
<flux>
There is no such nick uho_
JimmyRcom has quit [Ping timeout: 240 seconds]
<sgnb>
oh...
<sgnb>
my nick completion deceived me
f[x] has joined #ocaml
ftrvxmtrx has joined #ocaml
Leonidas has quit [Ping timeout: 272 seconds]
ygrek has joined #ocaml
ttamttam has joined #ocaml
Yoric has joined #ocaml
_unK has joined #ocaml
<gildor>
hi ygrek
<gildor>
concerning extunix
<gildor>
ygrek: have you any rules for commit?
<gildor>
ygrek: would you like me to commit in a separate branch and let you merge it after verification?
ygrek has quit [Ping timeout: 245 seconds]
barismetin has joined #ocaml
Leonidas has joined #ocaml
yangsx has quit [Ping timeout: 240 seconds]
_andre has joined #ocaml
avsm has joined #ocaml
th5 has joined #ocaml
MarcWebe1 has left #ocaml []
xeno has quit [Ping timeout: 240 seconds]
skavez has joined #ocaml
xeno has joined #ocaml
<skavez>
Hi there. How do you pattern match/compare the second element in a list to the head? I'm trying to compare the head to the head+1 to see if they're the same, but I haven't had much success.
ygrek has joined #ocaml
<skavez>
This is where I'm at now (trying to extract the second element), but OCaml's expecting list of a list instead of just a list. <http://ocaml.pastebin.com/3ZzqdhGJ>
<skavez>
(I should probably add that I'm new to OCaml as well. Learned a few basics awhile ago and trying to pick up again.)
<flux>
skavez, ask yourself: what is the type of the first match expression?
<flux>
skavez, then apply the logic that all match expressions must return the same type :)
<skavez>
flux: thanks! i'd read that earlier on about if statements, but it seemed to disappear when i needed it!
maharba has quit [Read error: Connection reset by peer]
eldragon has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
haelix_ has left #ocaml []
<skavez>
how do you check for an undefined argument? i have an inner function that takes "old_head" and "list" as params, but the first time it's run, old_head should be undefined. i got around this by seeding old_head with 0 when it's called from the outer function, but this forces me into an int list -- i'd like to keep it a polymorphic function.
<hcarty>
It looks similar in functionality to the Eclipse plugin
ttamttam has quit [Remote host closed the connection]
ftrvxmtrx has quit [Remote host closed the connection]
ftrvxmtrx has joined #ocaml
joewilliams is now known as joewilliams_away
joewilliams_away is now known as joewilliams
skavez has quit [Quit: Page closed]
<th5>
hcarty: Never tried it. If you try it, please post to caml-list. I'd like to hear how it compares to the others. I think IntelliJ is the best IDE for Java. I'm just waiting for the day when I can ditch emacs for something better (for OCaml).
smimou has joined #ocaml
<hcarty>
th5: I've installed it and toyed around with it a bit, combined with a GODI install of OCaml 3.12.0
<hcarty>
I
<hcarty>
The autoindent and code folding don't seem to work, at least not the way I have it setup
<hcarty>
But the completion works well
Yoric has quit [Ping timeout: 240 seconds]
<hcarty>
Pcre.pm<Ctrl-Space> brings up pmatch, for example.
<hcarty>
I don't know if there is a way to get it to use ocamlfind or some other custom compiler/build system.
Yoric has joined #ocaml
<th5>
Maybe I'll check it out later this week.
<hcarty>
th5: If you find anything interesting, please let me know. It looks promising, and among the first questions I get about OCaml is "Does it have an IDE?"
<th5>
Caml is my favorite language but unfortunately the tools around it can be a bit lacking
<th5>
If you aren't already using it, I highly recommend OCamlSpotter. No one seems to use it but for me it's essential.
<avsm>
ocamlspotter is awesome
Yoric has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
<hcarty>
Does ocamlspotter have vim support?
barismetin has quit [Remote host closed the connection]
<th5>
I don't think so. Though the emacs mode is just a simple interface to the command line tool.
<avsm>
ive been meaning to add vim support for ages
<avsm>
i updated ocaml annot to github.com/avsm/ocaml-annot , that works with 3.12 and vim, but not ocamlspotter (yet)
<avsm>
anyone else want to get to it first, feel free :)
<adrien>
MarcWeber made some completion support a few days ago
eldragon has quit [Read error: Connection reset by peer]
eldragon has joined #ocaml
Anarchos has joined #ocaml
eldragon has quit [Read error: Connection reset by peer]
th5 has quit [Quit: th5]
eldragon has joined #ocaml
eldragon has quit [Read error: Connection reset by peer]
ikaros has joined #ocaml
init1 has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
Yoric has quit [Quit: Yoric]
ulfdoz has joined #ocaml
eldragon has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
ygrek has joined #ocaml
robthebob has quit [Remote host closed the connection]
ccasin has quit [Quit: Leaving]
MarcWeber has joined #ocaml
MarcWeber has left #ocaml []
MarcWeber has joined #ocaml
<MarcWeber>
Can segfaultsb e caused by bad ocaml code?
<adrien>
in native code, stack overflows cause "segfaults"
<adrien>
could be bad C code too
<MarcWeber>
Its more likely to be a stack overlfow then.
<flux>
infact, can't segfault happen whenever C code stack overflows?
ftrvxmtrx has joined #ocaml
<adrien>
MarcWeber: if you don't know where it could be, recompile as bytecode
<adrien>
flux: well, bytecode only reports it as stack overflow because the ocaml vm is able to catch it
<MarcWeber>
adrien: :) Kn
<MarcWeber>
I can't reproduce it anymore.
<avsm>
there is OS-specific support for catching it safely on native code
<avsm>
if HAS_STACK_OVERFLOW_DETECTION is set by the configure script
<flux>
avsm, but afaik it still doesn't work in C code?
smimou has quit [Ping timeout: 265 seconds]
<avsm>
it may work; its implemented as a sigsegv handler
<flux>
oh, ok
<avsm>
but the exception wont be raised unless you're in ocaml code
<avsm>
- faulting address is word-aligned
<avsm>
- faulting address is within the stack
<avsm>
- we are in Caml code */
<flux>
right, so it doesn't?
<avsm>
if you're in C bindings when you overflow, no
<avsm>
but the original question was "Can segfaultsb e caused by bad ocaml code?", to which the answer is no if your platform has overflow detection
<flux>
well, I was thinking it wasn't being quite as literal
<flux>
after all, many functions, especially for example in the Unix-module, are implemented in C
<flux>
I suppose you'd need to have some bad luck to hit the stack overflow at that exact point, though
<flux>
because I don't think they use stack a lot. well, Unix.write copies the argument into stack before writing it?
<adrien>
i386,linux_elf|amd64,linux|power,rhapsody|amd64,macosx|i386,macosx|amd64,macosx <- hard-coded list for HAS_STACK_OVERFLOW_DETECTION, but I think I had a stack overflow notified as a segfault not so long ago
<avsm>
no, it doesnt
ygrek has quit [Ping timeout: 245 seconds]
chee has joined #ocaml
_andre has quit [Quit: leaving]
<hcarty>
adrien, avsm: I've been wanting to take a look at both ocaml-annot and MarcWeber's vim modifications.
<hcarty>
adrien, avsm: Thanks for the reminders :-)
ikaros has quit [Quit: Leave the magic to Houdini]
init1 has quit [Quit: Quitte]
fraggle_ has quit [Ping timeout: 276 seconds]
<avsm>
excellent :)
<avsm>
bundling them all together would be nice; ive not had a chance to look at marc's properly
thieusoai has joined #ocaml
avsm has quit [Quit: Leaving.]
fraggle_ has joined #ocaml
ccasin has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
roconnor has quit [Remote host closed the connection]
fraggle_ has quit [Remote host closed the connection]
mikeK_ has joined #ocaml
fraggle_ has joined #ocaml
<mikeK_>
I'm trying to build a function to see if all the elements in the list are even. I'm using List.fold but I'm getting a type mismatch that I don't quite understand. Anyone point me in the right direction? http://codepad.org/7hOrvx8M
<sepp2k>
mikeK_: The function given to fold_left does not take a list as either of its arguments (unless either the list given to fold_left is a list of lists or the accumulator is a list), however your all_pred_rec function takes a list, so you can't use it as an argument to fold_left.
<sepp2k>
Also the name is misleading as the function is not actually recursive.
<sepp2k>
mikeK_: Also, unless this is a learning exercise, you should just use the List.for_all function.
sepp2k1 has joined #ocaml
<mikeK_>
sepp2k: hm, I'm a little confused right now. Give me a few minutes to work it out
sepp2k has quit [Ping timeout: 264 seconds]
<mikeK_>
sepp2k1*
tautologico has joined #ocaml
<mikeK_>
sepp2k1: since all_pred_rec is the function being passed to fold_left, doesn't it take a list?
sepp2k has joined #ocaml
<sepp2k>
mikeK_: Yes, all_pred_rec does take a list the way you defined it, but it shouldn't.
sepp2k1 has quit [Quit: Leaving.]
<mikeK_>
sepp2k: This is part of a learning exercise, here's an example of the function in its usage. http://pastie.org/1157009
<mikeK_>
What should all_pred_rec take if not a list? Just evaluate argument n?
<sepp2k>
mikeK_: If you want to fold a list of ints and have a boolean result the function given to fold_left should have type bool -> int -> bool
<sepp2k>
Generally the function given to fold_left has type 'a -> 'b -> 'a where 'a is the result type and 'b is the element type of the list you're folding
<mikeK_>
ah, I see. That's very helpful.
<mikeK_>
how do I understand that type description? Does "bool -> int -> bool" mean the first variable is a boolean then an integer is evaluated and the return is a boolean?
mfp has quit [Ping timeout: 276 seconds]
<sepp2k>
Yes, you can think of it as "first argument is a bool, second is an int and the return value is a bool"
<sepp2k>
Though technically it means "the argument is a bool and the result is a function from int to bool.
<sepp2k>
(because let f x y = foo is syntactic sugar for let f = fun x -> fun y -> foo )
<mikeK_>
okay. I'm unsure about how to modify my function to fit that though. Since i need to pass in a function to evaluate the element and also a list to continue the operations for the rest of the list
<sepp2k>
continuing the operations for the rest of the list is what fold does for you
<sepp2k>
Otherwise you wouldn't need fold at all and could just use your function directly (which is exactly where you'd end up by making all_pred_rec actually recursive)
<sepp2k>
If you want/need to use fold, the function should take the result up to now (i.e. whether all the previous elements were even) and the current element and return the new result.
<sepp2k>
If you want to solve it using recursion, the function should take a list, look at its head, decide whether the property is fullfilled for that element and if so, call itself recursively on the remaining elements.
<sepp2k>
Note that any solution using fold will not short-circuit (i.e. it will go through the whole list even if the first element was already odd)
mfp has joined #ocaml
LionMadeOfLions has quit [Ping timeout: 245 seconds]