Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't curry * !< $n in Rakudo #2286

Closed
p6rt opened this issue Dec 5, 2010 · 5 comments
Closed

Can't curry * !< $n in Rakudo #2286

p6rt opened this issue Dec 5, 2010 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Dec 5, 2010

Migrated from rt.perl.org#80256 (status was 'resolved')

Searchable as RT80256$

@p6rt
Copy link
Author

p6rt commented Dec 5, 2010

From @masak

<uasi> rakudo​: say 1, 2 ... * > 3
<p6eval> rakudo : OUTPUT«1234␤»
<uasi> say 1, 2 ... * !< 3
<uasi> rakudo​: say 1, 2 ... * !< 3
<p6eval> rakudo : OUTPUT«Can't take numeric value for object of type
Whatever [...]
<uasi> :/
<masak> huh.
* masak submits rakudobug
<masak> must be some unfortunate combination of ! and operator currying.

@p6rt
Copy link
Author

p6rt commented Dec 20, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in S02-builtin_data_types/whatever.t

commit f94554a2d47ed61f19df5888bd358a97c5f41fb5
Author​: Kodi Arfer <hippo@​Thoth.(none)>
Date​: Sun Dec 19 19​:19​:40 2010 -0500

  [whatever.t] Added tests for RT #​80256.

Inline Patch
diff --git a/S02-builtin_data_types/whatever.t b/S02-builtin_data_types/whatever.t
index 92b5680..4e1a45e 100644
--- a/S02-builtin_data_types/whatever.t
+++ b/S02-builtin_data_types/whatever.t
@@ -1,7 +1,7 @@
 use v6;
 use Test;
 
-plan 62;
+plan 71;
 
 # L<S02/Built-In Data Types/"The * character as a standalone term captures the notion of">
 # L<S02/Native types/"If any native type is explicitly initialized to">
@@ -206,6 +206,23 @@ is (0,0,0,0,0,0) >>+>> ((1,2) xx *), <1 2 1 2 1 2>, 'xx * works';
 # RT #73162
 eval_lives_ok '{*.{}}()', '{*.{}}() lives';
 
+# RT #80256
+{
+    my $f = * !< 3;
+    isa_ok $f, Code, 'Whatever-currying !< (1)';
+    nok $f(2), 'Whatever-currying !< (2)';
+    ok $f(3), 'Whatever-currying !< (3)';
+    ok $f(4), 'Whatever-currying !< (4)';
+
+    $f = 5 R- *;
+    isa_ok $f, Code, 'Whatever-currying with R- (1)';
+    is $f(7), 2, 'Whatever-currying with R- (2)';
+    is $f(0), -5, 'Whatever-currying with R- (3)';
+
+    dies_ok { &infix:<+>(*, 42) }, '&infix:<+>(*, 42) doesn\'t make a closure';
+    dies_ok { &infix:<R+>(*, 42) }, '&infix:<+>(*, 42) doesn\'t make a closure';
+}
+
 done_testing;
 
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Dec 20, 2010

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Dec 20, 2010

From @Kodiologist

Fixed by the patch in RT #​80474, which was Rakudo commit cae7f952ad.

@p6rt
Copy link
Author

p6rt commented Dec 20, 2010

@Kodiologist - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Dec 20, 2010
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant