Skip to content

Commit

Permalink
May have fixed up ResizableStringArray usage
Browse files Browse the repository at this point in the history
  • Loading branch information
jayemerson committed Jul 29, 2011
1 parent 1172038 commit 3971ef1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/nqr/Actions.pm
Expand Up @@ -453,8 +453,12 @@ method term:sym<forint>($/) {
# Need to figure out how to make this ResizableStringArray:
method term:sym<string_constant>($/) { make $<string_constant>.ast; }
method string_constant($/) {
my $past := $<quote>.ast;
$past.returns('String');
#my $past := $<quote>.ast;
my $past := PAST::Op.new( :name('!stringarray'),
:pasttype('call'),
:node($/) );
$past.push($<quote>.ast);
#$past.returns('String');
make $past;
}

Expand Down
7 changes: 7 additions & 0 deletions src/nqr/Runtime.pm
Expand Up @@ -22,6 +22,11 @@
for (@args) { @ans[@ans] := $_; }
@ans;
}
my sub stringarray (*@args) {
my @ans := pir::new("ResizableStringArray");
for (@args) { @ans[@ans] := ~$_; }
@ans;
}

######################################################
## GSL functions with . in the names in the R wrapper:
Expand Down Expand Up @@ -89,6 +94,8 @@
set_global '!intarray', $P0
$P0 = find_lex 'floatarray'
set_global '!floatarray', $P0
$P0 = find_lex 'stringarray'
set_global '!stringarray', $P0
$P0 = find_lex 'whichmax'
set_global 'which.max', $P0
$P0 = find_lex 'whichmin'
Expand Down
2 changes: 1 addition & 1 deletion t/00-sanity.t
@@ -1,5 +1,5 @@

say("1..33")
print("1..33")

# Basic assignment
a <- 1
Expand Down
2 changes: 1 addition & 1 deletion t/nqr.t
@@ -1,4 +1,4 @@
say("1..3")
print("1..3")

a <- 1

Expand Down

0 comments on commit 3971ef1

Please sign in to comment.