Re: Hyper Here-Docs? (was: Re: angle quotes for here-docs ?)

2004-11-30 Thread Michele Dondi
On Thu, 25 Nov 2004, Larry Wall wrote:
On Thu, Nov 25, 2004 at 11:59:21AM -0600, Rod Adams wrote:
: Seeing the « in the context of a here-doc made me think can you do a
: » here-doc?
Nope, you can only hyper operators, not terms.
Incidentally, just like mathematically (albeit slightly loosely) an 
element of a set can be thought of as a function from any singleton, would 
it be possible for Perl 6 to provide a fast (under the syntactical point 
of view) way to promote a term to a function returning it?

Michele
--
Not really.  It was an insider joke.  If you need to ask, you won't
get the answer.  I never said I was a nice guy.
- David Kastrup in comp.text.tex, Re: \slash and /

Re: Hyper Here-Docs? (was: Re: angle quotes for here-docs ?)

2004-11-30 Thread David Christensen
Incidentally, just like mathematically (albeit slightly loosely) an 
element of a set can be thought of as a function from any singleton, 
would it be possible for Perl 6 to provide a fast (under the 
syntactical point of view) way to promote a term to a function 
returning it?

What's wrong with the perl 5:
sub mysub($x) {
return sub { $x };  # the sub{$x} is the construct
}
?
David


Re: Hyper Here-Docs? (was: Re: angle quotes for here-docs ?)

2004-11-30 Thread Abhijit Mahabal
On Tue, 30 Nov 2004, David Christensen wrote:
Incidentally, just like mathematically (albeit slightly loosely) an element 
of a set can be thought of as a function from any singleton, would it be 
possible for Perl 6 to provide a fast (under the syntactical point of view) 
way to promote a term to a function returning it?

What's wrong with the perl 5:
sub mysub($x) {
return sub { $x };  # the sub{$x} is the construct
}
or the perl6
$xsub = { $x };
I am a little confused if the following is valid perl6:
our xsub = { $x };
I believe that would work and install this function in the package global 
symbol table because xsub is the reference to the function xsub.

If you wanted to get a function for each element in an array @a, I suppose 
you can say:

sub makefunc($x){{$x}}
@funcarray = @a.makefunc;
And that can also be shortened to:
@funcarray = @a{my $x=$^x;{$x}};
--abhijit


Re: Hyper Here-Docs? (was: Re: angle quotes for here-docs ?)

2004-11-30 Thread Michele Dondi
On Tue, 30 Nov 2004, David Christensen wrote:
Incidentally, just like mathematically (albeit slightly loosely) an 
element of a set can be thought of as a function from any singleton, 
would it be possible for Perl 6 to provide a fast (under the syntactical


point of view) way to promote a term to a function returning it?
What's wrong with the perl 5:
sub mysub($x) {
return sub { $x };  # the sub{$x} is the construct
}
?


Michele
--
The amount of repetition repetition isn't that great. 
- Ignacy Sawicki in comp.text.tex
  thread Bug in FeynMF's Queues?


Re: Hyper Here-Docs? (was: Re: angle quotes for here-docs ?)

2004-11-30 Thread Michele Dondi
On Tue, 30 Nov 2004, Abhijit Mahabal wrote:
or the perl6
$xsub = { $x };
Sorry, I was missing the obvious...
Michele
--
[...] is like requiring to play tennis with a square ball.
Which admittedly makes the game more interesting.
- Giuseppe Oblomov Bilotta in comp.text.tex (edited)


Hyper Here-Docs? (was: Re: angle quotes for here-docs ?)

2004-11-25 Thread Rod Adams
Juerd wrote:
Thomas Seiler skribis 2004-11-25 14:52 (+0100):
 

Is $heredoc = «END; the same as $heredoc = END; ?
   

I certainly hope not.
Quoting the delimiter is needed, by the way.
How is 'END' disambiguated from 'qw' list, anyway?
 

Seeing the « in the context of a here-doc made me think can you do a 
» here-doc?

So, something like :
@text = »END;
text1
END
text2
END
text3
END
text4
END
for @text { ...}

The hard question about this is: how do you know when you've hit the 
last END? especially if the text you're loading looks like Perl code, or 
if you have different END later in your code?

btw, should it be », «, or »«?
-- Rod Adams


Re: Hyper Here-Docs? (was: Re: angle quotes for here-docs ?)

2004-11-25 Thread Larry Wall
On Thu, Nov 25, 2004 at 11:59:21AM -0600, Rod Adams wrote:
: Seeing the « in the context of a here-doc made me think can you do a 
: » here-doc?

Nope, you can only hyper operators, not terms.

: So, something like :
: 
: @text = »END;
: text1
: END
: 
: text2
: END
: 
: text3
: END
: 
: text4
: END
: 
: for @text { ...}
: 
: 
: 
: The hard question about this is: how do you know when you've hit the 
: last END? especially if the text you're loading looks like Perl code, or 
: if you have different END later in your code?

I think you have a really good place for a split there.  Then there's
no ambiguity about which is the internal separator and which is the
final delimiter.

: btw, should it be », «, or »«?

Er, can I pick D?

Larry