<tobiasBora>
jpdeplaix: Ok... I think it's strange to put cmi in one folder and source in another but why not...
<tobiasBora>
jpdeplaix: Do you know if you could answer to my above question ? (converning ocamlbuild) since you seems to be quite involved in this project ?
<jpdeplaix>
well for an executable there is no point
robink_ is now known as robink
<tobiasBora>
Hum yes, but for a library ?
<jpdeplaix>
but for libraries .mlpack's just put every modules you've specified into a module (making them sub-modules)
<jpdeplaix>
it avoids name conflicts basically
<tobiasBora>
jpdeplaix: Isn't it the same thing as putting them in a subfolder ?
<jpdeplaix>
not at all. If you have foo/a.ml and ./b.ml then with the right includes you can access A from B
thomasga has quit [Quit: Leaving.]
<jpdeplaix>
but with mlpack, You can only access A through the module name you specified when you were making the mlpack
<jpdeplaix>
So Mypack.A for example
<tobiasBora>
And with the folder example it would be B.Foo.A ? O_o
<jpdeplaix>
what ?
mort___ has joined #ocaml
<jpdeplaix>
No, I just said to you: it would be just A
<tobiasBora>
jpdeplaix: So the only difference between "./a.ml; ./b.ml" and "./foo/a.ml; ./b.ml" is that the code has a better organisation ?
<jpdeplaix>
well, if you don't put the includes (the "-Is foo" from your command line) there the sub-directories would be unaccessible
<jpdeplaix>
but if you put it then yes, organization
<tobiasBora>
Ok great thank you !
<jpdeplaix>
note also that some build-systems like OASIS requires (but not enforce) to put every sub-package into a sub-directory or an other directory
keen___________0 has joined #ocaml
keen____________ has quit [Ping timeout: 258 seconds]
nullcat_ has quit [Quit: gone...]
swgillespie has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
leafac has joined #ocaml
mort___ has quit [Quit: Leaving.]
jabesed has quit [Quit: Konversation terminated!]
tnguyen has joined #ocaml
shinnya has quit [Ping timeout: 245 seconds]
tnguyen has quit [Client Quit]
<tobiasBora>
I would like to build a kind of build-system for a modelize website. For the moment I compile everything by putting the arguments with the command line instead of using files like _tags...
<tobiasBora>
(I do that because it's easy for the user to configure, and me I don't need to badly autogenerate _tags files that would pollute the current dir)
<tobiasBora>
Is is a good idea or is it really a better idea to use _tags files ?
xificurC has quit [Remote host closed the connection]
xificurC has joined #ocaml
struk|desk2 has joined #ocaml
milosn has quit [Ping timeout: 256 seconds]
struk|desk has quit [Ping timeout: 256 seconds]
CissWit has quit [Ping timeout: 256 seconds]
ygrek has quit [Ping timeout: 265 seconds]
CissWit has joined #ocaml
rgrinberg has quit [Ping timeout: 250 seconds]
nicoo_ has joined #ocaml
nicoo_ has quit [Client Quit]
nicoo_ has joined #ocaml
nicoo_ is now known as nicoo
The_Mad_Pirate has joined #ocaml
<jpdeplaix>
tobiasBora: well, users usually passes through _tags because it's easier to read and you don't have to give/remember the arguments to pass
c74d has quit [Remote host closed the connection]
c74d has joined #ocaml
<tobiasBora>
jpdeplaix: Ok thank you ! And a last question for tonight : is it possible to avoid the writing of a file .mlpack ?
leafac has quit [Read error: Connection reset by peer]
<tobiasBora>
(I mean doing the same thing as .mlpack but in command line)
leafac has joined #ocaml
leafac has quit [Read error: Connection reset by peer]
<jpdeplaix>
I'm not sure but I think you can't. I agree, it's a shame
<tobiasBora>
Too bad :'-(
<tobiasBora>
I will try to find a way to autogenerate it, but I'll see it tomorrow. Thank you for your help !
milosn has joined #ocaml
imslavko has quit [Quit: Connection closed for inactivity]
manizzle has quit [Quit: Leaving]
lordkryss has quit [Quit: Connection closed for inactivity]
darkf has joined #ocaml
rgrinberg has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
rgrinberg has quit [Ping timeout: 246 seconds]
<struktured>
can I match on a subsets of polymorphic variants? something like this: type a = [`A] ;; type b =[`B];; type ab = [a|b];; let f t = match t with type a -> ... | type b -> ...
rgrinberg has joined #ocaml
<dora-molly>
struktured: | #a ->
<struktured>
:D this is awesome. glad I went with polymorphic variants in this situation. Thanks a bunch!
<dora-molly>
|#o->
<dora-molly>
I just realised that this is valid code :o
<struktured>
the only thing I'd like now is a way to go from `Foo of 'a to just `Foo without my own type conversions...ppx I suppose
<rgrinberg>
dora-molly: new game. is it ocaml or line noise :P
<struktured>
sometimes both are good answers
BitPuffin|osx has quit [Ping timeout: 240 seconds]
<dora-molly>
;)
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
tmtwd has joined #ocaml
idegen has quit [Quit: Leaving.]
jeffmo has quit [Quit: jeffmo]
Submarine has quit [Remote host closed the connection]
gabemc has quit [Ping timeout: 252 seconds]
swgillespie has joined #ocaml
psy_ has quit [Ping timeout: 272 seconds]
pyon is now known as model-pyon
nullcat_ has joined #ocaml
<nullcat_>
is there a easy way to make a k-v data structure that "k" can be of type int list?
tmtwd has quit [Ping timeout: 272 seconds]
<nullcat_>
i'll just use core's Hashtbl.Poly...
jeffmo has joined #ocaml
<rgrinberg>
Drup: so how do you read a string into a generic json type in js_of_ocaml? I don't want to define types and use deriving
<nullcat_>
merlin does not support functor
<nullcat_>
?
<nullcat_>
module MyMap = Map.Make(MyKey)
<rgrinberg>
merlin supports functors for me
<nullcat_>
i want to use autocompletion on it but it doesn't work
<nullcat_>
i need to do module MyMap : Map.S ?
<nullcat_>
maybe?
badkins has quit []
<rgrinberg>
hmm, no you shouldn't need that
<rgrinberg>
and your code compiles right?
<nullcat_>
yes
<rgrinberg>
nullcat_: can you make a small snippet so i can try and reproduce?
<rgrinberg>
if i can reproduce, we can report it on the bug tracker
<dora-molly>
then launch vim, reproduce, share the file and we'll be able to debug
MercurialAlchemi has joined #ocaml
<nullcat_>
it suddenly works.. after some opam upgrade and restart terminal and vim
<nullcat_>
thanks!
erider has joined #ocaml
erider has quit [Remote host closed the connection]
rgrinberg has quit [Ping timeout: 264 seconds]
rgrinberg has joined #ocaml
jeffmo has quit [Ping timeout: 244 seconds]
model-pyon has quit [Quit: I give up on the 3D world.]
psy_ has quit [Ping timeout: 264 seconds]
Gama11 has joined #ocaml
mort___ has joined #ocaml
Haudegen has quit [Ping timeout: 264 seconds]
matason has joined #ocaml
tmtwd has quit [Quit: Leaving]
mort___ has quit [Quit: Leaving.]
matason has quit []
matason has joined #ocaml
Haudegen has joined #ocaml
inf-gropeoid has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ollehar has joined #ocaml
rgrinberg has quit [Ping timeout: 258 seconds]
Simn has joined #ocaml
nullcat_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ggole has joined #ocaml
matason has quit []
mort___ has joined #ocaml
jonludlam has quit [Ping timeout: 265 seconds]
zpe has joined #ocaml
tmtwd has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Ping timeout: 244 seconds]
asQuirreL has joined #ocaml
thomasga has joined #ocaml
jonludlam has joined #ocaml
A1977494 has joined #ocaml
A1977494 has left #ocaml [#ocaml]
ingsoc has joined #ocaml
rgrinberg has joined #ocaml
freling has joined #ocaml
rgrinberg has quit [Ping timeout: 272 seconds]
axiles has quit [Quit: Quitte]
dsheets has quit [Ping timeout: 265 seconds]
Hannibal_Smith has joined #ocaml
Haudegen has quit [Ping timeout: 245 seconds]
leafac has joined #ocaml
thomasga has quit [Quit: Leaving.]
dsheets has joined #ocaml
thomasga has joined #ocaml
sdothum has joined #ocaml
thomasga has quit [Client Quit]
kushal has joined #ocaml
Kakadu has joined #ocaml
rgrinberg has joined #ocaml
Haudegen has joined #ocaml
rgrinberg has quit [Ping timeout: 240 seconds]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
sdothum has joined #ocaml
thomasga has joined #ocaml
ski has quit [Ping timeout: 240 seconds]
ski has joined #ocaml
thomasga has quit [Quit: Leaving.]
xian has quit [Remote host closed the connection]
stygianguest has joined #ocaml
freling has quit [Quit: Leaving.]
mort___1 has joined #ocaml
mort___2 has joined #ocaml
mort___ has quit [Ping timeout: 256 seconds]
mort___1 has quit [Ping timeout: 255 seconds]
_andre has joined #ocaml
fraggle-boate has quit [Ping timeout: 256 seconds]
vodkaInf1rno has joined #ocaml
iZsh_ has joined #ocaml
freling has joined #ocaml
AdmWiggin has joined #ocaml
cmtptr_ has joined #ocaml
<flux>
it comes to my mind how the 'naked pointer' optimization could easily be fixed in ocaml c binding libraries without an intermediate object.. simply make it an integer for storage?
MercurialAlchemi has quit [Remote host closed the connection]
<flux>
works of course only for cases where the ocaml code is not intended to dereference the pointer, which I guess is most often the case
MercurialAlchemi has joined #ocaml
octachron has joined #ocaml
Haudegen has quit [Ping timeout: 245 seconds]
<dora-molly>
flux: yep it works when the pointer is not byte aligned (char*)
<flux>
did the OCaml's C headers/library provide that function?
<companion_cube>
but maybe I should move CCIO into containers itself
<nuki>
Yop, scuse me, is there a way to redirect Sys.command into a particular Channel ?
<companion_cube>
it doesn't make much sense to separate it, since it has no additional dependency
<companion_cube>
nuki: if you want more control over subprocesses, I think you should probably go with Unix
<Drup>
companion_cube: doesn't ccio need unix ?
<Drup>
if so, nope please.
<companion_cube>
no it doesn't
<companion_cube>
I wouldn't suggest this otherwise, of course
<nuki>
Ok thanks (open_process_in I suppose ?)
<companion_cube>
yes, exactly
<companion_cube>
or open_process_full for even more control
<nuki>
I see. It's only for retreive Git information :)
<companion_cube>
:)
leafac has quit [Quit: Leaving.]
leafac has joined #ocaml
<flux>
there's pure ocaml git implementation as well. no idea if it works.
<Drup>
it should works quite well, yeah
<flux>
but it won't probably know about .git/config, if that's applicaple?
kaustuv has joined #ocaml
<kaustuv>
If I want to profile a program that uses, say, batteries, do I have to recompile batteries with ocamlopt -p? And, if so, is there a way to tell opam to compile it with -p?
<Drup>
don't use -p to profile, just use perf
leafac has quit [Ping timeout: 256 seconds]
zmyrgel has joined #ocaml
<kaustuv>
perf?
<Drup>
and potentially, use the +fp switch on opam to have frame pointers and stack traces informations
<Drup>
it's a linux command :)
<kaustuv>
Ah, OK, will google the rest. Thanks for the suggestion.
<kaustuv>
The +fp branch changes the ABI, right?
<ggole>
Don't think so
<kaustuv>
OK, good
<ggole>
It means a register is reserved to contain the base pointer, which makes it a lot easier to walk the stack
<Drup>
at the price of ~5% loss, iirc.
<kaustuv>
But doesn't that mean that the calling convention changes
<kaustuv>
I guess I am recompiling everything anyway with the opam switch
<ggole>
No, the base pointer is maintained within the function
<Drup>
yes, you recompile everything
<ggole>
But you'll lose some of the debugging benefits if you don't recompile
<Drup>
note that you don't *have* to use this switch, it will just give better information
<kaustuv>
It's no big deal to recompile everything for me.
<kaustuv>
I just didn't want to maintain two divergent versions of the same package
rgrinberg has joined #ocaml
Haudegen has joined #ocaml
cmtptr_ is now known as cmtptr
rgrinberg has quit [Ping timeout: 252 seconds]
mort___2 has left #ocaml [#ocaml]
<kaustuv>
Is there any sense in which the pickled names of functions correspond to source positions?
<ggole>
pickled?
<kaustuv>
things named like camlFoo__function_7337
<ggole>
Oh
<ggole>
Uh, don't think so
ollehar has quit [Ping timeout: 256 seconds]
<flux>
you know what this means?! you get to write one! woohoo!
<flux>
make it work like c++filt :)
<Drup>
pretty sure that's the internal number given by the typechecker during name resolution, and you wan't to fiddle with that
<ggole>
Part of the names are "random", too
<ggole>
At least, they change for each compilation.
thomasga has joined #ocaml
ollehar has joined #ocaml
<kaustuv>
How do I get perf to not report things like caml_start_program at the top? I want to order the functions roughly how gprof orders them.
<kaustuv>
Maybe I should read a tutorial on perf instead...
<kaustuv>
apparently the magic invocation was 'perf report --no-children'
<xificurC>
anyone here using yeti?
kaustuv has left #ocaml ["ERC Version 5.3 (IRC client for Emacs)"]
nuki has quit [Remote host closed the connection]
freling has quit [Quit: Leaving.]
rgrinberg has joined #ocaml
klj has joined #ocaml
rgrinberg has quit [Ping timeout: 265 seconds]
Hannibal_Smith has quit [Quit: Leaving]
idegen has joined #ocaml
mort___ has joined #ocaml
fraggle-boate has joined #ocaml
klj has quit [Quit: ZZZzzz…]
hay207 has joined #ocaml
dora-molly is now known as crapitaine-hoche
crapitaine-hoche is now known as craptain-hochet
jpdeplaix` has joined #ocaml
BitPuffin has joined #ocaml
rgrinberg has joined #ocaml
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
rgrinberg has quit [Ping timeout: 250 seconds]
Algebr has joined #ocaml
ollehar has quit [Ping timeout: 255 seconds]
freling has joined #ocaml
rgrinberg has joined #ocaml
Submarine has joined #ocaml
badkins has joined #ocaml
thomasga has quit [Quit: Leaving.]
<Algebr>
say you're making a command line app, how do you get a notification that tab was hit. Do you just listen for '\t'?
<flux>
yes, though you need to set the tty to a mode that allows you to read individual key presses
<flux>
by default tty is line buffered
<flux>
Unix.tcsetattr will help you there
<adrien_znc>
use a library? :P
kushal has quit [Ping timeout: 264 seconds]
tane has joined #ocaml
<Algebr>
found the answer on stack, rgrinberg asked the exactly same question
<Drup>
(use lambad-term :D)
<companion_cube>
just to read \t ? isn't it a bit overkill?
<flux>
but you need to provide a command line editor basically
<flux>
so for that perhaps lambda-term is suitable.
<dmbaturin>
Speaking of lambda-term, does it include anything to simplify adding command completion?
<Drup>
companion_cube: it provides all the auto completion stuff already done for you
<companion_cube>
sure
<Drup>
well, what flux said, basically
<companion_cube>
hmmm, I'd think there was a binding to readline somewhere, but apparently not
<Drup>
dmbaturin: command line option ? No, lambda-term doesn't deal with command line
<Algebr>
oh, Lterm_read_line seems fruitful
klj has joined #ocaml
<dmbaturin>
Drup: No, not options, commands within application.
<dmbaturin>
* or not just commands, like utop can complete function names
rgrinberg has quit [Ping timeout: 256 seconds]
<Drup>
it's simple really
<Drup>
you provide a function taking the current line as input and the list of potential completion
<Drup>
and returning ...
kdef has joined #ocaml
milosn has joined #ocaml
vincenzoml has joined #ocaml
<vincenzoml>
Hello, I would like to load a dot file as a graph in ocamlgraph but don't really understand the API. So far I can load a graph using Dot.parse_dot_ast, and then I could manually traverse the parse tree and create a new imperative graph, but I suppose there's a function to do just that?
<vincenzoml>
I get lost in the documentation as there are many functors, so I don't really understand return types
<Drup>
Dot.Parse(G).parse
<Drup>
with G the module for your graph
<Drup>
oh, my bad, there is a second module argument
<Enjolras>
companion_cube: i've a little more time, do you think i should an issue about the exhaustivity warning with module inclusion ?
<companion_cube>
I don't know
<companion_cube>
maybe you should write to the mailing list
<Enjolras>
Ok
<companion_cube>
(since no ocaml maintainer is on this channel anymore)
<adrien_znc>
(we lost gasche?)
thomasga has quit [Client Quit]
<adrien_znc>
but for bugs, never through IRC
<Enjolras>
i am not even sure it's a bug :)
<companion_cube>
we lost gasche several weeks, if not months, ago
<adrien_znc>
he was around not long ago I think
thomasga has joined #ocaml
Submarine has quit [Remote host closed the connection]
<vincenzoml>
Drup: Thanks a lot! I just did not realise that I should click on "Parse" in the page you linked, so that I get the actual documentation of the module, and not of the parent module :)
<Enjolras>
companion_cube: i feel like i should have posted to ocaml-beginners instead
<companion_cube>
GADTs are not really a beginner topic
<companion_cube>
and you are not a beginner :p
<Drup>
what was the question ?
<companion_cube>
it's on the mailing list now
<Drup>
ah, yeah
<Drup>
there is a bug report by leo white on that
<Drup>
closed as wontfix by jacque
<Enjolras>
crap. Ok :)
<Drup>
I tried to find it the other day, but couldn't, because I have the same issue in furl
<Drup>
someone will probably link to the actual bug report, this time, so it's good you asked
<Enjolras>
Drup: do you happen to know how to put annotations to disable warning in the code ?
<Enjolras>
companion_cube: talked about [@@warning "-w -8"] but i've found no documentation and didn't manage to make it work
<Enjolras>
and i was in a hurry
<companion_cube>
might be [@@@warning "-w -8"]
<Drup>
yeah, that's correct
<vincenzoml>
Drup, I am still horribly confused. I don't know how to get a Builder.S module and I don't really know, e.g., what a "persistent" graph means. Is there any tutorial or documentation which is not the ocamldoc?
<Drup>
one is for the whole current structure, the other is for the thing you are annotating
<companion_cube>
and then [@@@warning "-w +8"] to re-enable the warning again
<Enjolras>
right. [@@@warning "-8"] to be exact
<Drup>
companion_cube: No, it's not positional
<Drup>
(at least, I doubt it is)
<Enjolras>
It's attached to AST nodes, i guess it work only for the ast subtree
<Drup>
vincenzoml: which graph are you using ?
<vincenzoml>
Drup: I think I just understood that I should use Graph.Pack.Digraph in the beginning. So I will use that, and I suppose that Graph.Pack.Digraph is also a Builder.S?
<Enjolras>
companion_cube: looks like it can only be attached to functions and apply to the given function
<vincenzoml>
Drup: no it isn't. So how do I get a Builder.S from Graph.Pack.Digraph?
<Drup>
vincenzoml: oh, you are using the pack !
<Drup>
then it's easy
<companion_cube>
Enjolras: @@@ is for toplevel annotations, @@ for declaration-level annotation, I think
<Drup>
Digraph.parse_dot_file
<Drup>
:D
<vincenzoml>
Drup: actually when I asked questions I was using Persistent, since I don't need mutable graphs, but my understanding of the thing is still very rough so I prefer to switch to Pack.
<Enjolras>
oh, someone replied with a nice hack to workaround the issue
<vincenzoml>
Drup: ah, thanks :)
<Enjolras>
if you replace type foo by type foo = EmptyFoo, it works.
<Enjolras>
Since it's phantom types in my case, that's no big deal
m___ has joined #ocaml
<Drup>
Enjolras: I had the same issue with some non-phantom types, and the workaround was not possible, unfortunatly
struktured has quit [Ping timeout: 256 seconds]
<Enjolras>
yeah, in this case the only workaround i can see is warning annotations. But that solve my issue. Too bad i've already finished the project :>
<Drup>
vincenzoml: if you are using Persistent, you can get a Builder with Builder.P(G)
<Drup>
(and Builder.I if you are using Imperative)
<vincenzoml>
Drup: I mostly need to traverse all nodes, and for each node to find predecessors and successors (I'm developing a model checker, just to explain it better). So I need that these operations are implemented as efficiently as they can, is Pack a good option?
<Drup>
well, the issue with pack is that you don't choose the labels
<Drup>
otherwise, it's exactly the same as Persistent/Imperative, just specially applied
zpe_ has joined #ocaml
<vincenzoml>
Drup: but shall I look at the code or is there some documentation on complexity of the functions across the various implementations?
mort___ has quit [Quit: Leaving.]
zpe has quit [Ping timeout: 240 seconds]
darkf has quit [Quit: Leaving]
<Drup>
the complexity is documented in each implementation
shinnya has joined #ocaml
rgrinberg has joined #ocaml
vincenzoml has quit [Ping timeout: 246 seconds]
octachron has quit [Quit: Leaving]
AdmWiggin is now known as tianon
A1977494 has joined #ocaml
A1977494 has left #ocaml [#ocaml]
Submarine has joined #ocaml
slash^ has joined #ocaml
Algebr has quit [Read error: No route to host]
thomasga has quit [Ping timeout: 272 seconds]
thomasga has joined #ocaml
tmtwd has quit [Ping timeout: 246 seconds]
tane has quit [Quit: Verlassend]
thomasga has quit [Quit: Leaving.]
struktured has joined #ocaml
thomasga has joined #ocaml
rgrinberg has quit [Ping timeout: 272 seconds]
kushal has joined #ocaml
gabemc has joined #ocaml
rgrinberg has joined #ocaml
freling has quit [Quit: Leaving.]
badkins has quit [Remote host closed the connection]
MrScout has joined #ocaml
jwatzman|work has joined #ocaml
thomasga has quit [Quit: Leaving.]
psy_ has joined #ocaml
thomasga has joined #ocaml
struktured has quit [Remote host closed the connection]
struktured has joined #ocaml
badkins has joined #ocaml
wwilly has joined #ocaml
ygrek has joined #ocaml
sepp2k has joined #ocaml
Hannibal_Smith has joined #ocaml
struktured has quit [Read error: Connection reset by peer]
zpe_ has quit [Remote host closed the connection]
struktured has joined #ocaml
inf-gropeoid is now known as inf-groupoid
struktured has quit [Ping timeout: 256 seconds]
shinnya has quit [Ping timeout: 258 seconds]
Anarchos has joined #ocaml
Haudegen has quit [Ping timeout: 244 seconds]
rgrinberg has quit [Ping timeout: 265 seconds]
jeffmo has joined #ocaml
wwilly has left #ocaml ["Leaving"]
gabemc has quit [Ping timeout: 250 seconds]
BitPuffin has quit [Ping timeout: 265 seconds]
ncthom91 has joined #ocaml
ncthom91 has quit [Client Quit]
Haudegen has joined #ocaml
thomasga has quit [Quit: Leaving.]
m___ has quit [Ping timeout: 246 seconds]
Algebr has joined #ocaml
rgrinberg has joined #ocaml
sdothum has joined #ocaml
ggole has quit []
freling has joined #ocaml
Haudegen has quit [Ping timeout: 264 seconds]
thomasga has joined #ocaml
dsheets has quit [Ping timeout: 255 seconds]
mengu has joined #ocaml
psy_ has quit [Ping timeout: 252 seconds]
shinnya has joined #ocaml
tane has joined #ocaml
Haudegen has joined #ocaml
dsheets has joined #ocaml
luzie has quit [Remote host closed the connection]
luzie has joined #ocaml
A19774941 has joined #ocaml
A19774941 has left #ocaml [#ocaml]
Hannibal_Smith has quit [Ping timeout: 265 seconds]
Hannibal_Smith has joined #ocaml
Kakadu has quit [Quit: Page closed]
jrslepak has joined #ocaml
fedjo has quit [Remote host closed the connection]
TheLemonMan has joined #ocaml
TheLemonMan has quit [Changing host]
TheLemonMan has joined #ocaml
<Algebr>
I'm having difficulty with a regex for Re. I want all matches from a long string where the pattern starts with SOME_ATTR and keeps going until a ;. I tried Re.str "SOME_ATTR.[^;]*" but I got an empty list when that was paired with Re.matches.
<MercurialAlchemi>
uh
<MercurialAlchemi>
did you mean this . after SOME_ATTR?
<Algebr>
I tried with and without the .
nullcat has joined #ocaml
asQuirreL has quit [Ping timeout: 245 seconds]
<l1x>
guys silly question, if I compile a native app it does not have any dependencies on the OS to run
<l1x>
is that right?
<nullcat>
um... i don' think so
<S11001001>
are they statically linked?
<nullcat>
"Unix.gettimeofday" won't work on Windows? maybe
asQuirreL has joined #ocaml
<S11001001>
l1x: might depend on what you mean by "dependencies on the OS". e.g. you certainly can't run the native binary built for gnu/linux on windows
<l1x>
sure sure
<S11001001>
l1x: conversely, I wouldn't consider a dynamic link to libc.so.6 to be "dependency on the OS", but you might
<l1x>
i mean i build a native app for a certain linux kernel, i copy it to another node same kernel, will it run?
<l1x>
or i need ocaml runtime to be installed
<S11001001>
l1x: it'll run. No need for same kernel even
<S11001001>
boy wouldn't that be inconvenient :)
<l1x>
:)
<l1x>
same kernel = not macos or windows
<S11001001>
I see
<l1x>
great!
<l1x>
thanks
<adrien>
21:03 nullcat : "Unix.gettimeofday" won't work on Windows? maybe
<adrien>
it works
<nullcat>
oh ok
<nullcat>
Lwt_unix maybe wont' work...
<adrien>
iot works fairly well
<adrien>
it*
<adrien>
maybe better than standard Unix actually
<nullcat>
ok, then i shouldn't say that. never tried ocaml on Windows
slash^ has left #ocaml [#ocaml]
freling has quit [Quit: Leaving.]
<Algebr>
I have a regex pattern that works on an online validator but Re doesn't produce the same result..
<nullcat>
code?
sepp2k has quit [Quit: Leaving.]
Kakadu has joined #ocaml
<Algebr>
the pattern of interest is "SOME_ATTR\([^type][^;]*"
nullcat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rgrinberg has quit [Ping timeout: 245 seconds]
nullcat has joined #ocaml
rgrinberg has joined #ocaml
<rgrinberg>
Algebr: youre using pcre syntax
<rgrinberg>
so compile your re with Re_pcre
<Algebr>
rgringberg: I didn't see your message so I was trying a third regex package, pcre and it worked for that one.
<Algebr>
funny timing
<rgrinberg>
;)
<Algebr>
So which regex package is the most feature rich and maintained? Should I just be using re?
<rgrinberg>
Algebr: i should probably write this up somewhere, but recently i found it much more convenient to construct re's with combinators directly
<rgrinberg>
Algebr: Re_str. but it doesn't matter they're all just thin syntax over Re
<Algebr>
right but there's a package called pcre and yet re also has a submodule re_pcre
<flux>
pcre is the real Perl Comparible Regexp eeEeE bindings
<rgrinberg>
Algebr: what flux said. And it's also very mature and has a great reputation
<flux>
(ah regular expression yes ;-))
<flux>
it's suberp in fact
<flux>
but I've tried to use Re lately anyways :)
<flux>
but its interface isn't quite as convenient out-of-the-box. of course, if you pre-compile each regexp beforehand anyways, but..
matason has joined #ocaml
<flux>
and Re_pcre has served me fine
<Drup>
yeah, Re_pcre is very useful when replacing Pcre/Netstring_pcre code
<Algebr>
so I should use re_pcre instead of pcre/
<flux>
though I seem to think having trouble splitting ",a,b,c" so that I get the first empty field with Re
<rgrinberg>
Algebr: do you care about having a c dependency that's ubiquitous?
<Drup>
Algebr: do you want real pcre or simply actual re with the pcre syntax ?
<flux>
ok, so I did have this problem: assert (Re.split (Re.compile @@ Re_pcre.re ",") ",a,b" = [""; "a"; "b"]);;
<flux>
why is that?
matason has quit [Client Quit]
<Algebr>
I want something that would be able to accept that pattern I gave. pcre worked with that pattern.
<flux>
it is as if the first and last , are ignored, but not if there are two of them.
<Drup>
guys, there are bug trackers for a reason :D
<rgrinberg>
flux: that was fixed in recent versions
<flux>
well, I was thinking if it was maybe an user error. pcre has all these many matchers :)
* rgrinberg
forgot if he fixed or c-cube
<flux>
but I suppose as Re only has basically two ways to split..
<flux>
nice to know that it now works
<flux>
means that my previously working code is now again broken, thanks guys ;-)
<rgrinberg>
Algebr: use what works for you. Can't go wrong with either
<rgrinberg>
hell there's even jsc's re2
<rgrinberg>
and of course the builtin str
<flux>
what? there is no builtin str
<rgrinberg>
(but that's it!)
* rgrinberg
wonders how re performs on jsoo
codesmythe has joined #ocaml
<Drup>
it performs okayish, since jsoo represent string in a dual way, array of rope
<Drup>
s/of/or/
<flux>
so when do we get to see Re_perl6?
<Drup>
when someone masochist enough write it ? :]
<Drup>
(I personally use the combinators ...)
<flux>
I bet the current regular expression parsers don't even support comments within regular expressions.
<Drup>
flux: sure it does
<flux>
Re_pcre does?
<Drup>
Re.(rep (* Let's Repeat it ! *) digit)
<flux>
..
<Drup>
:D
<Drup>
You wanted a comment inside a regular expression :3
<flux>
which reminds me how nice a tool pa_micmatch was
<flux>
does sedlex do this as well? RE ["Hh"]"ello" space+ (alpha+ as name) -> Some name
<Drup>
It's not as easy to write ...
<flux>
it also has this magic that ([0-9]+ as i) makes i become an integer
<flux>
though I suppose there could be a cleaner syntax for it.. but saves int_of_string-stuff from code that heavily does integer-matching
<Drup>
I'm basically doing that in furl, but special cased
systmkor has joined #ocaml
xificurC has quit [Remote host closed the connection]
Algebr has quit [Remote host closed the connection]
Algebr has joined #ocaml
xificurC has joined #ocaml
sheijk has quit [Remote host closed the connection]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
nullcat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Algebr>
I saw something about not having to do \\ to escape in strings, something with {| } or whatnot. Can anyone show a small example
tinhead has joined #ocaml
<smondet>
Algebr: let x = {bla| kjdi \ " kdi ' |bla}
<Algebr>
smondet: just copy and pasting that into utop doesn't work
<Drup>
which version of ocaml are you using ?
<Algebr>
4.02.1
<flux>
works on my machine (TM)
<Algebr>
/sigh;;
<smondet>
Algebr: what's the error?
<Drup>
on mine too :>
nullcat has joined #ocaml
<Algebr>
utop[16]> let x = {bla| kjdi \ " kdi ' |bla};;
<Algebr>
Error: Parse error: [label_expr_list] or [expr level .] expected after "{" (in [expr])
<Drup>
gah
<Drup>
get rid of camlp4
<smondet>
do you have any camlp4 extension loaded?
ygrek has quit [Ping timeout: 264 seconds]
codesmythe has quit [Quit: Leaving.]
<Algebr>
I'm using core, so I guess the answer is yes
<Drup>
that's not necessarily linked.
<smondet>
wasn't there a hack in utop for RWO readers that loads a "jane st like" environments (core + syntaxes + evaluate Async.t)?
<ericbmerritt>
I could use a bit of help with a format string. I have a function with a type signature that looks like val foo: t -> ('a, unit, string, unit) format4 -> 'a
<ericbmerritt>
however when I call this with something like 'foo bar "-> %s %s" baz bash'
<ericbmerritt>
I get a error saying too many arguments are passed
<ericbmerritt>
obviously the compiler isn't recognizing the format string, but I am a loss as to why
Anarchos has joined #ocaml
<Drup>
can you show the exact function ?
mal`` has quit [Ping timeout: 248 seconds]
<ericbmerritt>
yea. sure one second Drup I have been mucking around with it
nullcat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Drup>
that's not ('a, unit, string, 'ret) format4 -> 'a at all
<Drup>
You can probably implement what you want with kprintf
<ericbmerritt>
I basically have the same arguments as Async_shell.sh_lines stream. My goal is just to pass through and capture the result so I can log it out in a specific way
<Drup>
yeah, except you can't "report arguments" like that
<Drup>
you have an arbitrary number of argument that would need to be insert inside the call of Async_shell.sh_lines
<Drup>
that's not how function application works in OCaml :)
QuanticPotato has joined #ocaml
<Drup>
As I said, you should be able to use Printf.kprintf to do what you want
<Drup>
you give to kprtinf the function doing whatever it wants with the string once it's formatted
<Drup>
and it will give you a function taking a format and doing format-things
<ericbmerritt>
I am not seeing how Printf.kprintf would solve my problem (that of wanting to take printf style arguments in a function that is not printf)
<flux>
you want to take printf style arguments but you don't want to eventually print it?
<ericbmerritt>
well, I will eventually pass it through to a function that takes printf style arguments. Then capture the result of that function and do some other things
<ericbmerritt>
eventually it does get printed. just not by me
<flux>
well, I think that's going to be impossible
<flux>
you basically need to forward it as a string
nullcat has joined #ocaml
<ericbmerritt>
me taking the arguments is a symptom of me of me wanting to wrap that other function
tinhead has quit [Remote host closed the connection]
<flux>
let's say this: there is no general way to wrap function of varying arity
<flux>
the whitepaper (short'n sweet) lets you see a bit how printf works (might work?) under the hood
<dsheets>
i use ksprintf and format_of_string to do some of this...
<dsheets>
it's ugly and painful but sometimes necessary
<Drup>
it's perfectly possible, it's what kprintf is made for
<flux>
drup, but you don't forward the original arguments forward
<flux>
you get a string and you forward "%s" str then
<Drup>
yeah but it's equivalent, there is no other way to consume the arguments given a format anyway
<flux>
ksprintf (btw, kprintf is deprecated) is just one that works with the magic format arguments..
<Drup>
it's all buried in a universal.
<Drup>
actually, no, ksprintf is the mother of all printfs :D
<Drup>
everything is implemented with it
<flux>
I agree that it's the practical way to really achieve it
<flux>
my manuals say about Printf.kprintf: "A deprecated synonym for ksprintf."
MrScout has quit [Ping timeout: 256 seconds]
<flux>
oh, right, you didn't argue about that :-)
<Drup>
no I didn't :D
<flux>
so for clarity, you do something like this: let foo fmt = Printf.ksprintf (fun str -> Printf.eprintf "printing %s..\n" str; Printf.printf "%s" str; Printf.eprintf "printed %s!\n" str) fmt
<flux>
but sleepy time, happy coding :)
tinhead has joined #ocaml
QuanticPotato has quit [Quit: Leaving]
Haudegen has quit [Ping timeout: 256 seconds]
ollehar has joined #ocaml
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
badkins has joined #ocaml
badon has quit [Ping timeout: 252 seconds]
ygrek has joined #ocaml
badkins_ has joined #ocaml
tane has quit [Quit: Verlassend]
<l1x>
S11001001: file h2t.native ->h2t.native: a /usr/local/bin/ocamlrun script text executable
<nullcat>
will there be ``String.set`` in 4.03?
<S11001001>
l1x: run ldd on it
<l1x>
this means you ocamlrun on the host to run it
badkins has quit [Ping timeout: 276 seconds]
<l1x>
macos has no ldd :)
<l1x>
i need to build it on linux
<mspo>
osx uses otool for ldd
<mspo>
otool -l is the same as ldd, iirc
<l1x>
yep, it says h2t.native: is not an object file
<l1x>
i guess native means it has no byte code but the native code still runs through ocamlrun
tinhead_ has joined #ocaml
<Algebr>
using ctypes, how can I translate this kind of C code....thing *foo = NULL;some_func(&foo). I'm having a hard time with the & for foo since Ctype's addr only takes a structure, whereas this is needing the take the address of a pointer.
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
wraithm has joined #ocaml
Cyanure has quit [Remote host closed the connection]
<l1x>
ocamlc is the bytecode compiler, and ocamlopt is the native code compiler.
<l1x>
nevermind, i just need to read the documentation
badon has joined #ocaml
tinhead has quit [Ping timeout: 265 seconds]
MercurialAlchemi has quit [Ping timeout: 255 seconds]
Haudegen has joined #ocaml
<Algebr>
nvm, it seems its not possible so I just remembered to use allocate_n
manizzle has joined #ocaml
badon has quit [Disconnected by services]
badon_ has joined #ocaml
badon_ is now known as badon
MrScout has joined #ocaml
tinhead_ has quit [Remote host closed the connection]
badkins_ has quit [Read error: Connection reset by peer]
badkins has joined #ocaml
MrScout has quit [Read error: Connection reset by peer]
MrScout has joined #ocaml
tinhead has joined #ocaml
ingsoc has quit [Ping timeout: 265 seconds]
hay207 has quit [Ping timeout: 272 seconds]
klj has quit [Quit: ZZZzzz…]
Hannibal_Smith has quit [Quit: Leaving]
mengu has quit [Remote host closed the connection]