mbishop changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab OCaml 3.10.2 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
<palomer> I love polymorphic variants
<palomer> they're intersection types and union types rolled into one
<palomer> but the error messages are undecipherable
Hadaka has quit [leguin.freenode.net irc.freenode.net]
Hadaka has joined #ocaml
coucou747 has quit [Read error: 113 (No route to host)]
LordMetroid has joined #ocaml
<palomer> thelema, you in?
<thelema> palomer: I am.
LordMetroid has quit [Client Quit]
<thelema> intersection types?
<thelema> [mix & match as you will] types
<palomer> yay!
<thelema> what can I do you for?
<palomer> for the life of me I can't figure out how to get a [> `textview ] Gtk.obj
<thelema> GtkText.create and .create_with_buffer make them.
<thelema> type text_view = [ `container | `gtk | `textview | `widget ]
<palomer> oh
<palomer> I'm creating my textview with GText.view ~buffer:buffer ~packing:source_window#add
<palomer> so I have to change the way I create textviews?
<thelema> where does GText.view get defined?
<thelema> I see GText.View as a module.
<palomer> I know!
<palomer> I have no idea why it works
<palomer> I got it from the tutorial
<thelema> hmmm...
<thelema> ah, ok. that'll work. It doesn't seem to be defined, but view is in the src.
<palomer> what should I switch it to?
<thelema> and it calls either View.create of View.create_with_buffer depending on its arguments.
<thelema> create is in GtkTextProps.TextView (included at the top)
<thelema> but you want create_with_buffer anyway.
<palomer> but it'll do the same thing
<thelema> yes, you should get a Gtk.text_view Gtk.obj out in the end.
<thelema> so what's the problem? you can't call set_buffer on the result of your GText.view function?
<palomer> err
<palomer> no problem
<palomer> but I'm creating a buffer the same way:P
<thelema> s/set_buffer/get_window/
<palomer> what's the standard way to create a buffer?
<palomer> I'm using GText.buffer
<palomer> (also undocumented)
<thelema> GText.buffer ()
<thelema> grr, why is this undocumented...
Amorphous has quit [Connection timed out]
<thelema> (** @gtkdoc gtk GtkTextBuffer *)
<thelema> val buffer : ?tag_table:tag_table -> ?text:string -> unit -> buffer
<palomer> ocaml doesn't like it when I use create_with_buffer on GText.buffer
<palomer> This expression has type GText.buffer but is here used with type
<palomer> Gtk.text_buffer = [ `textbuffer ] Gobject.obj
Amorphous has joined #ocaml
<thelema> hmm, yes. The types don't match up...
<thelema> try using GtkText.Buffer.create []
<thelema> apparently this generates a different kind of buffer.
<palomer> well, create_buffer accepts it
<palomer> but this new kind of buffer doesn't have the method create_tag
<palomer> (whereas GText.buffer () does)
* palomer is under the impression that lablgtk is actually two distinct APIs
<thelema> gtk1, gtk2
<palomer> with two interfaces
<palomer> (object based vs module based)
<palomer> so the documented stuff is the latest interface?
<palomer> the one that's module based
<thelema> I don't know that - it'd be a good question for Jacques. When you find out, let me know.
<palomer> is there any way to get the drawing window with something created with GText.view
<palomer> as yes, #get_window
<thelema> get_window doesn't work?
<palomer> err, my code depends on GText.window
<palomer> if I use GtkText.create_with_buffer then I have to rewrite a lot of stuff
<thelema> ah, GText vs GtkText...
<palomer> yeah, two interfaces to the same thing
<thelema> so you need to know what Gtk.Tage.window_type to pass to #get_window?
<thelema> *Tags
Loki_ has quit [Read error: 113 (No route to host)]
<palomer> err
<palomer> `WIDGET
<palomer> I'm guessing
* thelema would guess that too...
<palomer> nom I'm trying to figure out how to call Gdk.GC.create on whatever #get_window returned
Loki_ has joined #ocaml
seafood_ has joined #ocaml
<palomer> wait, it works
<thelema> seems pretty straightforward, looking at the types
<palomer> hrmph
<palomer> can't seem to find draw_rectangle
<palomer> supposed to be in Gdk
Axioplase has quit ["Lost terminal"]
<palomer> ahh, found it
<palomer> Gdk.draw
<palomer> this is looking to get complicated!
<palomer> the things I do for cleaner code!
Hadaka has quit [Read error: 145 (Connection timed out)]
Hadaka has joined #ocaml
<palomer> thelema, any idea how to create a Gdk.color?
<palomer> I want to set the foreground/background of the gc
<palomer> I'm scared of the functions in Gdk.Color
<palomer> (alloc is a scary name!)
* thelema checks
<thelema> Gdk.Color.alloc (Gdk.Color.get_system_colormap ()) (`RGB (0,0,0))
<palomer> ok, so it IS that function
<thelema> yup.
<palomer> my attempt
<palomer> which fails
<palomer> nothing happens :/
<thelema> is there a pink color?
<thelema> I guess it should error out in that case.
<palomer> pink is a colour
<palomer> I've used it plenty of times!
<thelema> I've never used pink as a gtk color.
<palomer> ok, I changed it to red, still nothing
<palomer> I use "pink" and "light blue" mostly
<palomer> sky blue isn't a colour :/
* thelema rebuilds his lablgtk2 to work with his current community-ocaml
<thelema> hmm, okay - it doesn't draw on my computer either...
<palomer> strange, eh?
<palomer> maybe it's the call to realize that makes all the difference?
<palomer> oh wait, the answer is on the page
<palomer> "Sounds like an expose event needs to be signaled"
<palomer> what the blazes does that mean:P
<thelema> hmm, I think it might be the realize - try showing the window and *then* painting on it.
<palomer> that's what I'm doing, no?
<thelema> maybe you can't paint on the window before it's realized(which creates the GDK resources for it), and
<thelema> n/m...
<thelema> Many times when you think you might need it, a better approach is to connect to a signal that will be called after the widget is realized automatically, such as GtkWidget::expose-event. Or simply g_signal_connect_after() to the GtkWidget::realize signal.
<palomer> so view#event#connect#expose ~calleback: (fun _ -> view#realize) ?
<thelema> no, #connect#expose ~callback:(fun _ -> draw rectangle)
<palomer> still doesn't work
<thelema> hmmm...
<palomer> I tried both connecting view#event#expose and source_window#event#expose
<palomer> I also added a call to realize
<palomer> no go
<palomer> view#misc#realize (); <--calling realize
<thelema> I now think that won't help...
<palomer> I tried putting the whole code in the callback
<palomer> no go
<thelema> beats me.
<palomer> in fact
<palomer> I have another program where I draw rectangles constantly
<palomer> to no effect
<palomer> what does realize do?
<palomer> I can't add whatever is returned by GtkText.View.create [] to a GtkWindow
<palomer> bummer!
Jeff_123 has joined #ocaml
CrawfordComeaux has joined #ocaml
<palomer> hullo Jeff_123
<palomer> how's your int64 lib going?
<Jeff_123> it's good. just doens't link in native mode
<Jeff_123> I'm done working on it. If someone else can fix it then i'll give them svn acess.
<palomer> that's the spirit!
<Jeff_123> I have other things to work on :\
<palomer> I've got similar issues
<palomer> but I can't quit:\
<Jeff_123> you and your complicated objects
<Jeff_123> (or was that someone else)
pango has quit [Remote closed the connection]
pango has joined #ocaml
<CrawfordComeaux> I'm trying to decide if I should be coding something in ocaml or sml...
<CrawfordComeaux> what should I base my decision on?
<palomer> Jeff_123, it was me
<palomer> but my current issue is with gtk
<palomer> CrawfordComeaux, one answer: ocaml
<palomer> it has more libraries
<palomer> more usability features
<palomer> an object system
<palomer> better emacs support
<palomer> not to mention otags and omake
<palomer> anyone know how to do "dir foo*" in ocaml?
<palomer> make that "ls foo*"
<CrawfordComeaux> performance is a big factor
<CrawfordComeaux> I was looking at the mlton compiler as a possibility
<palomer> mlton is cool
<palomer> if you're only interested in performance, check out mlton
<CrawfordComeaux> it's going the be the backend of a webapp
<palomer> then I'm expecting you'll need libraries
<orbitz> Smerdyakov has some web framework/langauge he thinks will revolutionze the world
Kopophex has quit [Read error: 110 (Connection timed out)]
<palomer> orbitz, seriouslp;P?
<CrawfordComeaux> what is it?
<palomer> I think it's called "scheme"
<orbitz> no it starts with an L
<CrawfordComeaux> lisp?
<orbitz> no i thin it' strongy typed
<palomer> lojban!
<orbitz> liek laquonic or osmethign
<orbitz> there was a / in there too
* palomer screams "I WANT MUTUALLY RECURSIVE MODULES!"
<orbitz> you just wante verything
<orbitz> you are 'that guy'
<CrawfordComeaux> I just want the summer to start and then immediately finish so that I can have my web app finished!
<orbitz> that only works when you do work inbetween
<CrawfordComeaux> personally, I think it'll revolutionize parts of the world and my name might end up being taught to students somewhere, someday
<CrawfordComeaux> yeah...I know...I just really want to see how it turns out and if I'm blowing it out of proportion as far as what it'll be capable of
<palomer> haha
<palomer> I think everyone in this channel thinks he's working on the next big thing
<CrawfordComeaux> yeah, but cmon now...I think if you're not even sure what your software will be capable of, either you shouldn't be coding or you're creating skynet
<CrawfordComeaux> the idea alone helped me get a free web host!
<CrawfordComeaux> I think the guy said something like 10GB space and 50GB bandwidth/month....
* palomer is creating skynet
<CrawfordComeaux> I dunno...I just remember thinking "that's way more than I'll need for a long time"
<palomer> that's what I tell people who ask me what I do
<palomer> no kidding
<CrawfordComeaux> I tell them I slowly die as I try to finish school
<CrawfordComeaux> my job's not yet interesting enough to even bother claiming it's skynet
<CrawfordComeaux> though I did have to implement the kermit protocol for it...
<palomer> you work?
<CrawfordComeaux> fairly certain the number of 25-year olds that can claim that and also don't work for companies creating communication software is a very low number
<CrawfordComeaux> work from home programming...it's a dream :)
<palomer> which language?
<CrawfordComeaux> c# with .net 2.0
<dobblego> got any openings? :)
<CrawfordComeaux> you have to be regionally located
<CrawfordComeaux> and you don't want to be...that means living in louisiana or mississippi
<dobblego> I'm in the same solar system as you
<dobblego> oh
<CrawfordComeaux> what...no snide remark ;)
<dobblego> I'm not regionally fluent enough to do that
<dobblego> not in the US
<CrawfordComeaux> ah ok
<CrawfordComeaux> well regardless...I'M writing skynet
<CrawfordComeaux> AND taking a cigarette break...
CrawfordComeaux is now known as Crawford|sssssss
Crawford|sssssss is now known as Craw|sssssmokin
al-maisan has joined #ocaml
Craw|sssssmokin is now known as CrawfordComeaux
<CrawfordComeaux> palomer: I'll tell you about my skynet if you tell me about yours
<CrawfordComeaux> and also, laconic seems like it could revolutionize the world
<palomer> my skynet WILL revolutionize the world, though
<palomer> what's laconic?
<palomer> Smerdyakov's dig?
* palomer goes takes a walk
Mr_Awesome has joined #ocaml
Jeff_123 has quit [Read error: 104 (Connection reset by peer)]
al-maisan has quit ["Leaving."]
al-maisan has joined #ocaml
<CrawfordComeaux> yeah
<CrawfordComeaux> sorry about that...reading up on the chord lookup system I need to code before friday
<CrawfordComeaux> strike that...saturday
ygrek has joined #ocaml
<palomer> piano chords?
<CrawfordComeaux> chord peer-to-peer lookup
<CrawfordComeaux> what's your skynet?
<palomer> a programming language
<palomer> go figure
<CrawfordComeaux> lol...mine kind of is too....why's yours awesome?
<palomer> it does many things differently
<palomer> yours?
<CrawfordComeaux> model/simulate systems by creating plain-english rulesets that explicitly define the system's behavior
<CrawfordComeaux> originally, it was just going to be a webapp for playing nomic variants in real-time with an automated referee
<palomer> cool
<palomer> one of my projects aims is to be able to code in plain english
<palomer> but, then again, its an old idea
<palomer> so your language is a DSL?
<CrawfordComeaux> then I realized that I could implement standard board game objects like boards, cards, pieces, and dice in the interface and not require the defining aspect of nomic variants (players being able to add/delete/amend a rule in the current ruleset)....voila - ability to model/simulate/play most games
<CrawfordComeaux> yep
<CrawfordComeaux> and then I realized that just because I'm calling it a game, that doesn't mean the rulesets have to actually define a game
<palomer> erm, I never studied it, but you checked out game theory?
<CrawfordComeaux> what aspect of game theory?
<CrawfordComeaux> so now you've got an english-driven web-based simulator that allows you to export its state at any point...AND can be scripted via the rules...so gameplay/operation can be automated as well
<palomer> btw, are you french?
<palomer> your names french
<CrawfordComeaux> cajun
<CrawfordComeaux> you typically don't find the 'x' at the end in france
<CrawfordComeaux> usually just in nova scotia, louisiana, or any other places that the british deported the acadians to
<CrawfordComeaux> if it's in france, it probably showed up at the same time in history
<palomer> they were deported from new brunswick to nova scotia?
<CrawfordComeaux> from nova scotia to louisiana, mostly
<palomer> can you speak french?
<CrawfordComeaux> un petit peu
<CrawfordComeaux> I'm sure my grammars horrible and my vocabulary super-spotty
<palomer> well, erm, ocaml has a strong french connection
<palomer> (which you probably know of)
<CrawfordComeaux> I wasn't aware
<palomer> it was developed at INRIA
<palomer> so what tools do you need to implement your skynet?
<CrawfordComeaux> pretty much just an adaptable CMS to let me easily create the interface and the ml backend...though the details haven't even been designed yet
<CrawfordComeaux> once school's over, I have another week left of contract work...then my summer of code project starts
<palomer> CMS?
<CrawfordComeaux> content management system
<CrawfordComeaux> something like joomla or drupal (just naming them because they're popular right now)
<CrawfordComeaux> lots of php
<palomer> ahh, you want to compile INTO ml
<palomer> that's what I'm doing
<CrawfordComeaux> yep
<CrawfordComeaux> but how the dynamic nature of the whole game is best laid out in the code is still something that needs more thought
<palomer> well...ocaml has obj.magic
<palomer> that lets you bypass the type system
<CrawfordComeaux> I don't think I want to bypass the type system
<CrawfordComeaux> abstract types are one reason for using ml
<CrawfordComeaux> but strict usage of the types
* palomer had to bypass the type system in his language
<CrawfordComeaux> should make the implementation of the dsl much easier
<palomer> have you ever done any functional programming?
* CrawfordComeaux had to implement the type system last semester...in ml
<CrawfordComeaux> yeah...my programming languages professor's a sadistic son of a bitch...
<CrawfordComeaux> I learned SNOBOL4, SML/NJ, and SmallTalk last sem
<palomer> heh
<CrawfordComeaux> each assignment was inspired madness....for SNOBOL4, write a recognizer for algol68 programs...for ML, code the hindley-milner type inferencing system to typecheck ML programs....
<CrawfordComeaux> for SmallTalk, create an object that performs EXACTLY like a C++ switch statement...
<palomer> how does that work?
<CrawfordComeaux> including nested cases....ugh
<CrawfordComeaux> I don't remember...I coded it in a few hours.
<CrawfordComeaux> don't even remember the syntax of the language
<CrawfordComeaux> I could so very much care less, too. that language is the devil
* palomer has implemented a hindley milner type checker maybe half a dozen times
<CrawfordComeaux> ML I can handle. SNOBOL4, I don't know if I could really code much in it. Pattern-based languages don't inherently give rise to obvious applications
<CrawfordComeaux> not when you're talking about just crunching numbers, anyway
<palomer> so much of the world isn't about crunching!
<CrawfordComeaux> yes yes...I'm just being grouchy now, sorry
<CrawfordComeaux> in any case, I'd rather be chatting about A) my skynet, B) your skynet, or C) my joy at simply being accepted for google's summer of code
<palomer> congrats!
<CrawfordComeaux> thanks :)
<palomer> the summer of code will be about your skynet?
<CrawfordComeaux> one more reason to think I'm writing skynet
<CrawfordComeaux> yep
<palomer> I'm spending my summer continuing to write my skynet
<palomer> been writing in since february
<palomer> it's a beast!
<CrawfordComeaux> sounds like it! tell me more
<palomer> well, I got a fat scholarship to work on it
<palomer> make that medium weight
<palomer> but I'm considering presenting it to industry instead
<CrawfordComeaux> cool...what does it do? what IS it?
<palomer> it's a programming language and a structure editor to go with it
<palomer> lemme find something in the same vain
<CrawfordComeaux> how's it work? what does it do?
<CrawfordComeaux> okie dokie
<palomer> erm, can't find the thesis
<palomer> well, instead of editing text, you're editing the AST directly
<palomer> no parsing
<palomer> this, of course, is an old idea
<CrawfordComeaux> ok...how does that work?
<palomer> in my system you move around the AST with the arrow keys
<palomer> and you edit whatever needs to be edited
<palomer> one of the advantages is that you never get any syntax errors
<palomer> because there is no syntax
<palomer> no keywords
<palomer> pure goodness
<CrawfordComeaux> any examples? I've been up 3 days...I need pictures
<palomer> this guy's structured editor is very spiffy
<palomer> spiffier than mine
<CrawfordComeaux> that's neat
<palomer> very neat
<palomer> they were very hot in the 80s
<palomer> then they died out
<CrawfordComeaux> hmm...does it really allow you to do very much?
<palomer> standard structured editors have several advantages
<palomer> they lower the learning curve
<palomer> no parsing means faster compilation
<palomer> erm
<palomer> ok, I'll be honest, its a silly idea:P
<palomer> but mine's different
<palomer> !
<CrawfordComeaux> well? spit it out! how?!
<palomer> but I'll be revealing all my secrets
<palomer> !
<CrawfordComeaux> well fine then...don't talk to me about it
<palomer> CrawfordComeaux, I sent you a private message!
<palomer> oh wait, I'm not registered
<palomer> one sec
<CrawfordComeaux> AHA!
<CrawfordComeaux> I was about to curse mibbit
<palomer> CrawfordComeaux, think of it as advanced code completion
<CrawfordComeaux> gotcha
<palomer> CrawfordComeaux, so how are you going to implement your english like rules?
<palomer> you'll have to implement your own parser generator?
filp has joined #ocaml
<CrawfordComeaux> oh hell no
<CrawfordComeaux> I'm simply going to design the DSL and then have a very strict interface for inputting the rules
<CrawfordComeaux> I'm thinking dynamically-updated dropdown boxes
<CrawfordComeaux> afterall, who cares what you decide to call the objects in the game...
<CrawfordComeaux> I certainly don't...and ML doesn't care about ANYTHING but type-correctness...
<palomer> btw, if you use ocaml you can use polymorphic variants and then you don't need to specify your datatypes when you generate your code
<CrawfordComeaux> so I can just add a type attribute to each dropdown or something along those lines that determines what values to populate the list with from the game state
<palomer> that's what I did
<CrawfordComeaux> I think it'll be cleaner with the datatypes
<CrawfordComeaux> and I don't think you need ocaml to be able to do that, do you?
<palomer> if you use sml you need to specify your types
<palomer> if you use ocaml then you don't need
<palomer> (just use polymorphic variants)
<palomer> it's a feature unique to ocaml
<palomer> I'm crazy about them
<palomer> I don't quite understand what types do in your system
<palomer> but, in my system I have datatypes
<palomer> which generate _no code_
<palomer> they're only used in the typechecker of my language
<palomer> what's laconic btw?
<CrawfordComeaux> that's something someone said somebody else thought would be skynet
<palomer> it's funny you mentioned skynet
<palomer> my friends always joke that I'm making skynet
<palomer> and I tell'em "I'm making the thing that'll make skynet"
<palomer> bedtime!
<palomer> if you have any type questions, email me
<palomer> night!
seafood_ has quit []
<CrawfordComeaux> will do
rwmjones has joined #ocaml
struk_atwork has quit [Read error: 110 (Connection timed out)]
hd_ has joined #ocaml
pattern has quit [Read error: 110 (Connection timed out)]
hkBst has joined #ocaml
hd_ has left #ocaml []
rby has quit [Read error: 104 (Connection reset by peer)]
OChameau has joined #ocaml
hkBst_ has joined #ocaml
rby has joined #ocaml
hkBst has quit [Read error: 110 (Connection timed out)]
palomer_ has joined #ocaml
hkBst_ is now known as hkBst
Tetsuo has joined #ocaml
palomer has quit [Read error: 110 (Connection timed out)]
palomer_ has quit [Read error: 110 (Connection timed out)]
palomer_ has joined #ocaml
CrawfordComeaux has quit ["http://www.mibbit.com ajax IRC Client"]
pattern has joined #ocaml
rwmjones_ has joined #ocaml
LordMetroid has joined #ocaml
petchema has joined #ocaml
seafood_ has joined #ocaml
authentic has quit [Read error: 104 (Connection reset by peer)]
rwmjones_ has quit ["Closed connection"]
jlouis has quit [Remote closed the connection]
jlouis has joined #ocaml
yangsx has quit [Read error: 110 (Connection timed out)]
lordmetroid_ has joined #ocaml
seafood_ has quit []
lordmetroid_ has quit [Client Quit]
Mr_Awesome has quit ["aunt jemima is the devil!"]
OChameau-bis has joined #ocaml
OChameau has quit [Read error: 110 (Connection timed out)]
LordMetroid has quit [Read error: 110 (Connection timed out)]
OChameau-bis has quit [Client Quit]
OChameau has joined #ocaml
hardcopy has joined #ocaml
<hardcopy> greetings!
petchema has quit [Read error: 110 (Connection timed out)]
petchema has joined #ocaml
Linktim has joined #ocaml
Linktim_ has joined #ocaml
sporkmonger has quit []
Linktim- has joined #ocaml
rwmjones_ has joined #ocaml
Linktim has quit [Read error: 110 (Connection timed out)]
Jeff_123 has joined #ocaml
coucou747 has joined #ocaml
Jeff_123 has quit [Client Quit]
Linktim_ has quit [Read error: 110 (Connection timed out)]
rwmjones_ has quit ["Closed connection"]
sporkmonger has joined #ocaml
Associat0r has joined #ocaml
Linktim_ has joined #ocaml
LordMetroid has joined #ocaml
Yoric[DT] has joined #ocaml
authentic has joined #ocaml
<flux> funny, the .opt -version of my binary is 50% the size of the byte code version..
Linktim- has quit [Read error: 110 (Connection timed out)]
<jlouis> flux, some major code-optimization going on?
<flux> I would think the byte code would be relatively short, but apparently it's not the case. it something extra gets stuffed in.
<flux> not an issue for me, just wondering..
<Yoric[DT]> hi
sirius6b has joined #ocaml
LordMetroid has quit [Connection timed out]
sporkmonger has quit []
<flux> it would be very cool, if type errors in cases such as if true then 42 else false would be able to highlight both expressions (42 and false)
CrawfordComeaux has joined #ocaml
<flux> I remember there was a white paper discussing the issue of making more understandable type errors, too bad none of it has apparently surfaced in compilers
Linktim- has joined #ocaml
<Yoric[DT]> Does anyone have access to the ACM portal ?
<flux> I apparently do
<flux> what are you looking for?
Linktim_ has quit [Read error: 110 (Connection timed out)]
ygrek has left #ocaml []
ygrek has joined #ocaml
<Yoric[DT]> Ok, someone else got that for me.
<Yoric[DT]> Thanks.
<Yoric[DT]> mmmhhhh.... are there any postfix operators in OCaml >
<Yoric[DT]> mmmhhhh.... are there any postfix operators in OCaml ?
<flux> hmm.. which languages _does_ have postfix operators?
<sirius6b> forth?
<ygrek> Can anyone confirm the fingerprint for forge.ocamlcore.org? -- looks like they've changed the host's ssh key
<Yoric[DT]> rpl :)
<flux> now that I think of it some language must have '!' operator
<flux> ygrek, I can't, but perhaps that's due to the debian openssl vulnerability generating worthless keys
<flux> (otoh this is a perfect time to do MITM attacks, everyone just assumes that ;))
<ygrek> I won't assume :)
<Yoric[DT]> The C family has a postfix ++.
<ygrek> actually I was just regenerating my own keys and wanted to test if it works
Yoric[DT] has quit ["Ex-Chat"]
<flux> does anyone ever bump into this problem: you want to define a value of a record, which has a closure, which gets the record as an argument: let foo = { value = 42; closure = (fun () -> magic foo); } ?
<flux> and if so, what's your standard solution..
<flux> using the keyword rec apparently doesn't quite work in that case
<flux> I've used lazy evaluation, message passing, but usually I've just extracted the pieces of information the function needs out of the record, like: let foo = let value = 42 in { value = value; closure = (fun () -> magic value); }, but that's annoying when the record has multiple values
<flux> (with lazy evaluation it would go like: let rec foo = lazy { value = 42; closure = (fun () -> magic (Lazy.force foo)) } in Lazy.force foo)
sporkmonger has joined #ocaml
Linktim_ has joined #ocaml
Linktim_ has quit [Read error: 110 (Connection timed out)]
Linktim- has quit [Read error: 110 (Connection timed out)]
eugman has joined #ocaml
jeremiah has joined #ocaml
struk_atwork has joined #ocaml
struk_atwork has quit [Read error: 104 (Connection reset by peer)]
Demitar has quit [Read error: 110 (Connection timed out)]
Linktim has joined #ocaml
Linktim_ has joined #ocaml
LordMetroid has joined #ocaml
Linktim has quit [Read error: 110 (Connection timed out)]
thelema has quit [Read error: 110 (Connection timed out)]
Linktim- has joined #ocaml
Axioplase has joined #ocaml
LordMetroid has quit ["Leaving"]
Linktim_ has quit [Read error: 110 (Connection timed out)]
kig has quit [Connection reset by peer]
blue_prawn has joined #ocaml
pango has quit [Remote closed the connection]
pango has joined #ocaml
Linktim_ has joined #ocaml
coucou747 has quit [Read error: 104 (Connection reset by peer)]
coucou747 has joined #ocaml
Linktim- has quit [Read error: 110 (Connection timed out)]
Linktim- has joined #ocaml
<hardcopy> Screw this, I'm forking the OCaml project and starting OLlama
<hardcopy> MuwahAHAhAhAha
hardcopy has quit []
<flux> actually using laziness makes the lazy value leak into the used record also..
<flux> in case the definition of closure already happens to need to the record
Linktim_ has quit [Read error: 110 (Connection timed out)]
<spainish> hardcopy, OLlama, faster than OCaml?
<flux> quick, it appears ollama.com is available..
filp has quit ["Bye"]
<CrawfordComeaux> why bother? O'Reilly's already using the llama for perl
<CrawfordComeaux> and if you can't get a pertinent O'Reilly mascot, your language isn't worth squat
sirius6b has quit ["Ухожу"]
munga has joined #ocaml
rodge has joined #ocaml
<munga> hi all, how can I user camlp4 to create a pretty printer ? For example, do you know of a small "arithmetic expression" example to parser and pretty print an expression ?
<Smerdyakov> munga, have you read any tutorials?
<munga> Smerdyakov: yes :) but I can't find a small example for the pretty printing ...
<munga> I'm looking at the camlp4 wiki atm...
<munga> :) thanks anyway
<CrawfordComeaux> Smerdyakov: someone said that you think laconic is going to become skynet or something like that
<Smerdyakov> CrawfordComeaux, OK
<CrawfordComeaux> they actually said something more along the lines of "is going to revolutionize the world"...
<CrawfordComeaux> from what I saw, it's got potential, but I don't have time to read the guy's paper on it
<Smerdyakov> "The guy's"? I'm the guy.
<CrawfordComeaux> oh well hey! neat!
<CrawfordComeaux> sorry...the paper will have to wait til the weekend
<CrawfordComeaux> I just got done reading through 2 whitepapers and a doctoral thesis on probabilistic cmos....
Yoric[DT] has joined #ocaml
<Yoric[DT]> hi again
<Smerdyakov> CrawfordComeaux, have we talked before? Your nick isn't familiar.
<CrawfordComeaux> nope
<CrawfordComeaux> I just popped in here last night for the first time to gets opinions on ocaml vs mlton-compiled sml as a backend for a webapp I'm going to be developing
marmottine has joined #ocaml
<Smerdyakov> Yeah, I think Laconic/Web is going to be the best choice a year from now.
<CrawfordComeaux> are you a one-man team getting it together?
<Smerdyakov> Yes.
<CrawfordComeaux> so where to from here?
<Smerdyakov> I don't know what you're asking.
<CrawfordComeaux> development-wise, I mean
<CrawfordComeaux> and do you need some web space?
<Yoric[DT]> Smerdyakov: what's that ?
<Smerdyakov> Yoric[DT], what's what?
thelema has joined #ocaml
<Smerdyakov> CrawfordComeaux, I founded an Internet hosting cooperative. I don't need web space. :)
<Yoric[DT]> Laconic/Web
<Smerdyakov> Yoric[DT], http://laconic.sf.net/
<Yoric[DT]> thanks
<Yoric[DT]> niec
<Yoric[DT]> That is, "nice".
<CrawfordComeaux> sorry...I saw that laconicweb.com has a parking page on it, figured it was you and you were without a host
nuncanada has quit ["Leaving"]
<Smerdyakov> I'd rather not talk about my plans in detail now, because then I can turn out to be wrong later. I'll just be working about 50% time on it starting soon.
<Yoric[DT]> Is that a research plan or a start-up plan ?
<Smerdyakov> More of the latter
<Smerdyakov> Yoric[DT], also, I think I reminded you before, but remember that question marks never have spaces before them in English. :)
<Yoric[DT]> oops
<Yoric[DT]> I remember you reminding this either to me or to bluestorm, yes.
<CrawfordComeaux> do other languages have spaces before their question marks?
<Yoric[DT]> French does.
<Yoric[DT]> Before question and exclamation marks and before colons and semicolons.
<CrawfordComeaux> All those years of French class and I either never noticed or they were doing it wrong....
postalchris has joined #ocaml
LordMetroid has joined #ocaml
OChameau has quit ["Leaving"]
filp has joined #ocaml
Snark has joined #ocaml
Linktim_ has joined #ocaml
<Axioplase> CrawfordComeaux: Actually, not many (young) French people know that exclamation mark, question mark and colon are prefixed by a non breakable space
<CrawfordComeaux> well great...now I can't code since my mind's been blown!
<jonafan> soooo
<jonafan> i'm having trouble with this euler problem
<jonafan> isn't 1 the factorial of 0?
<CrawfordComeaux> yep
<CrawfordComeaux> what's the "problem"?
<jonafan> according to my code, the answer is 145
Linktim- has quit [Read error: 110 (Connection timed out)]
<CrawfordComeaux> well that's obviously wrong...unless it's the only one out there
<jonafan> it's odd that my code is able to find 145 and nothing else
<CrawfordComeaux> why is that an "euler" problem?
<jonafan> i'm testing ever number between 3 and 3 million
<jonafan> i don't know
<CrawfordComeaux> according to my research, you're missing one
<CrawfordComeaux> pastebin time!
<jonafan> holy crap, how did i get fact 0 as 0?
<orbitz> CrawfordComeaux: project euler is just a site that has probelsm to solve
<CrawfordComeaux> orbitz: yeah...my research just showed me that
<orbitz> are you native english speaker?
<Smerdyakov> I really get peeved at the abandonment of capital letters by so many in Internet communication.
<CrawfordComeaux> yes, I am
<jonafan> don't worry dudes, i think i fixed it
<Smerdyakov> I'm not sure if missing capitals or punctuation bother me more/.
<orbitz> what abou the ladies in teh room?
<orbitz> Smerdyakov: does my skillz make you cry?
<Smerdyakov> Run-on sentences are up there, but that's not an Internet thing; most people don't know how to separate clauses properly in any setting.
<jonafan> 16% genius!
<CrawfordComeaux> Smerdyakov: i7 kud B3 \/\/uRz
<CrawfordComeaux> so what's the answer now, jonafan
<Smerdyakov> Maybe I should get a "semicolons are beautiful" T-shirt.
<jonafan> 40730
<jonafan> which is correct
* CrawfordComeaux <3 semicolons
<orbitz> i never knwowhen to use a semicolon
<jonafan> semicolons are for putting 2 sentences together
<jonafan> related sentences anyway
thelema has quit [Read error: 104 (Connection reset by peer)]
<orbitz> why not just wrap them in ()?
<Smerdyakov> jonafan, now, see, how can you not realize it's rude not to include a comma before "anyway" there?
<Smerdyakov> jonafan, you get a different meaning with what you used, though that meaning clearly doesn't apply here.
<jonafan> i see how rude it is
<Smerdyakov> jonafan, then you are under arrest.
<jonafan> sorry, i don't care about capitalization of punctuation on internets
<orbitz> saw an episode of cops the toher day
<jonafan> OR
<orbitz> and the cop was telling some kids "crime don't pay!"
<Smerdyakov> jonafan, I'm sorry, too, that you're such a bastard.
<orbitz> what a role model
<jonafan> what bothers me is when people don't get it's/its or they're/their/there right
<jonafan> and they refuse to be corrected
<Smerdyakov> Capitalization and punctuation have important roles to play in disambiguation.
<orbitz> english is the perl of spoken langauges. human runtime just changes the type of there/their/they're on teh fly
<jonafan> see, i know the proper way to write, but 99% of the time, it's clear what is meant in that context
<jonafan> the people who don't get they're/their/there simply don't know or care
<Smerdyakov> jonafan, it's especially hard to make such judgments when communicating with an audience where native English speakers are a minority, like here.
al-maisan has quit ["Leaving."]
<jonafan> i thought this was the english ocaml channel
<Smerdyakov> jonafan, what does that have to do with it?
<jonafan> well, presumably you know english if you're here
<orbitz> the primary language is english, many people here are not native english speakers thoguh
<jonafan> and if clarification is needed, i'm right here
<Smerdyakov> jonafan, that is such a bullshit statement, especially in its implication that there is a standard definition of what it is to "know" a language, and secondarily in its implication that people are able to know when they know.
<Smerdyakov> orbitz, that was a run-on sentence. A semicolon would have salvaged it.
<jonafan> if we're conversing, it should become clear whether they know if they know.
<Smerdyakov> jonafan, that's just not applicable to practice. People whose English is far from awesome still come here with legitimate conversational topics.
<orbitz> omg
<jonafan> frankly, talking in realtime with a native english speaker, such as myself, is a good experience for those people
rodge has quit ["Leaving."]
<orbitz> i have never worked a place with worse connectivity
<Smerdyakov> jonafan, and anyone who didn't learn English very young is going to be expending effort on deciphering sentences. It's just polite to avoid making it hard for them.
<jonafan> and seriously, if it's that much of an issue, i am capable of polishing my typing up in those situations
Linktim_ has quit [Read error: 110 (Connection timed out)]
<Smerdyakov> How do you know this isn't one of those situations? How do you know there aren't well-meaning people here who want to participate but aren't because of this?
<flux> yoric[dt], hmm, I wonder.. I suppose having provisions for supporting continuation-passing-style with the Enum module would be too much to ask?-)
<jonafan> Yeah, I bet they'd feel like assholes if they didn't get their grammar right SMERDYAKOV
<Yoric[DT]> flux: how would you envision that ?
<orbitz> i think just the s is capitalzed tehre since it's a propernow
<orbitz> noun
rodge has joined #ocaml
<jonafan> omg typo what are you saying
<orbitz> Smerdyakov: how isthe startup coming?
<flux> yoric[dt], well, there would be another module which would replicate the features but with cps :). so val map : ('a -> 'b) -> 'a t -> 'b t would go to val map : ('a -> 'b cont) -> 'a t -> 'b t cont, val from : (unit -> 'a) -> 'a t to val from : (unit -> 'a cont) -> 'a t cont etc. but yeah, maybe that wouldn't make sense if it doesn't come with a cps framework..
Snrrrub has joined #ocaml
<flux> type 'a cont = ('a -> cps) -> cps
<Smerdyakov> What the heck is type [cps]?
<flux> cps would be some type indicating for example "wait fori
<flux> "wait for io"
pango has quit [Remote closed the connection]
<flux> so you would have let read_input fd = IO.wait_readable >>= fun () -> .. Unix.read fd .. in IO.return buffer
<flux> but for example reading a file lazily via some EnumCPS (or EnumMonad?) interface would be possible
Snark has quit ["Ex-Chat"]
eugman has quit ["leaving"]
pango has joined #ocaml
<Yoric[DT]> well, if you can write down a good idea of what [cps] is, I'm willing to give it a try.
<flux> I don't it is a requirement for [cps] to have a concrete type
<flux> I actually have one for it, but it's at work
<CrawfordComeaux> here's a fun little distraction: http://www.gamedesign.jp/flash/susuke/susuke.html
<Yoric[DT]> flux: er...
<Yoric[DT]> so would you write [type ('a, 'b) cont = ('a -> 'b) -> 'b] ?
<Yoric[DT]> Or functorize ?
<flux> functorize I suppose
sporkmonger has quit [Read error: 110 (Connection timed out)]
<flux> module type CPS = struct type t type 'a cont = ('a -> t) -> t val return : 'a -> 'a cont val bind : 'a cont -> ('a -> 'b cont) -> 'b cont end
blue_prawn has quit ["Client exiting"]
<Yoric[DT]> It starts to look a bit too specific for a general-purpose Enum module.
rwmjones has quit [Remote closed the connection]
<Yoric[DT]> However, we can think about having a set of modules dedicated to CPS.
<Yoric[DT]> If you want to contribute them, feel free :)
rwmjones has joined #ocaml
<flux> crawfordcomeaux, I have a friend by me attempting to enter digit '5'.. succeeded after perhaps dozens of times :)
<jonafan> i am afraid i do not understand this game
Poulet has joined #ocaml
<jonafan> wow, it DOES have trouble with 5s
<flux> jonafan, try drawing the top horizontal line as last
<jonafan> ah HAH
<CrawfordComeaux> yeah...it can handle multiple strokes...took me a few tries to get 4
<Smerdyakov> Someone found my web site by searching for "clutter caml."
<Smerdyakov> Now I want my Clutter Caml compiler.
<CrawfordComeaux> what is clutter caml?
<Smerdyakov> I don't know, but I want some.
<CrawfordComeaux> oh I think project euler is going to be very bad for me
sporkmonger has joined #ocaml
coucou747 has quit ["bye ca veut dire tchao en anglais"]
pango has quit [Remote closed the connection]
<Yoric[DT]> mmmhhh....
pango has joined #ocaml
* Yoric[DT] has the weird feeling that question 5 is unsolvable.
rwmjones has quit ["Closed connection"]
<CrawfordComeaux> ok...project euler fails
<CrawfordComeaux> they don't trim the input before checking it!
<jonafan> haha problem 5?
<Yoric[DT]> indeed
<Yoric[DT]> I was too lazy to check my computation but I have the feeling that e-d must both be 2 and 3.
<jonafan> oooooh
<Yoric[DT]> oh, no
<jonafan> you're not doing euler problems
<Yoric[DT]> Nope, that stuff lposted by CrawfordComeaux, I think.
<jonafan> yeah...
<Yoric[DT]> Plus I think I mixed a "b" and a "d".
<Yoric[DT]> Too lazy to check.
Associat0r has quit []
<Yoric[DT]> mmmhh....
<orbitz> hhmmm
<Yoric[DT]> Is there a simple way to defunctorize Set into something polymorphic ?
<orbitz> extlib has a polymorphic map and set
<Yoric[DT]> Only map, I think.
<flux> map can emulate set
<Yoric[DT]> Indeed.
<flux> except it may be missing certain operations, such as union
* palomer_ gasps
<palomer_> orbitz said something coherent!
<palomer_> (though false)
<Yoric[DT]> Except I was kind of counting on union.
<orbitz> palomer_: one step at at ime
<orbitz> Yoric[DT]: does Core have one?
<orbitz> Yoric[DT]: you may have to write a PSet for all of us then
<orbitz> probably not too hard
<flux> union between two sets that have different comparison functions.. hmm :)
<orbitz> hot!
<Yoric[DT]> :)
<palomer_> mecha hot
<Yoric[DT]> Well, I'll just rewrite union from map.
thelema has joined #ocaml
<palomer_> thelema, found the mistake from yesterday
<palomer_> I have to switch `WIDGET with `TEXT
* palomer_ goes to take a nap
<CrawfordComeaux> geez...largest prime factor of a 12-digit number...hmmm
<CrawfordComeaux> sieve of erosthothenes (sp?) here I come
yziquel has joined #ocaml
<orbitz> even teh sieve should taek awhile right?
<palomer_> brute force can factor 12 digit numbers easily
<palomer_> you only need to go up to a 6 digit number
<palomer_> that's about a million divisions
<orbitz> why only utpo a 6 digit number?
<orbitz> err sqrt
<palomer_> get_factor a b = if a > sqrt b then [] else if a divides b then a::get_factor (a+1) b else get_factor (a+1) b
<palomer_> even better
<palomer_> get_prime_factors a b = if a > sqrt b then [] else if a divides b then (if is_prime a then a :: get_prime_factors (a+1) b else get_prime_factors 1 a :: get_prime_factors (a+1) b) else get_prime_factors (a+1) b
<palomer_> err
<palomer_> one of those :: is a @
<spainish> Fermat said it's prime with a probability of 99.999999%
marmottine has quit ["Quitte"]
rodge has quit ["Leaving."]
Ramzi has quit [Read error: 104 (Connection reset by peer)]
Ramzi has joined #ocaml
al-maisan has joined #ocaml
al-maisan has quit [Remote closed the connection]
al-maisan has joined #ocaml
al-maisan has quit [Remote closed the connection]
al-maisan has joined #ocaml
al-maisan has quit [Remote closed the connection]
Demitar has joined #ocaml
al-maisan has joined #ocaml
al-maisan has quit [Remote closed the connection]
coucou747 has joined #ocaml
Demitar has quit [Client Quit]
al-maisan has joined #ocaml
Axioplase has quit ["leaving"]
coucou747 has quit [Client Quit]
coucou747 has joined #ocaml
coucou747 has quit [Read error: 104 (Connection reset by peer)]
<palomer_> hrmph
<palomer_> looks like I'm in desperate need of a canvas widget
<palomer_> thelema, you around?
postalchris has quit ["Leaving."]
al-maisan has quit ["Leaving."]
ygrek has quit [Remote closed the connection]
<Yoric[DT]> 'night everyone
Yoric[DT] has quit ["Ex-Chat"]
filp has quit ["Bye"]
Demitar has joined #ocaml
<CrawfordComeaux> is there a way to determine if a number is the greatest prime factor of another number without performing any division?
<Smerdyakov> The concept of "whether a division is performed" is sufficiently vague to me that I don't think your question is well-formed.
<Ramzi> CrawfordComeaux: Sure.
coucou747 has joined #ocaml
<Ramzi> Let's say you want to check if p is the greatest prime factor of n.
<CrawfordComeaux> Ramzi - without knowing the other factors of n
<Ramzi> Well, you check if(p*k == n) for all k from 2 to the sqrt(n). If there is a k, then for every natural from p+1 to sqrt(n), do the same thing.
<Ramzi> The question is different if you know p already divides n or not.
LordMetroid has quit ["Leaving"]
<Ramzi> If you know that p is a factor of n, simply check for a bigger factor between p+1 and sqrt(n).
coucou747 has quit ["bye ca veut dire tchao en anglais"]
Snrrrub has quit []
structured has joined #ocaml
<hkBst> Ramzi: the biggest prime factor of n is not necessarily less than sqrt(n)...
<hkBst> but what is the case is that there is at most one prime factor greater than sqrt(n), though there may be none
<dobblego> sqrt 15 is 3.8, yet 5 is a prime factor
<hkBst> CrawfordComeaux: but if your candidate largest prime factor p is less than sqrt(n), then the problem reduces to "Is the largest prime factor of n/p greater than p?". I don't know of a way to get around that division.
<structured> hkBst: wwhat about the smallest?
<hkBst> structured: unless it is 2 you'll need to do divisions I think
<palomer_> the answer is 42
<structured> I just jumped into at the middle of your conversation...are you trying to solve prime factorization? A subset of the domain?
<palomer_> we're breaking an RSA key
<palomer_> the public key is 77
<palomer_> can you help us?
<structured> I'd love to, but even though prime factorization is one of my greatest mathematical passiosns, I am no expert.
<hkBst> :)
<orbitz> palomer_: are you going to use polymorphic variants?
<hkBst> palomer_: is it from a debian box? ;P
<structured> palomer_: sounds like an awesome goal. good luck and keep the channel updated
yangsx has joined #ocaml
Poulet has quit []
<palomer_> grrr
* palomer_ is _desperate_ for a canvas