<Drup>
what results is supposed to be returned if "you don't care" ?
<Drup>
you need to return *something*
<zamN>
hm
<zamN>
the end result is to take every result form this function and append it to a list
<zamN>
so I guess [] ?
talzeus has joined #ocaml
<Drup>
probably
<Drup>
(I don't know enough to answer :p)
<zamN>
i'm using it in this manner: (max a b)::[] # returns bigger int, when equal return something
ollehar has joined #ocaml
BitPuffin has quit [Ping timeout: 245 seconds]
<zamN>
when its equal i want to return a type that will be prepended to this list
<zamN>
that is not an integer
<Drup>
you want an option type
<zamN>
where?
<wmeyer`>
zamN: I believe you have to imagine your else branch returning a default value
<wmeyer`>
or an option type: None
<wmeyer`>
but then you have to handle all the way down in your code
<zamN>
ugh
<wmeyer`>
sorry :) that's or other way you have to handle, so I see no reason for 'ugh' :-)
<wmeyer`>
not handling is a user error
<wmeyer`>
here in OCaml detected by the type checker
<zamN>
actually this is easy
<wmeyer`>
in Lisp you could use empty list, right? but you have to handle that too
<wmeyer`>
at some point
<zamN>
in ruby i can just ignore everything
<zamN>
:D
oriba has joined #ocaml
<Drup>
and get type error every where
<zamN>
rubY?
<zamN>
pfft
<zamN>
types make ruby laugh
<wmeyer`>
and then your program runs with error or runtime behavior that you don't expect
<zamN>
lol yeah. I am not necessarily a fan of dynamic languages either.
<wmeyer`>
glad to hear: +1
<zamN>
I prefer staticly typed languages the most.
<zamN>
infer-typed languages make me cry
<zamN>
;D
<wmeyer`>
from dynamic languages I like lisp only.
<zamN>
although they do make me think :) which is a good thing
csakatoku has quit [Remote host closed the connection]
<wmeyer`>
that's or other way, I learned typing is really useful
<Drup>
zamN: once, I tried to do some stuff in Python, I spend one hour trying to debug some searching function. At the end, I discovered that python was coercing string to int everywhere ... except in the equality function, and didn't warned me than it was different types
csakatoku has joined #ocaml
<Drup>
I closed my editor, I never did any python again since.
<zamN>
lol yeah I've had the same problem before Drup :p
csakatoku has quit [Read error: Connection reset by peer]
<zamN>
I know the danger
<wmeyer`>
Drup: that's the 'runtime behavior that you don't expect'
<Drup>
zamN: that's a type error for me =)
csakatoku has joined #ocaml
<wmeyer`>
Drup: yes, for me too. :D
csakatoku has quit [Remote host closed the connection]
<Drup>
that's sad, because I would like to contribute to some very interesting python projects
<Drup>
but the language is impossible for me.
<zamN>
arg i have the same problem again x_x
<wmeyer`>
python is actually pretty bad.
<Drup>
wmeyer`: I tried to use the statically verified part of it, but it's not possible in practice
<zamN>
Basically what that code does is it search through a list of tuples and checks to see if one of them matches a character. If there are none that exist then I want to return NOTHING
<zamN>
but instead of NOTHING i just return -1
<zamN>
but then i realized i'm screwed again x_x
<zamN>
so my issue is, i want *some type* that i can append to an int list that is not an int
<Drup>
no, that's ok
<Drup>
first, do the function : "opt_append : 'a option -> 'a list -> 'a list"
<zamN>
ok
<Drup>
well, not append, opt_cons is more correct
<Drup>
the option type is defined like this, if you don't know it : "type 'a option = Some of 'a | None"
<Drup>
you can pattern match it.
<zamN>
ah okay
<zamN>
was just going to ask heh
<Drup>
after that, just modify move_helper to return an option
<Drup>
and you are good to go.
<zamN>
how do i modify it though
<zamN>
i want to return an int
<Drup>
an int option*
<zamN>
so the question becomes, how do i make an int an option int o_O
<zamN>
so my move is nfa -> int list -> char option -> int list
<zamN>
which i dont know why o_O
<Drup>
if I remember correctly, the second part of your record is an option type
<Drup>
and you test the equality, line 12
<zamN>
ah.. it is
<Drup>
hence c is an option too :)
<zamN>
arg
<zamN>
so i need to find a way around this
<zamN>
although i'm not sure how
<Drup>
you can pattern match the option, and act accordingly :)
<zamN>
yeah
<zamN>
i was just gonna say that heh
<Drup>
zamN: I advise you to find a good idea (like merlin, for exemple). This will give you more type informations (like the type of an arbitrary expression in your code) which may help you quite a lot
<zamN>
basically i'm trying to loop over that list
<zamN>
but i have no idea how to write that recursively
<zamN>
after the if/else runs i want to just call eval_paths again on tail
<zamN>
but i don't know how to express that in ocaml
avsm has joined #ocaml
avsm has quit [Ping timeout: 246 seconds]
cesar_ has joined #ocaml
cesar_ is now known as Guest9325
breakds has quit [Remote host closed the connection]
divyansr has joined #ocaml
<divyansr>
Hi there it is my first time here. Community here seems way quieter than #haskell
<zamN>
nah, they just have more restricted hours.
ygrek has joined #ocaml
Guest9325 has quit [Remote host closed the connection]
ggole has joined #ocaml
zamN has quit []
derek_c has joined #ocaml
avsm has joined #ocaml
avsm has quit [Ping timeout: 265 seconds]
<whitequark>
jpdeplaix: set_initializer, I think
<whitequark>
if I understand correctly what bind does
yacks has quit [Ping timeout: 268 seconds]
cesar_ has joined #ocaml
cesar_ is now known as Guest42687
ousado_ has joined #ocaml
rixed has joined #ocaml
iZsh_ has joined #ocaml
<whitequark>
jpdeplaix: yes, declare_global and set_initializer
ohama has quit [Disconnected by services]
ohama_ has joined #ocaml
NoNNaN has quit [Ping timeout: 240 seconds]
ousado has quit [Read error: Connection reset by peer]
n0v has quit [Ping timeout: 272 seconds]
iZsh has quit [Ping timeout: 272 seconds]
rixed_ has quit [Ping timeout: 272 seconds]
n0v has joined #ocaml
ohama_ is now known as ohama
Guest42687 has quit [Remote host closed the connection]
Neros has quit [Ping timeout: 246 seconds]
<gour>
morning
ulfdoz has joined #ocaml
avsm has joined #ocaml
ulfdoz has quit [Ping timeout: 240 seconds]
<gour>
yesterday i got some very valuable input about nimrod vs rust vs ocaml. now i'm a bit curious what is the opinion of language experts here about D?
avsm has quit [Ping timeout: 265 seconds]
<adrien>
I'm quite the opposite of a language expert but as far as I'm concerned, it has nice features but it also feels too complicated to me
<adrien>
but I value very much ocaml's generally-clean core and fast compiles
crocket has left #ocaml []
<gour>
adrien: well, i'm definetely honour your opinion, no matter what do you think about yourself ;)
yezariaely has joined #ocaml
<divyansr>
ocaml is much more beginner friendly than haskell
<gour>
adrien: do you like it (D) more than rust?
<gour>
divyansr: heh, it seems so...or, at least, one possible explanation why i'm now here after playing with haskell some years ago :-)
Arsenik has joined #ocaml
<divyansr>
But I find abstraction are much more deeply rooted in haskell than ocaml. It makes just a clean code if you find perfect abstraction.
ttamttam has quit [Quit: ttamttam]
<gour>
well, in my case i need some gui bindings and considering that those are usually OOP, i find ocaml more pleasant to use or let's say more pragmatic
<jpdeplaix>
whitequark: mmmh nope, I don't think so. Bind is a function that inserts LLVM-IR code
<whitequark>
jpdeplaix: ok, with the bindings, you don't insert textual IR, you build IR from data structures
<whitequark>
what do you do with bind?
<jpdeplaix>
yes, it's textual IR :/
ttamttam has joined #ocaml
<whitequark>
jpdeplaix: oh, that's not a problem
<whitequark>
I've just wrote a binding for IRReader, so you can write a module, load it from IR to bitcode, and then link with the current module
<whitequark>
you'd just need to define an external global in the current module.
<jpdeplaix>
ok, fair enough
<jpdeplaix>
and what about to_string ?
<whitequark>
will be in 3.4 for types, values and modules
<adrien>
gour: I don't know which one of Rust or D I prefer; I haven't used them enough but I tend to find both too complicated for my tastes; Rust is probably worse than D here: I find that reading a snippet of Rust code is painful
<jpdeplaix>
oh ! I didn't see string_of_llmodule :)
ttamttam has quit [Client Quit]
<gour>
adrien: he he...right. signal/noise ratio is not so great in rust
<jpdeplaix>
great ! Thanks whitequark
<jpdeplaix>
I will not have the time to switch to 3.4 before January I think :(
<adrien>
gour: I'm waiting a bit for Rust though: it's still young and once they have a better overview of how things are used, they can probably reduce the symbol clutter a lot
mcclurmc has quit [Remote host closed the connection]
<adrien>
it's almost like GTK+ and EFL/Elementary: boxes in GTK+ have sane defaults but the ones in Elementary haven't
<adrien>
10 years between the two
<whitequark>
jpdeplaix: 3.4 isn't released much before that :)
<gour>
adrien: 10 years to get straigt defaults for boxes? :-) if ocamlpro takes wxocaml seriously or something comes out of lablqt, i'll be pleased
mcclurmc has joined #ocaml
<gour>
*straight
<jpdeplaix>
well the dev version
<adrien>
gour: I meant, you don't need to tweak their settings much: you usually have to change one or two of them
<adrien>
in elm, you need to check each of them
<gour>
adrien: yeah, i got it
<adrien>
but gnome people have had 10 more years to find the sweet spot
<gour>
:-)
mcclurmc has quit [Ping timeout: 240 seconds]
djcoin_ has joined #ocaml
djcoin_ is now known as djcoin
NoNNaN has joined #ocaml
Kakadu has joined #ocaml
cago has joined #ocaml
avsm has joined #ocaml
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
avsm has quit [Ping timeout: 260 seconds]
<gasche>
to me Elm suggests this function-reactive language that compiles to Javascript
<gasche>
(as this is mainly dedicated to user interaction, I had enough room for confusion while reading the backlog)
<gasche>
*functional-reactive
<adrien>
yeah, that's why I first wrote it in full
<adrien>
then I got lazy :P
<companion_cube>
yo
<adrien>
o/
<companion_cube>
\o
platypine has joined #ocaml
platypine has quit [Ping timeout: 264 seconds]
csakatoku has quit [Remote host closed the connection]
csakatoku has joined #ocaml
csakatoku has quit [Ping timeout: 265 seconds]
derek_c has quit [Quit: Lost terminal]
Kakadu has quit [Ping timeout: 250 seconds]
lynch has joined #ocaml
<lynch>
hello
<lynch>
I'm new in ocaml and I discover a compatibility problem with the version 4.01 and genfft version 3.3.3
<lynch>
When I compile genfft (fftw v.3.3.3) with ocaml v 4.01 I have a : util.cmi is not a compiled interface
<lynch>
But with the version 4.00 the compilation is ok.
csakatoku has joined #ocaml
_5kg has quit [Read error: Connection reset by peer]
Kakadu has joined #ocaml
Picolino has joined #ocaml
csakatok_ has joined #ocaml
csakatoku has quit [Ping timeout: 246 seconds]
avsm has joined #ocaml
Simn has joined #ocaml
avsm has quit [Ping timeout: 246 seconds]
cdidd has quit [Ping timeout: 260 seconds]
def-lkb_ is now known as def-lkb
kerneis has quit [Ping timeout: 260 seconds]
skchrko has quit [Quit: Leaving]
kerneis has joined #ocaml
<gasche>
lynch: it looks like you're mixing compilation product of different versions of OCaml
<gasche>
you should "make clean" or whatever to remove all compiled objects (.cmo, .cmo, .cma, .o...) before trying to compile with a different version
ttamttam has joined #ocaml
Kakadu has quit [Ping timeout: 250 seconds]
<mrvn>
lynch: unfortunately you have to recompile everything for each ocaml version. There is no compatibility between compiler versions.
Kakadu has joined #ocaml
Kakadu has left #ocaml []
Kakadu has joined #ocaml
adrien_o1w is now known as adrien_oww
mort___ has joined #ocaml
<lynch>
gasche: I have already clean everything
<gasche>
lynch: does fftw provide .cmi files in its distribution?
<gasche>
(could you give the adress of the tarball to try building it myself?)
<lynch>
no. everything is compile from .ml and .mli
<gasche>
then I'm rather confident your error is due to not cleaning enough
<gasche>
(maybe their "make clean" target is faulty)
wolfnn has joined #ocaml
<lynch>
I've check my folder. Only .ml and .mli are kept after a make clean
<adrien_oww>
"util.ml*" is from their sources or from somewhere else?
<lynch>
is a source file
<adrien_oww>
also, iirc, when you build fftw, you don't use the ocaml compiler
<adrien_oww>
the devel team of fftw does
<adrien_oww>
other people building on their machine don't
_andre has joined #ocaml
csakatok_ has quit [Remote host closed the connection]
<adrien_oww>
so there might be something else wrong or maybe you're fetching their sources through version control and not tarballs
<lynch>
the standard version of fftw does not use ocaml. But the software genfft inside fftw use ocaml.
csakatoku has joined #ocaml
<lynch>
And for my work I have to use genfft
<adrien_oww>
yup
<adrien_oww>
can you pastebin the build log?
<lynch>
because I have to optimized fft for specific size
<gasche>
(and give a link to the source tarball for fftw)
<nicoo>
Did you re-run the configure script afet switching compiler ?
<nicoo>
after*
<gasche>
it compile just fine on my machine as well, with ./configure --enable-maintainer-mode
<lynch>
yes, I re-run configure script
<adrien_oww>
git/svn clean (or something similar, after you are sure you won't lose your modifications)
cdidd has joined #ocaml
<lynch>
nicoo: I didn't switch the compiler. I did a first installation with apt-get
avsm has joined #ocaml
_5kg has joined #ocaml
<nicoo>
lynch: But how did you compile against 4.00 then ?
<lynch>
I compiled it in another computer
jonludlam has joined #ocaml
<def-lkb>
did you had different versions of ocaml on this computer? maybe you are using opam? what does your PATH looks like?
<nicoo>
def-lkb: According to what he said, he doesn't
avsm has quit [Read error: Operation timed out]
<lynch>
standard path with /usr/local/bin ...
<nicoo>
lynch: Give us the ouput of “echo $PATH; ocamlopt -where; which ocamlopt; which ocamlbuild” please
mcclurmc has joined #ocaml
<nicoo>
(use a pastebin)
ygrek has quit [Ping timeout: 260 seconds]
<kerneis>
gasche: there is an OCaml Compiler Hacking session tonight in Cambridge, I plan to revisit my patches for ocamlbuild (well, start thinking about them again at least)
<kerneis>
if you have had any insight since last time, don't hesitate (either here, or by emal/on the bug tracker)
ousado_ is now known as ousado
<kerneis>
I think a useful first step would be the possibility to recover the (transitive closure of the) dependencies built for a given rule
ousado has quit [Changing host]
ousado has joined #ocaml
<kerneis>
then, most of our issues would be greatly simplified
mort___ has quit [Ping timeout: 245 seconds]
<kerneis>
probably a bit tricky to do in a backward-compatible way, but adding a new function just for this might make sense
<kerneis>
I'll look at the code tonight
mcclurmc has quit [Ping timeout: 272 seconds]
ollehar1 has quit [Ping timeout: 272 seconds]
<lynch>
nico: 1: i've installed ocaml with apt-get and the version was 4.01. I had problem with it. 2 I've install from source the version 4.00 and the build works. 3:Now I tried to clean everything and reinstall ocaml from apt-get but the version of the repo is now 3.12.1 I don't know why the version of the ubuntu repo has changed
<lynch>
So I can't now send you the build log
<gasche>
I'm surprised that you got 4.01 from the ubuntu repository, it's a quite recent version
<gasche>
kerneis: I don't see how you plan to use that for the .cmo->.mllib issue
<gasche>
(I didn't look at that again; in September I furiously hacked towards better parallelization on OCamlbuild, but I had too much things to do since so it's sitting on my laptopt unfinished)
<gasche>
(I'm not saying it's bad idea, just that I'm tired and busy so you should explain in a bit more detail)
dsheets_ has joined #ocaml
<whitequark>
gasche: there's avsm's repository with recent ocaml and even nightly builds
ontologiae has quit [Ping timeout: 265 seconds]
<gasche>
yeah, but surely lynch would notice if he/she had installed a custom ppa repository?
<kerneis>
hmm, I was thinking about automatic generation of files to install from mllib
<kerneis>
(the other bug I have been working on)
<kerneis>
and I remember thinking several times during hacking ocamlbuild "if only I could get the list of dependencies"
cdidd has quit [Read error: Operation timed out]
<kerneis>
now I'm not sure it would help for cmo->mllib either
<gasche>
ah
<lynch>
The first time, I've installed ocaml from standard repository and the version was 4.01
<kerneis>
i'll think aout it
<gasche>
ok, I just misunderstood which problem you were talking about
<kerneis>
no worries, it was ambiguous
<gasche>
I admit I never thought a lot about Daniel's request, I'm not sure what he wants and would be need
<gasche>
*needed
<lynch>
gasche and nicoo: I've installed ocaml 4.01 from the svn and the compilation works fine. So I suppose the problem was with the version of the ubuntu repo
<gasche>
(I think it's a very good feature to have but I'm happy to let people that understand the need look at it)
<gasche>
lynch: I think you cannot get 4.01 from the official ubuntu repository
<kerneis>
(well I already do it in a hackish way in CIL, so I feel qualified :-)
<gasche>
so you probably did something wrong there
<gasche>
but it's nice to hear your problem is solved anyway; have fun with FFTW
<gasche>
and consider using OPAM to install new versions of OCaml or its libraries next time
<lynch>
I made only a "apt-get install ocaml-nox"
<gasche>
kerneis: I think there is a list of "dynamic dependencies" stored somewhere in the cache
<gasche>
but of course you cannot tell what they are *before* building the target, you only discover them while building
<kerneis>
thanks
<kerneis>
yes, that makes sense
<lynch>
thanks for the help.
lynch has quit [Quit: Ex-Chat]
<gasche>
kerneis: you should probably have a look at ocaml_dependencies.ml
<gasche>
and the way it is used in ocaml_compiler.ml (eg. in link_gen)
<gasche>
I haven't had any reason to read that part of the code yet (for parallelization I worked on the "run" function of rule.ml that does some lower-level stuff), so I cannot tell much more about it
<gasche>
if you come with enlightening comments while reading the source, I'll be glad to commit them
<kerneis>
build the cmo, get all its dependencies, build an mllib from that
<kerneis>
I am *not sure*
<kerneis>
but that might have been my line of thought 2 months ago
<kerneis>
anyway, time for a shower
<gasche>
yes that would help
<gasche>
in essence, ocamlbuild is already doing all that work when you ask for a .cma whithout a .mllib
<gasche>
so you could steal that code and adapt it to produce the .mllib in the middle
<kerneis>
indeed
<kerneis>
but making it generic would help solve my other bug
<kerneis>
probably
<gasche>
I think ocaml_dependencies.ml is already the stuff that does it generically
<gasche>
but that doesn't tell you how to use it (while hacking on the build code that use it may give you some clues)
<gasche>
(follow which code is running in ocaml_compiler.ml when the .cmo->.cma rule is fired; it's certainly either link_gen or link_unit that you will discover after following a handful of painful partial applications)
cago has quit [Read error: Connection reset by peer]
cago1 has joined #ocaml
cdidd has joined #ocaml
csakatoku has joined #ocaml
ttamttam has quit [Quit: ttamttam]
<kerneis>
( :-) )
rand000 has joined #ocaml
gnuvince has quit [Ping timeout: 272 seconds]
avsm has joined #ocaml
rand000_ has joined #ocaml
ttamttam has joined #ocaml
skchrko has joined #ocaml
avsm has quit [Ping timeout: 264 seconds]
talzeus has quit [Remote host closed the connection]
rwmjones has quit [Ping timeout: 246 seconds]
sepp2k has joined #ocaml
BitPuffin has joined #ocaml
rwmjones has joined #ocaml
divyansr has quit [Quit: Page closed]
csakatoku has quit [Remote host closed the connection]
avsm has joined #ocaml
avsm has quit [Read error: No route to host]
avsm1 has joined #ocaml
ontologiae has joined #ocaml
Neros has joined #ocaml
ygrek has joined #ocaml
avsm1 has quit [Ping timeout: 264 seconds]
mcclurmc has joined #ocaml
wolfnn has quit [Ping timeout: 246 seconds]
mcclurmc has quit [Ping timeout: 265 seconds]
Kakadu has quit [Ping timeout: 250 seconds]
Kakadu has joined #ocaml
ygrek has quit [Ping timeout: 264 seconds]
bentnib_ is now known as bentnib
zygentoma has joined #ocaml
<zygentoma>
'hoi
<companion_cube>
o/
yacks has joined #ocaml
breakds has joined #ocaml
Neros has quit [Ping timeout: 264 seconds]
yacks has quit [Max SendQ exceeded]
yacks has joined #ocaml
darkf has quit [Quit: Leaving]
yacks has quit [Quit: Leaving]
rwmjones has quit [Ping timeout: 246 seconds]
talzeus_ has joined #ocaml
platypine has joined #ocaml
platypine has quit [Changing host]
platypine has joined #ocaml
ccasin has quit [Ping timeout: 245 seconds]
letoh_ is now known as letoh
platypine has quit [Ping timeout: 265 seconds]
Neros has joined #ocaml
ccasin has joined #ocaml
platypine has joined #ocaml
rwmjones has joined #ocaml
ontologiae has quit [Ping timeout: 246 seconds]
Drup has joined #ocaml
platypine has quit [Ping timeout: 260 seconds]
<yezariaely>
regarding the discussion about preview.ocaml.org: anyone else can't middle mouse button-click on links to open them in new windows in firefox?
<yezariaely>
new tabs, sorry
<dsheets_>
yezariaely, wfm w ff23
<yezariaely>
dsheets_: took me a a while to understand your abbrevs, but ok ;-)
<flux>
works for me as well.
<yezariaely>
hmm, okay then its local. thx.
skchrko_ has joined #ocaml
skchrko_ has quit [Client Quit]
mcclurmc has joined #ocaml
mcclurmc has quit [Ping timeout: 260 seconds]
breakds has quit [Remote host closed the connection]
Drup has quit [Quit: Leaving.]
Drup has joined #ocaml
djcoin has quit [Quit: WeeChat 0.4.1]
Drup has quit [Ping timeout: 240 seconds]
Drup has joined #ocaml
mcclurmc has joined #ocaml
yacks has joined #ocaml
zpe has joined #ocaml
Drup1 has joined #ocaml
Drup has quit [Ping timeout: 272 seconds]
Drup has joined #ocaml
avsm has joined #ocaml
Drup1 has quit [Ping timeout: 264 seconds]
Drup has quit [Ping timeout: 246 seconds]
Drup has joined #ocaml
shinnya has joined #ocaml
ontologiae has joined #ocaml
cago1 has quit [Quit: Leaving.]
<Kakadu>
Also, preview.ocaml.org has some broken links. Are they should be reported as a bugs, what do you think?
rand000_ has left #ocaml []
mort___ has joined #ocaml
Neros has quit [Ping timeout: 245 seconds]
Neros has joined #ocaml
ygrek has joined #ocaml
ygrek has quit [Remote host closed the connection]
ygrek has joined #ocaml
Kakadu_ has joined #ocaml
osa1 has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest50959
<yezariaely>
Kakadu: I am not really sure. There are many templates so it is a bit hard to distinguish expected from unexpected templates.
Kakadu has quit [Ping timeout: 250 seconds]
troydm has quit [Ping timeout: 264 seconds]
avsm has quit [Quit: Leaving.]
avsm1 has joined #ocaml
eikke has joined #ocaml
csakatoku has joined #ocaml
Drup has quit [Read error: Connection reset by peer]
Drup1 has joined #ocaml
troydm has joined #ocaml
Drup1 is now known as Drup
Guest50959 has quit [Remote host closed the connection]
csakatok_ has joined #ocaml
hcarty has quit [Remote host closed the connection]
csakatoku has quit [Remote host closed the connection]
csakatok_ has quit [Ping timeout: 272 seconds]
cesar_ has joined #ocaml
cesar_ is now known as Guest6362
gour has quit [Disconnected by services]
gour_ has joined #ocaml
Drup has quit [Quit: Leaving.]
avsm1 has quit [Quit: Leaving.]
Drup1 has joined #ocaml
Guest6362 has quit [Remote host closed the connection]
skchrko has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 246 seconds]
shinnya has quit [Ping timeout: 246 seconds]
avsm has joined #ocaml
Drup1 is now known as Drup
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
strobegen has quit [Quit: Leaving.]
<whitequark>
hmmmm, I've been thinking about error handlers
mcclurmc has quit [Remote host closed the connection]
<whitequark>
it seems that I *can* map LLVM fatal errors to OCaml exceptions!
<jpdeplaix>
\o/
<adrien_oww>
and catch them and handle them? :o
<whitequark>
however I'm really not sure if this will leave LLVM data structures in any usable state.
<whitequark>
adrien_oww: in theory.
<whitequark>
I can just longjmp out of the fatal error handler.
<whitequark>
i.e. what ocaml does when I raise an exception.
<whitequark>
the problem is exception-safety, for which LLVM was never designed, because duh! no exceptions
<whitequark>
well, let me just check if this works.
rndm has quit [Ping timeout: 264 seconds]
yezariaely has quit [Quit: Leaving.]
rndm has joined #ocaml
gour_ is now known as gour
<whitequark>
I wonder what's worse: just an assertion and flat-out abort(), or an exception which may *sometimes* result in broken stuff on heap which *may* explode later.
mcclurmc has joined #ocaml
* whitequark
sighs
<ggole>
abort() is ok imo: at least its usually clear what should be fixed
<whitequark>
well, there's been a lot of opinions against abort() and I can understand them
<whitequark>
this is especially frustrating in toplevel.
<whitequark>
(which llvm did not work in until my latest patches anyway)
<ggole>
I think most of the objections are to abort() in library code
<ggole>
Since you leave little chance for the consumer of your library to do, well, anything
<whitequark>
yep.
<whitequark>
I think an exception may be useful even if you know you can't touch the library afterwards.
<whitequark>
Say, write a crashreport and bail out.
<ggole>
Can you tear down the state safely?
<whitequark>
no clue.
<ggole>
Sounds fun.
<whitequark>
I *think* I can.
mcclurmc has quit [Ping timeout: 245 seconds]
<whitequark>
to be sure, this would require extensive code investigation, hours with valgrind and probably some patches.
<ggole>
So... what's the alternative? Die, but a bit more informatively?
<whitequark>
maybe I'll become bored enough at some moment to make a complete callgraph of all LLVM functions reachable from the external API and look at allthe asserts in them, but not yet.
<whitequark>
(alternative) yep.
<ggole>
Mmm
<whitequark>
OCaml heap should not be corrupted at that point.
zamN has joined #ocaml
<ggole>
abort makes it easy to poke around in a debugger (if the crash can be reprod)
<ggole>
If you pull down the stack then you just get whatever messages/logging are there
<adrien_oww>
can be an option and you can use a function pointer to chose what to do :P
<ggole>
Yeah
<whitequark>
ggole: yes, I'm thinking about enabling this optionally.
<zamN>
Hey can anyone help me figure out how to loop this code ?_?. I want to use a loop so badly but I need to do it recursively and I just can't think of how.. http://paste.debian.net/hidden/dc9b0958/
<zamN>
basically on line 6 i want to keep checking the tail
<zamN>
in normal code i would just have a while loop around that code block and it would work
<zamN>
but i can't do that here x|
Neros has quit [Ping timeout: 245 seconds]
<ggole>
If there's no List function that does what you want, then just write a (recursive) inner function that does what you want
<ggole>
That's the equivalent functional construct to a while (or other sort of loop)
<zamN>
like an anonymous function?
<ggole>
No, just let rec loop arg1 arg2 = ... in loop init_arg1 init_arg2
<zamN>
oh.. so i can declare a named function inside of a function?
<ggole>
Sure.
<ggole>
Good old lexical scope.
Arsenik has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
<zamN>
there is an explicit return keyword in ocaml right?
<whitequark>
no
<ggole>
No, everything is an expression instead
<whitequark>
there's also no break or continue
<whitequark>
though you can use exceptions instead (same for return)
<ggole>
Occasionally that is annoying: usually if you program in a good functional style it doesn't come up
ontologiae has quit [Ping timeout: 240 seconds]
<whitequark>
DHH would be happy :3
<ggole>
I think I missed that reference
<ggole>
Oh, is that to do with return in ruby?
<whitequark>
David Heinemeier Hanson, the author of Rails
<zamN>
I dont know what i have to write here though
mort___ has quit [Quit: Leaving.]
<ggole>
Right
<zamN>
in my loop i want to check to see if they meet certain requirements, then call the outter function again. After those if statements evaluate i want to keep looping
<zamN>
although i don't think that compiles
<ggole>
I'm not quite following that.
<Drup>
zamN: do you really need to have a loop inside your recursive ec_helper function ?
<zamN>
Drup: I just want to go through all the results i get back in state_trans
<zamN>
right now i only evaluate the first one
<Drup>
ok, so yes
<Drup>
zamN: as an exercice before going on, did you try to write map or fold by yourself ?
<zamN>
i didn't write fold myself, i got it from powerpoint slides
<zamN>
or it is and i'm just not collecting the reults
<zamN>
results *
Neros has joined #ocaml
<zamN>
so on every call, i want to collect the s2 and put it into ec_states
<ggole>
You might be running into the [] case of the inner function, which terminates the entire search
<ggole>
If you don't want to do that, you should call the outer function again (with suitable args)
<zamN>
oh
<zamN>
well my thinking is this: i want to loop and check to see if they meet the criteria, if they do then call this function again with these arguments. Otherwise once we hit the end of the list return our results.
<zamN>
isn't that the equivalent?
<whitequark>
hm, does ocaml use libc longjmp for raising exceptions or just mov %esp ?
<whitequark>
siglongjmp.
<ggole>
zamN: maybe, just think through what you want the code to do
<ggole>
ocaml doesn't use longjmp for exceptions
<whitequark>
ggole: it does.
<whitequark>
I just looked at disassembly.
<adrien_oww>
hmmm
<adrien_oww>
I don't know how it does exceptions but I know it does it differently from others
Kakadu_ has quit []
<ggole>
I getmovlcaml_exception_pointer, %esp
<whitequark>
oh, so it does on x86_64 but not x86_32
<whitequark>
sigh
cesar_ has joined #ocaml
<whitequark>
you see, the behavior of longjmp is very much not the same as movl foo, %esp
<ggole>
I'm surprised that it uses longjmp on any platform
<whitequark>
longjmp unwinds the stack.
cesar_ is now known as Guest63237
<whitequark>
so, if there were any non-OCaml stack frames with cleanup clauses in between, those cleanup clauses will be invoked.
<ggole>
Right
<whitequark>
in particular, this will call destructors of C++ objects on stack
madroach has joined #ocaml
<whitequark>
btw: LLVM doesn't override assert with its fatal error handler, so assertions will still abort.
<ggole>
I think this is closer to what you want, looking at that (Ruby?) code
jonludlam has quit [Remote host closed the connection]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 246 seconds]
mcclurmc has quit [Remote host closed the connection]
<zamN>
ggole: that still seems to be returning back only one of the results
mcclurmc has joined #ocaml
<ggole>
Hmm
<ggole>
I must have misunderstood what the code should do
<zamN>
well, it could be my wrapper function is doing things incorrectly
<zamN>
basically there are things called transitions. I have a list of them. When the transition letter is 'None' i want to add the end state of the transition (s2) to the list. I want to do this for all possible transitions with the letter as 'None"
<ggole>
Oh, I think I see: the inner function doesn't process the rest of the elements as soon as there is a match
<zamN>
no
<zamN>
its supopsed to be incremental
<zamN>
like it can branch out into seperate transitions
<zamN>
er, seperate calls
<zamN>
and each call could break out into seperate calls themselves
<ggole>
So I think it should be "then ec_helper m s2 (loop (s2::acc) rest)"
<ggole>
But it's a bit hard to say :/
<zamN>
ggole that fixed it!
<orbitz>
Anyone familiar with the Core.Std.Map? I'm curious why comparator is a type variable for Map.t. Shouldn't the type always be the same? namely 'k -> 'k -> int ?
<ggole>
\o/
<zamN>
now I have to do this loop thing again
<zamN>
heh
dsheets_ has quit [Read error: Operation timed out]
<zamN>
i wanted eval_paths to just run through the tail every time
<zamN>
but now that you showed me the other way I might be able to do it on my own.
Kakadu has joined #ocaml
NoNNaN has quit [Ping timeout: 240 seconds]
NoNNaN has joined #ocaml
ollehar has joined #ocaml
<smondet>
orbitz: you should read core_map.mli in core_kernel, I think the idea is to use that type parameter to "fix" the comparison function (once you start using one, you cannot change)
<orbitz>
ahh
<orbitz>
hrm
<orbitz>
i see so if you have two maps yo ucan be sure they have the same type even dwon to comparison function
<smondet>
yes the functor you use to create the comparison function creates a unique phamtom type
<zamN>
is it more efficient to concat or cons?
<smondet>
once you start using it, you have to provide always the same one
<orbitz>
zamN: const is O(1) on lists
<zamN>
awesome
dsheets_ has joined #ocaml
<orbitz>
smondet: thanks
skchrko has joined #ocaml
lopex has quit [Remote host closed the connection]
dch has quit [Remote host closed the connection]
jonludlam has joined #ocaml
bobry has quit [Remote host closed the connection]
davekong has quit [Remote host closed the connection]
jyeo has quit [Remote host closed the connection]
IbnFirnas_ has quit [Remote host closed the connection]
strmpnk has quit [Remote host closed the connection]
ggherdov has quit [Remote host closed the connection]
<orbitz>
Hrm, is tehre a prettier way to write something that compares a tuple of things without the if? i.e. (x1, y1) (x2, y2), let c = M.compare x1 x2 in if c = 0 then M2.compare y1 y2 else c ?
<bernardofpc>
(1,2) = (3,4) works
<ggole>
Pervasives.compare, possibly
<bernardofpc>
not sure if you need "more equality" than that
<ggole>
It "walks" data structures automatically
<bernardofpc>
hum, right, not equality, but order
anderse has joined #ocaml
<mrvn>
< and > work too
<orbitz>
i want to avoid polymorphic compare
<mrvn>
as long as you only want natural order that just works.
<mrvn>
I'm not sure if a handmade one would be faster
<orbitz>
according to jane st polymorphic compare can be quite slow
<orbitz>
Also, polymorphic compare may not know what itmeans for my two things to be equal
<orbitz>
such as a set
<mrvn>
The bigger the structre the more overhead you will have with manualy compare.
<mrvn>
true. Your biggest problem will be comparing tuples. You will have to create compare modules for 2,3,4,5,... tuples.
<mrvn>
or use Obj.* to compare them field by field.
<mrvn>
ugly.
<ggole>
That's what compare does
<mrvn>
sure. but you could have custom compare function for each field, passed as an array for example.
strmpnk has joined #ocaml
dch has joined #ocaml
<orbitz>
i'm looking more for if there is a cute way to compare two N-length values in a single expresion rather than 'if' on every one
mcclurmc has quit [Remote host closed the connection]
Drup has quit [Quit: Leaving.]
Drup1 has joined #ocaml
Drup1 is now known as Drup
<ggole>
It'd be nice if the compiler specialised compare for things like tuples (where applicable)
<mrvn>
doesn't it?
<mrvn>
it does for some types
<ggole>
int, float, bool, char, I think.
<mrvn>
unit?
<mrvn>
float array?
<ggole>
No and no according to my simple little test
<mrvn>
comparing units probably doesn't happen often but still. I would have thought all trivial types would get handled the same.
<ggole>
They could probably share the specialisation with int/bool/char, yeah
<mrvn>
compare_not_pointer()
<zamN>
I'm trying to now figure out how to do this accept method. Basically I only want to return true if the base case is true. The problem is that its not looping over the states again -_- http://paste.debian.net/hidden/54a260a7/
<tizoc>
bitbckt: thats what I thought at first, but each time I call Thread.create a new OS thread is created
<adrien>
it depends on the mode you're in
<bitbckt>
did you compile with -thread?
<adrien>
actually
<tizoc>
ahh ok
<adrien>
" Lightweight threads for Posix 1003.1c and Win32." <- that's a weird way to call things
<tizoc>
bitbckt: I'm in the ocaml repl, and I did #thread to enable threads
<tizoc>
otherwise the Thread module was not available
<adrien>
it's a good way to get threads
<adrien>
you have to do it before loading other packages though
<adrien>
(for libraries that might behave differently if threads are available that is)
dsheets_ has quit [Ping timeout: 260 seconds]
ggole has quit []
<tizoc>
adrien: bitbckt: ok, just found about -vmthread, thanks
<adrien>
tizoc: but were you after something specific?
<adrien>
why not system threads?
dsheets_ has joined #ocaml
<tizoc>
adrien: not really, I was just reading the `Thread` module docs, and the "lightweight" part surprised me because I always thought ocaml's threads were OS threads
<tizoc>
I didn't know until now that both options were available
lamawithonel__ has joined #ocaml
Anarchos has joined #ocaml
bitemyap1 has joined #ocaml
<kerneis>
I don't understand
<kerneis>
mllib -> cmo does compute the transitive closure
ontologiae has joined #ocaml
<kerneis>
it just ignores dynamic dependencies
<kerneis>
and I'm not quite sure what the difference is
<kerneis>
oh no, there is a List.filter ( ... List.mem full_contents)
<kerneis>
this code is horrible
<adrien>
tizoc: ok; if you want something more advanced with lightweight threads, you have lwt and async too
<tizoc>
adrien: yes, async is what I have been using
Ptival_ has joined #ocaml
aggelos_ has joined #ocaml
lamawithonel_ has quit [Remote host closed the connection]
bitemyapp has quit [Ping timeout: 240 seconds]
dkg has quit [Ping timeout: 240 seconds]
dkg has joined #ocaml
Ptival has quit [Ping timeout: 240 seconds]
aggelos has quit [Ping timeout: 240 seconds]
cantstanya has quit [Ping timeout: 240 seconds]
klltkr has joined #ocaml
strmpnk has joined #ocaml
bitemyap1 is now known as bitemyapp
ollehar has joined #ocaml
tane has joined #ocaml
ollehar has quit [Ping timeout: 265 seconds]
mcclurmc has joined #ocaml
rwmjones has quit [Ping timeout: 240 seconds]
cesar_ has joined #ocaml
cesar_ is now known as Guest2097
Ptival_ is now known as Ptival
Arsenik has quit [Remote host closed the connection]
Guest2097 has quit [Ping timeout: 265 seconds]
Kakadu has quit []
nikki93 has joined #ocaml
rwmjones has joined #ocaml
w0rm_x has left #ocaml []
nikki93 has quit [Remote host closed the connection]
mcclurmc has quit [Remote host closed the connection]
Tinybird has joined #ocaml
Tinybird has left #ocaml []
nikki93 has joined #ocaml
djcoin has quit [Quit: WeeChat 0.4.1]
Tinybird has joined #ocaml
<Tinybird>
Hi, all~
<Tinybird>
I am a newbie learning ocaml
Tinybird has left #ocaml []
nikki93 has quit [Remote host closed the connection]
<rand000>
Hello, someone here with experience of camlp4o stream-parsing?
<rand000>
I have a solution that works with a kind of imperative approach in one of my parsing functions, but I wanted to rewrite it with a more functional style
<rand000>
It seems to get lost in a recursive loop..
<rand000>
I found the solution if anyone is interested; the [ _ ] pattern in [noise_pars] has to get a "'" in front of it to understand it as a seperate char, and not a "char Stream.t"
platypine has joined #ocaml
lopho has quit [Ping timeout: 245 seconds]
bjorkintosh has joined #ocaml
jonludlam has joined #ocaml
dsheets_ has joined #ocaml
cantstanya has joined #ocaml
mcclurmc has joined #ocaml
lopho has joined #ocaml
jonludlam has quit [Read error: Operation timed out]
mort___ has joined #ocaml
dsheets_ has quit [Ping timeout: 244 seconds]
rwmjones has quit [Ping timeout: 244 seconds]
willy_ has joined #ocaml
darkf has joined #ocaml
dsheets_ has joined #ocaml
Picolino has quit [Ping timeout: 272 seconds]
Anarchos has quit [Ping timeout: 268 seconds]
zpe has quit [Remote host closed the connection]
Neros has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
zpe has quit [Ping timeout: 248 seconds]
cesar_ has joined #ocaml
cesar_ is now known as Guest5156
rwmjones has joined #ocaml
rwmjones has quit [Read error: Connection reset by peer]
Guest5156 has quit [Ping timeout: 248 seconds]
tane has quit [Quit: Verlassend]
eikke has joined #ocaml
anderse has quit [Quit: anderse]
willy_ has quit [Remote host closed the connection]
rwmjones has joined #ocaml
ulfdoz has joined #ocaml
<zamN>
hey, how do i change fields in a record? -_- i forgot
<Drup>
if it's mutable, "bla.bli <- blu"
<Drup>
if you want to recreate a new record with a different value : "{bla with bli = blue}"
<Drup>
-e
Anarchos has joined #ocaml
mcclurmc has quit [Remote host closed the connection]