quot;;
}
else
{
say $x;
}
}
foo(inf8 127); # prints "transfinite"
foo(127); # prints 127
foo(int8 127); # prints 127
and type unions only sweep
the problem under the rug of multiple dispatch, and you still have
to teach the newbies.
I agree with that.
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
HaloO,
I wrote:
subset Five of Int where {$_ == 5}
is the corresponding type
my Five $x; # effectively a constant
my 5$y; # syntax error or 5 in type position?
Would
my :(5) $z;
work as a type literal?
Regards, TSa.
--
"The unavoidable price of reliabili
; she has to cast that
to Str: ("10" as Str)--. So we have "10".HOW === Str but "10".WHAT ===
Num Str.
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
ype system as part
of the runtime environment. That is there is a type computation going
on in parallel to a value computation. The meta object system is largely
part of the value system. The things the type system does at runtime is
checking assignments, checking bindings, selecting dispatch targets and
instanciating parametric types.
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
$y; # syntax error or 5 in type position?
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
7;.
Side question: how binary can M be when compiling P? In C++ e.g. the
template code of D has to be available. Are there interface files in
Perl 6?
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
ually clearer to bind a namespace ref
than calling a magic function. It sort of amounts to the same
outcome, though.
I will also have to say something about the usefulness of the
concept of virtual class. Stay tuned.
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
same
implementation. In both cases C is OUTER::C. The "magic" should
happen when an invocation of foo is created. That is the moment when
the scope of OUTER::C can be bound by 'my C $b' through $x and $y
respectively.
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
HaloO,
John M. Dlugosz wrote:
TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote:
"Candidate set" would be a better term. It is a subset of all long names
of a multi in a lexical scope.
List, not set, because it is ordered. nextsame/nextwith/etc. are
described as invoking the next
ing type errors.
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
terpret that sort of
intensionally as being worse than an outright violation. That
is already the tendency of violation means second-class ;)
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
se
classes will be checked for applicability rather than arbitrarily
taking the leftmost.
Indeed, I would hope that order of inheritance doesn't matter.
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
else considered
harmful but useful). But I don't see much use for it offhand.
Does that imply that multiple assignment is second-class, too?
And that with a language that provides the concept of eternal
equality with ===, or checking of referential identity with =:=.
Big surprise that is.
Re
t the item positionally with prefix @ or .[]. Note that Captures
are immutable and therefore nicely covariant. Except of course that
containers are captured as containers and can be mutated. But Larry
revealed that single assignment semantics are aspired and mutability
is a historic artifact or so.
Re
Num <: Item <: Seq which is a cycle!
Dealing with cycles is not within the reach of type system because
these need <: to be transitive.
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
bsumes Item. But that has problems of its
own---see my reply there.
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
t; Int is expected. I love this self contradiction of Perl ;)
Well, and you can't neither use foo nor bar to denote the arrow type.
Note that I consider myself a knowledgeable bystander with the
knowledgeable being debatable ;)
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
HaloO,
I wrote:
sub foo () { my $x = 0; yield $x++; }
I meant:
sub foo () { my $x = 0; yield $x++ while 1;
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
++; }
&f = &foo.new; # or also foo.new?
say f(); # 0
say f(); # 1
say f(); # 2
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
y be Real^NaN^Overflow^...
so that if you wanted a non-exceptional type you could use Real.
Note that this implies that Num is *unordered* and the order-ops
actually act on the Real type.
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
the value type?
You mean capturing the sigil? I guess using $ is as generic as one could
get. @, @@ and % essentially are type constraints. So
sub (::Container[of => ::ValType] @x)
already constrains ::Container to Positional.
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
foo; # syntax error or special type meaning
foo ; # calls foo with @_[0] :=
foo .; # calls foo with @_[0] := $CALLER::_.
foo::; # pulls out a from lexical namespace of foo
The last line uses postfix:<::> not sigil:<::>.
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
two delegations at work
these would be @?USA and @?GERMANY. I really love the linguistic power
of Perl 6 :)
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
ise
that binding cannot be overloaded and this really is
where the type checker kicks in. But what exactly is
it supposed to do then?
I guess the generic answer is that there will be installable
pairs of dispatcher and binder. Which then raises the question
what the standard set will be :)
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
hat does a structural inspection.
Would that be worth an addition to Perl 6? We already have
'can' for single methods.
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
g!
To address this, I propose using a positive way to declare generic
parameters rather than having them implicit based on not previously
existing. I propose the triple colon, :::, for this purpose:
:::T $x;
Which is ugly.
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
And what is a protoinvocation of a sub? When is it evaluated?
Finally I wonder why we didn't give a meaning to Type<>? Does that
look too much like C++, C# or Java templates?
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
no relation at all. And Bivariance
means both!
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
s I would like to define + and * to
be listfix and commutative, that is independent of order. Note that
this is orthogonal to the definition of evaluation order.
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
he dynamic type
of the value stored in $spot? Or are you talking about
dispatching .new itself?
sub foo (Dog $d) {...}
foo(.new); # .new called in Dog item context?
# with $d as invocant?
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
e.g. I wonder
if there's an isomorphism between that and (Str,infix<~>). But I
agree that I shouldn't bother the list with such things unless I
hope it could be useful for Perl 6 which I hoped for the identity
of X. But seemingly that was a false hope.
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
HaloO,
John M. Dlugosz wrote:
I seem to recall seeing sigils in a signature without names,
but now I can't remember where.
E.g. in S06 und section "The want function".
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
that
this doesn't parse 'our :(X *@) sub foo()' should.
perhaps? I seem to recall seeing sigils in a signature without names,
but now I can't remember where.
Same here. Should be in the synopsis somewhere.
Regards, TSa.
--
"The unavoidable price of reliability is simplicity"
-- C.A.R. Hoare
ations are like comments.
I doubt that this is the case with Perl 6, or is it?
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
s so far.
Not for elements of an array or hash!
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
LLER::a because $OUTER::a is the outer
lexical scope where foo is defined. And I think that this
reaching out to the caller should taint foo in some way.
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
he direct indexing of a name with [] and {} is
reserved for type theoretical things. And one paper that makes
use of this is Theory.pod from Luke. Apart from that the
current design doesn't say much about the type system ;(
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight f
= 42; # illegal
So perhaps one needs
my ::T T $x = 'blahh';
to constrain $x to the type of the rhs.
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
ay somehow having
at least one element.
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
,1) X ([]) === (0,1)?
The original question was sort of about how to write a list
that has .elems == 1 but "no" content.
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
:T does Arithmetic
}
...
}
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
@a X (@b X @c) === ( ( @a[0], (@b[0],@c[0])), ...).
That is two lists of differently structured pairs.
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
w.
The other term I would thing is synonymous to flow is stream.
But that's already taken for event stream, data stream and
implies linearity whereas flow naturally implies branching.
The third term I come up with is context blocks. But context
in Perl 6 is something very different.
Regar
HaloO,
John M. Dlugosz wrote:
Can you give a pointer to where this was discussed?
It was said by $Larry in the "Adding linear interpolation
to an array" thread where I also tried to explain co- and
contravariant typing of container types.
Regards, TSa.
--
The Angel of Geometry and
pt the last, such
that @b.shape.elems == @array.shape.elems - 1.
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
# container type still wrong
my Int $x5 := $y2 :coerce; # type check agrees at run time.
# (The :coerce and :defer adverbs to := is proposed)
With the view paradigm these adverbs are obsolete I guess.
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
could save
some surprises.
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
HaloO,
why is (1,2,3) X () defined to be the empty list
and not (1,2,3) as is the case with the cartesian
product of sets which X basically is with preserved
order.
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to
e slice returned and hand over the remaining shape as
context to &bar? Since relying on the order of &foo and &bar in the
source is bad, an even more elaborate scheme can be used that queries
&foo and &bar before the actual call which slots they intend to fill
in the pending slice
a and the
return type becomes a list instead of a num.
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
)/4 not -(5/4)
$x.tail = 0;
say $x; # -2
The idea here is that the tail of a Num points towards -Inf
and ends at the next Int in that direction. So numbers are
snakes crawling rightwards ;)
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any
with subject 'fossil spotted by TSa' or so :)
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
n. Perl 6 might actually
develop the idiom that [EMAIL PROTECTED] implies a special role of @array[0].
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
HaloO,
just re-reading S03 I saw that it defines the Rat to Int
conversion as truncation. Why not floor semantics like in %?
Actually I would recommend floor semantics whenever an integer
is coerced. With the sole exception of Num propably using
rounding.
Regards, TSa.
--
The Angel of Geometry
p;, +^
and ~^ into the second one. The code generator and the optimizer would
use these features and give erroneous results when overloads don't
respect them.
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
HaloO,
Jon Lang wrote:
TSa wrote:
Note that I see ** more as a parametric postscript then a real binary.
That is $x**$y sort of means $x(**$y).
That's where we differ, then. I'm having trouble seeing the benefit
of that perspective, and I can clearly see a drawback to it - n
HaloO,
TSa wrote:
Another good use of the dot forms is to get a single character
form to tighten precedence: $x**3! != $x**3.! == $x**(3!).
BTW, is the dot form only available for postfix or for infix
as well? I.e. 3 * 2 == 3.*(2)?
Regards, TSa.
--
The Angel of Geometry and the Devil of
>...
So no whitespace dwimmery here? I.e. one would need |$x | to
force the second | into infix? But eventually the parser has
to give up when the same symbol is overloaded as prefix, postfix,
infix and symmetric circumfix anyway.
Regards, TSa.
--
The Angel of Geometry and the Devil of Al
n
the top precedence by the dot whereas it actually comes in as additional
information about i. There's the same problem with
foo 1 + 3; # (foo 1) + 3 or foo (1 + 3)
which can only be decided by information about foo.
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra
of postfix
operators.
How are postfix operators asymmetric?
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
HaloO,
Mark J. Reed wrote:
On Wed, Mar 26, 2008 at 1:06 PM, TSa <[EMAIL PROTECTED]> wrote:
> 1 + a(x)²!
Seems like a mathematician would be inclined to write that one as this instead:
1 + a²(x)!
That one is ambiguous because it could mean a(a(x)) or a(x)*a(x)
with the la
$y make sense. E.g. there's no
square root of a function.
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
precedence for !. My actual
reading of the ASCII version picks a(x) as the operation with
highest precedence and going from there outwards encountering
+ to the left and ** to the right with ** being of higher
precedence. Then I'm left with + to the left and ! to the right
with precedence of !
plus to do the Ring role. Additionally implementing unary / or 1/ or so
would yield the Field role.
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
HaloO,
Doug McNutt wrote:
Don't allow it to become
= f(-$x); ## wrong!
Unless of course f does Linear, then you can factor out or in the
multiplication with -1 at will. So linearity of operators and
functions is a very interesting property for optimizers.
Regards, TSa.
--
The Ang
associating the factors.
Commutativity would be an even better property of an operator because it
doesn't have to assemble values returned from multiple threads in the
order prescribed by the source code. E.g. if 10 threads are started for
[*]1..100 each multiplying 10 consecutive values the main thread can *=
them together in the order they happen to arrive.
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
at behaves like Num but swaps precedence
of + and *:
my Blahh $y = 3;
say foo($y); # == 18
say foo(3); # == 12
How should the dispatcher know to dispatch to + first for $y?
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
a Num operator and thus
2/3 != 0 but 2/3 == 0..
The P in Perl stands for Practical, not Pedantic.
I consider well designed interfaces as practical not pedantic ;)
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attrib
verloading. In other words $x is then always converted
into the suitable form. But how is that performed in general? IIRC,
the only generically available form is stringification.
Hmm, thinking twice, the above optimization is admissible only if
multiplication is commutative irrespective of the type of
nice idea is to abbreviate that as *+ or +* akin
to Einstein's summation convention.
Regards, TSa.
--
The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being. -- Attributed to Hermann Weyl
ntained in html
for $myxmlvar[/html/body/div]]{
print; # prints $_, the current loop variable
}
How about
for grep html::body::div $myxmlvar {...}
Regards, TSa.
--
You know, it would be sufficient to really understand the electron.
--- Albert Einstein
f is a difficult thing to do. In general Inf == Inf will
hardly hold. The first thing I would expect is Inf to be properly typed.
That is Inf[Num] is different from Inf[Complex] and for finite types any
number outside the valid range could represent Inf.
Regards TSa.
--
You know, it would be suffic
possible to return a
lazy list that captures STDIN from the time of call onwards.
Regards, TSa.
--
good idea to
provide a fatter interface that has got explicit opendir and
openfile methods in addition to plain open that dwims.
Regards, TSa.
--
HaloO,
[EMAIL PROTECTED] wrote:
+Similarly, within a C<.{}> indexing operation you can use C<*[$idx]>
+to convert from standard indices to user-defined:
+
+@lengths{ *[2] .. Oct } # Same as: @lengths{ Jan .. Oct }
Isn't that same as @length{Mar..Oct}?
--
HaloO,
Steve Lukas wrote:
Thinking of the form, I see three ways:
(1) The best readable form is probably:
readonly $temperature; # lexical scope
The current spec has got
constant $temperature = getValue();
Hope that helps, TSa.
--
BTW, is the where clause in the signature still seeing the outside
shape? Or does one have to say something like @a.OUTER::begin to
get at it because the @a of the sub always has got shape ([EMAIL PROTECTED])?
Regards, TSa.
--
tever,Int) are supported
and create the respective Whatever values. The range
Whatever value in the end has got three parameters:
the first array index, the first index after the array
and the array length. This might be a bit too complicated
to be really useful.
Regards, TSa.
--
the array for the second * to jump in
positive direction.
Regards, TSa.
--
up with an access of @a[5..10-1].
But then how would $i = 5..* work? It would need to be
written $i = 5..^* to exclude the index 10.
Regards, TSa.
--
er and let
the Whatever code extract any relevant relative information knowing
that a "dwim" was explicitly called for by use of *.
Could you make an example of what you mean here, please. Do you mean
a dispatch to &postcircumfix:<[ ]>?
Regards, TSa.
--
infix:<-> return a lazy Whatever value that becomes
a specific index when it hits &postcircumfix<[ ]>? That is
we have something like Whatever arithmetic?
Regards, TSa.
--
t this does not carry over the
Num equality -0.0 == +0.0 to Int. So what is more important
sign or magnitude? BTW, does floor return an Int or a Num?
Regards, TSa.
--
HaloO,
[EMAIL PROTECTED] wrote:
+ The lower
+right corner of a two dimesional array is C<@array[*-1, *-1]>.
That should read @array[*-1; *-1], or not?
--
are character positions integers or can we have fractional
characters on a higher unicode level that is a sequence of lower
level chars?
Regards, TSa.
--
erhaps like mod better
than %.
Regards, TSa.
--
is potential sign handled in ===?
my UInt $x = 3;
my Int $y = 3;
if $x === $y { say "true?" }
Regards, TSa.
--
. Then we could make the div and mod pair
mean the Euclidean definition. Everything else could be loadable
from a module. Deal?
Regards, TSa.
--
l rational number support the remainder
must be capabable of repetitions such that 0.333... represents
1/3 with full accuracy and results like 0.999... are normalized
to 1.0. For irrational numbers the remainder might have a
closure that produces more digits if requested.
Regards, TSa.
--
es Int'.
So consider this as an addendum to the supertyping thread.
Regards, TSa.
--
$x * $y > 0 whenever $x > 0 &&
$y > 0, that is there are no divisors of zero. Second -2**31 is
available to encode "infinity" or NaN. In int61 arithmetic with
modulus 2**61 - 1 in a 64 bit value we have the two spare bit
combinations 01 and 10 after the sign to encode special numbers.
Regards, TSa.
--
aiting for an answer what fear Mark has with
calculations crossing zero that are more difficult with
the Euclidean definition. Any idea?
Regards, TSa.
--
. A sane definition of div and % is important. A spec that leaves
it up to the implementation to pick whatever is convenient is bad in
my eyes.
Regards, TSa.
--
components separately.
That is the rmod definition as outlined in my other mail in
this thread. The fact that a remainder is negative for positive
dividend and divisor is moot for complex numbers with their
continuous "sign" in the range 0..2*pi in the polar representation.
Regards, TSa.
--
and width defaulting to 1,
as before.
Regards, TSa.
--
q = 2 - 2i, r = -2 + 3i
I cannot give an algorithm how to calculate the remainder.
Even less do I know how to generalize it to full Complex.
Regards, TSa.
--
2.4 == 3.2 % -2.4 == 0.8
This definition is most useful when it comes to defining the modulus
for classes that fit the underlying axioms of an (euclidean) integral
domain. E.g. this modulus is also defined for Complex numbers.
Regards, TSa.
--
nt about going
: with a latter, I think it will be okay.
That's the approach I'm taking.
Note that there is no decision to make here. A set of pairs
is *not* a hash. E.g. { (1,2), (1,3) } is a set of two pairs
but the additional uniqueness of the keys fails.
Regards, TSa.
--
s Complex {...} # for instanciation
role Num-1.3-Complex does STD:Num does Complex
{
method re (--> STD:Num) { self }
method im (--> STD:Num) { 0.0 }
}
}
Regards, TSa.
--
Or does a module
that contains the line
class Num is also does Complex {...}
infect all other uses of the class because the class is
global? BTW, could we make that read
class Num also does Complex {...}
Regards, TSa.
--
201 - 300 of 657 matches
Mail list logo