<fds>
I think you need a bit more explanation of what you're trying to do. What do you mean "make a function that is applied N times"?
<dmbaturin>
MooseAndCaml: Applied N times to the same initial value?
<dmbaturin>
I.e. F(2, f, x) = f(f(x)), or something else?
<MooseAndCaml>
yes like that
<fds>
Then your accumulator shouldn't be a list, should it?
tmtwd has quit [Quit: Leaving]
<MooseAndCaml>
I'm looking for a list of lists
Algebr has joined #ocaml
<dmbaturin>
Well, this function would be a combinator anyway, fully polymorphic.
tmtwd has joined #ocaml
<dmbaturin>
let rec times n f x = if n = 1 then f x else times (n-1) f (f x)
<MooseAndCaml>
I tried that function but it seems to only return the same type as the input
struktured has quit [Ping timeout: 246 seconds]
Bhavya has joined #ocaml
tmtwd has quit [Quit: Leaving]
ygrek has joined #ocaml
<dmbaturin>
MooseAndCaml: Well, if you want to feed (f x) to f : 'a -> 'b again, (f x) must be of type 'a.
<MooseAndCaml>
I'm always looking to use the initial input -- like N parallel transformations. I updated the gist a bit but I don't think its quite right
tjscanlon has joined #ocaml
struktured has joined #ocaml
<dmbaturin>
What do you mean by parallel transformations?
<dmbaturin>
What's the expected type of your function?
<MooseAndCaml>
it runs the function on an input list and returns a list of lists, There is a random function built in the function that is running N times which is why N copies are of interest
<dmbaturin>
What does it do N times and to what?
<MooseAndCaml>
it filters a list into subsets. There is an element of randomness to the filtering
<MooseAndCaml>
I updated you function in the gist to do what I think it should do, but it's not working
<MooseAndCaml>
actually thats not quite right, but the one above it is the idea
siddharthv is now known as siddharthv_away
siddharthv_away is now known as siddharthv
Algebr has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
kdr2__ has quit [Ping timeout: 252 seconds]
keen___________8 has joined #ocaml
keen___________7 has quit [Ping timeout: 255 seconds]
kdr2__ has joined #ocaml
moei has quit [Read error: Connection reset by peer]
moei has joined #ocaml
struktured has quit [Ping timeout: 250 seconds]
Algebr has joined #ocaml
<Algebr>
Does batteries really not have something to get a datetime string?
<flux>
sadly the best option is probablty Calendar, which has quite a steep curve..
<flux>
Calendar does Everything(TM) as far as I can see, though
<Algebr>
I used to get upset by crappy library support, now I just accept it as a fact of ocaml life.
<flux>
one of us!
johnf_ has joined #ocaml
<Algebr>
its truly an elite club.
<flux>
don't have something? you can write it! in ocaml! what could be fate better than that?!
<flux>
opam has really made it much easier to take external libraries into use
<Algebr>
getting shit done TM.
<dmbaturin>
Can't say it's really unique to any language.
<dmbaturin>
Some just have more bad libraries to choose from, maybe find one that is bad exactly in the way you want.
<flux>
well, perl has been nice in its domain
<flux>
it has library for most anything
<flux>
most of them come with tests, as well.. doesn't mean they work, though ;)
<flux>
for example, perhaps has DBI/DBD for database interaction.. ;)
<flux>
s/perhaps/perl/ oops
<Algebr>
I can't even phantom life without opam.
<Algebr>
fathom*
<flux>
well, there was apt-get
<flux>
but opam allows a lot faster upgrades, more up-to-date libraries, even experimental ones
<Algebr>
I hate how apt-get chops stuff into -dev
<dmbaturin>
Algebr: That was perfectly reasonable for C libs. Making it global policy is odd though.
<flux>
isn't it reasonable to not install .cmo, .cmi, .mli to users of applications?
struktured has joined #ocaml
<flux>
though I'm not sure what was left in the actual package, some binding stubs I guess?
<Algebr>
If I'm installing python, then then I want the headers.
<Algebr>
I don't want to search around python-dev
<flux>
yet 99% people installing python don't want to install the headers
<Algebr>
I doubt that that's the case on linux users.
<flux>
do I want to install python headers to an embedded router?
<dmbaturin>
Algebr: Most python users never write bindings to C libs, so they never want the headers.
<dmbaturin>
flux: Oddly enough I've seen people complaining about package maintainers breaking python or ruby into multiple packages.
<Algebr>
it was very annoying doing python on debian
<dmbaturin>
Why?
<flux>
I was going to get some solid numbers from popcon, but only seems to allow queries for source packages :)
<flux>
because apt-gettin also -dev packages was just too damn hard?-)
<Algebr>
because when I wanted to install something I have to figure it out either via apt-get or pip, then apt messes the path
<flux>
I guess I've never done serious enough python development then having never bumped into that
<Algebr>
to be honest i think that if a language has its own package manager, opam/pip then its code shouldn't exist in the OS package manager
johnf_ has quit [Read error: Connection reset by peer]
<flux>
well, opam isn't very old
pii4 has quit [Ping timeout: 276 seconds]
MooseAndCaml has quit [Ping timeout: 246 seconds]
<flux>
for me it would probably be enough to ship with opam and the compiler
<flux>
not sure if that would cover 95% of use cases yet
<flux>
libpython-dev is installed 10360 times, python is installed 137513 times, according to popcon data
<flux>
impossible to say if that data is biased towards developers, users or administrators, though :)
<dmbaturin>
Some people want frozen libraries from the distro.
<Algebr>
not sure if that a good measure cause lots of other programs use python
<flux>
yet, not a number even close to 50%
<flux>
for reference libc6-dev is 91000
<flux>
ocaml-base-nox is btw 5631, findlib 1351 (the highest-ranking ocaml-dev-package)
<flux>
liblablgtk2-ocaml-dev isn't far behind, 954
<flux>
liblablgtk2-ocaml has 1396 though; not a huge difference, but there is a difference
<flux>
nothing depends on liblablgtk2-ocaml though so I'm not sure why anyone would install it ;-)
pii4 has joined #ocaml
<dmbaturin>
Since ocaml binaries are usually statically linked, I guess people see fewer reasons not to use opam.
<Algebr>
Is there a one liner via lwt_io to read 1024 bytes from /dev/random and directly write to a file/outputchannel
<flux>
I'm certain there is, ocaml doesn't have significant newlines ;)
LnL has joined #ocaml
<flux>
I guess if one uses Unix.read one must expect to get partial reads.. I suppsoe Lwt_io provides some higher level functions than that, haven't really used it
<Algebr>
yes, I found it. Lwt_io.read ~count:1024 data_source >>= Lwt_io.write_line h) so pleasing.
<Algebr>
<Algebr>
where data_source is the handle from /dev/random
tmtwd has joined #ocaml
tmtwd has quit [Remote host closed the connection]
meiji11 has quit [Remote host closed the connection]
<flux>
you should measure also CPU time, not only wall-clock time
<flux>
it's likely a very low number
<flux>
(ie. time ./testApp)
<flux>
it also depends how secure stream do you want. /dev/random won't give data out if it doesn't have sufficient entropy. it's usually used to seed (cryptographically secure) random number generators, or maybe short crypto keys.
<flux>
all this above is assuming Linux, I don't know how it works in OSX :-)
<flux>
ah so your code is reading 50 gigabytes from /dev/random? that's basically an infinity :)
<flux>
even with /dev/urandom I wouldn't call it a great idea.. instead just use a user-space random number generator.
<flux>
I believe cryptokit comes with decent random number generators
<Algebr>
my head isn't working.
<flux>
you should get that fixed
<Algebr>
OKay, now I changed it to a correct value of 50MB and now I have a different problem to the execution finishign nearly instanteously and du -sh reporting a directory size of only 80k
<flux>
ok, so the problem is that Lwt_io.read probably does partial reads
<flux>
though I don't see how it finishes nearly instantenously
<flux>
maybe it's documented if it can leave a read partial. but given it's a network-oriented library, I would expect that..
<flux>
and if so, perhaps it'd be easier to use the file-to-stream -function and pick x characters from that char Lwt_stream.t
<flux>
but I need to be moving, good luck :-)
<Algebr>
thanks!
Algebr has quit [Remote host closed the connection]
Haudegen has quit [Ping timeout: 264 seconds]
Simn has joined #ocaml
Haudegen has joined #ocaml
Submarine has joined #ocaml
Submarine has joined #ocaml
xificurC has quit [Ping timeout: 244 seconds]
xificurC has joined #ocaml
bobpoekert has quit [Ping timeout: 252 seconds]
bobpoekert has joined #ocaml
k1000 has quit [Ping timeout: 252 seconds]
k1000 has joined #ocaml
hay207 has joined #ocaml
psy_ has quit [Ping timeout: 256 seconds]
psy_ has joined #ocaml
xificurC has quit [Ping timeout: 256 seconds]
ygrek has quit [Remote host closed the connection]
<companion_cube>
so [< field] designates any type that has at most those four constructors
<justgage>
so at most 4 but at least 1?
<companion_cube>
I think so, yes
<companion_cube>
0 variants would be the empty type…
<ggole>
More that it cannot have other constructors
<ggole>
I don't think empty variants are allowed, though
<Drup>
well, you could imagine [> ], which would be any variant type, but it's not supported, unfortunatly
<ggole>
Hmm, you can have type 'a empty = 'a constraint 'a = [> ]
<ggole>
But not [] or [<]
_whitelogger has joined #ocaml
sivoais_ is now known as sivoais
sivoais has joined #ocaml
sivoais has quit [Changing host]
nullcat_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<hcarty>
I'm getting "
<zoetus>
ah, thanks, that seemed to fix that particular error
<hcarty>
That's not very helpful, self..
<zoetus>
now i'm getting "│W: Cannot find source file matching module 'Bt' in library bt_pervasives", even though there is a bt.ml file there
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
<hcarty>
I'm getting "Cannot locate deriver eq" when using ppx_deriving in merlin but the same code compiles fine and can be used from utop. Any suggestions for how to diagnose this?
<hcarty>
I have "PKG ppx_deriving.std" in my .merlin
zpe has joined #ocaml
<companion_cube>
if you're using 4.02.2 I have the same issue
<companion_cube>
I suspect it's because the AST has changed in subtle ways
<rks`>
yes, the currently released version of merlin doesn't support 4.02.2
<rks`>
I need to make a new release...
<hcarty>
rks`: Would/should a pin to master work?
<hcarty>
companion_cube: On 4.02.1, if I use ppx_deriving 2.1 I get the issue. It goes away if I roll back to 2.0.
<companion_cube>
yes, ppx_deriving 2.1 was released because of 4.02.2
<companion_cube>
the official stance is "4.02.1 doesn't exist anymore, use 4.02.2" afaict