<flux>
heh, from sources: let real_pos (i : int) (h : handle) = let (_, _, _, _, p, _, _, _) = h in i - p
<flux>
actually that was generated so never mind
<Camarade_Tux>
flux, nice, godi is at 3.1 and 3.4 is available
<mfp>
there's something the Haskell guys are doing massively better --- I knew about Language.C, which is incomplete and in devel, but never heard of FrontC which AFAICS is stable and has existed for over 4 years
<flux>
frontc's documentation could use some work. as it doesn't exist :)
<mfp>
no ocamldoc?
<flux>
I'll check what it'll look like, but there doesn't seem to be much to go from..
<Camarade_Tux>
at least for the basic features it looks self-explanatory
<flux>
ok, actually the generated documentation is somewhat useful
<flux>
right, looks simple enough to use
<flux>
now, who's up for writing FrontC++?-)
<mfp>
both the functions and the constructors are annotated with ocamldoc, seems good to go
<flux>
I was thrown off by the fact that there are no *.mli-files
<Camarade_Tux>
btw, I just checked gccxml bindings and qtcaml while I was at it, it seems mlgccxml is done and the project is really progressing :)
<flux>
if frontc suitable for reading source in, making no modifications, and then outputting it out exactly as it was when it went in?
<flux>
or doing things like detecting indentation?
<flux>
camarade_tux, ah, that's quite interesting
<flux>
I'm not particularly interested in qt, but the c++ binding side of the project does interest me
<flux>
(maybe I should have a wider vocabulary so I wouldn't repeat the word 'interesting' ;-))
<Camarade_Tux>
nice ? ;)
<mfp>
flux: doesn't look like it (it seems to work on preprocessed C)
<Camarade_Tux>
mfp, right
<flux>
so it's mostly useful for doing static analysis of C, including binding generation
<mfp>
there's yacfe for that
<flux>
true
<mfp>
Camarade_Tux: what was the problem with yacfe?
<Camarade_Tux>
it's really complex and I couldn't find the doc
<Camarade_Tux>
in the toplevel frontc returns 3 lines where yacfe returns about 60
fschwidom has joined #ocaml
Yoric[DT] has joined #ocaml
onigiri has joined #ocaml
<Camarade_Tux>
webkit-gtk headers parsed :)
<Camarade_Tux>
translation will probably wait a bit...
<olegfink>
Camarade_Tux: you're translating c headers to ocaml bindings?
<Camarade_Tux>
olegfink, yeah
<Camarade_Tux>
I have a previous version which used sed for parsing... and worked !
hkBst has joined #ocaml
<flux>
I had a perl-based refactoring tool for converting our old code base to new system
<Camarade_Tux>
olegfink, you can get an html-displayer in 7/13 lines of code : http://pastey.net/103269
<flux>
it had to find which functions needed context-parameters, and make sure they got it
<Camarade_Tux>
flux, but it relied on indentation and line-feeds to parse everything :)
<Camarade_Tux>
that's why I wanted to get rid of it
<olegfink>
by the way, I think let _ = main () isn't needed, ocaml calls main
<flux>
except it doesn't :)
hkBst has quit [Remote closed the connection]
hkBst has joined #ocaml
<Camarade_Tux>
well, I had already killed the sed version, I was using ocaml but it was really dirty anyway ;)
<olegfink>
let main = print_endline "Take me to your leader!"
<olegfink>
$ ocamlbuild test.native --
<olegfink>
Finished, 4 targets (4 cached) in 00:00:00.
<olegfink>
Take me to your leader!
<olegfink>
ah, stupid me
<olegfink>
main is not a function
<flux>
yep
<Camarade_Tux>
hehe
<olegfink>
(haskell syntax seems to be harmful for my health)
<olegfink>
Camarade_Tux: can you render the page to something off-screen, like an image?
<flux>
camarade_tux, that webkit-thingy looks interesting, keep up the good work ;)
<Camarade_Tux>
olegfink, I'm not sure gtk supports this, plus those bindings were really quick and minimal
<Camarade_Tux>
with the new parsing I'd like to be able to test the api patchs so if it's supported in webkit-gtk, it will be supported too in the bindings :)
<Camarade_Tux>
flux, thanks :)
<olegfink>
there is no built-in way to get the name of a constructor i
<olegfink>
*without sexplib, right?
authentic has quit [Remote closed the connection]
<Camarade_Tux>
olegfink, if you find one, share it ;)
<olegfink>
well, there is deriving extension which comes with Show built-in, but that's cheating
<Camarade_Tux>
completely unrelated : I need to run ocaml on embedded, most probably arm
<Camarade_Tux>
iirc native doesn't work but will at least bytecode run ?
<flux>
bytecode will run, but it is inconvenient to build ocamlrun and the libraries for it
<flux>
not impossible or even exceedingly difficult, but..
<Camarade_Tux>
that's for a prototype and coding in C would take a *lot* of time so as long as bytecode works, I'm happy (I don't need a lot of libraries, just pxp... gah ! or sexplib if I preprocess the files first :) )
<flux>
also you might need to be very careful about memory consumption
<Camarade_Tux>
you mean I have to pay attention when coding the Travelling Salesman Problem ? =P
<Camarade_Tux>
considering its applications, it will certainly need a *big* boost in memory actually
<Camarade_Tux>
anyway, I'm off
tomh has joined #ocaml
Gionne has quit ["Leaving"]
ofaurax has joined #ocaml
<olegfink>
hi
<olegfink>
I have two list lists, one with constructors of some algebraic type, and another with string. what I want is a map from the elements from the former to the latter
<fschwidom>
if i have a function to construct an datastructure how can i use this function to creat a pattern for matching?
<olegfink>
(e.g. [ [A;B]; [C;D] ] and [ ["A"; "B" ]; ["C"; "D"] ], and I want a function like A -> "A" | B -> "B" | C -> "C" | D -> "D")
<fschwidom>
olegfink: could List.iter2 solve your Problem?
<olegfink>
no, more like either a map or a fold
asabil has joined #ocaml
<Smerdyakov>
olegfink, are you saying you don't know how to implement this, or just that you are hoping for a function in the standard library to make it a one-liner?
<olegfink>
the latter, of course
<Smerdyakov>
I'm pretty sure there is no such function. It's not a very usual pattern.
<Smerdyakov>
The association list functions would do it if you flattened the lists and zipped them together.
<olegfink>
currently I have a compromise implementing something looking like [List.filter2]
<olegfink>
yes, I'm flattening them now
<Smerdyakov>
So a composition of [List.flatten], [List.combine], and [List.assoc] does it.
<Smerdyakov>
I'm kind of puzzled at why you want to do this, though. Why not built a [Map] in the first place?
<olegfink>
ah, right, I forgot about asssoc.
<Smerdyakov>
s/built/build
<olegfink>
Smerdyakov: I use the list of operators also for precedence matters (that's because it's two-dimensional)
<fschwidom>
is it possible to predefine patterns in variables?
<Smerdyakov>
fschwidom, no.
tsuyoshi has quit ["Lost terminal"]
onigiri has quit []
sporkmonger has joined #ocaml
tsuyoshi has joined #ocaml
<mfp>
uh
<mfp>
* ChanServ sets ban on Smerdyakov!*@*
<mfp>
* ChanServ has kicked Smerdyakov from #haskell (Banned: don't*pick*on*newbies)
<Smerdyakov>
Yup. Minor infestation of jackasses in that channel.
<tomh>
owned Smerdyakov ~
authentic has joined #ocaml
<tsuyoshi>
yeah.. he's the only person I have on ignore
<tsuyoshi>
very smart guy but incredibly annoying
authentic has left #ocaml []
authentic has joined #ocaml
authentic has left #ocaml []
pumpkin_ has quit [kornbluth.freenode.net irc.freenode.net]
Camarade_Tux has quit [kornbluth.freenode.net irc.freenode.net]
snhmib has quit [kornbluth.freenode.net irc.freenode.net]
thelema has quit [kornbluth.freenode.net irc.freenode.net]
purple_ has quit [kornbluth.freenode.net irc.freenode.net]
ecc has quit [kornbluth.freenode.net irc.freenode.net]
mwhitney has quit [kornbluth.freenode.net irc.freenode.net]
ecc has joined #ocaml
mwhitney has joined #ocaml
authentic has joined #ocaml
rwmjones has joined #ocaml
Camarade_Tux has joined #ocaml
purple_ has joined #ocaml
rwmjones has quit ["Leaving"]
* Camarade_Tux
already loves frontc
jeddhaberstro has joined #ocaml
pango has quit [Remote closed the connection]
<olegfink>
Camarade_Tux: okay, 287 lines of ocaml for parser, interpreter and pretty printer of a C-like (more like bc-like) language
<olegfink>
is it very bad or it'll be okay if I drop a few dozens of lines?
<Camarade_Tux>
well, I can't really answer, I've only started language parsing this week :p
<Camarade_Tux>
(but considering it's C-like, 287 lines is quite short imo)
threeve has joined #ocaml
<olegfink>
bc from plan9 is 989 loc
<olegfink>
(of c/yacc code, that is)
pango has joined #ocaml
snhmib has joined #ocaml
<Camarade_Tux>
ok, I've written print_endline/Printf.printf calls everywhere I need to put transformations
<Camarade_Tux>
I definitely love frontc :)
jeremiah has joined #ocaml
alexyk has joined #ocaml
jeremiah has quit [Read error: 104 (Connection reset by peer)]
thelema has joined #ocaml
fschwidom has quit [Read error: 104 (Connection reset by peer)]
jeremiah has joined #ocaml
<olegfink>
okay, 268 lines and a few new features added and bugs fixed
<flux>
surely some new bugs added also?-)
<flux>
hmm.. idea: a program that lets me write a piece of code that uses module X, and it generates an interface file for the new module X
<flux>
so I could write, say: let foo n = N.x + 5 * n * N.foo n
<flux>
and it would generate module type N = sig val x : int val foo : int -> int end
<flux>
I think that could be useful for designing something you're not quite sure how to go about, but you have some idea how you would like to use it
<thelema>
you're right that "how you would use it" implies a type
<flux>
in theory it could work by replacing all symbols N.zzz with (failwith "N") and afterwards asking the types with ocamlc -dtypes
<thelema>
I don't think it'd be that useful - most types are pretty simple.
<flux>
I don't think it would be that easy, though
<flux>
for example it wouldn't cover new types
<thelema>
the compiler could do this (as it does for non-module types)
<vixey>
-dtypes enables dependent types?
<thelema>
vixey: no dependent types in ocaml.
<flux>
vixey, -dtypes enables generation of .annot-files, which indicate the types of all expressions in the program
<flux>
vixey, it's excellent when used with an editor that supports them, such as emacs & ocaml-mode or vim and the related extension to it
<flux>
(in emacs C-c C-t gives the type of the expression under the point)
<alexyk>
I'm probably missing it, but are there ranges in ocaml? is there an easy way to generate [1;2;3;...;n]?
<alexyk>
f# has [0 .. n]
<Smerdyakov>
alexyk, no such syntactic sugar in the base distribution
<Smerdyakov>
alexyk, trivial to implement with a function
<alexyk>
Smerdyakov: did that, just wanted to check
<alexyk>
so... I'm not really using the O in ocaml, might as well have stuck with SML. Is there spike in popularity due to script kiddies seeing the O? Easying path from Java or C#?
threeve has joined #ocaml
<alexyk>
I mean why didn't script kiddies pick up SML instead?
<alexyk>
not that I believe there's many script kiddies around, but I wonder what the theory of luck can be here
<alexyk>
Smerdyakov: saw that; that actually shows SML is not worse than OCaml. Basically I realized I program mostly in a common subset. Yet all newbies are attracted to ocaml, not SML. You never hear "I learned about that cool language ML today."
<alexyk>
oh well, one of the natures mysteries
<Camarade_Tux>
I tried using mlton once, stopped when I couldn't install it and it had already polluted my system too much
<det>
alexyk, "Batteries Included" has "0 -- n"
<alexyk>
det: interesting, thx! in fact having a range easily available eases imperative folks migration very much
<alexyk>
not having a range is just rude :)
<Smerdyakov>
Camarade_Tux, interesting. In Debian, all it takes is "apt-get install mlton".
<Camarade_Tux>
I should be able to compile the program I'm going to compile with :)
bjorkBSD has joined #ocaml
<alexyk>
det: can batteries' -- be used from toplevel?
<alexyk>
also, I get, The files /opt/godi/lib/ocaml/pkg-lib/batteries_nothreads/batteries.cma
<alexyk>
and /opt/godi/lib/ocaml/pkg-lib/extlib/extLib.cma
<alexyk>
disagree over interface Enum
<thelema>
alexyk: yes, batteries comes with bocaml, a wrapper for ocaml that provides batteries functionality
<alexyk>
-- should I recompile some?
<thelema>
alexyk: try a make clean
<det>
alexyk, ocamlfind batteries/ocaml
<alexyk>
thelema: I get them from godi... are they supposed to be in sync there?
<det>
alexyk, will run batteries included toplevel
<thelema>
uh oh.
<thelema>
don't use extlib at the same time as batteries - batteries should supercede extlib
<alexyk>
tried to reinstall batteries in godi, they complain they need Camlzip which is not there; is it godi-zip in godi?
<thelema>
I think so.
<alexyk>
(looks like it)
* thelema
doesn't use godi
<alexyk>
thelema: why?? it seems such a natural thing
<alexyk>
all useful languages come with package managers, CPAN, PyPi, etc.
<alexyk>
thelema: it proves java and C# are not cool :)
<thelema>
you said "useful" not "cool"
<alexyk>
M$ is uncool by definition, you get your modules form Bill Gates after signing EULA
<alexyk>
thelema: for me useful is cool :) I refuse to use uncool languages, and I don't like curly braces
<alexyk>
anything with curly braces in it, forget it
<bjorkBSD>
why?
<bjorkBSD>
you can remap your keyboard to not have to shift to use it...
<alexyk>
bjorkBSD: {} remind of C++ and Java, like a war veteran with flashbacks
<bjorkBSD>
aww you've been traumatized.
<alexyk>
I like python, ruby, and ocaml; my first language love was Ada, I prefer text bracketing
<alexyk>
{} look unreadable
<bjorkBSD>
Ada? that's cool.
<thelema>
I love ada's types, but it's too B&D for me.
<bjorkBSD>
boring and dry?
<alexyk>
I followed Ada since Ada 83 to Ada 2005
<alexyk>
I like its emphasis on type safety -- similar to ocaml btw
<thelema>
Bondage and Domination.
<alexyk>
thelema: you have to if you program a Boeing
<thelema>
ada ties me up and beats me.
<thelema>
not really - Ada's fading quickly even in that world.
<alexyk>
btw do they teach Ada in France still? and program Arian in it?
<thelema>
they can't get enough programmers to learn it.
<thelema>
this is just what I hear through the grapevine, not my personal experience.
<alexyk>
what was the result of Arian/Ada -- that Ada is still good?
<alexyk>
I saw it was proven innocent
<alexyk>
and you really have no other languages with such a history of paranoid safety, so it makes sense to use it for such things imho
<flux>
the new private type abbreviations go a bit towards type safe dimensional types ;). too bad true dimensional types are not quite possible (?) in ocaml. or has that been tried?
<thelema>
what do you want from "true dimensional types"?
<thelema>
you won't get the ability to do (1 meter) + (2 feet) using the builtin (+) operator
<alexyk>
I always run ocaml with it and am happy arrows up/down work; didn't find how to do C-r equivalent though
<thelema>
wow. We should integrate this.
<alexyk>
the real killer feature would be an equivalent of zsh or ipython multi-line up/down -- switching through the whole consequtive lines for a fun
<alexyk>
thelema: I used it for months, was really happy to google it out
* thelema
wonders about licensing issues
<flux>
hmph.. readline should support externally stopping and resuming it..
<flux>
otherwise, how can you have asynchronous operations that generate output?
<thelema>
you should be able to get it working with bocaml - don't you just add the toprl to your .ocamlinit?
<alexyk>
thelema: I didn't change .ocamlinit, but launching bocaml shows garbage on arrows up/down
<alexyk>
doesn't work even after explicit #require "readline";;
<flux>
I think it's hardly a killer feature, but a good one nevertheles :)
<thelema>
curious...
<flux>
and license-wise I believe readline is not the optimal choice. perhaps libedit.
<flux>
this was discussed here briefly some time ago, btw
<thelema>
it's directly in the scope of our project - making ocaml easier and nicer for people to program in.
<alexyk>
thelema: my .ocamlinit starts with #use "topfind";; when I tell that to bocaml, it waits until interrupted
<thelema>
hmm..
<alexyk>
thelema: you can get the contact for programmer-monk.net from whois it
Mr_Awesome has quit ["aunt jemima is the devil!"]
<alexyk>
flux: you'd be surprised how a killer feature it is, NOT to have to arrow-up through a previous fun to get to the test line for it!
<alexyk>
:)
<alexyk>
zsh does it well, but zsh had years and years of debugging just that
<alexyk>
thelema: does bocaml load findlib by default? it tells me nothing which #use "topfind" tells me usually
<thelema>
yes, bocaml does
acatout has joined #ocaml
<alexyk>
thelema: so it hides the topfind's help stuff, right?
<olegfink>
a collective project run by a bunch of cool university (ex-)students
<alexyk>
olegfink: I wonder if you can sit on a Software Engineering Chair :)
<alexyk>
should it be факультет?
<alexyk>
(i.e. department?)
<Smerdyakov>
I'm sure the OOPS people have produced more results towards their original goal than the TUNES people have. TUNES is sort of a record-holder in that department. :P
<alexyk>
is there a way to do "^[0-9]{2}$" matching "10" with Str or I have to go to Pcre? is there a \d in Str?
<Smerdyakov>
Also, OOPS seems to be a university-sponsored project.
<olegfink>
oops is not really a project, it's a bunch of cool people
<olegfink>
there is a company, terkom, behind it.
<olegfink>
alexyk: I think db meant Chair as in председатель, not that it makes any more sense.
<alexyk>
ah, and then they all got chairs by cut and paste... my CS dept heads (Penn & Dartmouth) are chairs, so that works (once)
<olegfink>
but you're right, I should ask him what Chair really means
<alexyk>
you may have a dean too
* alexyk
sits on his Software Engineering Chair produly
* alexyk
proudly that is
<olegfink>
alexyk: I think the answer is neither, at least that's what ocamldoc suggests about Str.
<olegfink>
and also it has weird escaping conventions because it's embedded in ocaml strings
<alexyk>
olegfink: arrgh, where does Str get its regexp? from XIXth centiry?