gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
MaskRay has joined #ocaml
MaskRay has quit [Changing host]
MaskRay has joined #ocaml
Tobu has joined #ocaml
NihilistDandy has joined #ocaml
twittard_ has joined #ocaml
twittard_ has quit [Client Quit]
Ori_B_ has quit [Quit: leaving]
twittard has quit [Ping timeout: 260 seconds]
Tobu has quit [Read error: Operation timed out]
ulfdoz has quit [Ping timeout: 240 seconds]
ulfdoz has joined #ocaml
Tobu has joined #ocaml
Tobu has quit [Read error: Operation timed out]
emmanuelux has quit [Ping timeout: 240 seconds]
otk_ has quit [Ping timeout: 272 seconds]
Tobu has joined #ocaml
ulfdoz has quit [Ping timeout: 265 seconds]
twittard has joined #ocaml
<dsheets> *sigh* porting my compiler to the browser with js_of_ocaml is currently stalled on mutual recursion in the parser :-(
<dsheets> functorizing the system calls away was trivial in comparison
Tobu has quit [Ping timeout: 260 seconds]
twittard has quit [Quit: twittard]
Tobu has joined #ocaml
cdidd has joined #ocaml
EmmanuelOga has quit [Ping timeout: 244 seconds]
cyphase has quit [Quit: http://www.cyphase.com/]
cyphase has joined #ocaml
everyonemines has joined #ocaml
otk has joined #ocaml
EmmanuelOga has joined #ocaml
MaskRay has quit [Remote host closed the connection]
MaskRay has joined #ocaml
The_third_man has joined #ocaml
tzictli has joined #ocaml
EmmanuelOga has quit [Ping timeout: 244 seconds]
pango is now known as pangoafk
Tobu has quit [Ping timeout: 260 seconds]
Tobu has joined #ocaml
edwin has joined #ocaml
ftrvxmtrx has joined #ocaml
tzictli has left #ocaml []
NihilistDandy has quit []
cyphase has quit [Ping timeout: 260 seconds]
thomasga has joined #ocaml
antegallya has joined #ocaml
willb has quit [Ping timeout: 260 seconds]
willb has joined #ocaml
emias has joined #ocaml
antegallya has quit [Ping timeout: 272 seconds]
djcoin has joined #ocaml
cyphase has joined #ocaml
ikaros has joined #ocaml
Xizor has joined #ocaml
<ppilatus> Hello, what is the name of `not' function in OCaml?
<ppilatus> That is, boolean negation
<djcoin> not ?
<ppilatus> uh
<ppilatus> right
<ppilatus> sorry
<djcoin> :)
<ppilatus> I have another question however. I have this code for modelling NFAs: http://ideone.com/wihig it is actually F#, but I think the idea is simliar. 's here is a type for states and 'a - type for letters. Now, I want to construct an function which converts a NFA to a NFA with only one final state. The problem is, that means I have to add additional state: adding another value to the type 's. Is it even possible to do that?
<ppilatus> Should I stop using types for representing sets for states/alphabets? Would it be better to use states instead?
avsm has joined #ocaml
milosn_ is now known as milosn
Obfuscate has quit [Ping timeout: 276 seconds]
Kakadu has joined #ocaml
_andre has joined #ocaml
roha has joined #ocaml
ikaros has quit [Quit: Ex-Chat]
Cyanure has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
avsm has quit [Quit: Leaving.]
Tobu has joined #ocaml
mcclurmc has quit [Excess Flood]
mcclurmc has joined #ocaml
Obfuscate has joined #ocaml
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
mcclurmc has quit [Excess Flood]
mcclurmc has joined #ocaml
<flux> ooh, how could I have missed that (yet another) generic printer patch for ocaml: http://alan.petitepomme.net/cwn/2011.12.13.html#5
Tobu has quit [Ping timeout: 260 seconds]
roha has quit [Ping timeout: 252 seconds]
Obfuscate has quit [Ping timeout: 240 seconds]
goncalo has quit [Remote host closed the connection]
avsm has joined #ocaml
Obfuscate has joined #ocaml
Tobu has joined #ocaml
dwhj has joined #ocaml
NihilistDandy has joined #ocaml
Submarine has quit [Ping timeout: 252 seconds]
silver has quit [Ping timeout: 240 seconds]
letrec has joined #ocaml
antegallya has joined #ocaml
ulfdoz has joined #ocaml
emmanuelux has joined #ocaml
silver has joined #ocaml
<everyonemines> ppilatus: Use variant types if the set is fixed. Otherwise use a hashtable.
<everyonemines> That's my suggestion.
<flux> (or Set.t if you want to stay functional)
djcoin has quit [Ping timeout: 272 seconds]
<flux> actually hmm right, it's a bit tricky in that case perhaps
<everyonemines> I don't mind not having a generic print that much, but what you hear from people learning ocaml is
<everyonemines> 1) no generic print 2) wtf are refs
<everyonemines> or "why can't i mutate this variable"
<everyonemines> I have to admit that ocaml is not noob-friendly for someone coming from C or java
roha has joined #ocaml
<everyonemines> and for that problem I don't think "but you can patch it, sort of, with this 3rd party thing" will satisfy people :-/
<flux> well, there is a chance in near (?) future we will see some runtime type capabilities or generic printing
<flux> in practice it -is- kinda annoying to have to write generic printers for your datastructures when debugging. and Std.dump doesn't always fit the bill.
wwi has joined #ocaml
<flux> whereas dynamic languages make it so easy.
<wwi> bonjour
<everyonemines> Well, that patch isn't a generic printer for new datastructures.
<everyonemines> They could just implement generic print in the interpreter
<everyonemines> with a special function that gets removed during compilation.
<flux> hmm, it works for everything that has string_of defined? and you can locally define them for external data structures
<everyonemines> oh, that's how it works
<everyonemines> an OO sort of thing
<flux> I think it would automatically work for, say, map of maps of strings to ints
<flux> that kind of pretty printer would be annoying to write, especially for a newbie
<flux> and should there be some unsupported datatype, you can (?) just write let string_of_blahgargh a = .. in show your_data_structure_involving_blahgargh
<flux> haven't tried it though :)
<flux> of course, the bad sode of %show is that it doesn't generalize
<flux> when you see that working, you want more, and you get disappointed that it's some compiler majikk :)
<flux> (much like printf)
<everyonemines> printf is kind of ugly too
<everyonemines> well, not worse than in C I guess
<flux> well, better actually, because it's safe
<flux> and I prefer to use it for all my formatted output needs
<everyonemines> I mean in terms of implementation hackery
<flux> sure
<flux> I think the C version is a lot simpler ti implement, though :)
ulfdoz has quit [Remote host closed the connection]
ulfdoz has joined #ocaml
Tobu has quit [Ping timeout: 260 seconds]
wwi has quit [Remote host closed the connection]
djcoin has joined #ocaml
avsm has quit [Read error: Connection reset by peer]
avsm has joined #ocaml
emmanuelux has quit [Read error: Connection reset by peer]
emmanuelux has joined #ocaml
roha has quit [Remote host closed the connection]
Tobu has joined #ocaml
ontologiae has joined #ocaml
<ontologiae> hi all
<djcoin> hi
EmmanuelOga has joined #ocaml
ulfdoz has quit [Quit: kernel-upgrad]
antegallya has quit [Read error: Operation timed out]
ulfdoz has joined #ocaml
iago has joined #ocaml
leoncame` has quit [Quit: Asta la vista]
Kakadu has quit [Quit: Page closed]
antegallya has joined #ocaml
<thelema> ppilatus: use functors and provide a function to create a new state
scottmcl66 has joined #ocaml
<thelema> ppilatus: or pass in as argument to your conversion function a helper that will build a state of the right type
<thelema> val convert : ('s, 'a) nfa -> (unit -> 's) -> ('s, 'a) nfa
everyonemines has quit [Quit: Leaving.]
<djcoin> what was ppilatus question ?
<thelema> djcoin: about using polymorphic types to represent states of an NFA and how to generate a state if your function doesn't know the state type
<djcoin> thelema: thanks ! :)
scottmcl66 has quit [Quit: ChatZilla 0.9.88 [Firefox 10.0.1/20120208060813]]
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
dwhj has quit [Quit: dwhj]
emmanuelux has quit [Remote host closed the connection]
beginner has quit [Read error: Connection reset by peer]
beginner has joined #ocaml
emmanuelux has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
MaskRay has quit [Quit: leaving]
emmanuelux has joined #ocaml
Kakadu has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
emmanuelux has quit [Read error: Connection reset by peer]
emmanuelux has joined #ocaml
emmanuel_ has joined #ocaml
emmanuel_ has quit [Read error: Connection reset by peer]
emmanuel_ has joined #ocaml
emmanuel_ has quit [Client Quit]
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
iago has quit [Quit: Leaving]
iago has joined #ocaml
iago has quit [Client Quit]
iago has joined #ocaml
<ppilatus> thelema: this is interesting, but it seems like something hard to use
<ppilatus> (eg: if I have 'type S = Q0 | Q1' what would be the state-generating function?)
<ppilatus> I should probably switch to Sets
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
<thelema> or integers to identify states.
<thelema> and put them in an array.
<thelema> here's some types from my FA library
spearalot has joined #ocaml
<ppilatus> oh, interesting
<ppilatus> thanks
<ppilatus> I am not sure what do you mean by "integers to identify states" tho
thomasga has quit [Quit: Leaving.]
letrec has quit [Ping timeout: 252 seconds]
<ppilatus> May I also ask you, why do you need bool here: https://github.com/thelema/ocaml-regex/blob/master/minreg.ml#L11 ?
<thelema> all the nfa states are in an array, their ID is the index in the array
<ppilatus> ah
<thelema> the bool in that is whether this node is already simplified.
<thelema> It's been a long time since I wrote that code, but I recall having to track whether each sub-expression was simplified
<thelema> oh yeah, so I could do multiple operations on the minreg and then simplify the whole thing.
ftrvxmtrx has quit [Quit: Leaving]
NihilistDandy has quit []
djcoin has quit [Quit: WeeChat 0.3.2]
Cyanure has quit [Remote host closed the connection]
mdelaney has joined #ocaml
ftrvxmtrx has joined #ocaml
beginner has quit [Changing host]
beginner has joined #ocaml
mdelaney has quit [Quit: mdelaney]
hyperboreean has quit [Ping timeout: 240 seconds]
avsm has quit [Quit: Leaving.]
mdelaney has joined #ocaml
Drup has joined #ocaml
avsm has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Client Quit]
Tobu has quit [Ping timeout: 260 seconds]
antegallya1 has joined #ocaml
antegallya has quit [Disconnected by services]
antegallya1 is now known as antegallya
Tobu has joined #ocaml
ontologiae has quit [Ping timeout: 255 seconds]
mdelaney has quit [Quit: mdelaney]
avsm has quit [Quit: Leaving.]
Drup has quit [Quit: Leaving.]
ulfdoz has quit [Ping timeout: 265 seconds]
ulfdoz has joined #ocaml
ulfdoz has quit [Ping timeout: 265 seconds]
_andre has quit [Quit: leaving]
Tobu has quit [Ping timeout: 260 seconds]
ulfdoz has joined #ocaml
ontologiae has joined #ocaml
avsm has joined #ocaml
pangoafk is now known as pango
thizanne has quit [Ping timeout: 240 seconds]
Tobu has joined #ocaml
Tobu has quit [Ping timeout: 260 seconds]
NihilistDandy has joined #ocaml
NihilistDandy has quit [Client Quit]
Tobu has joined #ocaml
Kakadu has quit [Remote host closed the connection]
<gildor_> thelema: pull request send
<thelema> gildor_: thanks, I'll look at it now
<thelema> next time you send pull request, you won't include the "not for pull request" commits, right?
<thelema> maybe best to use --squash...
<gildor_> thelema: I reverted it
<gildor_> what is squash ?
<thelema> gildor_: I noticed. It still clutters the commit history, and git allows very nice history rewriting
mifadir has joined #ocaml
<thelema> squash turns your 10 commits into a single commit
<thelema> todo: benchmark ocaml cost of mod by various constants and compare with bit shift
<gildor_> thelema: oh, that is nice, git rebase --squash
<gildor_> thelema: I suppose you are talking of / 8
<thelema> let *rec* apply_bit_op ? odd way to extend
<thelema> L30
<thelema> "if n mod 8 = 0 ..."
<gildor_> thelema: not sure it will be a big win in the end, but at least it is only needed in 2 places of the code
<thelema> Is apply_bit_op faster than inlining each option?
<thelema> sure, not a big deal. `n land 0x07 = 0`
<gildor_> it costs smthg like 1%-2% of perf
<gildor_> that the reason i didn't do it for mem
<gildor_> (mem is fully inlined)
<gildor_> I choose to optimize read operation and simplify write operation
<thelema> what's the TODO: mask comments?
<thelema> Is apply_bit_op faster than inlining each option?I'll just look at the whole diff instead...
<gildor_> where the TODO mask comments ?
<thelema> in your first bitset.ml-modifying commit.
<thelema> they got replaced in a later commit.
<thelema> (it's harder to review pull requests when they modify things repeatedly.)
<thelema> I see you didn't go for exponential resizing
<thelema> it looks like there's a bunch of functions that got un-implemented
jave has quit [Ping timeout: 276 seconds]
jave has joined #ocaml
spearalot has quit [Quit: Computer has gone to sleep]
NihilistDandy has joined #ocaml
student202 has joined #ocaml
<student202> Can anyone help me with creating a certain function in ocaml?
<_habnabit> I dunno; can anyone?
<student202> Can you :)?
<_habnabit> how am I supposed to know
<NihilistDandy> (fun x -> x+1)
<_habnabit> I'm not omniscient
<thelema> student202: just ask your question
<NihilistDandy> I'm mathematically certain that's a function
<student202> Alright, I have a list and I want to check every element against itself in that list for some certain property.
<adrien> (+) 1
<thelema> List.filter?
<thelema> List.exists? List.for_all?
<student202> Still not quite clear how to do so
ski has quit [Ping timeout: 248 seconds]
<thelema> student202: what's the return type of your function?
<_habnabit> well, you haven't explained _what_ you want to do
<student202> I would ideally want to to return a boolean
<thelema> student202: and that boolean is true only when all elements in the list have the property?
<student202> for example the problem is based off units
<thelema> let l = [2;4;6] in let p x = x mod 2 = 0 in List.for_all p l
<student202> so if I have FT LBS M S
<student202> that would be an invalid list because ft and m share the same base unit: which is m
<thelema> you want to see if any pair of elements have a paired property?
<student202> basically yes
<student202> I'll give another example
<thelema> let rec test_pairs p = function [] | [_] -> true | x::tl -> not (List.exists (p x) tl) && test_pairs p tl
<student202> Yeah this seems like it would work
<student202> basically no two elements in the list cannot have the same property of sharing a base unit
<thelema> it's O(n^2). If you can categorize your items, you could probably drop the complexity down to O(dn) with d categories
<thelema> or maybe even O(n)
<student202> thanks for the help, i'll see if this works and try to dissect what it's saying lol
<thelema> although it'd be a bit more code.
edwin has quit [Remote host closed the connection]
<student202> I'm still quite lost even with some help. The function I am trying to write takes in a list. It is a list of base units (grams, seconds, meters) or a list of derived units, units that are derived from the base units, such as kg, km and min. Basically the list that I generated can have combinations of those units. Like [km;m;s;min] but I want to call a function on this list to make sure that every unit in the list do not shar
<student202> For the case of [km;m;hour;min] this would be an invalid list because km and m share the base unit m, and hour and min share the base unit seconds
<thelema> do you have a function to tell if a pair is invalid?
<student202> No but I could write one, it basically would just read from a hashtable to see its base unit
<thelema> write one, call it 'p' and use test_pairs p l
<student202> Alright.
cdidd has quit [Remote host closed the connection]
<gildor_> thelema: I am back
<gildor_> thelema: what do you mean by un-implemented ?
<thelema> gildor_: oops, misread
<thelema> gildor_: I must have been looking at an earlier commit where intersect/etc. weren't implemented
<thelema> I see now the apply_set_op function
<gildor_> thelema: the .mli is fully implemented in the new version
<gildor_> thelema: and if you run the tests on the old version, you'll see that there are various bugs
<thelema> out of curiosity, do you recall the bugs you found?
<gildor_> thelema: yes, one of them is wiht create_full
<thelema> creating the last few elements in the set?
<gildor_> the doc said that its count must match the parameter
<thelema> I noticed the code to handle that - good check
<thelema> s/check/catch/
<gildor_> wait a minute, I'll switch to the ref branch
<gildor_> AFAIR, there was a bug in diff or sym_diff
<gildor_> no, it was in diff (test diff1)
<gildor_> if one bitset is longer than the other, the difference of size if filled with bit set
<gildor_> e.g. if you diff 2 sets of 5 elements, you get 130 elements at the ened
<gildor_> thelema: ^^^
<thelema> ah, diff fills with 0xff instead of 0x00? That's a big oops
<gildor_> next time, I'll rebase before pushing, it will ease your work
<thelema> yes, please.
<thelema> gildor_: pull request merged
<gildor_> thelema: L316 of the previous version
<gildor_> thelema: even the comment is false
* gildor_ not a git/github expert
<thelema> yes, that code is not correct for diff.
<thelema> I think those three lines shouldn't be there. only extra a bits should get copied.
<thelema> but anyway...
<thelema> four lines
<thelema> thanks for your help. I'm tempted to throw together a version of bitset using bigarray (or maybe float arrays and Int64.of_float) to get larger block sizes for scanning
<thelema> although if the set is really that sparse, a int Set.t might be better
<gildor_> thelema: you can try a bigarray for size, but you won't get a big performance improvement
Tobu has quit [Ping timeout: 260 seconds]
<thelema> well, I'd want to use an int array, but mod 63 or mod 31 isn't so nice.
<gildor_> thelema: knowing that on 32bit computer you can already store 128M integers in a bitset
<gildor_> thelema: oh, i tried a int array (63)
ontologiae has quit [Ping timeout: 272 seconds]
<gildor_> thelema: not big perf improvement
<thelema> ok.
<gildor_> thelema: keep in mind that there is a write barrier
<thelema> not for ints
<thelema> only for pointer values
<gildor_> so if you store whatever in a int array it'll check the write barrier first
<gildor_> it won't check the int, because it is an immediate value, but it'll check the array
<thelema> really?
<thelema> interesting...
<gildor_> not 100% sure, it needs to be checked
<thelema> `a.(5) <- 3` shouldn't involve any write barrier
<_habnabit> is there a simple way of getting the 5th through last elements of an array? I thought BatArray had a thing, but I don't see it
<_habnabit> reading over it again
<thelema> hmm, I thought I added a 'tail' function to array. Maybe I only did for strings
<_habnabit> so just Array.sub ?
<thelema> yup, only strings. should copy that over.
<thelema> yes. I'll add in Array.head,tail,first,last to get slices identified by position or length
<_habnabit> hooray, thanks
<thelema> (or you can do it and save me the work - they're already implemented in BatString
<_habnabit> atm is not a good time; maybe tomorrow, but I have too many things I need to finish today
<thelema> ok, I'll probably do it by then
<gildor_> thelema: anyway, concerning int array vs string the logic is almost the same
<gildor_> thelema: but char are small enough to play with intermediate array (likt next_set_bit_array) which are a big performance win
<gildor_> thelema: all in all string ref is the best implementation i have
<gildor_> thelema: (I had a look at the asm generated by an assignement in a string, and think there is no write barrier involved)
* gildor_ time to go to bed
<thelema> yes, next_set_bit_array is nice.
<thelema> it'd have to be broken up for ints
<thelema> maybe 16b at a time
<thelema> good night.
Tobu has joined #ocaml
mifadir has quit [Quit: Quitte]
avsm has quit [Quit: Leaving.]
Jetbeard has joined #ocaml
<Jetbeard> dear god, I've been up far too long
<Jetbeard> the OCaml compiler is complaining about a syntax error on the following line of code: " iter (fun (x, l) -> gen (CASEARM x l)) arms;
<Jetbeard> can anybody immediately spot what's wrong with this and tell me why i'm being stupid?
<_habnabit> it's probably something not on that line
<Jetbeard> It compiles just fine without that line
<_habnabit> oh, that's right
<_habnabit> did you mean CASEARM (x, l) ?
<_habnabit> forgot about ocaml's crazy init-upper vs. init-lower fetish
<Jetbeard> ah yes, it's possible i do
<Jetbeard> that's fixed it, thanks
<Jetbeard> iter (fun (x, l) -> gen (CASEARM x l)) arms;
<Jetbeard> oops disregard that, middle-click paste etc.
<Jetbeard> byebye now
<Jetbeard> thankyou again _habnabit
Jetbeard has quit [Quit: off to sleep]
letrec_ has joined #ocaml
ftrvxmtrx has quit [Ping timeout: 240 seconds]
Xizor has quit []
MaskRay has joined #ocaml
Tobu has quit [Ping timeout: 260 seconds]
antegallya has quit [Ping timeout: 252 seconds]
otk_ has joined #ocaml
otk has quit [Ping timeout: 245 seconds]
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 272 seconds]
ulfdoz_ is now known as ulfdoz