Re: log(n) amortized growth for containers

2015-12-13 Thread Jimmy Cao via Digitalmars-d
On Friday, 11 December 2015 at 03:55:27 UTC, Andrei Alexandrescu 
wrote:
Does anyone know of a plotter that supports logarithmic 
integral? Of course better ideas about all of the above are 
welcome!




Yes, my go-to for my university plotting needs is SageMath.

Here is the plot of the two functions, the red one is without the 
li(x).  The vertical axis scale is logarithmic.


https://sagecell.sagemath.org/?z=eJyVjk0KgzAQhfeCdxjcmNAI1mXBK_QIlWAmaWhMZEzB9vRNBDdFCt3NPL73o1CDZiu_QFkAEMYneVgFdLcrc8EM1kc0JF1CODQHcnPmvCzKQqUgk4O-c9bNtoGZm6GHZZQxIg2zC5FNcmZaAElvkHXi3LacC9ByxDG4QH3lrLlHQ4i-EoDK7PouTZIeSIt9Y9-1-9vXSy1ykcN04mTT6lfNc__pYID5NYBQ_V_zAe2Da2c=&lang=sage


Re: log(n) amortized growth for containers

2015-12-13 Thread Jimmy Cao via Digitalmars-d
On Friday, 11 December 2015 at 03:55:27 UTC, Andrei Alexandrescu 
wrote:
To figure a growth schedule that leads to log(n) work per 
element, a differential equation must be solved:


s(n) / s'(n) = log(x)

where s(n) will be the (continuous extension of the) growth 
schedule's sum, i.e. s(n) = f(1) + f(2) + ... + f(n). In other 
word, s(n) is how many elements we moved around, and s'(n) is 
the capacity after n steps. The division gives us how much work 
was done per element.


To verify, if s(n) = n, you get O(n) work per element, i.e. 
quadratic behavior for linear capacity growth. If s(n) = 2^n, 
you get O(1) work per element.


So I entered the equation above in Wolfram:

https://www.wolframalpha.com/input/?i=y%28x%29+%2F+y%27%28x%29+%3D+log%28x%29


I like this approach to amortized analysis.  I have a question, 
though,


the diff eq you have is

s(n) / s'(n) = log(x)

But the WolframAlpha query solves for effectively:

s(n) / s'(n) = log(n)

Why does x = n?

Shouldn't x be s'(n), so that s(n)/s'(n), how much work was done 
per element, is bounded by the number of elements appended (that 
is about the capacity s'(n))?  I thought number of elements != n, 
but rather something between s'(n) and s'(n-1)?




Re: Need DUB pull request reviewers

2015-12-16 Thread Jimmy Cao via Digitalmars-d

On Tuesday, 15 December 2015 at 08:12:59 UTC, Sönke Ludwig wrote:
We have a current shortage of reviewers for the DUB repository 
[1]. Martin is more or less the only one apart from me, but we 
are both currently too busy to get this done in a timely 
manner. If anyone can spare a few minutes (maybe even 
regularly), that could be a great help, even without specific 
knowledge of the code base.


Thanks,
Sönke

[1]: 
https://github.com/D-Programming-Language/dub/pulls?q=is%3Aopen+is%3Apr


Sure, I'd love to help out.  I am extraordinarily idle for the 
next month, at least.


Re: Trying to build dlang.org - what am I doing wrong

2015-12-17 Thread Jimmy Cao via Digitalmars-d

On Thursday, 17 December 2015 at 08:48:21 UTC, wobbles wrote:
So - the conversation about the website/documentation piqued my 
interest a bit and I decided to have a go at making the 
documentation more readable.


However, reading the instructions from:
http://wiki.dlang.org/Starting_as_a_Contributor#Fetch_and_build_dlang.org

It should be a simple matter of:
```bash
mkdir -p ~/code; cd ~/code
git clone https://github.com/D-Programming-Language/dlang.org
cd dlang.org
make -f posix.mak LATEST=2069.2
```

However, I get a std.net.curl error during compilation of dub 
(luckily dlang.org doesn't depend on dub, so it doesn't 
particularly matter and I can carry on with my tinkering).


http://pastebin.com/q41AnJyr

I assume theres a problem with the makefiles here - or is it 
stupid user syndrome?


Do you have libcurl installed?  I think it's required to build 
dub.


Re: Unions and CTFE

2015-12-18 Thread Jimmy Cao via Digitalmars-d

On Friday, 18 December 2015 at 14:30:25 UTC, Gianni Pisetta wrote:

Hi all,
i'm coding a parametrized crc implementation that can support 
most of the standards. I want to make it work with CTFE and i 
stumbled upon a difficulty when using 
std.bitmanip.nativeToLittleEndian and 
std.bitmanip.nativeToBigEndian.
The code below is the concept used by EndianSwapper and it does 
not compile because of unions and CTFE. Also as the error 
message is very obscure, is it intended behaviour or a bug?


I think it's intended behavior.  According to 
http://dlang.org/changelog/2.065.0.html#ctfe-overlapped-field


"Bit image reinterpretation by using two overlapped union fields 
is not allowed during CTFE."





Re: Redesign of dlang.org

2015-12-19 Thread Jimmy Cao via Digitalmars-d
On Saturday, 19 December 2015 at 14:33:35 UTC, Jacob Carlborg 
wrote:

[3] http://www.googledrive.com/host/0B7UtafxGD9vESlB3aFBxcjNPOXM


This looks incredible.  I think the layout is a huge improvement 
from the existing one.


I do wish there were a one-click link to the forums on the 
navigation-bar, instead of a Community dropdown.  I personally do 
not like dropdown menus in navigation bars like that.  I'd rather 
only the most important pages be available there as direct links.


Re: Redesign of dlang.org

2015-12-19 Thread Jimmy Cao via Digitalmars-d

On Sunday, 20 December 2015 at 02:04:30 UTC, Jakob Jenkov wrote:
If the D website maintainers are to put an effort into changing 
its design, would it not be preferable to go "all-in" and jazz 
it up, e.g. like http://www.scala-lang.org/ ?


I would like to know this, too.  Scala's website is really 
beautiful.


But, I would prefer a design like https://ocaml.org/ -- simple, 
clean, and efficient.