higgs has quit [Remote host closed the connection]
ryanartecona has quit [Quit: ryanartecona]
rgrinberg1 has quit [Ping timeout: 272 seconds]
rgrinberg1 has joined #ocaml
yaewa has joined #ocaml
systmkor has quit [Quit: Leaving]
moei has quit [Ping timeout: 246 seconds]
shinnya has quit [Ping timeout: 250 seconds]
darkf has joined #ocaml
rgrinberg1 has quit [Ping timeout: 272 seconds]
alinab has joined #ocaml
tmtwd has joined #ocaml
xificurC has joined #ocaml
tmtwd has quit [Remote host closed the connection]
xificurC has quit [Remote host closed the connection]
xificurC has joined #ocaml
deavid has quit [Ping timeout: 272 seconds]
psy_ has quit [Read error: Connection reset by peer]
deavid has joined #ocaml
psy_ has joined #ocaml
sailorswift has joined #ocaml
keen___________1 has joined #ocaml
keen___________0 has quit [Ping timeout: 255 seconds]
deavid has quit [Ping timeout: 250 seconds]
sailorswift has quit [Max SendQ exceeded]
sailorswift has joined #ocaml
sailorswift has quit [Max SendQ exceeded]
deavid has joined #ocaml
MercurialAlchemi has joined #ocaml
AlexRussia_ has joined #ocaml
yaewa has quit [Quit: Leaving...]
moei has joined #ocaml
kakadu has joined #ocaml
Snark has quit [Ping timeout: 244 seconds]
Snark has joined #ocaml
shinnya has joined #ocaml
tane has joined #ocaml
shinnya has quit [Ping timeout: 264 seconds]
noplamodo_ has quit [Ping timeout: 272 seconds]
octachron has joined #ocaml
noplamodo has joined #ocaml
BitPuffin|osx has quit [Ping timeout: 255 seconds]
MercurialAlchemi has quit [Ping timeout: 240 seconds]
damason has joined #ocaml
<damason>
Is this a good place for beginner OCaml questions? Trying to find out if there are any library functions to curry/uncurry.
<zozozo>
damason: afaik there isn't any function like that in the standard library though some other libraries do provide such functions (for instance in containers CCFun.curry)
<damason>
zozozo: thanks
ollie314 has joined #ocaml
haesbaert has joined #ocaml
fantasticsid has joined #ocaml
ollie314 has left #ocaml [#ocaml]
^elyse^ has joined #ocaml
fantasticsid has quit [Remote host closed the connection]
octachron has quit [Quit: Leaving]
Sorella has quit [Quit: Connection closed for inactivity]
<companion_cube>
damason: you can write one anyway, very easily: let curry f x y = f (x,y)
<companion_cube>
let uncurry f (x,y) = f x y
ygrek has joined #ocaml
<flux>
hmm, would modular implicit enable curry_n?-o
zpe has joined #ocaml
<companion_cube>
I'm not sure
<companion_cube>
what is the point of uncurrying anyway?
<flux>
well, there are these cases like Thread.create (foo a b) c that are a bit like a hack
<flux>
Thread.create (curry foo) (a, b, c) might be a bit cleaner?
<zozozo>
flux: i see how to do some currying of the form : ('a1 * ('a2 * .. )) to 'a1 -> 'a2 with implicits, but not with n-uplet, :p
<flux>
so: whenever you want to pass a function and its argument to be later applied, in the case of n-ary functions
<flux>
otherwise I think I've very rarely missed curry/uncurry..
<zozozo>
flux: with your example you have to allowate the 3-uple, which is not so good I'd think
<flux>
zozozo, bah, I don't worry about allocations :)
<zozozo>
^^
<flux>
I suppose the ocaml language does need the curry functions to be separate for different arities
<flux>
so you can tell 'how much to curry'
<flux>
given let foo a b = fun c -> .. is the same as let foo a b c = ..
<companion_cube>
flux: in this case I'd probably write Thread.create (foo a b c) ()
<flux>
companion_cube, you mean (fun () -> foo a b c) ()
<flux>
or of course you may choose to write the functions in a way that accepts () as the last agrument.
<companion_cube>
well, do you spawn that many threads? :)
<flux>
passing functions is hardly limited only to running threads :)
<flux>
though to be fair, I found zero instances of fun () -> .. from my codes where I did not have something else than just another function in the body :)
Haudegen has quit [Ping timeout: 250 seconds]
<flux>
no! here I have it! Thread.create (fun () -> thread t_reqs t_internal) () in ;-)
<companion_cube>
so you do use Thread, incredible :p
<flux>
not that many interfaces use 'functions argument' interface, so there's that.
Haudegen has joined #ocaml
ygrek has quit [Ping timeout: 260 seconds]
zpe has quit [Remote host closed the connection]
MercurialAlchemi has joined #ocaml
zpe has joined #ocaml
^elyse^ has quit [Quit: Leaving...]
zpe has quit [Remote host closed the connection]
ggole has joined #ocaml
BitPuffin|osx has joined #ocaml
Anarchos has joined #ocaml
sh0t has joined #ocaml
Simn has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
lobo has joined #ocaml
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
<bernardofpc>
I use this hack a lot for timing my functions
<bernardofpc>
time_it (f a b) c
<bernardofpc>
since it is unreasonable to change f's behaviour
<bernardofpc>
(and it seems like a kludge to do (fun () -> f a b c) ())
jc has joined #ocaml
sh0t has quit [Ping timeout: 245 seconds]
ryanartecona has joined #ocaml
jc has quit [Quit: Leaving.]
mfp has quit [Read error: Connection reset by peer]
shinnya has joined #ocaml
zpe has joined #ocaml
Unhammer has quit [Remote host closed the connection]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
<zozozo>
bernardofpc: well in some cases, some computation could take place when you evaluate (f a b) before you give the third argument
<zozozo>
and that would more or less change the time mesured
lordkryss has joined #ocaml
lordkryss has left #ocaml [#ocaml]
mfp has joined #ocaml
tane has quit [Ping timeout: 244 seconds]
zpe has quit [Remote host closed the connection]
tane has joined #ocaml
lobo has quit [Quit: leaving]
xet7 has quit [Remote host closed the connection]
Sorella has joined #ocaml
whirm has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
lobo has joined #ocaml
obadz- has joined #ocaml
obadz has quit [Ping timeout: 252 seconds]
ryanartecona has joined #ocaml
jao has joined #ocaml
Anarchos has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 252 seconds]
tane has quit [Quit: Verlassend]
xet7 has joined #ocaml
AlexRussia_ has quit [Ping timeout: 260 seconds]
jeffmo has joined #ocaml
darkf has quit [Quit: Leaving]
tane has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 256 seconds]
jeffmo has quit [Quit: jeffmo]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
slash^ has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
AlexRussia_ has joined #ocaml
<gpietro>
guys i have a parser.mly where in the header part %{ ...%} i declare a function...then when i compile a file which opens the module Parser the function is not accessible
<gpietro>
how do i make it accesible ?
<ggole>
Put it in a third module
<ggole>
The .mli generated by ocamlyacc doesn't export what you put in the header.
<gpietro>
oh
<gpietro>
thanks ggole
jbrown has joined #ocaml
tane has quit [Quit: Verlassend]
ygrek has joined #ocaml
psy_ has quit [Ping timeout: 250 seconds]
slash^ has quit [Read error: Connection reset by peer]
<gpietro>
guys in one module i have a function declared which iters trhough hashtable.printing its values..this hashtable is updated in another file...and in another file again..i call the the function declared to print the values. Now why is the hastable always empty? If i add something ?
<gpietro>
if i add something and then right after i iter trhough it..the values seem to be there
Haudegen has quit [Ping timeout: 246 seconds]
whirm has quit [Quit: WeeChat 1.3]
<kakadu>
hard to say. Maybe you do not pass right hashtable to the right function......
Haudegen has joined #ocaml
zpe has joined #ocaml
<gpietro>
yeah i am being vague so: in file tools.ml i have:
<gpietro>
Hashtbl.iter (fun k v-> pprintExp k; pprintExp v) var_table
<gpietro>
then in parser.mly
<gpietro>
i have something on the line... a<-b {Hashtbl.replace var_table (Identifier($1)) ($3);}
<gpietro>
and in interp.ml i have something like:
<gpietro>
i mean i just call printSYmboTable
<zozozo>
gpietro: your printSymbolTable is à value, not a function
<gpietro>
mmm
<zozozo>
try something like : let printSymbolTable () = ...
<gpietro>
ok but..
<gpietro>
ahhh
swgillespie has joined #ocaml
<zozozo>
so that it has type unit -> unit
<zozozo>
instead of just unit
<kakadu>
just pass hashtable to your function
<gpietro>
zozozo, thanks a lot!
<gpietro>
the () owrked just fine
zpe has quit [Ping timeout: 245 seconds]
<gpietro>
i cant belieave i wasted 3 hours on this
<zozozo>
^^
<gpietro>
:(
<kakadu>
global variables are weird ususally and (I think) in this concrete case
<kakadu>
If you pass hashtable explictly you will not make this kind of mistakes
<zozozo>
kakadu: sometimes you want global hashtables e.g for hashconsing
<gpietro>
so when i added at the definition of the function "()"
<gpietro>
formally what did I do?
<gpietro>
i declared it as a function
<zozozo>
exactly
<gpietro>
and not as a first order variable
<gpietro>
but what else can it be?
<gpietro>
i mean
<gpietro>
what's the semantics? just a closure?
<zozozo>
weel
<zozozo>
*well
<zozozo>
when you write let a = <something> it evaluates <something> and you get its result in a
<zozozo>
which then has exactly the type of the expression <something>
<zozozo>
when wou write let f x = <something>, it is equivalent to let f = function x -> <something>
<zozozo>
so that if <something> has type t and x has type t', f is of type t' -> t
<zozozo>
gpietro: is it clear ?
tane has joined #ocaml
<zozozo>
ah, I forgot, () is the (only) value of type unit
<gpietro>
ok let me read
<gpietro>
and understand
<gpietro>
:)
jc has joined #ocaml
<gpietro>
yeah zozozo i get it...so in order to have what i wanted i need to declare a function from unit to unit
<gpietro>
i mean yeah ok
zpe has joined #ocaml
tmtwd has joined #ocaml
AlexRussia_ has quit [Ping timeout: 255 seconds]
jc has quit [Quit: Leaving.]
jao has quit [Ping timeout: 272 seconds]
Haudegen has quit [Ping timeout: 256 seconds]
ygrek has quit [Ping timeout: 252 seconds]
Haudegen has joined #ocaml
ggole has quit []
Lis has joined #ocaml
creichert has joined #ocaml
zpe has quit [Remote host closed the connection]
tane has quit [Quit: Verlassend]
sh0t has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 260 seconds]
nullcatxxx_ has joined #ocaml
MrScout has joined #ocaml
swistak35 has joined #ocaml
lobo has quit [Quit: leaving]
The_Mad_Pirate has joined #ocaml
JuggleTux has joined #ocaml
Simn has quit [Quit: Leaving]
noplamodo has quit [Ping timeout: 244 seconds]
noplamodo has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 245 seconds]
malc_ has joined #ocaml
damason has quit [Ping timeout: 260 seconds]
troydm has quit [Quit: What is hope? That all of your wishes and all of your dreams come true? (C) Rau Le Creuset]
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
nooz has joined #ocaml
nooz has left #ocaml ["ERC (IRC client for Emacs 24.5.1)"]
xificurC has quit [Ping timeout: 256 seconds]
jeffmo has joined #ocaml
sh0t has quit [Ping timeout: 264 seconds]
<schoppenhauer>
hi. is there a default way of "unsafely" accessing an array without bounds checking?
<schoppenhauer>
I found that there is an option -unsafe
<schoppenhauer>
but I only want to remove the bounds checking in a few places.
<schoppenhauer>
hm. there is bigarray.unsafe_get, if I see that correctly.
<mrvn>
yes. use that but only when you already checked bounds.
<mrvn>
bounds check is basically free nowadays because the cpu can do that while waiting for ram and such.
gustav_ has quit [Ping timeout: 260 seconds]
<malc_>
mrvn: that's overly optimistic statement
<schoppenhauer>
I didn't check bounds, but I use an index that must - arithmetically - lie in bounds.
<schoppenhauer>
it's just nitpicking and I probably shouldn't care, but I do :3
gustav_ has joined #ocaml
<schoppenhauer>
hm. other question: can I determine if some object ("thing") references some other thing?
<mrvn>
schoppenhauer: that's checking.
<schoppenhauer>
mrvn: what?
<mrvn>
malc_: it's true 99% of the time.
<mrvn>
schoppenhauer: if it arithmetically must lie within bounds then you've checked.
<schoppenhauer>
yes.
<schoppenhauer>
ok.
<schoppenhauer>
thx.
<mrvn>
schoppenhauer: do check your initial index though
<schoppenhauer>
and btw, I agree, normally array bounds checking is useful and mostly not really unperformant. that's why I do not want to use -unsafe and make the whole program unsafe.
<schoppenhauer>
but there are two places that are called extremely often.
<mrvn>
yeah, it's those 1% of code that uses 99% of the time where it can make a difference.
<schoppenhauer>
indeed.
<schoppenhauer>
even c++ has its array bounds checker of sorts nowadays :3
<mrvn>
Like when you do a quick sort you check the index at the start and then use unsafe for the rest.
<mrvn>
schoppenhauer: c++ only does static bounds check at compile time for arrays.
<schoppenhauer>
mrvn: there is address sanitizer
<mrvn>
and if it fails gcc happily just deletes the relevant code silently.
<schoppenhauer>
mrvn: officially, it is a "debugging technique", but many people run servers with address sanitizer. I also do.
<schoppenhauer>
because performance penalty is about 1,6%, but security enhancement is ... probably high, considering the source of most vulnerabilities.
<mrvn>
doesn't help when you have something like OpenSSL that brings it's own my_malloc()
<mrvn>
.oO(which is why that kind of thing is such a bad idea)
<schoppenhauer>
well, I do not understand why they have an own malloc.
<mrvn>
because on some broken system the system malloc was so horribly bad they had to replace it
<schoppenhauer>
actually, I do not understand ... people use java, python, php, etc., for every sh*t. but for security sensitive stuff, they still use plain C.
<mrvn>
python and php are worse.
<schoppenhauer>
they are slow.
<mrvn>
mostly irelevant. The time critical parts are C libraries
<schoppenhauer>
and I agree that they shouldn't be used for cryptography.
<schoppenhauer>
but using only arrays that are bounds-checked, etc., would probably be ... slower but more secure.
<mrvn>
except you get so many more other errors ...
<schoppenhauer>
but then again, people don't use miTLS, because miTLS is not safe against probabilistic timing attacks.
<schoppenhauer>
because formal verification is sooooo theoretical. but probabilistic timing attacks are not. :3
<mrvn>
getting cryptographic code to be same from timing and cache attacks is realy realy hard
<schoppenhauer>
yes.
<mrvn>
s/same/safe/
<schoppenhauer>
but that only strengthens my opinion that an implementation should be verified. at least with pen and paper.
<mrvn>
gcc and clang just optimize to darn much and screw everything up. And if you got it working so the optimizer doesn't screw it up then the next version might do so again.
<mrvn>
I'm not sure there is any verification program that handles timing and cache attack vulnerabilities
<schoppenhauer>
they could use compcert
<schoppenhauer>
or write their own compiler
<mrvn>
esspecially one that understands what the compiler optimizer will do with the code and tell you when it breaks timing
<schoppenhauer>
ok, BitSet from ocaml-extlib, apparently :3
tmtwd has joined #ocaml
tennix has quit [Ping timeout: 250 seconds]
malc_ has quit [Quit: leaving]
damason has quit [Remote host closed the connection]
damason has joined #ocaml
madroach has quit [Ping timeout: 264 seconds]
madroach has joined #ocaml
<schoppenhauer>
hm. anyone here using nixos?
<schoppenhauer>
or nix?
<mahem1>
Hmmmm, so I am not using a build environment but just ocamlc to compile a small project. Am I doing this right that I have to rm *.cm{a,i,o} all of the time?