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

Trivial implementation of 'pop' for List #98

Closed
p6rt opened this issue May 24, 2008 · 7 comments
Closed

Trivial implementation of 'pop' for List #98

p6rt opened this issue May 24, 2008 · 7 comments
Labels

Comments

@p6rt
Copy link

p6rt commented May 24, 2008

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

Searchable as RT54746$

@p6rt
Copy link
Author

p6rt commented May 24, 2008

From @bacek

Hello.

There is trivial implementation of 'pop' operator form for List.

--
Bacek.

@p6rt
Copy link
Author

p6rt commented May 24, 2008

From @bacek

pop.diff
Index: src/classes/List.pir
===================================================================
--- src/classes/List.pir	(revision 27778)
+++ src/classes/List.pir	(working copy)
@@ -1118,8 +1157,15 @@
     .return list.'uniq'()
 .end
 
-## TODO: join map reduce sort zip
+.sub 'pop' :multi('List')
+    .param pmc list
 
+    .return list.'pop'()
+.end
+
+
+## TODO: zip
+
 =back
 
 =cut

@p6rt
Copy link
Author

p6rt commented May 24, 2008

From @bacek

Refined test suite for 'pop'.

@p6rt
Copy link
Author

p6rt commented May 24, 2008

From @bacek

pop_t.diff
Index: t/passing_spec
===================================================================
--- t/passing_spec	(revision 27778)
+++ t/passing_spec	(working copy)
@@ -18,6 +18,7 @@
 S29-array/keys_values.t
 S29-array/kv.t
 S29-array/pairs.t
+S29-array/pop.t
 S29-list/mutating_listops.t
 S29-num/abs.t
 S29-num/complex.t
Index: t/spec/S29-array/pop.t
===================================================================
--- t/spec/S29-array/pop.t	(revision 20514)
+++ t/spec/S29-array/pop.t	(working copy)
@@ -43,6 +43,7 @@
     is(+@pop, 3, 'we have 3 elements in the array');
 #?rakudo skip 'arity trouble'
     is(pop @pop, 3, 'inline pop @pop works');
+#?rakudo emit pop @pop;
 
     is(+@pop, 2, 'we have 2 elements in the array');
     is(@pop.pop(), 2, 'inline @pop.pop() works');
@@ -70,9 +71,13 @@
 # testing some error cases
 {
     my @pop = 1 .. 5;
+#?rakudo skip 'dies_ok not implemented'
     dies_ok({ pop()         }, 'pop() requires arguments');    
+#?rakudo skip 'dies_ok not implemented'
     dies_ok({ pop(@pop, 10) }, 'pop() should not allow extra arguments');            
+#?rakudo skip 'dies_ok not implemented'
     dies_ok({ @pop.pop(10)  }, 'pop() should not allow extra arguments');    
+#?rakudo skip 'dies_ok not implemented'
     dies_ok({ 42.pop        }, '.pop should not work on scalars');
 }
 
Index: t/passing_spec
===================================================================
--- t/passing_spec	(revision 27778)
+++ t/passing_spec	(working copy)
@@ -18,6 +18,7 @@
 S29-array/keys_values.t
 S29-array/kv.t
 S29-array/pairs.t
+S29-array/pop.t
 S29-list/mutating_listops.t
 S29-num/abs.t
 S29-num/complex.t

@p6rt
Copy link
Author

p6rt commented May 24, 2008

@bacek - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented May 28, 2008

From @pmichaud

Applied in r27876, thanks!

Pm

@p6rt
Copy link
Author

p6rt commented May 28, 2008

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

@p6rt p6rt closed this as completed May 28, 2008
@p6rt p6rt added the patch 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