On Fri, Oct 12, 2018 at 3:14 PM ToddAndMargo via perl6-users <perl6-us...@perl.org <mailto:perl6-us...@perl.org>> wrote:

     >> On Fri, Oct 12, 2018 at 3:32 PM ToddAndMargo via perl6-users
     >> <perl6-us...@perl.org <mailto:perl6-us...@perl.org>
    <mailto:perl6-us...@perl.org <mailto:perl6-us...@perl.org>>> wrote:
     >>
     >>
     >>     But this does not?
     >>
     >>           $ p6 'sub RtnOrd( Str $Char --> Str, Int ){return $Char,
     >>     ord($Char)}; say RtnOrd "A";'
     >>
     >>           ===SORRY!=== Error while compiling -e
     >>           Malformed return value (return constraints only
    allowed at the
     >>     end
     >>     of the signature)
     >>           at -e:1
     >>           ------> sub RtnOrd( Str $Char --> Str⏏, Int ){return
    $Char,
     >>     ord($Char)}; say R

    On 10/12/18 12:52 PM, Curt Tilmes wrote:
     > You could make a subset for the List your're trying to return:
     >
     > subset liststrint of List where .[0] ~~ Str && .[1] ~~ Int;
     > sub RtnOrd( Str $Char --> liststrint) ...


    I am confused.

    I want to get the --> syntax correct for `return $Char, ord($Char)`


On 10/12/18 1:49 PM, Brad Gilbert wrote:
That would be `List`

     sub RtnOrd( Str $Char --> List ){ $Char, ord($Char) }
     say RtnOrd "A"
     # (A 65)



$ p6 'sub RtnOrd( Str $Char --> List ){return $Char, ord($Char)}; say RtnOrd "A";'
(A 65)


But "List" does not tell my what is in the list.

Reply via email to