2008-03-05

<hcarty> RobertFischer: Because GODI does not (currently) work with non-GODI OCaml installs
<RobertFischer> hcarty: Why wouldn't we use godi for that?
<hcarty> It may work well as a base for downloading and building unmet dependencies, though I don't know how the internals work
<hcarty> It can install and uninstall packages by name, and handle loading dependencies
<hcarty> ocamlfind would fit nicely as part of an OCaml CPAN
<hcarty> I am not on CPAN, but I'm a heavy user. Less so since I found OCaml, but CPAN is still a wonderful resource
<hcarty> "that holds" meaning that CPAN can install packages which require compiled code as well
<hcarty> evn: True, but that holds for libs which use C as well
<hcarty> I can install a Perl package from CPAN in (almost) the same way, regardless of if I installed from a binary package or source
<hcarty> But CPAN working regardless of initial installation method
<hcarty> evn: GODI is in the right direction
<hcarty> bluestorm_: Thank you, paste 41 is now in place and attributed
<hcarty> A CPAN-like tool would likely help somewhat, but community feelings seem mixed
<hcarty> flux: Good night
<hcarty> Yoric[DT]: I think putting OSR in a subject line does that already...
<hcarty> Do you have a list of your extensions somewhere?
<hcarty> bluestorm_: Oh, very nice
<bluestorm_> hcarty: ... but you can use one of my syntax extension to make the warning go away :-'
<hcarty> Each of them seems to work. 41 is particularly short and sweet, while avoiding the warnings of the "Highly naive" solution
<hcarty> Thank you all - this is both helpful and interesting on its own
<hcarty> flux: No
<bluestorm_> hcarty: first try : http://ocaml.pastewith.us/38
<hcarty> The list will be split in to 2 or 3 runs, of approximately equal size
<hcarty> I do not get any stack overflows with the code I have, and I don't think it is tail recursive
<hcarty> On the order of 10000
<hcarty> But each element should be unique
<hcarty> So [15;16;1;2;3] is a possible input
<hcarty> But the entire input list may not be
<hcarty> A given run will be sorted from smallest to largest
<hcarty> thelema: I take that back
<hcarty> The numbers I am splitting are array indices
<hcarty> thelema: That would be ok, but in this case it is safe to assume the list is pre-sorted from smallest to largest
<thelema> hcarty: do you want [1;2;3;2;1] to come out as one run?
<hcarty> Google has not provided much help, though I may be searching for the wrong thing(s)
<hcarty> The code I have now is http://ocaml.pastewith.us/37 but it seems like there should be a cleaner way
<hcarty> Does anyone here know of a nice, clean method of splitting a list (or array) of integers to consecutive runs? Taking [1;2;3;8;9;10;15;16] and returning [1;2;3] [8;9;10] [15;16]
<hcarty> Hopefully JoCaml will have/gain enough momentum to keep going
<hcarty> RobertFischer: I have not seen your post to the JoCaml list yet - perhaps the list is moderated?
<hcarty> "the list" being the JoCaml mailing list
<hcarty> RobertFischer: There is occasional noise on the list, but it is hard to tell which, if any, of JoCaml, CamlP3l, coThreads or OCamlMPI are worth following
<hcarty> bluestorm: Thanks, I will give the extension a try soon
<bluestorm> actually hcarty you could do the change yourself, by just exchanging position at line 72 : "with"; mt = module_type; ":"; me = module_expr -> ... (but still i'd be interested in your opinion)
<hcarty> bluestorm: That looks good
<bluestorm> hcarty: private type interface = ... with sig ... end : struct ... end ?
<hcarty> That seems accurate. And I am not sure of the best syntax or if it is worth it :-)
<hcarty> bluestorm: Yes, definitely
<bluestorm> hcarty: would a syntaxic extension that would *not* try to infer any signature from structure items still be useful ?
<hcarty> http://ocaml.pastewith.us/36 - This is a short piece of code, implemented using the method we are discussing
<hcarty> I would like to restrict a part of the interface (file I/O for a specific file type) so that a valid interface can only be generated by a Module.open_file function
<hcarty> The real module has a large number of automatically generated functions (C library binding) along with some higher level hand written functions
<hcarty> flux: Yes, definitely
<hcarty> bluestorm: Thank you very much for the offer - I would happily use it
<hcarty> It was copied and pasted from the toplevel, and there edited repeatedly
<hcarty> bluestorm: Yes, that's what I'm thinking of using now
<hcarty> This is where I find OCaml's objects appealing
<hcarty> This may be possible with camlp4, but if so it's far beyond my experience with it
<hcarty> With the only effect being that type t is made abstract. The rest of the module still gets exported
<hcarty> I would like something along the lines of sig type t ... end = struct type t = float let foo = (rest of module here) end
<hcarty> Which is not particularly attractive or elegant, but may be what I am stuck with. Unless there is a way to provide a partial signature which only constrains a few types and values. But that does not seem to be possible either.
<hcarty> module Foo = struct module Test : sig type t = private A val a : t end = struct type t = A let a = A end include Test end;;
<hcarty> It looks like the simplest work around is something like
<hcarty> The module is quite large and I am hoping to not have to maintain the interface/signature by hand
<hcarty> I'm just looking for the "can't create value..." outside of module functions
<sgnb> hcarty: private doesn't make sense inside struc...
<hcarty> I have a camlidl ocamlbuild plugin/rule to add to the list of examples
<hcarty> Oh, on the camlp4 section. I was looking through ocamlbuild.
<hcarty> evn: Ah, thanks... I should have checked there :-)
<hcarty> The "Login/Create account" page does not have an option to create one
<hcarty> Is it possible to create an account on the Gallium/ocamlbuild/camlp4 wiki?
<hcarty> pango, bluestorm, mbishop: Thank you for your help and tips. I went with pango's latest suggestion as that seems to be about as clean as I will get for now
<hcarty> So I'm stuck with String.* functions, unless I find a way to link Str or PCRE
<hcarty> ocamlbuild does not have an option (that I see) to use external libraries in its plugins
<hcarty> bluestorm: Ah, nice. That should do the trick. Thanks.
<hcarty> mbishop: I don't know how to use Str from inside ocamlbuild

2008-03-04

<hcarty> So it could be anything from "" to " ..."
<hcarty> Sorry, I mistyped - all whitespace is what I'm looking for
<hcarty> How would I check for an empty string in myocamlbuild.ml? Is there a way to use the Str or Pcre libraries?
<hcarty> If you included the code on both ends you could use a variant or string to tell the client what to run. That would be much less flexible though.
<hcarty> The docs say sending a functional value with give a run-time error
<hcarty> Actually... that looks like what the JoCaml docs are calling "code mobility"
<hcarty> pango: Yes, Mosix is what I was thinking of
<hcarty> Under some systems, a running process can be migrated to a different node in a cluster, for instance
<hcarty> A process in the OS sense, I suppose. I do not know the proper terminology
<hcarty> Mobile process, or something similar
<hcarty> Whatever the proper replacement for process is then
<hcarty> s/being able//
<hcarty> I think code mobility in this case is the ability of an individual process being able to move from one system to another

2008-02-28

<hcarty> bluestorm: Very nice, thank you for putting that out. The automatic use of function names would be handy for a simple version, but this is very nice as is.
<hcarty> bluestorm: I would be interested in a let foo x = TODO kind of camlp4 extension if you decide to write it

2008-02-27

<hcarty> Oh yes, will do
<hcarty> BZs?
<rwmjones> hcarty, yes I think just install F8 and them use the SRPMs directly. They may just need to have the BuildRequires adjusting
<hcarty> F8 may be safer regardless
<hcarty> rwmjones: Thanks for the tip. I am at a conference now, hence the lack of testing so far. I'll see what the state of F9 is when I get home and pick an install method from there.
<rwmjones> hcarty, I don't think F9 installs at the moment, at least people on fedora-devel-list were talking about that. You can always install F8 and upgrade through enabling the development repo though.
<hcarty> flux: That link is the only English-language description I've seen, though there was at least one other post on it in French
<hcarty> rwmjones: Ok. I think I am going to put the latest Fedora 9 pre-release on a test partition to do so
<jstanley> hcarty: yeah, def. looks interesting.
<hcarty> jstanley: You are welcome - it looks like a nice wrapper, but I have not used it beyond compiling the example
<hcarty> rwmjones: And I will be testing several of those Fedora/RHEL OCaml packages in the next 7-10 days. Thank you for putting them together
<hcarty> rwmjones: Working with legacy code/data libraries/gui seems to be sadly C-entrenched
<jstanley> hcarty: thanks.
<jstanley> hcarty: i'd be interested in taking a look, anything that might clean up this mess would be a good thing.
<hcarty> They seem to be very simple, but may be helpful for your binding generation
<hcarty> jstanley: I don't know if it will help, but I saw a few recent posts on one of the OCaml feed aggregators on inline-C in OCaml

2008-02-26

<hcarty> And it may break if you added D of 'a or similar to type t ... I'm not sure
<hcarty> Perhaps not ideal for long term, but for testing or prototype purposes it may help
<hcarty> external t_to_int : t -> int = "%identity";;
<hcarty> type t = A | B | C
<hcarty> Snrrrub: For a variant -> int, you could use some "%identity" trickery

2008-02-21

<hcarty> s/this//
<hcarty> Yes, this an empty array would definitely be an exception here
<bluestorm> hcarty: don't you check the [| |] case ?
<thelema> hcarty: good.
<hcarty> thelema: I settled on http://ocaml.pastewith.us/34 - In this case it's for an array. I would go with fold_left for a list though
<thelema> hcarty: one semi-solution - List.fold_left min max_int l

2008-02-20

<hcarty> I second the recommendation for Jason Hickey's book - it's quite nice
<hcarty> tuareg generally catches that sort of thing for me, but that would be a very useful debugging aid
<hcarty> Ok, I see
<hcarty> So using ;; at a given point would report some cascading error there, rather than further along in the source?
<thelema> hcarty: using ;; at the end of my top-level phrases. It makes sure that I've completed the phrase at the point I think I've completed it. (it helps me localize phrasing errors in what I've written.)
<hcarty> I have found that using ;; ends up hiding small typing issues which turn up as errors later on
<hcarty> thelema: using ;; or not using it?
<thelema> hcarty: I find that using it makes the compiler (slightly) more strict on what I write
<hcarty> coucou747: That's what I use, or a value from a library
<hcarty> AxleLonghorn: My understanding is that it is the compiler finding the end of each expression. Using ";;" in compiled code can hide errors at times

2008-02-19

<_W_> hcarty, yeah I figured something like that was up, it's just that the text on that page made it appear as if there WAS a binary, and they just forgot to link to it or something
<hcarty> _W_: Windows binary packages are something the OCaml team recently asked for help on
<hcarty> Array.reduce_left min [|1;2;0;5|];;
<hcarty> Oh my, I'm very sorry about that
<hcarty> module Array = struct include Array let reduce_left f a = fold_left f a.(0) (sub a 1 (length a - 1)) end;;
<thelema> hcarty: just giving credit where it's due.
<hcarty> thelema: Thanks, I think I will use those names
<hcarty> Oh no! I can't use them then... :-)
<thelema> hcarty: that's the python name
<hcarty> I like "reduce"...
<hcarty> jderque: Thanks
<jderque> hcarty: it's called foldl1 in haskell : "foldl1 is a variant of foldl that has no starting value argument, and thus must be applied to non-empty lists."
<hcarty> s/is/it is/
<hcarty> Thank you for both of the examples, but is the naming convention that I am wondering about
<hcarty> coucou747: That works, I am just wondering if there is a standard name
<thelema> hcarty: one semi-solution - List.fold_left min max_int l
<coucou747> hcarty> es geht ?
<hcarty> And find doesn't really apply for all uses...
<hcarty> "find" is the first thing that comes to my mind, but it has a different meaning in the stdlib
<hcarty> Then foo min [1;2;3] to find the smallest item in the list
<hcarty> Is there a standard name for a fold using only the contents of the given list/array? Something like: let foo f l = List.fold_left f (List.hd l) (List.tl l)
<hcarty> Yes
<hcarty> orbitz: Not really, except in mapping to a filename

2008-02-18

<hcarty> "they" being name clashes
<hcarty> Or, at least, they are a different issue
<hcarty> And, when speed is less of an issue, the name clashes that come with structures are not such an issue
<hcarty> But anonymous object creation can be useful
<hcarty> bluestorm: They probably can in some cases. And they seem to require more manual type annotations than other OCaml code
<hcarty> LordMetroid: The OO parts of OCaml are fairly nice and easy to use in OCaml as well - they mix well with OO or non-OO code
<hcarty> The Sdflow library has let (|>) x f = f x, so I use that operator
<hcarty> thelema: I use xf, as I find it saves a lot of typing
<Smerdyakov> hcarty, I still place the probability at close to 0.
<hcarty> Which Microsoft is
<hcarty> Smerdyakov: They would be much more likely to from someone who is part of the consortium

2008-02-15

<jstanley> hcarty: yeah there's lots of stuff to go C -> OCaml
<hcarty> camlidl goes the other way...
<hcarty> Sorry, misread the question
<hcarty> jstanley: camlidl

2008-02-13

<hcarty> Oops, sorry
<hcarty> Or a default value, like bluestorm's example

2008-02-12

<hcarty> Oops... gone
<hcarty> You are more likely to get a good answer in #sml

2008-02-11

<mbishop> hcarty: that's a good tip
<hcarty> Since you will get a warning/error if the type doesn't end up being ()
<hcarty> kig: Using let () = ... rather than let _ = ... can help catch errors

2008-02-10

<hcarty> Some base grades only on exams, others only on HW
<hcarty> s/departmnet/department/
<hcarty> bluestorm: It varies from school to school and department to departmnet
<hcarty> cheatersrealm: Ugly code is ok... it's (often) part of learning a language
<Smerdyakov> I think my link is to the latest version of what hcarty linked.
<hcarty> http://www.cs.caltech.edu/courses/cs134/cs134b/book.pdf -- This is a nice one as well

2008-02-08

<hcarty> With several projects just using custom Makefiles
<hcarty> Snrrrub: I think it's split between OCamlMakefile, omake and ocamlbuild

2008-02-07

<hcarty> flux: Thanks for the tip :-)

2008-02-06

<jstanley> hcarty: alrighty, thanks.
<hcarty> jstanley: You may want to ask on the list - there is generally a better chance one of the INRIA folks will pipe in with help
<hcarty> It makes it much easier to get up and running
<hcarty> letrec: I would recommend godi as well for a source install of OCaml

2008-02-01

<hcarty> Thanks for putting it out
<hcarty> I am enjoy the pieces of your comprehension library I have used so far
<hcarty> I am well thank you! And you?
<hcarty> Hello Yoric[DT]
<hcarty> olegfink: What editor/environment are you using?

2008-01-31

<jstanley> hcarty: yeah, the reasonable approach with CAMLparam0/CAMLlocal1 to hold a resulting object ref value, and CAMLreturn isn't cutting it -- let me know if you feel like peeking at my code and seeing if you can see anything amiss.
<hcarty> I think it's a precedence issue
<hcarty> Or let () = object#function in
<hcarty> That too
<hcarty> You are welcome
<hcarty> You need () around the stuff between "then" and "else"
<hcarty> Good luck!
<hcarty> Since the CAMLparam, CAMLlocal and CAMLreturn macros are (from what I understand) what keep an OCaml value alive
<hcarty> Then (perhaps?) the GC should Do The Right Thing
<hcarty> If you handle the return value of new_solver() with CAMLlocal it should be ok
<hcarty> I do not know how you would signal the GC to say "I'm done with this one" though
<hcarty> Since the object should have a C type of value
<hcarty> CAMLreturn may do the magic for you
<hcarty> But I don't know if there is an equivalent to the CAMLlocal macros for this
<hcarty> I think if you declare it as a value type, and return it as such, then it should work?
<hcarty> That makes sense
<hcarty> Ah, ok
<jstanley> hcarty: yeah, because the main() in the C program invokes the caml runtime which just uses Callback.register on a lot of caml functions.
<hcarty> jstanley: Do you have the OCaml GC running in your program? I haven't used an OCaml lib from a pure-C program, so I don't know the details of how that works.
<hcarty> in C
<hcarty> The function ml_plotter is used as a callback
<hcarty> http://www.linux-nantes.org/~fmonnier/OCaml/ocaml-wrapping-c.php -- That's the link, but I was mistaken. I don't think it has what you want.
<jstanley> hcarty: awesome, thanks much. most examples i've seen just demonstrate how to make an ocaml binding for a C lib. I want to do the opposite and need to make sure that there's nothing funky going on with heap mgmt.
<hcarty> jstanley: Someone posted a tutorial link on one of the lists recently... I'm trying to find the link
<hcarty> kbidd: You can also do let foo = ... and blah = ...
<hcarty> It makes testing camlp4 extensions much more difficult
<hcarty> bluestorm: Ok, thanks. I'll check Mantis to see if it's been reported
<bluestorm> hcarty: looks like a bug
<hcarty> Any following give that error
<hcarty> The first will load without issue
<hcarty> Sorry, I didn't explain - the error comes up when "#use"ing more than one .ml file
<hcarty> Is there a way to get around the "I/O error: Bad file descriptor" error when using a camlp4 extension in the toplevel?
<hcarty> Yoric[DT]: Do you know which is faster, an option type or an exception?

2008-01-29

<hcarty> That does not stop everyone's informed opinion from being different...
<hcarty> For some of us, it's the only thing we have a chance to voice a somewhat informed opinion on :-)
<hcarty> \

2008-01-28

<bluestorm> hcarty: to what i personally understood, Xavier Leroy didn't say they would include anything inside the inria-provided packages
<hcarty> 08.01.26 - has the meeting transcription as well as a link to the Cal Tech book. Seems worth keeping around.
<hcarty> Excellent, thank you
<flux> for the record, I use flux hcarty pango :)
<hcarty> Sadly, I only have ~1 day in by buffer currently :-)
<hcarty> Where are the IRC logs for #ocaml? Someone provided a link a few days ago, but I can't find it...

2008-01-26

<hcarty> mbishop: Thanks for the pointer to the updated book
<hcarty> The development of OCaml is (from what I understand) more closed than Haskell - at least GHC

2008-01-25

<hcarty> Probably... but that does not make it less confusing when it first happens
<hcarty> bluestorm: except in (fun (x,y) -> ...) which ends up biting me now and then

2008-01-24

<hcarty> I've found it to be both, but OCaml was my first trip in to FP as well
<asmanur> hcarty: hum, i think it's more useful than fun
<hcarty> asmanur: But part of the fun/utility of OCaml is the ability to use whichever style fits

2008-01-23

<hcarty> flux: Perhaps godi is worth a try? Or a manual backport of Debian 3.10.x packages

2008-01-10

<hcarty> jonafan: My guess is so that it can be set at the start of a program, rather than needing to link a separate Sys library for toplevel vs compiled

2008-01-09

<hcarty> I worked for a web app place for a while who ran some very large sites with Perl. I personally really like the language, but it definitely has its weak points
<flux> hcarty, nothing beats use CGI for simple stuff :)
<hcarty> There are always Perl and Python low(er)-level CGI libraries as well
<hcarty> middayc: There are a few examples using the ocamlnet CGI library in the ocamlnet svn repository

2008-01-08

<hcarty> flux: Yes, I tried adding another two wheels on top of the buggy, so it could roll and still move. It took a lot of tinkering to make it work
<flux> hcarty, hm, it's not that simple that physics stuff after all, I fail add adding a spring between wheels :) (I think I'd need to apply a torque to wheel2 too)
<hcarty> I added the #use "topfind";; line
<hcarty> I believe so
<hcarty> Rear vs front wheel spinning I think
<hcarty> Yes, you're right - I forgot to add that
<hcarty> ~/.ocamlinit that is
<hcarty> Put whatever commands you'd like to use automatically in there
<hcarty> .ocamlinit
<hcarty> Mouse buttons can make it go forward (left button), backward (right) or flip the buggy (middle)
<hcarty> flux, middayc: Moonbuggy in a bubble if you're interested: http://0ok.org/code/ocaml/moon_buggy.ml
<hcarty> middayc_: The code overall looks pretty nice by the way
<hcarty> For a simple project it should be fairly straightforward to switch between the two
<hcarty> I do not know how the performance would change. The impact would likely depend on what else is being done when you access an element
<hcarty> I would do the same, or use a Hashtbl and name them, or Map
<hcarty> At least when coming from a C/C++/etc background
<hcarty> It can take a little while to get a feel for it
<hcarty> As I understand it, it's when it comes to "something that can be returned" - but I don't know the proper terminology
<hcarty> middayc_: ;; is only needed in the toplevel
<hcarty> middayc_: Glad to help
<hcarty> It may be listed as Caml rather than OCaml
<hcarty> Several of the pastebin sites out there do support OCaml... http://pastebin.be/ and http://ocaml.pastewith.us/ are two of several
<hcarty> I just edited a demo file which came with the chipmunk bindings
<hcarty> middayc_: No no, that was someone else
<hcarty> middayc_: http://www.gnu.org/software/src-highlite/ -- though I don't know if windows will still be a problem?
<middayc_> hcarty ... you made the chipmunk and allegro bindings?
<flux> hcarty, maybe a bit, but I think it makes it more consistent
<hcarty> flux: re: my moonbuggy edits - it definitely makes it less tutorial-like
<hcarty> middayc_: I think that can be done from vim and/or emacs
<flux> hcarty> flux: http://0ok.org/code/ocaml/moon_buggy.ml -- I "updated" the demo, making it a bit cleaner and hopefully easier to add pieces to -- any thoughts?
<middayc> what moon_buggy (I came late .. the first thing I see is "<flux> hcarty, btw, if the idea ..." )
<flux> hcarty, btw, if the idea of moon_buggy is to demonstrate the capabilities of the library, perhaps such a released version should have multiple versions: from simple to complex. sort of like a tutorial..
<hcarty> I haven't compiled it. I've been #use-ing it from the toplevel
<hcarty> flux: http://0ok.org/code/ocaml/moon_buggy.ml -- I "updated" the demo, making it a bit cleaner and hopefully easier to add pieces to -- any thoughts?

2008-01-07

<hcarty> Impressed overall though as well
<hcarty> "impressed with Chipmunk's performance" that is
<hcarty> I'm really impressed with Chipmunk... the CPU use is impressively low for each of the 7 included demos
<hcarty> Though I imagine it would still be decent in bytecode given the the physics stuff is still compiled C
<hcarty> The native toplevel is in a CVS OCaml branch I think... with some playing around with that and OpenGL you could make quite a nifty playground
<hcarty> I have a research project I'm working which does the same thing, but for 3D concave shape -> set of convex shapes
<hcarty> The video game world has come up with and/or applied a lot of cool tricks which have interesting applications in physical problems
<hcarty> It's just a lot easier to ask "is this point inside?" with a convex shape than with a concave one
<hcarty> It's been solved, I think - the research is on ice crystals, so the concave -> convex is a step along the way
<hcarty> It's fun stuff to think about
<hcarty> Or a set of convex polygons
<hcarty> Have you watched the videos on the main Chipmunk page? Particularly the sketches and machine videos
<hcarty> It looks promising for something like gears
<hcarty> Definitely. If you don't, I probably will when I have time
<hcarty> If only :-)
<hcarty> And it seems to be very CPU efficient - I'm looking forward to getting a chance to play with the OCaml bindings
<hcarty> The demos are some of the coolest toys I've seen in a while