Re: Tweaking junctions

2010-10-26 Thread Todd Olson

On 2010-Oct-25, at 15:14, Damian Conway wrote:

 Yes, Ted Z. pointed out to me that, as the name of this construct,
 every has ambiguity and synonym issues. Other possibilities are:
 
select(@values)  one(3..7)
those(@values)  one(3..7)
whichever(@values)  one(3..7)
itemize(@values)  one(3..7)
extract(@values)  one(3..7)
 
 ...of which, only Cselect really seems a good alternative.
 
 Any other suggestions most welcome!

Applying a slightly more stringent test example,
the above terms, plus a few new suggestions,
separates in to two groups

  these work for me

@nv = those(@values)  one(3..7)
@nv = only(@values)  one(3..7)
@nv = solely(@values)  one(3..7)
@nv = exclusively(@values)  one(3..7)
@nv = whichever(@values)  one(3..7)

  these do not work for me

@nv = select(@values)  one(3..7)
@nv = extract(@values)  one(3..7)
@nv = isolate(@values)  one(3..7)
@nv = locate(@values)  one(3..7)
@nv = itemize(@values)  one(3..7)


It is tempting to use

@nv = sift(@values)  one(3..7)
@nv = winnow(@values)  one(3..7)

however, like 'filter' it is confusing what they focus attention on.
Often they focus on what is being discarded
   To winnow the chaff from the grain
yet sometimes they focus on what is being retained
   it's difficult to winnow out the truth
   it's difficult to sift out the truth

I wonder if some times we might desire what is to be discarded,
that is the complement of the outcome this conversation started with.

(@keep, @discard) = filter(@values)  one(3..7)
(@grain, @chaff)  = winnow(@values)  one(3..7)
(@truth, @lies)   = sift(@values)  one(3..7)


Regards,
Todd


Re: threads? - better metaphors

2010-10-13 Thread Todd Olson

On 2010-Oct-12, at 10:22, Damian Conway wrote:

 What we really need is some anecdotal evidence from folks who are actually
 using threading in real-world situations (in *any* languages). What has worked
 in practice? What has worked well? What was painful? What was error-prone?
 And for which kinds of tasks?
 
 And we also need to stand back a little further and ask: is threading
 the right approach at all? Do threads work in *any* language? Are there
 better metaphors?


 'Channels are a good model of the external world' - Russ Cox
  Threads without Locks, slide 39

Perhaps the work on the 'channel' model done in Plan9 (and Inferno) will be 
helpful.
It has many years of experience in publicly available code, libraries, and 
discussion
archives, and verification tools.

Particularly the work of Russ Cox
   http://swtch.com/~rsc/

Particularly 
   Threads without Locks
   Bell Labs, Second International Plan 9 Workshop, December 2007
   http://swtch.com/~rsc/talks/threads07/

This talk has a nice crisp overview of the issues in different models
and mentions several real world applications

   concurrent prime sieve (by Mcllroy)
   file system indexer implementation
   publish and subscribe
   re-entrant IO multiplexing window systems
 http://swtch.com/~rsc/thread/cws.pdf   -- amazing 
stuff!
 http://video.google.com/videoplay?docid=810232012617965344
   the classic 'Squinting at Power Series' - and several others (see slide 31)
 http://swtch.com/~rsc/thread/squint.pdf
 (this could be an excellent test suite of any 'threading' implementation)

and extended in the work of PlanB  
 http://lsub.org/ls/planb.html
 http://lsub.org/index.html#demos



This model is available on many OSs in the port of Plan9 to user space
  http://swtch.com/plan9port/
and in C based libthread that builds multiple-reader, multiple-writer finite 
queues.
There is a lot to like and borrow from Plan9, including the 9P2000 protocol as 
a core organizing meme
  http://9p.cat-v.org/faq

The 'Spin' verification tool and it's history are *very* interesting also
  http://swtch.com/spin/


Note that many of the people doing 'go' were the ones that did Plan9 


Regards,
Todd Olson

PS   I'd really like to have their channel model available in Perl6
 Many things I'd like to model would work well with channels
 I have (unpublished) Perlish syntax to lay over channels

PPS  Russ has also done some nice work on regular expression engines
   http://swtch.com/~rsc/regexp/

Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Todd Olson
At 17:10 -0500 2009-12-16, Dave Whipp wrote:
define the return value more formally, something like:

   our multi method polar (Complex $nim: -- [ Real $mag where 0..Inf,
Real $angle where -¼ ..^ ¼ ]) is export { ... }


In complex analysis it is often legitimate to work with numbers
where the range of $angle is something other than -¼ ..^ ¼,
either because you want the branch cut somewhere else ( 0 ..^ 2¼ )
or you are on some other sheet ( ¼ ..^ 3¼ )

Does the above proposal stand in the way of this sort of work?

Regards,
Todd Olson


Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Todd Olson

At 19:46 -0500 2009-12-16, Dave Whipp wrote:

yary wrote:

 At 00:15 +0100 12/17/09, Moritz Lenz wrote:

 Not quite, .abs returns one of the polar coordinates (the magnitude), so
 only a method is missing that returns the angle.

 Any ideas for a good name?


 Would a method called phi with a unicode synonym É be too obtuse?



Anything wrong with .angle?



In physics and electrical engineering we often speak of the phase


Regards,
Todd Olson

Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Todd Olson
At 14:54 -0500 2009-12-17, Jon Lang wrote:
Dave Whipp wrote:
And really, my whole point is that the implementation details are
(conceptually) the only thing that distinguishes Complex::Polar from
Complex::Cartesian.


All though  both  e^(i ¼)  and  e^(i 3 ¼)  evaluate to -1 + 0i
it is often useful to be able to distinguish them.
So perhaps the question is do we really want Perl6 to automatically
convert e^(i 3 ¼)  to  e^(i ¼)  internally.  If not, then
we really do want some sort of access to the implementation details.


This is similar to the question for rational numbers if we
really want Perl6 to automatically convert  4/8  to 1/2 
and 51/68 to 3/4 internally


So if you mean that we should have access to the implementation details
to see if we have 4/8 rather than 1/2, then I'm with you.

Regards,
Todd Olson


Re: Humorous but serious article

2008-08-07 Thread Todd Olson
Hi

See my latest creation at http://www.dlugosz.com/Perl6/web/APL.html

A modern decendent of APL is J
http://www.jsoftware.com/
http://www.jsoftware.com/jwiki/FrontPage

Regards,
Todd Olson