Re: [perl6/specs] 5277fe: Add expmod and is-prime as built-ins in Int

2012-09-20 Thread Martin D Kealey
On Wed, 19 Sep 2012, GitHub wrote:
>   Log Message:
>   ---
>   Add expmod and is-prime as built-ins in Int

> +Returns True if C<$x> is known to be a prime, or is likely to be a
> +prime based on a probabilistic Miller-Rabin test.  (The optional
> +argument tells how many times to iterate the probabilistic test,
> +if such is necessary.)
> +
> +Returns False if C<$x> is known not to be a prime, or is unlikely to
> +be a prime after probabilistic testing.

Isn't Miller-Rabin definitive when it disproves primality? In which case the
probabilistic qualifier in the last paragraph isn't needed.

Or is this just to allow that some better (presumably faster or more probable)
non-deterministic primality test might be used in the future? (Though
Miller-Rabin is already pretty fast, so there seems little reason not to
incorporate it as part of any future test.)

But in that case, we should be saying up front that the test might change.

-Martin


[perl6/specs] 1c74b8: Assume Miller-Rabin certainty on composites

2012-09-20 Thread GitHub
  Branch: refs/heads/master
  Home:   https://github.com/perl6/specs
  Commit: 1c74b86e60d011c047666dbf837acd2960d6e890
  
https://github.com/perl6/specs/commit/1c74b86e60d011c047666dbf837acd2960d6e890
  Author: Larry Wall 
  Date:   2012-09-20 (Thu, 20 Sep 2012)

  Changed paths:
M S32-setting-library/Numeric.pod

  Log Message:
  ---
  Assume Miller-Rabin certainty on composites

Pointed out by Martin D Kealey.





Re: state statements versus state expressions

2012-09-20 Thread Larry Wall
On Tue, Sep 11, 2012 at 10:25:03PM +0100, Nicholas Clark wrote:
: On Tue, Sep 11, 2012 at 11:11:11PM +0200, Carl Mäsak wrote:
: > Nicholas (>):
: > > Where in the synopses (or other documents) does it explain why these two
: > > are different?
: > >
: > > $ ./perl6 -e 'sub foo {state @a = (3, 4); say ++@a[0];}; foo; foo;'
: > > 4
: > > 5
: > > $ ./perl6 -e 'sub foo {(state @a) = (3, 4); say ++@a[0];}; foo; foo;'
: > > 4
: > > 4
: > 
: > S03:4912. "Each declarator can take an initializer following an equals
: > sign (which should not be confused with a normal assignment, because
: > the timing of the initialization depends on the natural lifetime of
: > the container, which in turn depends on which declarator you use)."
: 
: Thanks, but if I read that I wouldn't make this jump from it:
: 
: > In other words, the parens turn the special equals sign into normal
: > assignment again.
: 
: (which I'm fine with, as a reason. Although my mental model of it was
: "When it's a statement, it's special, with an implied phaser block.
: If it's part of an expression, however trivial, it can't be special")

There is no sense in which a declarator is a statement.  (Not even in
Perl 5.)  A declarator is simply a term.  The difference from Perl 5
is that in Perl 6, declarators are kinda like macros that can look for
more arguments, and the initializer argument happens to be labelled
with an '=' instead of something like :init(42).  The extra parens just
do term isolation in this case.

: So I guess my next question is "where is normal assignment explained?"
: Specifically, the part that would explain that you can put C or C
: or similar within the list on the left of the C<=>.

Er, why would normal assignment want to explain something that isn't normal?

Anyway, normal assignment is also explained in S03, albeit somewhat diffusely.

Larry


Re: [perl6/specs] 5277fe: Add expmod and is-prime as built-ins in Int

2012-09-20 Thread Stephen Pollei
On Thu, Sep 20, 2012 at 11:36 AM, Martin D Kealey
 wrote:
> On Wed, 19 Sep 2012, GitHub wrote:
>>   Log Message:
>>   ---
>>   Add expmod and is-prime as built-ins in Int
>
>> +Returns True if C<$x> is known to be a prime, or is likely to be a
>> +prime based on a probabilistic Miller-Rabin test.  (The optional
>> +argument tells how many times to iterate the probabilistic test,
>> +if such is necessary.)
>> +
>> +Returns False if C<$x> is known not to be a prime, or is unlikely to
>> +be a prime after probabilistic testing.
>
> Isn't Miller-Rabin definitive when it disproves primality? In which case the
> probabilistic qualifier in the last paragraph isn't needed.

Yes iirc correctly if the Miller-Rabin test determines it is not prime
then it is certainly not prime. If it says it might be prime it's
about a 50% 50% split if it's correct. Each test cycle is suppose to
be fairly independent.
so if it survives 1 round it's 50% prime 50% not-prime
2 75% 25%
3 87.5% 12.5%
4 93.75% 6.25%
so the certainty that it is prime approaches 1
as the number of tests approaches log2 of the number then there should
be less chance of a false positive than there are numbers in that
range.

perhaps it should return a float in the range of 0 to 1 ;-)

multi method is-prime ( Int $x: Int $tries = 100) is export
should also at least document that tries is never a negative number,
or if it is that it has same behaviour as zero.

>
> Or is this just to allow that some better (presumably faster or more probable)
> non-deterministic primality test might be used in the future? (Though
> Miller-Rabin is already pretty fast, so there seems little reason not to
> incorporate it as part of any future test.)
>
> But in that case, we should be saying up front that the test might change.

maybe multimethod signature should allow you to pass in a test, but
provide one by default?


CFOs not aligned with Recruiting

2012-09-20 Thread Staffing.org - Research Update
[1]Staffing.org - Weekly Research Update

[2]Home|[3]Store|[4]Products & Services|[5]Library
|[6]About Us

CFOS NOT ALIGNED WITH MARKETING Sept 20

[7]What is your staffing budget for 2012? More or less than last year? What are
you planning to ask for in 2013 and why?

Since all budgetary roads lead through the CFO’s office, it’s useful to
understand that perspective on the workforce and on staffing’s activities.
Here’s some recent research on that subject:

This past July, CFO Research asked 213 senior finance executives about their
future workforce plans. Compare the answers to what you know about your own
CFO’s thinking:
* How likely is it that full-time employment will increase in 2013? (59% said
likely or certain)

* How likely is it that part-time employment will increase? (54% said likely
or certain)

[8][jpeg]
EXPENSING TIME TO START DELAYS Sept 12
[9]The delay between when candidates accept offers and when they take their
seats ready for work is a good example of a “baked” recruiting process.

Based on experience, most companies have reliable rules of thumb for what the
delay should be for various job categories, along with a routine sequence of
administrative actions that have to occur: file creation, payroll notification,
desk space & furniture, orientation scheduling, technology set up, and so forth.
These tasks are firmly “baked” into the hiring process and considered
unavoidable.

Because these tasks often overlap the new hire’s obligatory notice to his
current employer, there’s no extra time “cost” other than what would have been
lost anyway. So the delay is considered to be the inevitable tail end of the
staffing process. For non-exempt hourly workers in mid-size companies (see
chart), this delay averages about...
[10][jpeg]
CONTRACTING IMPROVES TIME TO HIRE  Sept 7

[11]Contracting is a simple way to improve on time-to-hire performance by 20%.

This doesn’t mean “contracting out,” which shifts work to outside suppliers. It
means a small internal shift in the recruiting process through which the
recruiter and the hiring manager mutually establish reasonable performance
metrics.

The process can be casual and informal or not. It can focus on individual
requisitions or on groups of them. The added effort represents a small fraction
of the overall hiring effort yet produces significant, measurable improvements
in hiring manager satisfaction, department performance, and recruiter morale
(illustration is from our new [12]Cost and Time Report)...
[13][jpeg]
OLD COST MODELS BREAK DOWN August 30
[14][png] What does “average” mean any more? It’s getting harder and harder to
tell.

Our new corporate staffing efficiency report - [15]Cost and Time Report - being
released this coming weekend, is going to be controversial. What it says, in
essence, is that CPH and TTF averages no longer tell us at a glance what we need
to know about staffing efficiency. Considerable analysis is required.

Take this chart, for example, which illustrates the time to hire range for
employers seeking non-exempt hourly employees.

The average TTH for this group is 6.4 weeks if you measure by company size but
only 5.3 weeks if you measure by number of hires. And look at the range of data:
significant results from 1 to 14 weeks. What’s going on here?
[16][jpeg]

[http://twitter.com/share?url=http%3A%2F%2Ficont.ac%2F1hqqq&text=CFOs+not+aligned+with+Recruiting&via=Staffingdotorg]
 
[http://www.icontact-archive.com/YEDwjSNaO70kJquNWSaopxV9UYejjLDi?w=4#linkedinshare]
 
[http://www.icontact-archive.com/YEDwjSNaO70kJquNWSaopxV9UYejjLDi?w=4#googleplusone]

[17]

For our UPDATE Subscribers only!
Save $200
[18]Sign up for[19] Enterprise
Membership

12 month series
of reports. Includes new
Cost and Time Report

promo code SUB200

Popular Articles

[20]Tying Capability
to Profitability

[21]HR Technology:
Own or Lease?

[22]Great Global Dream
Requires Staffing
Leadership

[23][24]Follow us on Twitter

[25][26]Contact us
[27][jpeg]

Published by Staffing.org 10 Burchard Lane, Rowayton, CT 06853 203-227-0186
Copyright © 2012 Staffing.org. All rights reserved.

References

1. http://www.staffing.org/
2. http://www.staffing.org/
3. http://www.staffing.org/store.asp
4. http://www.staffing.org/productsandservices.asp
5. http://www.staffing.org/library.asp
6. http://www.staffing.org/aboutus.asp
7. http://www.staffing.org/library_ViewArticle.asp?ArticleID=640
8. http://www.staffing.org/library_ViewArticle.asp?ArticleID=640
9. http://www.staffing.org/library_ViewArticle.asp?ArticleID=639
10. http://www.staffing.org/library_ViewArticle.asp?ArticleID=639
11. http://www.staffing.org/library_ViewArticle.asp?ArticleID=638
12. http://www.staffing.org/storedetail.asp?itemid=90
13. http://www.staffing.org/library_ViewArticle.asp?ArticleID=638
14. http://www.staffing.org/library_ViewArticle.asp?ArticleID=637
15. http://www.staffing.org/storedetail.asp?itemid=90
16. http://www.staffing.org/library_ViewArticle.asp?ArticleID=637
17

Re: CFOs not aligned with Recruiting

2012-09-20 Thread Darren Duncan

So I guess we have a rare failure of a spam filter. -- Darren Duncan



Re: [perl6/specs] 5277fe: Add expmod and is-prime as built-ins in Int

2012-09-20 Thread Martin Kealey
On Thu, 20 Sep 2012, Stephen Pollei wrote:
> If it says it might be prime it's
> about a 50% 50% split if it's correct.

According to Wolfram, it's 75/25; so a positive result after 10 iterations
leaves about a one-in-a-million chance of being composite (more precisely,
one in 1048576).

> multi method is-prime ( Int $x: Int $tries = 100) is export
> should also at least document that tries is never a negative number,
> or if it is that it has same behaviour as zero.

Logically if "tries" is zero, is-prime shouldn't do any testing at all, and
should always return "true". (There's a chance it might be prime!)

If "tries" is negative, which idiom should we follow:
 * a range iterator (empty, zero tries, return true)
 * arrays etc count-backwards-from-the-end (keep trying until certain)
 * a logical ambiguity (return Any(true,false))
 * you-get-what-you-ask-for (return "PEBKAC":but(false) )
 * a logical contradiction (return an unthrown exception)
 * a formal error (throw an exception)

-Martin


Re: [perl6/specs] 5277fe: Add expmod and is-prime as built-ins in Int

2012-09-20 Thread Stephen Pollei
On Thu, Sep 20, 2012 at 9:22 PM, Martin Kealey  wrote:
> On Thu, 20 Sep 2012, Stephen Pollei wrote:

> According to Wolfram, it's 75/25; so a positive result after 10 iterations
> leaves about a one-in-a-million chance of being composite (more precisely,
> one in 1048576).

I'd believe wolfram over me, it's been a while since I've read Applied
Cryptography by Schneier .

>> multi method is-prime ( Int $x: Int $tries = 100) is export
>> should also at least document that tries is never a negative number,
>> or if it is that it has same behaviour as zero.
>
> Logically if "tries" is zero, is-prime shouldn't do any testing at all, and
> should always return "true". (There's a chance it might be prime!)

A good built in test before you try Miller-Rabin is at least test
against some of the small prime numbers 2,3,5,7,11,13 otherwise even
if if tries is zero saying 42 is prime is too wrong . However if only
a miller-rabin style tests are used then a value of tries being zero
should always return true.

> If "tries" is negative, which idiom should we follow:
multi method is-prime ( Int $x: UInt $tries = 100) is export
I think I read somewhere that perl6 has both Int and UInt , just
change the prototype
multi method is-prime ( Int $x: UInt $tries = 100 where  { $^n > 0 } ) is export
I think I even read you can constrain it so if zero tries  is
completely useless you can outlaw it

so document at least or change prototype to account for negative and
zero values.