-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change substitution rules for arrays (better security+optimization), …
…add array lexical scoping
- Loading branch information
Showing
5 changed files
with
56 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/lib/zrc/bin/zrc | ||
alias str string | ||
|
||
fn unique { | ||
let {count line A,map} { | ||
set count = 0 | ||
until {[read line]} { | ||
switch $map($line) { | ||
case '' { | ||
inc count | ||
set map($line) = 1 | ||
} | ||
case 1 { | ||
inc count -1 | ||
set map($line) = 2 | ||
} | ||
} | ||
} | ||
echo $count | ||
} | ||
} | ||
|
||
if {$argc == 2} { | ||
unique | ||
} else { | ||
for {set i = 2} {$i < $argc} {inc i} { | ||
unique < $argv($i) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters