[svn:parrot] r46075 - trunk/examples/shootout

mikehh at svn.parrot.org mikehh at svn.parrot.org
Tue Apr 27 20:09:28 UTC 2010


Author: mikehh
Date: Tue Apr 27 20:09:27 2010
New Revision: 46075
URL: https://trac.parrot.org/parrot/changeset/46075

Log:
replace in-place string ops

Modified:
   trunk/examples/shootout/regexdna.pir

Modified: trunk/examples/shootout/regexdna.pir
==============================================================================
--- trunk/examples/shootout/regexdna.pir	Tue Apr 27 19:34:13 2010	(r46074)
+++ trunk/examples/shootout/regexdna.pir	Tue Apr 27 20:09:27 2010	(r46075)
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2009, Parrot Foundation.
+# Copyright (C) 2006-2010, Parrot Foundation.
 # $Id$
 
 .sub main :main
@@ -65,7 +65,7 @@
 	chunklen = length chunk
 	unless chunklen goto endwhile
 	# They don't say you have to match case insenitive...
-	downcase chunk
+	chunk = downcase chunk
 	seq .= chunk
 	goto beginwhile
 endwhile:
@@ -84,7 +84,7 @@
 	$I0 = $P0."from"()
 	$I1 = $P0."to"()
 	$I1 -= $I0
-	substr seq, $I0, $I1, ''
+	seq = replace seq, $I0, $I1, ''
 	goto stripfind
 endstripfind:
 	seqlen = length seq
@@ -140,7 +140,7 @@
 #	$I0 = $P0."from"()
 #	$I1 = $P0."to"()
 #	$I1 -= $I0
-#	substr seq, $I0, $I1, replacement
+#	seq = replace seq, $I0, $I1, replacement
 #	goto switchfind
 #endswitchfind:
 
@@ -164,7 +164,7 @@
 	$P0 = pop matches
 	$I0 = $P0[0]
 	$I1 = $P0[1]
-	substr seq, $I0, $I1, replacement
+	seq = replace seq, $I0, $I1, replacement
 	goto switchloop
 endswitchloop:
 #############################################


More information about the parrot-commits mailing list