authentic has quit [Read error: 110 (Connection timed out)]
^authentic is now known as authentic
nuncanada has joined #ocaml
Palace_Chan has joined #ocaml
<Palace_Chan>
ah i forget "!" is for getting at the contents of a reference...is there a quick way to negate ? as in !false = true ?
<tsuyoshi>
not false = true
lorph has joined #ocaml
ched_ has joined #ocaml
<lorph>
if I have type test = Info of (string * int list)
<lorph>
how do I get the int list part
<lorph>
snd doesn't work for me
ched has quit [Read error: 110 (Connection timed out)]
<tsuyoshi>
let Info (_, foo) = bar
<tsuyoshi>
where bar is a test
<tsuyoshi>
and foo ends up being the int list
<lorph>
is that really the only way
<tsuyoshi>
if you want to use snd then you can do let Info foo = bar in snd foo
<lorph>
they both look crufty
<tsuyoshi>
if that is the only case for test, you could just do type test = string * int list
<tsuyoshi>
and then you don't need pattern matching
<tsuyoshi>
but with constructors you need to pattern match
<lorph>
ok thanks for the help
jeddhaberstro has left #ocaml []
struktured has quit [Read error: 110 (Connection timed out)]
struktured has joined #ocaml
nuncanada has quit ["Leaving"]
tvn1981a has joined #ocaml
struktured_ has joined #ocaml
tvn1981a has quit ["ChatZilla 0.9.83 [Firefox 3.0.1/2008070206]"]
struktured has quit [Read error: 110 (Connection timed out)]
thelema has quit [Read error: 60 (Operation timed out)]
electronx has joined #ocaml
Associat0r has quit []
mgodshall has quit [Read error: 104 (Connection reset by peer)]
mgodshall has joined #ocaml
electronx is now known as fatalerrorx
Yoric[DT] has joined #ocaml
<Palace_Chan>
if i want to check in ocaml code if something is an int32 how may i do that ?
<Palace_Chan>
like, something like val is_int32 of type int32 -> bool exists ?
<flux>
palace_chan, let is_int32 (foo : int32) = true
<flux>
if you want to extract that information out of a type variable, you cannot
<Palace_Chan>
im not sure i understand what "option" does in a type...like, what is an "int option" type conceptually ?
<Palace_Chan>
(maybe if i get that i would get what i am asking about)
<flux>
'int option' is either nothing (None) or an integer (Some 42)
<Palace_Chan>
type 'a option = None | Some of 'a
<flux>
a plain int is always an integer
<Palace_Chan>
so 'a option means it can be nothing or some thing of type 'a
<flux>
yes
<struktured_>
Palace_Chan: beats using a magic number, right?
<Palace_Chan>
haha, yes it's very interesting
struktured_ is now known as struktured
<Yoric[DT]>
hi
<Palace_Chan>
if i have something of type int * int option, and i take it as an argument foo to a function, can i say: match foo with | None -> 0 | Some (a,b) -> a+b ?
<Palace_Chan>
to break it apart if it happens to not be nothing ?
<flux>
palace_chan, you're actually looking for type (int * int) option, but yes
<flux>
you might also keep the None/Some and do match foo with None -> None | Some (a, b) -> Some (a + b)
<flux>
or: let map_opt f v = match v with None -> None | Some x -> Some (f x) makes that simply map_opt (fun (a, b) -> a + b) foo
<Palace_Chan>
flux, but if i want my function to return merely an int and not an int option, i can say None -> 0 and | Some (a,b) -> a+b; and this latter one would split the some tuple apart
<flux>
yes
<Palace_Chan>
flux, i'm still getting used to ocaml, it has some really neat things like that
jonafan_ has joined #ocaml
<Yoric[DT]>
Well, train to catch.
* Yoric[DT]
agrees that [option] is niiiiice.
<Yoric[DT]>
What is even nicer is that [option] is nothing special: you could define it in one line.
Yoric[DT] has quit ["Ex-Chat"]
jonafan has quit [Read error: 110 (Connection timed out)]
<Palace_Chan>
-10l has type int..how do i write a negative int32 then ?
<Palace_Chan>
Int32.neg 10l ?
<pango_>
# -10l;;
<pango_>
- : int32 = -10l
filp has joined #ocaml
<Palace_Chan>
if i want to do the 2-s complement negation of an Int32 do i have to add a 1l to the result of Int32.neg ?
<pango_>
Int32.lognot ?
<Palace_Chan>
oh so lognot + 1
<Palace_Chan>
i thought bitwise negation was unary negation...
<pango_>
# Int32.lognot (-10l) ;;
<pango_>
- : int32 = 9l
<Palace_Chan>
well the Int32.neg seems to yield 10l for -10l
<pango_>
I seldom use those, I'm not sure
<Palace_Chan>
it says in the documentation that neg is unary addition..which is odd since twos complement is pretty much the standard...and when i try it it actually seems to be doing twoscomplement while lognot is what i appears to be actual unary
xevz has quit [Read error: 110 (Connection timed out)]
<pango_>
gtg
mishok13 has joined #ocaml
gildor has quit ["leaving"]
gildor has joined #ocaml
marmotine has joined #ocaml
Palace_Chan has quit [Client Quit]
gene9 has joined #ocaml
seafood has joined #ocaml
seafood has quit [Read error: 104 (Connection reset by peer)]
<flux>
so you have a file which compiles, and you decicde to rename a variable
<flux>
well, just rename the definition and call this with ocaml-refactor.pl source.ml newname, and it finds the old instances by running ocamlc in a loop and replaces them with the new definition
<flux>
not sure if it's useful for anything, I'm thinking most of the cases search/replace would do just as well :)
<flux>
is it intrinsic to git, or would it, after small changes, work with other dvcs's too?
<flux>
or even non-distributed vcs..
<kig>
would work for all i know
<Eridius>
kelaouchi: "actually works" have you tried ticgit? I haven't tried any of them, but I thought ticgit was supposed to work
<kig>
it's a directory tree bugs/, with subdir all/ where the bugs are held, each in its own file, and symlinks in open/ and done/ to note bug state
hkBst has quit [Read error: 104 (Connection reset by peer)]
<flux>
how come I can't see gitbug's bugs in the web repository?
<kig>
there are no bugs
<flux>
lies!
<flux>
;)
<kig>
!
<flux>
well, symbolic links could cause trouble with other dvcs, namely darcs
<kig>
i mean, we had bugs, but those were in a main repo that for which the bug tool was built
<kig>
then moved bug tool to its own repo because maybe it is better that way
<flux>
how many bugs did the main repo have?
<kig>
five closed, no open
<flux>
so it hasn't exactly received massive testing :)
<kig>
yes
<kig>
because have fixme script that greps all fixmes from source files, eclipse-style
seafood_ has joined #ocaml
itouch has quit [Read error: 110 (Connection timed out)]
itouch has joined #ocaml
<kig>
Eridius: i tried to use ticgit but it errored, didn't feel like debugging it far enough (read through the error call stack, found myself in a spiral of confusion)
<Eridius>
huh
<kig>
errored on ti init iirc, or whatever the init cmd was
<kig>
or on adding new issue
<kig>
can't remember
<Eridius>
does gitbug install a hook to catch FIX[1] ?
<kig>
yes
<Eridius>
what does it do if you already have a hook?
<kig>
screws it up
<Eridius>
hah
<Eridius>
it should detect when you have an active hook and ask for user input
<Eridius>
also, is there any way to attach metadata to a bug? Such as reporter or assignee?
<flux>
how well does that kind of bug numbering work? is there a merge-algorithm that fixes colliding bug numbers?
<kig>
no, well, yes, you can add your own fields to the bug header, but there's no specific functionality
<kig>
bug numbering, first available running number
<kig>
or, mm, maybe the max
<Eridius>
how does that handle merging between repos?
<kig>
same as any other merge
<Eridius>
well no, because normal git objects aren't identified by an incrementing number
seafood has quit [Connection timed out]
<flux>
if two people are talking about 4, can there be any kind of certainty they're talking about the same bug?
<Eridius>
the question is what happens if you and your friend both create a new bug, then merge?
<Eridius>
these numbers can't be local-only either, or embedding them in a commit message would be broken
<kig>
then you get two bugs with id 4 and you get to mv them :/
<Eridius>
hrm, sounds like a design flaw
<Eridius>
ticgit uses a truncated hash, just like the rest of git
seafood_ has quit []
Yoric_ has quit ["Ex-Chat"]
<kig>
Eridius, flux: thanks, i added those to bugs
seafood has joined #ocaml
itouch has quit [Remote closed the connection]
seafood has quit [Client Quit]
<kig>
and fixed if existing post-commit hook -bug
marmotine has quit ["mv marmotine Laurie"]
<Eridius>
ya know, you could actually preserve monotonically-increasing numbers if you introduce unique identifiers for the source repo of the bug
<Eridius>
so you'd end up with messages like FIX[3@eridius]
<Eridius>
I'm not sure if this is a good idea yet, though
<Eridius>
I mean, do we really need monotonically-increasing numbers for bugs?
<Eridius>
for manipulating the list, sure. But for permanent reference, I don't think so
Associat0r has joined #ocaml
<Eridius>
also, maybe you should install a pre-commit hook that validates any FIX[foo] tokens it finds
<Eridius>
actually, commit-msg would probably be better
<Eridius>
hell, it could even edit a FIX[3] entry into FIX[23fba352d9]
<kig>
yeah, that's a good idea
<Eridius>
I'd probably suggest using 9 chars for the truncated sha
<kig>
use hashes internally, FIX[x] references either to hash or position in current open list
<Eridius>
permanently referencing a position in the open list is a really bad idea
<Eridius>
so the commit-msg hook should rewrite the FIX[#] to reference the truncated hash, or error out if the number isn't valid
<Eridius>
and if a hash is given, check to make sure it's a valid bug
<kig>
yes
<Eridius>
man, I wish I had a real use for this, because then I could contribute ;)
<Eridius>
whoa, gitbug stores bugs in a subdir of the project?
<Eridius>
wtf
<Eridius>
it should do what ticgit does and its own git ref
<kig>
why?
<kig>
it sounds like a pain to do fetches and pushes separately
<Eridius>
because I don't want to pollute my project's source with the bugs
<Eridius>
especially since that will make it a pain to deal with multiple branches of development
<kig>
but you have different bugs in different branches? if they're all in the same tree, the release branches get development branch bugs as well
<Eridius>
why would I want to put different bugs in different branches?
<kig>
but i can't say, not enough experience using the thing
<Eridius>
if I'm working in a topic branch, I shouldn't have to switch back to master just to add a bug
<Eridius>
I can imagine a feature where you have branch-specific bugs, but that could be handled by using yet another ref to hold the branch-specific bugs, and have gitbug read from both the global list and the branch-specific list
<Eridius>
you could even make your own hierarchy - refs/bugs/whatever
<Eridius>
but I would just throw that on the feature idea list
<kig>
my git workflow is git fetch origin master:master; git rebase master; run_tests; git push origin work:master, so haven't thought of anything beyond that
<Eridius>
you can use `git pull --rebase` instead of fetch + rebase
<kig>
oh, guess i better update my git version for that
<kig>
i have the procedure scripted to master; rebase; pushwork though
<Palace_Chan>
is there any way in which i can treat an int32 as an unsigned 32-bit value ?
<Eridius>
Palace_Chan: what do you want to do with it?
<Palace_Chan>
well, i want to treat it as if it was a memory address for a 32 bit address space...but basically i cant represent that range if the int32 is signed
<Palace_Chan>
and i dont need the signed interpretation for this purpose, i need all 32 bits
<Palace_Chan>
if i could use an int32 as unsigned i would be able to represent say address 0xFFFF FFFF (i dont need signed, no negative addresses)
<Eridius>
int64?
<Palace_Chan>
that is one option, but say im working with a function which already takes an int32 as argument and its part of an interface i am not suppose to change..then sure, maybe i can Int64.of_int32 the argument, but that would be a signed extension
<mbishop>
Jeff Shaw made a library for uint32/uint64
<mbishop>
however, they are kind of awkward to use (not the libraries fault, though)
<Palace_Chan>
in any case, since i cant use mod with Int32's and turning them into ints might lose information...how can i check if i have divisibility by say 4 or 5 ?
<Eridius>
4 is easy, you can do a bit test against 4 ;)
<Palace_Chan>
Eridius, ah! good one
<Eridius>
for 5, you could mask out the high bit and then do 1 of 2 tests
<Eridius>
if the high bit was set, add whatever the units digit of 2**31 is to your masked number and test
<Eridius>
otherwise just test the masked number
<Eridius>
said units digit is 8, btw
<Palace_Chan>
hmm, thanks luckily i just got powers of two like 4 involved