<palomer_>
ocaml produces object type constraints for you!
<palomer_>
wicked!
<palomer_>
does ocaml have static methods?
<sporkmonger>
hmm, is there a way to get omake to do ocamlmktop?
<det>
What do you mean by static methods?
seafood_ has joined #ocaml
hsuh has joined #ocaml
seafood_ has quit []
mwc has joined #ocaml
<thelema>
palomer_: static methods!?! we call those "functions" around here.
mbishop_ has joined #ocaml
mbishop_ has quit [Remote closed the connection]
mbishop_ has joined #ocaml
hsuh has quit ["bye"]
mbishop_ has quit [Remote closed the connection]
mbishop_ has joined #ocaml
mbishop has quit [Read error: 113 (No route to host)]
m3ga has joined #ocaml
m3ga has quit [Client Quit]
seafood_ has joined #ocaml
seafood_ has quit [Client Quit]
mbishop_ has quit [Read error: 110 (Connection timed out)]
<flux>
thelema, well, there is the thing about access control to consider
<flux>
I suppose that would need to be handled in the "old fashioned way" of using the module system
<flux>
so the 'fields' the 'static methods' would be able to access would need to be defined in a broader scope than in a language which has static methods
evn has quit [Remote closed the connection]
<thelema>
well, static methods can only access static fields, so move all that outside your objects into the module.
evn has joined #ocaml
seafood_ has joined #ocaml
goalieca has joined #ocaml
thelema has quit [Read error: 104 (Connection reset by peer)]
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
m3ga has joined #ocaml
m3ga has quit [Client Quit]
szell has quit [Read error: 104 (Connection reset by peer)]
szell has joined #ocaml
kappa_ has joined #ocaml
Yoric[DT] has joined #ocaml
f[x] has joined #ocaml
f[x] is now known as z[x]
coucou747 has joined #ocaml
filp has joined #ocaml
TaXules has quit [Remote closed the connection]
TaXules has joined #ocaml
schme has joined #ocaml
ygrek has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
ikaros has joined #ocaml
ygrek has quit [Remote closed the connection]
ygrek has joined #ocaml
Tetsuo has joined #ocaml
kappa_ has quit ["Leaving"]
z[x] has quit ["Leaving"]
z[x] has joined #ocaml
comglz has joined #ocaml
Snark_ has joined #ocaml
ppsmimou has joined #ocaml
hkBst has joined #ocaml
filp has quit [Remote closed the connection]
yangsx has quit [Read error: 110 (Connection timed out)]
filp has joined #ocaml
Demitar has quit [Connection timed out]
seafood_ has quit []
Tetsuo has quit [brown.freenode.net irc.freenode.net]
goalieca has quit [brown.freenode.net irc.freenode.net]
Amorphous has quit [brown.freenode.net irc.freenode.net]
authentic has quit [brown.freenode.net irc.freenode.net]
rhar has quit [brown.freenode.net irc.freenode.net]
Ugarte has quit [brown.freenode.net irc.freenode.net]
l_a_m has quit [brown.freenode.net irc.freenode.net]
donny has quit [brown.freenode.net irc.freenode.net]
guyzmo has quit [brown.freenode.net irc.freenode.net]
svenl has quit [brown.freenode.net irc.freenode.net]
qwr has quit [brown.freenode.net irc.freenode.net]
flux has quit [brown.freenode.net irc.freenode.net]
Naked has quit [brown.freenode.net irc.freenode.net]
ulfdoz has quit [brown.freenode.net irc.freenode.net]
prince has quit [brown.freenode.net irc.freenode.net]
seafood has quit [brown.freenode.net irc.freenode.net]
Dazhbog has quit [brown.freenode.net irc.freenode.net]
coucou747 has quit [brown.freenode.net irc.freenode.net]
mfp has quit [brown.freenode.net irc.freenode.net]
cmeme has quit [brown.freenode.net irc.freenode.net]
gim has quit [brown.freenode.net irc.freenode.net]
Tetsuo has joined #ocaml
coucou747 has joined #ocaml
goalieca has joined #ocaml
Amorphous has joined #ocaml
authentic has joined #ocaml
rhar has joined #ocaml
prince has joined #ocaml
mfp has joined #ocaml
cmeme has joined #ocaml
gim has joined #ocaml
ulfdoz has joined #ocaml
seafood has joined #ocaml
Dazhbog has joined #ocaml
svenl has joined #ocaml
Ugarte has joined #ocaml
guyzmo has joined #ocaml
donny has joined #ocaml
l_a_m has joined #ocaml
flux has joined #ocaml
qwr has joined #ocaml
Naked has joined #ocaml
kelaouchi has quit [Read error: 104 (Connection reset by peer)]
LordMetroid has joined #ocaml
kelaouchi has joined #ocaml
prince has quit [Client Quit]
goalieca has quit ["Ex-Chat"]
comglz_ has joined #ocaml
bla has quit [Read error: 110 (Connection timed out)]
bla has joined #ocaml
comglz has quit [Read error: 110 (Connection timed out)]
^authentic has joined #ocaml
gim has quit [Read error: 110 (Connection timed out)]
authentic has quit [Read error: 110 (Connection timed out)]
^authentic is now known as authentic
schme has quit [Connection timed out]
sporkmonger has quit []
sporkmonger has joined #ocaml
magthe has joined #ocaml
RobertFischer has joined #ocaml
jules_ has joined #ocaml
mwc has quit [Remote closed the connection]
<RobertFischer>
What's the opposite of "ago", as in "3 days ago"?
<RobertFischer>
How do you get the current system time in Ocaml?
<RobertFischer>
NM.
<RobertFischer>
They're in Unix.
<RobertFischer>
I just didn't see them the last time I checked Unix.
* RobertFischer
apparently needs coffee.
<jules_>
the opposite of ago is from now "3 days from now"
filp has quit ["Bye"]
jlouis has quit [Remote closed the connection]
<RobertFischer>
jules_: Actually, I think I'm going to use "Hence", since it's one word.
gim has joined #ocaml
delamarche has joined #ocaml
seafood_ has joined #ocaml
<flux>
whoo, I invented a "new idiom": (* shorter name for a lot used module *) module Q = Msgqueue (* now prevent using Msgqueue directly for consistency *) module Msgqueue = struct end
<RobertFischer>
When I run this script, I get "Reference to undefined global `Unix'", even if I explicitly add stdlib to the include path. Help? http://pastie.caboo.se/179148
<flux>
maybe it's a bit evil, dunno.. ;)
<flux>
robertfischer, how do you compile it?
<RobertFischer>
flux: That's used a lot. It's called "module aliasing".
<flux>
robertfischer, the latter definition was the point
<RobertFischer>
flux: Well, I get that error when I do ocaml ./dsl.ml
<RobertFischer>
flux: Ahhhh. I see it now.
<flux>
well, in that case you would need to add #load "unix.cma";; at the top of your file
<RobertFischer>
Hrm.
<flux>
I suppose ocaml unix.cma dsl.ml works too
<flux>
if you want to use ocaml for 'scripting', you might find ocaml-script (or something) useful; I haven't used it
<RobertFischer>
ocamlc gives me " Unbound record field label tm_mday" on line 27. So I'm still having trouble getting at Unix. I wonder if open will solve that problem?
<flux>
when you have an actual project, though, you will likely have something like PACKS=-package unix,and,other,modules and compile with ocamlfind ocaml -c $(PACKS) dsl.ml (and final endresult with ocamlfind ocamlc -linkpkg -o dsl dsl.cmo)
<flux>
you need to open Unix or alternatively refer to the fields as foo.Unix.tm_mday
<flux>
with pattern matching the rules are a bit less strict, you only need to explicitly state the module of the first field
<flux>
as in: { Unix.tm_mday = a; tm_min = b } etc
<flux>
perhaps you would like to use pa_openin
<flux>
which adds a construct "open Unix in .. "
<flux>
(you could use local modules too to sligthly reduce the repetition: let module U = Unix in .. foo.U.tm_mday ..)
coucou747 has quit ["bye ca veut dire tchao en anglais"]
jules_ has quit ["Leaving"]
<RobertFischer>
Sweet.
<RobertFischer>
Thanks you.
<flux>
you're welcome
<delamarche>
So, I'm starting to get back into functional programming again. You know, instead of sitting around before bed and reading a book, instead I'm hacking Scheme
<delamarche>
and last night i discovered why pattern matching is such a good idea
<delamarche>
like i actually grokked it
<delamarche>
hahaha
<flux>
recently there was a school assignment to be done in common lisp
<delamarche>
I was implementing a deque in scheme and i kept wanting to reach into the guts of the representation and tear it apart
<flux>
one of the finest adjustments I wrote for it was a simple pattern matcher for deconstructing lists ;)
<delamarche>
that's a great idea, actually
<delamarche>
i might try that next
<delamarche>
i'm flipflopping between SICP and Chris Okasaki's book
<delamarche>
because often I find I hit a wall in Okasaki's book and need more background to really get it, and SICP helps with that
<delamarche>
it's great fun
<delamarche>
flux: Did you have to use macros to do that?
<delamarche>
stupid question, maybe
<flux>
delamarche, yes, but that wasn't the assignment at all
<delamarche>
but i'm not the brightest
<delamarche>
yeah i understood that you were just having fun with it :D
<flux>
it's a course where there are four assignments in four different languages, and the lisp one was evaluated for beauty also
<flux>
I'm hoping to score :)
Yoric[DT] has joined #ocaml
<flux>
(for example, the fortran one was evaluated only for functionality)
ttt-- has joined #ocaml
comglz_ has quit [Client Quit]
<delamarche>
We had a course like that in my undergraduate program
<delamarche>
well, it was just the senior programming languages course
<delamarche>
I never took it :(
<delamarche>
I was studying computational biology so it was hard to fit everything in
<twobitsprite>
I was going to ask a question, then remembered the answer :)
Yoric[DT] has quit ["Ex-Chat"]
jlouis has joined #ocaml
seafood_ has quit []
<sporkmonger>
so... i'm a little confused
<RobertFischer>
sporkmonger: K?
<sporkmonger>
looking through the manual, i'm not seeing code that accesses tuples
<sporkmonger>
just code to create them
<sporkmonger>
how would you, for example, access the first element of a tuple?
<flux>
with pattern matching
<flux>
let (first_element, _, _) = (1, 2, 3)
<sporkmonger>
oh ok
<sporkmonger>
can you do that for variant types too?
<sporkmonger>
like, let Some x = Some 4
<flux>
yes, however you will get a warning about non-exhaustive match
<sporkmonger>
how would you do that in a safe way then?
<flux>
match Some 4 with None -> assert false | Some x -> ..
<sporkmonger>
ok
<flux>
usually you can structure the code in a way that the "noneness" of values goes away soon
pango_ has quit [Remote closed the connection]
<flux>
so you won't end up littering your code with stuff like that a lot
<flux>
however, if that doesn't look possible, you can use functions like val default : 'a -> 'a option -> 'a or val unopt : 'a option -> 'a ; the former would accept a default value to return for None, the latter would raise an exception on None
<flux>
there are other approaches too, such as monads
<flux>
but, off now ->
<flux>
happy hacking
pango_ has joined #ocaml
Linktim has joined #ocaml
<delamarche>
I think I'm going to make webpage with the title and keywords "how to access data in Ocaml tuples"
<delamarche>
:D
^authentic has joined #ocaml
<delamarche>
confused the heck out of me the first time too
<delamarche>
I remember that moment of panic... "OK, I have numbers in here, now how do I _get_ to them??"
<delamarche>
And invariably I end up changing tuples into records after a few iterations
<delamarche>
That's my story.
<Smerdyakov>
That should just be embarrassing for you. I'm sure every introduction to OCaml explains this.
<delamarche>
Well, I'm unashamed to admit that I am often dense. However, there are so many details to pick up on when starting with OCaml
<delamarche>
that even if every tutorial mentioned it, I probably just missed it.
<delamarche>
But now I'm curious.
<delamarche>
One moment please.
<delamarche>
OK, so in the OCaml tutorial (ocaml-tutorial.org) they introduce tuples and pattern-matching in the same chapter, but they never explicitly say that pattern matching is really the only way to interact with tuples. Maybe that should be obvious, fair enough.
<delamarche>
I want to look at a couple of books now
Linktim_ has joined #ocaml
z[x] has quit [Remote closed the connection]
<delamarche>
Section 5.2 in Hickey's book sort of hints at it, but really he just mentions fst and snd and doesn't go far beyond that
munga has quit ["Leaving"]
<delamarche>
the Ocaml for Scientists intro chapter doesn't really come out and say it either :)
<rwmjones>
RobertFischer, ping
<Smerdyakov>
I don't understand why you think anyone needs to say this explicitly.
<delamarche>
I don't, actually. I mean, I figured it out fairly quickly after all.
<Smerdyakov>
These sources should how to deconstruct tuples. What more do you need?
<Smerdyakov>
s/should/show2
<delamarche>
I'm just saying it might explain why I've heard this question from new Ocaml people quite often before
<delamarche>
*shrug*
<Smerdyakov>
I don't think anyone who's ever going to be a really good OCaml programmer would ask the question while learning OCaml.
<delamarche>
Right.
<delamarche>
I'm going to summarize my feelings here simply by saying, 'I disagree'.
<delamarche>
But I'm not yet a good OCaml programmer and so I can't actually dispute it.
<delamarche>
:)
<sporkmonger>
annnyways... so now that's i've started a minor dispute
<sporkmonger>
i've got this hashtable
<sporkmonger>
and i originally wrote some code that put a value of type State.t in it
<sporkmonger>
but then realized that was wrong
<sporkmonger>
and put a tuple of type (State.t * State.t list ref) in instead
<sporkmonger>
(init state * all states)
<sporkmonger>
so, now i'm getting a compile error
<sporkmonger>
saying i'm using the hashtable with the wrong type
<sporkmonger>
(State.t * State.t list ref) when it expected State.t
<sporkmonger>
i've looked everywhere for the straggler
<sporkmonger>
how do you find stuff like that?
authentic has quit [Read error: 110 (Connection timed out)]
^authentic is now known as authentic
<sporkmonger>
File "traverse.ml", line 39, characters 13-35:
<sporkmonger>
This expression has type State.t but is here used with type
<sporkmonger>
State.t * State.t list ref
<sporkmonger>
bah, found it.... recursive call i didn't notice
<sporkmonger>
the call was using the old method signature
<sporkmonger>
bah... ok... so, what does this mean?
<sporkmonger>
$ src/main/squish --train spam
<sporkmonger>
buy viagra!!
<sporkmonger>
online pharmacy!
<sporkmonger>
Bus error
Linktim has quit [Read error: 110 (Connection timed out)]
<sporkmonger>
(that's spammy input on stdin)
<sporkmonger>
"Bus error" doesn't tell me much
<Smerdyakov>
It means either:
<Smerdyakov>
1) You're using an unsafe function from a C library (including the OCaml standard library)
<Smerdyakov>
or 2) You found a bug in the OCaml implementation.
<Smerdyakov>
Or a bug in your OS, or a cosmic ray hit, etc..
<RobertFischer>
rwmjones: pong
<rwmjones>
RobertFischer, any concrete plans for cocanwiki? one thing that really needs to be fixed is the email-every-change (it should email all changes once/day or something like that)
<RobertFischer>
rwmjones: You're telling me. I just got nailed with that. :)
<RobertFischer>
rwmjones: I'm following Jeremy's lead right now, doing a few smaller things (TinyMCE integration first off), so you can pitch things over to him.
<rwmjones>
RobertFischer, one easy thing to implement is: (1) don't email changes at all when they happen, and (2) diff the entire website once per day (eg. from a cron job) and mail it to all the subscribed people
<RobertFischer>
rwmjones: Is there a public source code repository, or a more recent version of the code out there? Everything I have has (c) from 2004.
<rwmjones>
RobertFischer, afaik the latest version is in merjis's CVS. You have access?
<RobertFischer>
rwmjones: Not yet. Jeremy should be able to get me that?
<rwmjones>
on a conf call at the moment, I'll be more responsive in a bit
<rwmjones>
RobertFischer, I think the best thing is if you can set up a public project (eg. google code / berlios / gnu / whatever) and I'll upload the latest CVS + history. Latest CVS is very close to the last release (1.4.3)
<RobertFischer>
rwmjones: Sounds great. Will do.
<rwmjones>
RobertFischer, actually if you don't care about the CVS history then you can just upload 1.4.3 from the tarball, whichever
<RobertFischer>
I'll just upload from the tarball.
<rwmjones>
ok
<RobertFischer>
msg me your e-mail and I'll add you as a member, so you can check in any changes you've got.
<sporkmonger>
well, i'm clueless here on that bus error
<Smerdyakov>
sporkmonger, which library functions are you using?
<sporkmonger>
(then type in whatever, and ctrl-d)
<sporkmonger>
annexlib
<sporkmonger>
that's it
<sporkmonger>
and it's not the problem
<Smerdyakov>
sporkmonger, not even the standard library?
<sporkmonger>
oh, well, in stdlib, theres...
<sporkmonger>
Hashtbl, List, uhm... that's about it?
<sporkmonger>
oh, and Marshal
<Smerdyakov>
It's almost certainly Marshal.
<Smerdyakov>
Marshal is a very unsafe module.
<sporkmonger>
ok
<Smerdyakov>
As a client of it, you are responsible for making sure you never try to read a marshalled representation back in as a different type than the original object had.
<Smerdyakov>
I'd say 99% chance that you're doing that.
<sporkmonger>
hmm
<sporkmonger>
i call marshal 3 times
<Smerdyakov>
It's unmarshal that will be the location of the crash.
<Smerdyakov>
sporkmonger, let f x = ... ==> let f (x : int) = ...
<Smerdyakov>
sporkmonger, let x = ... in ... ==> let x : int = ... in ...
<sporkmonger>
k
<Smerdyakov>
I'm not sure the second one works, but, if not, there's something like it.
pango_ has quit [Remote closed the connection]
<sporkmonger>
how do i annotate the return value of a function?
<Smerdyakov>
let f x = ... ==> let f x : int = ...
pango_ has joined #ocaml
<sporkmonger>
k
evn_ has joined #ocaml
<sporkmonger>
let buckets bucket_file : Hashtbl.t = <-- doesn't seem to work :-P
<Smerdyakov>
Hashtbl.t isn't a type.
<sporkmonger>
oh ok
<sporkmonger>
what is the type of a hash table?
<Smerdyakov>
Read the standard library documentation.
<qwr>
sporkmonger: string int Hashtbl.t ?
<Smerdyakov>
qwr isn't right, either.
<sporkmonger>
ahh, i see
<qwr>
hmm, yes
<qwr>
(foo, bar) Hashtbl.t
<Smerdyakov>
qwr, I submit that it is very rude to just say the answer, rather than helping sporkmonger learn to read the manual.
<sporkmonger>
hehe
<qwr>
hmm, he should do it anyway ;)
<sporkmonger>
i figured it out on my own before i read his answer :-P
<sporkmonger>
i have a bad habit of asking the question, then looking for the answer
<sporkmonger>
and finding the answer because irc replies
<sporkmonger>
*before
<sporkmonger>
however, this doesn't seem to work:
* qwr
just looked the manual to figure out, what i remembered wrong
<sporkmonger>
let buckets bucket_file : string (State.t * State.t list ref) Hashtbl.t =
<sporkmonger>
syntax error, so i'm still missing something
<qwr>
sporkmonger: yes, it's not a tuple type there
evn_ has left #ocaml []
<sporkmonger>
woops, should've been
<sporkmonger>
let buckets bucket_file : (string, State.t * State.t list ref) Hashtbl.t =
<sporkmonger>
and... i found my error
<qwr>
sporkmonger: just two type parameters ;)
<sporkmonger>
called List.length on a list ref
RobertFischer has quit []
<Smerdyakov>
sporkmonger, and now you know why dependent types are great. You can write safe marshal-unmarshal with them. :)
<sporkmonger>
so, yeah, i guess my lesson is annotate any methods that unmarshal stuff
<Smerdyakov>
It's probably better to put a type annotation on each marshal/unmarshal cal.
<Smerdyakov>
marshal (x : int)
<Smerdyakov>
(unmarshal x : int)
<qwr>
Smerdyakov: how dependent types make marshalling safe?
* qwr
thinks demarshalling code would need to know the type expected. does dependent types make this type info somehow more available?
<Smerdyakov>
qwr, marshal and unmarshal can be implemented by recursion on type structure.
<Smerdyakov>
qwr, is it obvious to you that, for any of the types marshal handles (except maybe functions), you can write safe marshal/unmarshal specialized to that type?
<qwr>
Smerdyakov: i think yes
<Smerdyakov>
qwr, OK, then it should be clear why being able to recurse on type structure lets you write safe generic marshal/unmarshal.
<qwr>
Smerdyakov: hmm, i think i understood that...
<qwr>
Smerdyakov: haskell's read works similarly imho?
<qwr>
(using type classes...)
<Smerdyakov>
Similarly, but it doesn't work on all tuple types, for instance.
<Smerdyakov>
They hardcode N-ary tuples up to some fixed N.
<qwr>
ok :)
ikaros has quit [Read error: 104 (Connection reset by peer)]
ikaros has joined #ocaml
coucou747 has joined #ocaml
magthe has quit ["Ex-Chat"]
<jonafan>
why is excel retarded?
bluestorm has joined #ocaml
^authentic has joined #ocaml
^authent1c has joined #ocaml
^authent2c has joined #ocaml
authentic has quit [Read error: 110 (Connection timed out)]
^authent2c is now known as authentic
^authentic has quit [Read error: 110 (Connection timed out)]
thelema has joined #ocaml
^authent1c has quit [No route to host]
petchema has quit [Read error: 110 (Connection timed out)]
postalchris has joined #ocaml
<sporkmonger>
hmm, is there a function for printing out the contents of a hashtbl, like in toplevel?
<sporkmonger>
mostly for debug purposes
goalieca has joined #ocaml
<Smerdyakov>
No such thing in the standard library. You can write one yourself.
<sporkmonger>
ok
<thelema>
sporkmonger: if you write something nice, I'd like to include it as an extension to the Hashtbl stdlib.
<sporkmonger>
i suspect i'll probably just find another way to debug
* thelema
takes a stab at it
evn has left #ocaml []
<sporkmonger>
debugging a finite state model with 1000+ states turns out to be hard
<thelema>
Yes, I don't think printing the hashtbl would really help.
<sporkmonger>
well, i wanted it for a table with like 3 or 4 items in it
coucou747 has quit ["bye ca veut dire tchao en anglais"]
<sporkmonger>
but yeah
<sporkmonger>
for some reason, my model is always calculating probabilities of 1.0
<sporkmonger>
which ought to be impossible
<thelema>
there's some code in ExtLib to do dumps of arbitrary data by recursing over the binary structure, but I expect it'd produce difficult results for hashtbls.
<jlouis>
either an extension of the mantissa and exponent parts or something which can go closer to the rationals
<Smerdyakov>
thelema, you need to be able to figure out the size of the float to operate on it. I wasn't talking about physical representation, but rather semantics.
<Smerdyakov>
thelema, in any case, that sounds like a weird idea.
<thelema>
Smerdyakov: then yes, a tuple M, E, an M-bit mantissa and an E-bit exponent
<Smerdyakov>
thelema, what size float do you return as the result of an operation that yields a number that can't be represented by any size float?
<thelema>
that operation would need some parameters to decide how close an approximation to return.
<Smerdyakov>
Sounds altogether dodgy to me.
<thelema>
all 64-bit float operations have implicit mantissa/exponent parameters. This just makes everything explicit
<Smerdyakov>
I don't think anyone wants to use this ADT.
<thelema>
Smerdyakov: do you approve of OCaml's rational module?
<Smerdyakov>
It's a reasonable ADT, at least.
<Smerdyakov>
I don't work much with numbers, so I don't have any strong opinions about it.
<sporkmonger>
so, i'm just gonna assume Num will work until proven otherwise
<thelema>
sporkmonger: it will. be aware there's no float->num conversion, although there is string->num
<sporkmonger>
ok
<sporkmonger>
shouldn't be a problem
<sporkmonger>
anyways, i'm use omake, and i added num to OCAMLPACKS
<sporkmonger>
but it yelled at me for an unbound */
<sporkmonger>
ok, so there's no real performance improvement for boolean vs int then i assume?
<thelema>
palomer_: are you sure you need that? I guess you could schedule a task a certain time after the event, but there's likely a way to do things right.
<thelema>
sporkmonger: int is faster but of course bigger.
<palomer_>
thelema, I want something to happen every time a text entry has been updated
<sporkmonger>
i thought int was 32-bits?
<palomer_>
oh wait
<palomer_>
I'm an idiot
<palomer_>
I've already asked this question
<palomer_>
and had the answer
<palomer_>
ignore me
* palomer_
pleads insanity
<RobertFischer>
Damn it. My godi is hosed.
<RobertFischer>
Every time I fire it up, it just says "Illegal instruction" and stops. :(
evn has joined #ocaml
<sporkmonger>
that sucks
<sporkmonger>
i couldn't even compile godi, so
<thelema>
sporkmonger: on my computer, ints have 63 bits for storing the value and one bit for the GC.
<sporkmonger>
ok
LordMetroid has quit [Read error: 110 (Connection timed out)]
<sporkmonger>
well, i think speed is more important for what i'm doing
ttt-- has quit [Read error: 110 (Connection timed out)]
<sporkmonger>
technically this thing is eventually supposed to scan hundreds of transations / sec so
<sporkmonger>
er, hundreds of thousands rather
<sporkmonger>
hmm, maybe i should change my bit reader to take streams
<RobertFischer>
Uh oh.
<RobertFischer>
Now I've got "illegal instruction" any time I sudo.
<sporkmonger>
happened to me once, but it was because ulimit -s was set to something absurdly small
<sporkmonger>
iirc, 2
lordmetroid_ has quit [Client Quit]
LordMetroid has joined #ocaml
RobertFischer has joined #ocaml
Snark_ has quit ["Ex-Chat"]
<RobertFischer>
Anyone knows how to make it so that you can backspace in godi?
<flux>
tried control h?
lordmetroid_ has joined #ocaml
coucou747 has joined #ocaml
ygrek has quit [Remote closed the connection]
<RobertFischer>
Why is backspace ctrl-h in Godi?
jprieur has joined #ocaml
<flux>
it probably depends on how the terminal gets configured
<flux>
I don't know about godi's internals
<flux>
in unix ctrl-h is something one would expect to work if backspace doesn't, though
LordMetroid has quit [Connection timed out]
lordmetroid_ has quit [Client Quit]
mbishop has joined #ocaml
<RobertFischer>
flux: Thanks.
RobertFischer has quit []
RobertFischer has joined #ocaml
<sporkmonger>
yeah, i know i can set my terminal up in os x to bind the backspace key to ctrl-h
bluestorm has quit ["Konversation terminated!"]
chrisamaphone has joined #ocaml
mjrosenb has joined #ocaml
<mjrosenb>
soo....
<mjrosenb>
is && just a clever parsing trick?
<RobertFischer>
What makes you think so?
<mjrosenb>
RobertFischer: because it's a function
<RobertFischer>
mjrosenb: Right. An infix operator.
<mjrosenb>
so (&&) false;;
<mjrosenb>
should be a function that doesn't evaluate it's second argument, and returns false
<mjrosenb>
err
<mjrosenb>
it's argument
<RobertFischer>
Yup.
<pango_>
it's a special form, not something you can emulate with a function
<RobertFischer>
It's not uncommon to pass curried operators in as functions to things like map, iter, etc.
<mjrosenb>
right, but when you use it as a function value, it stops short circuiting
<sporkmonger>
ah hell... i fixed the bug i was having and suddenly my code is pegging the cpu to 100% and now it takes 60+ secs to produce a result
delamarche has quit []
<sporkmonger>
wish i knew why
vfdfdfvd has quit [Read error: 110 (Connection timed out)]
<sporkmonger>
so printf doesn't flush?
<pango_>
sporkmonger: use %! in format
<sporkmonger>
cool, thanks
<RobertFischer>
mjrosenb: If you're relying on short circuiting behavior of &&, you're doing something wrong. That's one of the IMHO things -- I'm sure other people will bicker -- but the rest is fine.
<mjrosenb>
RobertFischer: i wasn't, just i read that and thought it meant that it always short circuted ... even when partially applied
<mjrosenb>
and got very confused
<sporkmonger>
not sure, but i think my numbers are getting out of hand
<sporkmonger>
bah
seafood_ has joined #ocaml
<RobertFischer>
mjrosenb: If you're really lucky, the compiler might realize that the function will always return false and inline it. But probably not.
<mjrosenb>
pango_: that doesn't say how it gets translated into a function
<sporkmonger>
starting to wonder though if maybe there might be a math trick i could use that would allow me to skip the multiplication
<sporkmonger>
since i only need to know which probability is highest
<sporkmonger>
rather than an exact value
<pango_>
mjrosenb: as I said, it's a special form, it cannot be written as a function (or you have to "quote" arguments with (fun () -> ...) or similar to defer their evaluation)
<pango_>
it's sometimes annoying that you cannot define your own special forms in OCaml
<pango_>
I guess the next keyword is "camlp4"...
<mjrosenb>
pango_: there any documentation on special forms for ocaml?
<pango_>
mjrosenb: not formal one, afaik. There's only a short list of special forms anyway, if/then/else, &&, ||, lazy... (am I missing any?)
<mjrosenb>
i assume that if x then y else z ... evaluates to match x with true -> y, ...
<mjrosenb>
i know for sml, case foo of bar gets translated into a lambda and an application
<twobitsprite>
is there a better way to do something like: fun x -> mem x foo ... like how haskell has the function to swap the two arguments of a function...
<twobitsprite>
like: swap (mem foo) ... or something
postalchris has quit [Connection timed out]
<twobitsprite>
er... (swap mem) foo
<pango_>
mmmh well, match should probably be considered a special form too, not all branches are evaluated upfront, they're special evaluation rules
<mjrosenb>
not all branches can be evaluated...
<thelema>
twobitsprite: not built in, but trivial to construct such a swap function.
<pango_>
twobitsprite: what about let ( |< ) f x = f x and ( |> ) x f = f x like in F# ?
<mjrosenb>
pango_: i think the swap happens a step later
<pango_>
mjrosenb: yes, match must be a special form to... hence so is 'function'
<twobitsprite>
thelema, ok, I was just wondering if it was built in... thanks
flux has quit [Remote closed the connection]
<thelema>
twobitsprite: I've got some requests for those functions, but I don't think there's any consensus on nomenclature
<twobitsprite>
inria honors requests for functions?
<thelema>
twobitsprite: no. I'm not inria.
flx has joined #ocaml
<twobitsprite>
I didn't say you were...... I thought you were saying you've sent requests to inria to include those
<pango_>
mmh yes, I'm not sure those can be used to solve this case
<thelema>
twobitsprite: I'm the crazy guy thinking he can take community code and build a distro with an improved stdlib.
<twobitsprite>
thelema, ahh... I would use it! :) are you going to include an exponentiation operator which accepts integer exponents? :)
<thelema>
no releases yet - I'm going to finish UTF8 ropes and then try a release.
<twobitsprite>
right on
<thelema>
suggestions are welcome - code even better.
<twobitsprite>
I've always thought one of the things that has kept ocaml back from more wide-spread acceptance is all of the gaping holes in the stdlib
Tetsuo has quit ["Leaving"]
<thelema>
otoh, a bigger stdlib means more work just maintaining things for INRIA, which is why they won't do that.
<twobitsprite>
thelema, well... they could increase the stdlib by an order of magnitude or two and still be smaller than most other languages :)
<twobitsprite>
take python for example
<twobitsprite>
ships with an XML parser, and libraries for most major network protocols
<thelema>
java seemingly ships with a webserver.
<twobitsprite>
exactly
<twobitsprite>
so you have all of these horrible languages being widely used, yet such an elegant language like ocaml is still considered "accademic" ... I'm convinced its the stdlib... at least partly
<thelema>
RobertFischer: yes, that'll take some work. I plan on reviewing everything that goes in.
jprieur has quit ["Connection reset by beer"]
<twobitsprite>
RobertFischer, right... well, XML is a mess anyways
<RobertFischer>
twobitsprite: Unfortunately, it's an industry-standard mess. And neither YAML nor JSON seem to be beating it out of that role, despite promises to the contrary.
<sporkmonger>
JSON > YAML :-P
<RobertFischer>
Having a broken XML parser is like having a broken TCP/IP stack these days.
<RobertFischer>
A language just can't get away with it.
<sporkmonger>
tell that to ruby
<twobitsprite>
RobertFischer, right... I consider XML akin to legacy systems... sometimes you just have to either deal with them, or work around them...
<RobertFischer>
sporkmonger: See my link earlier: I did tell that to Ruby.
<twobitsprite>
unfortunately
<sporkmonger>
REXML is a cesspool of icky code
<sporkmonger>
oh, right
<sporkmonger>
sorry, didn't see
<sporkmonger>
lol
<RobertFischer>
Do you have a better solution for parsing XML with namespaces in Ruby? Hpricot doesn't support XML. (The Reddit comments are interesting, BTW: http://reddit.com/info/6d93y/comments/ )
<sporkmonger>
i wish i did
<sporkmonger>
i'd recommend libxml2
<sporkmonger>
but the bindings are sorta meh
<sporkmonger>
i've been tempted on numerous occasions to write new bindings for libxml2
<sporkmonger>
but every time i'm tempted, i remember how slow object creation in ruby is
<sporkmonger>
and i end up writing the whole thing in c and just pass back the final result
<sporkmonger>
instead of trying to create xml nodes directly in ruby
<sporkmonger>
of course, for stream based processing, not as much of an issue
<sporkmonger>
but yeah
love-pingoo has quit ["Connection reset by pear"]
Amorphous has quit [Connection timed out]
* RobertFischer
beats head against mod_caml set-up.
* RobertFischer
adds "get CocanWiki to run under FastCGI" to his to-do list.
mwc has joined #ocaml
Linktim_ has quit ["Konversation terminated!§§§!"]
chrisamaphone has quit ["Leaving."]
mjrosenb has left #ocaml []
gk has quit [Read error: 104 (Connection reset by peer)]
gk has joined #ocaml
bla has quit [Read error: 110 (Connection timed out)]