<rgrinberg>
hmm, is there a way to get the size of a hashtable?
<rgrinberg>
i mean for how many elements it's allocating memory for
GnomeStoleMyBike has quit [Ping timeout: 244 seconds]
lggr has quit [Ping timeout: 244 seconds]
lggr has joined #ocaml
emmanuelux has joined #ocaml
Yoric has joined #ocaml
<_habnabit>
rgrinberg, what would you do with that information?
<_habnabit>
rgrinberg, are you trying to diagnose a problem?
lggr has quit [Ping timeout: 246 seconds]
lggr has joined #ocaml
madroach has quit [Ping timeout: 240 seconds]
lggr has quit [Ping timeout: 252 seconds]
madroach has joined #ocaml
lggr has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
lggr has joined #ocaml
avsm1 has quit [Quit: Leaving.]
lggr has quit [Ping timeout: 265 seconds]
lggr has joined #ocaml
Yoric has quit [Ping timeout: 245 seconds]
lggr has quit [Ping timeout: 276 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 244 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 255 seconds]
lggr has joined #ocaml
jave has joined #ocaml
jave_ has quit [Ping timeout: 246 seconds]
lggr has quit [Ping timeout: 255 seconds]
jamii has quit [Ping timeout: 245 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 260 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 245 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 245 seconds]
lggr has joined #ocaml
cdidd has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 252 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 245 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 255 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 276 seconds]
lggr has joined #ocaml
jls has joined #ocaml
jls has quit [Client Quit]
johnsingleton has joined #ocaml
lggr has quit [Ping timeout: 246 seconds]
<johnsingleton>
Hi, I'm pretty new to OCaml and I'm having kinda a strange type problem. I'm sure it's simple but could someone have a look? http://pastebin.com/t5mEzixu
<kba>
johnsingleton: what problem do you get
<johnsingleton>
The error I get is "Error: This expression has type unit list but an expression was expected of type unit" -- it seems like I am keeping all my types straight, so I am confused
<kba>
so something is returning a list where it shouldn't
lggr has joined #ocaml
<johnsingleton>
is it possible to just tell it to return type unit after List.iter?
<johnsingleton>
if that's what its beef is
<johnsingleton>
perhaps using List.iter is not really what I want...
<kba>
I'm not sure if that would help, but yes it's possible
<kba>
expression; expression
<kba>
If you have like that, the last expression would be returned
<kba>
so List.iter (....); ()
<kba>
but if you need to do that, you should probably rewrite your code
<kba>
and keep in mind that I'm by no means an expert in OCaml
<johnsingleton>
I'm just trying to populate my hash table… perhaps a recursive loop would be more appropriate
<kba>
that's how I would do it
lggr has quit [Ping timeout: 244 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 246 seconds]
lggr has joined #ocaml
Yoric has joined #ocaml
lggr has quit [Ping timeout: 240 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 245 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 252 seconds]
lggr has joined #ocaml
Yoric has quit [Ping timeout: 240 seconds]
lggr has quit [Ping timeout: 248 seconds]
lggr has joined #ocaml
<johnsingleton>
oooook. So I've managed to work out that type error (it was a parens problem) but now I have something I'm totally stumped on: http://pastebin.com/g7tQa20E -- I get an error that: "Error: Some type variables are unbound in this type: method aj has type ('a, 'b list) Hashtbl.t where 'b is unbound"
<johnsingleton>
what exactly is unbound about b'?
lggr has quit [Ping timeout: 245 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 246 seconds]
lggr has joined #ocaml
<johnsingleton>
I think I understand the problem
<johnsingleton>
is it possible for me to specify the types that the hash table will handle in the signature?
lggr has quit [Ping timeout: 240 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 255 seconds]
lggr has joined #ocaml
lggr has quit [Ping timeout: 256 seconds]
<_habnabit>
johnsingleton, if your class is polymorphic, you have to do e.g. `class ['a, 'b] graph edge_list`
lggr has joined #ocaml
<johnsingleton>
I just solved it with this: val adjacency_list : (int, int list) Hashtbl.t = Hashtbl.create (length edge_list)
<johnsingleton>
is that acceptable?
<_habnabit>
johnsingleton, well, if that's what you mean, sure. it's not polymorphic, though
<johnsingleton>
in this case, I do want the type to be fixed
<_habnabit>
sounds fine
<johnsingleton>
I would have to do things more generically to make it polymorphic
<johnsingleton>
ok coolness, thanks
<_habnabit>
fwiw i got your pastebin to compile with just this change:
<wieczyk>
Nice article, but still i do not know how it works.
<wieczyk>
Not this certain type system, but how to encode C program as a lambda term
<wieczyk>
and check by some cool type system.
<wieczyk>
I would like to use my tool for
<wmeyer>
companion_cube: but usually it's not if you use combinators
lggr has quit [Ping timeout: 255 seconds]
<wieczyk>
implementing for example a something similar which encodes simple WHILE language in some lambda terms and checks.
<wmeyer>
wieczyk: Looks quite cool
<wieczyk>
I need this, becuase without a sandbox I cannot understand how exacly some thinks works and how to use it in practical world.
<companion_cube>
indeed, it not perfect
<wieczyk>
Thanks
<wmeyer>
I struggle with Format often
<wieczyk>
When I finish base
<wieczyk>
and have something bigger done
<wieczyk>
then feel free to develop this code too ;]
<wmeyer>
I would prefer something more automated but still doing nice job
groovy2shoes has joined #ocaml
<wmeyer>
wieczyk: thanks, maybe someday I can try to port it to my framework
<wieczyk>
mhmhm
lggr has joined #ocaml
<wmeyer>
companion_cube: I have usual workflows for everything apart format module
chambart has quit [Ping timeout: 246 seconds]
<wmeyer>
companion_cube: but now i think i have one: first do everything separated by "@ " and no boxes
<wmeyer>
companion_cube: and then do the "@;"
<wmeyer>
and finaly boxes
<wieczyk>
"@;" ?
* companion_cube
uses nested boxes
<wmeyer>
wieczyk: yes, read about Format module
<wieczyk>
I saw only interface.
<wmeyer>
wieczyk: sorry; being annoyed.
<wieczyk>
Sorry.
<wieczyk>
ok.
<companion_cube>
wmeyer: there are shortcuts in Format strings
<companion_cube>
stuff like "@[<h 2>%a:%d@]@;"
lggr has quit [Ping timeout: 240 seconds]
Yoric has joined #ocaml
<wmeyer>
yes, I use it
<wmeyer>
wieczyk: Format module allows to pretty print basicaly using boxes and indenetation :-) That's me tired, not you :)
lggr has joined #ocaml
<wmeyer>
so no need to be sorry
* wmeyer
being harsh today
<wmeyer>
ok companion_cube I agree it's pretty cool if somebody takes a structured approach and knows how to nest them
<wmeyer>
otherwise it's pain
lggr has quit [Ping timeout: 246 seconds]
Xizor has quit [Quit: So yes it's mIRC under wine under debian double peche capital. ;) I'll soon see in kfreeBSD.]
lggr has joined #ocaml
<wmeyer>
wieczyk: are you going to be extending the language?
<wieczyk>
Yes.
<wieczyk>
Now I want to focus on my master thesis and finish compiler for MiniML [according to Appel's book]
<wmeyer>
so it's not a sort of research project: hack away, play around, write a paper and then leave it to rot.
<wieczyk>
When I will have this basic, I am goint to extending etc.
<wieczyk>
No
<wieczyk>
I want to have code clear, I want this tool to be usable for other peoples.
<wieczyk>
I think it is a important part of popularizing programming-languages-related computer science.
<wmeyer>
wieczyk: I like the idea, good luck with it
<wieczyk>
Becuase currently we have a lot of articles, but even interested people [like me and you] dont know how to use many thinks.
<wieczyk>
Thanks.
<wieczyk>
For example
<wieczyk>
I believe that it is easy to improve quality of seminars on my university.
<wieczyk>
Instead of only-speaking-about-some-article
<wieczyk>
somecone could clone MiniML implementation to .. for example MyML
<wieczyk>
and have complete typechecker, parser, rpinter etc
<wieczyk>
and just focus on implementing extension from article.
<wmeyer>
wieczyk: that's correct, with an assumption people wanting to learn ML
<wieczyk>
But ok, I dont want to speak a lot about project. I hope it will not day.
<wieczyk>
I will force them to learn ML :D
<wmeyer>
the sad and pragmatic true is that people *don't want to even hear about ML*
lggr has quit [Ping timeout: 260 seconds]
<wieczyk>
;[
<wieczyk>
day -> die
<wieczyk>
my sound-based-writing english is fun.
<wieczyk>
funny*
<wmeyer>
mention ocaml at work - you will be either perceived as mental or different or that or other way they will be ingoring you
<wieczyk>
Yeah, I feel it now.
<wieczyk>
Sometime I think that people see me as a crazy man who cannot accept C++
<wmeyer>
one needs to use dirty social hacks to drag them to the dark side
<wieczyk>
It is funny for me how people believe in C++. When for example you tell that C++ is not good language, standard is not good.
<wmeyer>
and tacticals like, inserting braces in DSL or encoding dsls in XML
<wieczyk>
Then they with some emotional backend offense you 'WHAT !? WHAT IS BAD IN C++?!'
<wmeyer>
wieczyk: they are religious, some of them are aware it's crap, but will admit otherwise
lggr has joined #ocaml
<wieczyk>
In this language the order of evaluation of functon arguments is not specified.
<wmeyer>
wieczyk: I wouldn't be to picky about it, in OCaml too
<wieczyk>
Moment, i need to check what means the "picky" :D
<wmeyer>
wieczyk: in C++ is much worse, functions are mostly impure
<wieczyk>
Yes, and people are encoding higher order stuff by some non-effective entities like boost::function, boost::bind
<wieczyk>
Also polymorphism in C++ is bad. In ML
<wieczyk>
f :: forall a b, t
<wieczyk>
means that the code of functions is correct for any types we put as 'a' and 'b'
<wieczyk>
in C++ no, you can write template<> code which is correct only for some types.
<wieczyk>
bleh.
<wieczyk>
I know that ML also can have some ugly stuff.
<wieczyk>
It is normal, nothing is perfect.
* wmeyer
is in mood after using Format to defend C++ to piss off a bit wieczyk.
<wieczyk>
hehe
<wmeyer>
nope
<wmeyer>
i admit C++ is not a good language
<wmeyer>
and people are not aware
<wmeyer>
about it
<wmeyer>
JS is not better
<wmeyer>
and people are not aware about it too
<wieczyk>
Yes, I cannot admit that many C++ users are not aware that C++ like any other thing in this universe is not perfect.
<wieczyk>
OK
<milki>
theres a triple negative in that sentence
<milki>
>.<
<wieczyk>
I am going away, before you will panish me for Format module :D
<wmeyer>
wieczyk: maybe you know or not, actually you would be surprised but they might have some light in their brains telling them that ML is much better.
<wieczyk>
hehe
<wieczyk>
punish*
* wmeyer
not having very clear thoughs today
<wmeyer>
wieczyk: it was actually nice to rant again C++!
<wmeyer>
but I want really more people trying ML like you
lggr has quit [Ping timeout: 244 seconds]
<wmeyer>
actually writing serious stuff in it
lggr has joined #ocaml
wmeyer has left #ocaml []
iago has joined #ocaml
lggr has quit [Ping timeout: 246 seconds]
lggr has joined #ocaml
avsm has quit [Quit: Leaving.]
lggr has quit [Ping timeout: 244 seconds]
jbrown__ has quit [Ping timeout: 240 seconds]
lggr has joined #ocaml
emmanuelux has quit [Quit: emmanuelux]
ontologiae has quit [Ping timeout: 276 seconds]
jbrown__ has joined #ocaml
lggr has quit [Ping timeout: 256 seconds]
lggr has joined #ocaml
GnomeStoleMyBike has quit [Ping timeout: 246 seconds]