Instruction stringlengths 45 106 | input_code stringlengths 1 13.7k | output_code stringlengths 1 13.7k |
|---|---|---|
Convert the following code from AWK to Java, ensuring the logic remains intact. |
BEGIN {
IGNORECASE = 1
arr[++n] = "The AWK Programming Language"
arr[++n] = "The quick brown fox jumps over the lazy dog"
for (i=1; i<=n; i++) {
str = arr[i]
printf("old: %s\n",str)
gsub(/[aeiou]/,"",str)
printf("new: %s\n\n",str)
}
exit(0)
}
| public static String removeVowelse(String str){
String re = "";
char c;
for(int x = 0; x<str.length(); x++){
c = str.charAt(x);
if(!(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'))
re+=c;
}
return re;
}
|
Keep all operations the same but rewrite the snippet in Python. |
BEGIN {
IGNORECASE = 1
arr[++n] = "The AWK Programming Language"
arr[++n] = "The quick brown fox jumps over the lazy dog"
for (i=1; i<=n; i++) {
str = arr[i]
printf("old: %s\n",str)
gsub(/[aeiou]/,"",str)
printf("new: %s\n\n",str)
}
exit(0)
}
|
def exceptGlyphs(exclusions):
def go(s):
return ''.join(
c for c in s if c not in exclusions
)
return go
def main():
txt =
print(
exceptGlyphs('eau')(txt)
)
if __name__ == '__main__':
main()
|
Generate a VB translation of this AWK snippet without changing its computational steps. |
BEGIN {
IGNORECASE = 1
arr[++n] = "The AWK Programming Language"
arr[++n] = "The quick brown fox jumps over the lazy dog"
for (i=1; i<=n; i++) {
str = arr[i]
printf("old: %s\n",str)
gsub(/[aeiou]/,"",str)
printf("new: %s\n\n",str)
}
exit(0)
}
| Imports System.Text
Module Module1
Function RemoveVowels(s As String) As String
Dim sb As New StringBuilder
For Each c In s
Select Case c
Case "A", "a"
Case "E", "e"
Case "I", "i"
Case "O", "o"
Case "U", "u... |
Convert this AWK snippet to VB and keep its semantics consistent. |
BEGIN {
IGNORECASE = 1
arr[++n] = "The AWK Programming Language"
arr[++n] = "The quick brown fox jumps over the lazy dog"
for (i=1; i<=n; i++) {
str = arr[i]
printf("old: %s\n",str)
gsub(/[aeiou]/,"",str)
printf("new: %s\n\n",str)
}
exit(0)
}
| Imports System.Text
Module Module1
Function RemoveVowels(s As String) As String
Dim sb As New StringBuilder
For Each c In s
Select Case c
Case "A", "a"
Case "E", "e"
Case "I", "i"
Case "O", "o"
Case "U", "u... |
Change the programming language of this snippet from AWK to Go without modifying what it does. |
BEGIN {
IGNORECASE = 1
arr[++n] = "The AWK Programming Language"
arr[++n] = "The quick brown fox jumps over the lazy dog"
for (i=1; i<=n; i++) {
str = arr[i]
printf("old: %s\n",str)
gsub(/[aeiou]/,"",str)
printf("new: %s\n\n",str)
}
exit(0)
}
| package main
import (
"fmt"
"strings"
)
func removeVowels(s string) string {
var sb strings.Builder
vowels := "aeiouAEIOU"
for _, c := range s {
if !strings.ContainsAny(string(c), vowels) {
sb.WriteRune(c)
}
}
return sb.String()
}
func main() {
s := "Go Pro... |
Produce a language-to-language conversion: from AWK to Go, same semantics. |
BEGIN {
IGNORECASE = 1
arr[++n] = "The AWK Programming Language"
arr[++n] = "The quick brown fox jumps over the lazy dog"
for (i=1; i<=n; i++) {
str = arr[i]
printf("old: %s\n",str)
gsub(/[aeiou]/,"",str)
printf("new: %s\n\n",str)
}
exit(0)
}
| package main
import (
"fmt"
"strings"
)
func removeVowels(s string) string {
var sb strings.Builder
vowels := "aeiouAEIOU"
for _, c := range s {
if !strings.ContainsAny(string(c), vowels) {
sb.WriteRune(c)
}
}
return sb.String()
}
func main() {
s := "Go Pro... |
Can you help me rewrite this code in C instead of Common_Lisp, keeping it the same logically? | (defun vowel-p (c &optional (vowels "aeiou"))
(and (characterp c) (characterp (find c vowels :test #'char-equal))))
(defun remove-vowels (s)
(and (stringp s) (remove-if #'vowel-p s)))
| #include <stdio.h>
void print_no_vowels(const char *s) {
for (; *s != 0; s++) {
switch (*s) {
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
break;
defaul... |
Ensure the translated C# code behaves exactly like the original Common_Lisp snippet. | (defun vowel-p (c &optional (vowels "aeiou"))
(and (characterp c) (characterp (find c vowels :test #'char-equal))))
(defun remove-vowels (s)
(and (stringp s) (remove-if #'vowel-p s)))
| static string remove_vowels(string value)
{
var stripped = from c in value.ToCharArray()
where !"aeiouAEIOU".Contains(c)
select c;
return new string(stripped.ToArray());
}
static void test(string value)
{
Console.WriteLine("Input: " + value);
Console.WriteLine("O... |
Port the following code from Common_Lisp to C# with equivalent syntax and logic. | (defun vowel-p (c &optional (vowels "aeiou"))
(and (characterp c) (characterp (find c vowels :test #'char-equal))))
(defun remove-vowels (s)
(and (stringp s) (remove-if #'vowel-p s)))
| static string remove_vowels(string value)
{
var stripped = from c in value.ToCharArray()
where !"aeiouAEIOU".Contains(c)
select c;
return new string(stripped.ToArray());
}
static void test(string value)
{
Console.WriteLine("Input: " + value);
Console.WriteLine("O... |
Keep all operations the same but rewrite the snippet in C++. | (defun vowel-p (c &optional (vowels "aeiou"))
(and (characterp c) (characterp (find c vowels :test #'char-equal))))
(defun remove-vowels (s)
(and (stringp s) (remove-if #'vowel-p s)))
| #include <algorithm>
#include <iostream>
class print_no_vowels {
private:
const std::string &str;
public:
print_no_vowels(const std::string &s) : str(s) {}
friend std::ostream &operator<<(std::ostream &, print_no_vowels);
};
std::ostream &operator<<(std::ostream &os, print_no_vowels pnv) {
auto it = p... |
Can you help me rewrite this code in C++ instead of Common_Lisp, keeping it the same logically? | (defun vowel-p (c &optional (vowels "aeiou"))
(and (characterp c) (characterp (find c vowels :test #'char-equal))))
(defun remove-vowels (s)
(and (stringp s) (remove-if #'vowel-p s)))
| #include <algorithm>
#include <iostream>
class print_no_vowels {
private:
const std::string &str;
public:
print_no_vowels(const std::string &s) : str(s) {}
friend std::ostream &operator<<(std::ostream &, print_no_vowels);
};
std::ostream &operator<<(std::ostream &os, print_no_vowels pnv) {
auto it = p... |
Rewrite this program in Java while keeping its functionality equivalent to the Common_Lisp version. | (defun vowel-p (c &optional (vowels "aeiou"))
(and (characterp c) (characterp (find c vowels :test #'char-equal))))
(defun remove-vowels (s)
(and (stringp s) (remove-if #'vowel-p s)))
| public static String removeVowelse(String str){
String re = "";
char c;
for(int x = 0; x<str.length(); x++){
c = str.charAt(x);
if(!(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'))
re+=c;
}
return re;
}
|
Write a version of this Common_Lisp function in Java with identical behavior. | (defun vowel-p (c &optional (vowels "aeiou"))
(and (characterp c) (characterp (find c vowels :test #'char-equal))))
(defun remove-vowels (s)
(and (stringp s) (remove-if #'vowel-p s)))
| public static String removeVowelse(String str){
String re = "";
char c;
for(int x = 0; x<str.length(); x++){
c = str.charAt(x);
if(!(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'))
re+=c;
}
return re;
}
|
Write the same code in Python as shown below in Common_Lisp. | (defun vowel-p (c &optional (vowels "aeiou"))
(and (characterp c) (characterp (find c vowels :test #'char-equal))))
(defun remove-vowels (s)
(and (stringp s) (remove-if #'vowel-p s)))
|
def exceptGlyphs(exclusions):
def go(s):
return ''.join(
c for c in s if c not in exclusions
)
return go
def main():
txt =
print(
exceptGlyphs('eau')(txt)
)
if __name__ == '__main__':
main()
|
Can you help me rewrite this code in Python instead of Common_Lisp, keeping it the same logically? | (defun vowel-p (c &optional (vowels "aeiou"))
(and (characterp c) (characterp (find c vowels :test #'char-equal))))
(defun remove-vowels (s)
(and (stringp s) (remove-if #'vowel-p s)))
|
def exceptGlyphs(exclusions):
def go(s):
return ''.join(
c for c in s if c not in exclusions
)
return go
def main():
txt =
print(
exceptGlyphs('eau')(txt)
)
if __name__ == '__main__':
main()
|
Translate the given Common_Lisp code snippet into VB without altering its behavior. | (defun vowel-p (c &optional (vowels "aeiou"))
(and (characterp c) (characterp (find c vowels :test #'char-equal))))
(defun remove-vowels (s)
(and (stringp s) (remove-if #'vowel-p s)))
| Imports System.Text
Module Module1
Function RemoveVowels(s As String) As String
Dim sb As New StringBuilder
For Each c In s
Select Case c
Case "A", "a"
Case "E", "e"
Case "I", "i"
Case "O", "o"
Case "U", "u... |
Produce a functionally identical VB code for the snippet given in Common_Lisp. | (defun vowel-p (c &optional (vowels "aeiou"))
(and (characterp c) (characterp (find c vowels :test #'char-equal))))
(defun remove-vowels (s)
(and (stringp s) (remove-if #'vowel-p s)))
| Imports System.Text
Module Module1
Function RemoveVowels(s As String) As String
Dim sb As New StringBuilder
For Each c In s
Select Case c
Case "A", "a"
Case "E", "e"
Case "I", "i"
Case "O", "o"
Case "U", "u... |
Write a version of this Common_Lisp function in Go with identical behavior. | (defun vowel-p (c &optional (vowels "aeiou"))
(and (characterp c) (characterp (find c vowels :test #'char-equal))))
(defun remove-vowels (s)
(and (stringp s) (remove-if #'vowel-p s)))
| package main
import (
"fmt"
"strings"
)
func removeVowels(s string) string {
var sb strings.Builder
vowels := "aeiouAEIOU"
for _, c := range s {
if !strings.ContainsAny(string(c), vowels) {
sb.WriteRune(c)
}
}
return sb.String()
}
func main() {
s := "Go Pro... |
Transform the following Common_Lisp implementation into Go, maintaining the same output and logic. | (defun vowel-p (c &optional (vowels "aeiou"))
(and (characterp c) (characterp (find c vowels :test #'char-equal))))
(defun remove-vowels (s)
(and (stringp s) (remove-if #'vowel-p s)))
| package main
import (
"fmt"
"strings"
)
func removeVowels(s string) string {
var sb strings.Builder
vowels := "aeiouAEIOU"
for _, c := range s {
if !strings.ContainsAny(string(c), vowels) {
sb.WriteRune(c)
}
}
return sb.String()
}
func main() {
s := "Go Pro... |
Produce a functionally identical C code for the snippet given in D. | import std.stdio;
void print_no_vowels(string s) {
foreach (c; s) {
switch (c) {
case 'A', 'E', 'I', 'O', 'U':
case 'a', 'e', 'i', 'o', 'u':
break;
default:
write(c);
}
}
writeln;
}
void main() {
print_no_vowels("D Pro... | #include <stdio.h>
void print_no_vowels(const char *s) {
for (; *s != 0; s++) {
switch (*s) {
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
break;
defaul... |
Convert this D snippet to C and keep its semantics consistent. | import std.stdio;
void print_no_vowels(string s) {
foreach (c; s) {
switch (c) {
case 'A', 'E', 'I', 'O', 'U':
case 'a', 'e', 'i', 'o', 'u':
break;
default:
write(c);
}
}
writeln;
}
void main() {
print_no_vowels("D Pro... | #include <stdio.h>
void print_no_vowels(const char *s) {
for (; *s != 0; s++) {
switch (*s) {
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
break;
defaul... |
Write the same algorithm in C# as shown in this D implementation. | import std.stdio;
void print_no_vowels(string s) {
foreach (c; s) {
switch (c) {
case 'A', 'E', 'I', 'O', 'U':
case 'a', 'e', 'i', 'o', 'u':
break;
default:
write(c);
}
}
writeln;
}
void main() {
print_no_vowels("D Pro... | static string remove_vowels(string value)
{
var stripped = from c in value.ToCharArray()
where !"aeiouAEIOU".Contains(c)
select c;
return new string(stripped.ToArray());
}
static void test(string value)
{
Console.WriteLine("Input: " + value);
Console.WriteLine("O... |
Maintain the same structure and functionality when rewriting this code in C#. | import std.stdio;
void print_no_vowels(string s) {
foreach (c; s) {
switch (c) {
case 'A', 'E', 'I', 'O', 'U':
case 'a', 'e', 'i', 'o', 'u':
break;
default:
write(c);
}
}
writeln;
}
void main() {
print_no_vowels("D Pro... | static string remove_vowels(string value)
{
var stripped = from c in value.ToCharArray()
where !"aeiouAEIOU".Contains(c)
select c;
return new string(stripped.ToArray());
}
static void test(string value)
{
Console.WriteLine("Input: " + value);
Console.WriteLine("O... |
Ensure the translated C++ code behaves exactly like the original D snippet. | import std.stdio;
void print_no_vowels(string s) {
foreach (c; s) {
switch (c) {
case 'A', 'E', 'I', 'O', 'U':
case 'a', 'e', 'i', 'o', 'u':
break;
default:
write(c);
}
}
writeln;
}
void main() {
print_no_vowels("D Pro... | #include <algorithm>
#include <iostream>
class print_no_vowels {
private:
const std::string &str;
public:
print_no_vowels(const std::string &s) : str(s) {}
friend std::ostream &operator<<(std::ostream &, print_no_vowels);
};
std::ostream &operator<<(std::ostream &os, print_no_vowels pnv) {
auto it = p... |
Convert the following code from D to C++, ensuring the logic remains intact. | import std.stdio;
void print_no_vowels(string s) {
foreach (c; s) {
switch (c) {
case 'A', 'E', 'I', 'O', 'U':
case 'a', 'e', 'i', 'o', 'u':
break;
default:
write(c);
}
}
writeln;
}
void main() {
print_no_vowels("D Pro... | #include <algorithm>
#include <iostream>
class print_no_vowels {
private:
const std::string &str;
public:
print_no_vowels(const std::string &s) : str(s) {}
friend std::ostream &operator<<(std::ostream &, print_no_vowels);
};
std::ostream &operator<<(std::ostream &os, print_no_vowels pnv) {
auto it = p... |
Generate an equivalent Java version of this D code. | import std.stdio;
void print_no_vowels(string s) {
foreach (c; s) {
switch (c) {
case 'A', 'E', 'I', 'O', 'U':
case 'a', 'e', 'i', 'o', 'u':
break;
default:
write(c);
}
}
writeln;
}
void main() {
print_no_vowels("D Pro... | public static String removeVowelse(String str){
String re = "";
char c;
for(int x = 0; x<str.length(); x++){
c = str.charAt(x);
if(!(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'))
re+=c;
}
return re;
}
|
Can you help me rewrite this code in Python instead of D, keeping it the same logically? | import std.stdio;
void print_no_vowels(string s) {
foreach (c; s) {
switch (c) {
case 'A', 'E', 'I', 'O', 'U':
case 'a', 'e', 'i', 'o', 'u':
break;
default:
write(c);
}
}
writeln;
}
void main() {
print_no_vowels("D Pro... |
def exceptGlyphs(exclusions):
def go(s):
return ''.join(
c for c in s if c not in exclusions
)
return go
def main():
txt =
print(
exceptGlyphs('eau')(txt)
)
if __name__ == '__main__':
main()
|
Produce a language-to-language conversion: from D to Python, same semantics. | import std.stdio;
void print_no_vowels(string s) {
foreach (c; s) {
switch (c) {
case 'A', 'E', 'I', 'O', 'U':
case 'a', 'e', 'i', 'o', 'u':
break;
default:
write(c);
}
}
writeln;
}
void main() {
print_no_vowels("D Pro... |
def exceptGlyphs(exclusions):
def go(s):
return ''.join(
c for c in s if c not in exclusions
)
return go
def main():
txt =
print(
exceptGlyphs('eau')(txt)
)
if __name__ == '__main__':
main()
|
Generate a VB translation of this D snippet without changing its computational steps. | import std.stdio;
void print_no_vowels(string s) {
foreach (c; s) {
switch (c) {
case 'A', 'E', 'I', 'O', 'U':
case 'a', 'e', 'i', 'o', 'u':
break;
default:
write(c);
}
}
writeln;
}
void main() {
print_no_vowels("D Pro... | Imports System.Text
Module Module1
Function RemoveVowels(s As String) As String
Dim sb As New StringBuilder
For Each c In s
Select Case c
Case "A", "a"
Case "E", "e"
Case "I", "i"
Case "O", "o"
Case "U", "u... |
Convert this D snippet to VB and keep its semantics consistent. | import std.stdio;
void print_no_vowels(string s) {
foreach (c; s) {
switch (c) {
case 'A', 'E', 'I', 'O', 'U':
case 'a', 'e', 'i', 'o', 'u':
break;
default:
write(c);
}
}
writeln;
}
void main() {
print_no_vowels("D Pro... | Imports System.Text
Module Module1
Function RemoveVowels(s As String) As String
Dim sb As New StringBuilder
For Each c In s
Select Case c
Case "A", "a"
Case "E", "e"
Case "I", "i"
Case "O", "o"
Case "U", "u... |
Translate this program into Go but keep the logic exactly as in D. | import std.stdio;
void print_no_vowels(string s) {
foreach (c; s) {
switch (c) {
case 'A', 'E', 'I', 'O', 'U':
case 'a', 'e', 'i', 'o', 'u':
break;
default:
write(c);
}
}
writeln;
}
void main() {
print_no_vowels("D Pro... | package main
import (
"fmt"
"strings"
)
func removeVowels(s string) string {
var sb strings.Builder
vowels := "aeiouAEIOU"
for _, c := range s {
if !strings.ContainsAny(string(c), vowels) {
sb.WriteRune(c)
}
}
return sb.String()
}
func main() {
s := "Go Pro... |
Change the following D code into Go without altering its purpose. | import std.stdio;
void print_no_vowels(string s) {
foreach (c; s) {
switch (c) {
case 'A', 'E', 'I', 'O', 'U':
case 'a', 'e', 'i', 'o', 'u':
break;
default:
write(c);
}
}
writeln;
}
void main() {
print_no_vowels("D Pro... | package main
import (
"fmt"
"strings"
)
func removeVowels(s string) string {
var sb strings.Builder
vowels := "aeiouAEIOU"
for _, c := range s {
if !strings.ContainsAny(string(c), vowels) {
sb.WriteRune(c)
}
}
return sb.String()
}
func main() {
s := "Go Pro... |
Change the programming language of this snippet from Delphi to C without modifying what it does. | program Remove_vowels_from_a_string;
uses
System.SysUtils;
function RemoveVowels(const s: string): string;
const
VOWELS =['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'];
var
c: char;
begin
Result := '';
for c in s do
begin
if not (c in VOWELS) then
Result := Result + c;
end;
end;
const... | #include <stdio.h>
void print_no_vowels(const char *s) {
for (; *s != 0; s++) {
switch (*s) {
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
break;
defaul... |
Rewrite the snippet below in C so it works the same as the original Delphi code. | program Remove_vowels_from_a_string;
uses
System.SysUtils;
function RemoveVowels(const s: string): string;
const
VOWELS =['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'];
var
c: char;
begin
Result := '';
for c in s do
begin
if not (c in VOWELS) then
Result := Result + c;
end;
end;
const... | #include <stdio.h>
void print_no_vowels(const char *s) {
for (; *s != 0; s++) {
switch (*s) {
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
break;
defaul... |
Produce a functionally identical C# code for the snippet given in Delphi. | program Remove_vowels_from_a_string;
uses
System.SysUtils;
function RemoveVowels(const s: string): string;
const
VOWELS =['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'];
var
c: char;
begin
Result := '';
for c in s do
begin
if not (c in VOWELS) then
Result := Result + c;
end;
end;
const... | static string remove_vowels(string value)
{
var stripped = from c in value.ToCharArray()
where !"aeiouAEIOU".Contains(c)
select c;
return new string(stripped.ToArray());
}
static void test(string value)
{
Console.WriteLine("Input: " + value);
Console.WriteLine("O... |
Generate an equivalent C# version of this Delphi code. | program Remove_vowels_from_a_string;
uses
System.SysUtils;
function RemoveVowels(const s: string): string;
const
VOWELS =['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'];
var
c: char;
begin
Result := '';
for c in s do
begin
if not (c in VOWELS) then
Result := Result + c;
end;
end;
const... | static string remove_vowels(string value)
{
var stripped = from c in value.ToCharArray()
where !"aeiouAEIOU".Contains(c)
select c;
return new string(stripped.ToArray());
}
static void test(string value)
{
Console.WriteLine("Input: " + value);
Console.WriteLine("O... |
Port the provided Delphi code into C++ while preserving the original functionality. | program Remove_vowels_from_a_string;
uses
System.SysUtils;
function RemoveVowels(const s: string): string;
const
VOWELS =['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'];
var
c: char;
begin
Result := '';
for c in s do
begin
if not (c in VOWELS) then
Result := Result + c;
end;
end;
const... | #include <algorithm>
#include <iostream>
class print_no_vowels {
private:
const std::string &str;
public:
print_no_vowels(const std::string &s) : str(s) {}
friend std::ostream &operator<<(std::ostream &, print_no_vowels);
};
std::ostream &operator<<(std::ostream &os, print_no_vowels pnv) {
auto it = p... |
Change the following Delphi code into C++ without altering its purpose. | program Remove_vowels_from_a_string;
uses
System.SysUtils;
function RemoveVowels(const s: string): string;
const
VOWELS =['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'];
var
c: char;
begin
Result := '';
for c in s do
begin
if not (c in VOWELS) then
Result := Result + c;
end;
end;
const... | #include <algorithm>
#include <iostream>
class print_no_vowels {
private:
const std::string &str;
public:
print_no_vowels(const std::string &s) : str(s) {}
friend std::ostream &operator<<(std::ostream &, print_no_vowels);
};
std::ostream &operator<<(std::ostream &os, print_no_vowels pnv) {
auto it = p... |
Transform the following Delphi implementation into Java, maintaining the same output and logic. | program Remove_vowels_from_a_string;
uses
System.SysUtils;
function RemoveVowels(const s: string): string;
const
VOWELS =['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'];
var
c: char;
begin
Result := '';
for c in s do
begin
if not (c in VOWELS) then
Result := Result + c;
end;
end;
const... | public static String removeVowelse(String str){
String re = "";
char c;
for(int x = 0; x<str.length(); x++){
c = str.charAt(x);
if(!(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'))
re+=c;
}
return re;
}
|
Please provide an equivalent version of this Delphi code in Java. | program Remove_vowels_from_a_string;
uses
System.SysUtils;
function RemoveVowels(const s: string): string;
const
VOWELS =['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'];
var
c: char;
begin
Result := '';
for c in s do
begin
if not (c in VOWELS) then
Result := Result + c;
end;
end;
const... | public static String removeVowelse(String str){
String re = "";
char c;
for(int x = 0; x<str.length(); x++){
c = str.charAt(x);
if(!(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'))
re+=c;
}
return re;
}
|
Keep all operations the same but rewrite the snippet in Python. | program Remove_vowels_from_a_string;
uses
System.SysUtils;
function RemoveVowels(const s: string): string;
const
VOWELS =['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'];
var
c: char;
begin
Result := '';
for c in s do
begin
if not (c in VOWELS) then
Result := Result + c;
end;
end;
const... |
def exceptGlyphs(exclusions):
def go(s):
return ''.join(
c for c in s if c not in exclusions
)
return go
def main():
txt =
print(
exceptGlyphs('eau')(txt)
)
if __name__ == '__main__':
main()
|
Convert the following code from Delphi to Python, ensuring the logic remains intact. | program Remove_vowels_from_a_string;
uses
System.SysUtils;
function RemoveVowels(const s: string): string;
const
VOWELS =['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'];
var
c: char;
begin
Result := '';
for c in s do
begin
if not (c in VOWELS) then
Result := Result + c;
end;
end;
const... |
def exceptGlyphs(exclusions):
def go(s):
return ''.join(
c for c in s if c not in exclusions
)
return go
def main():
txt =
print(
exceptGlyphs('eau')(txt)
)
if __name__ == '__main__':
main()
|
Can you help me rewrite this code in VB instead of Delphi, keeping it the same logically? | program Remove_vowels_from_a_string;
uses
System.SysUtils;
function RemoveVowels(const s: string): string;
const
VOWELS =['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'];
var
c: char;
begin
Result := '';
for c in s do
begin
if not (c in VOWELS) then
Result := Result + c;
end;
end;
const... | Imports System.Text
Module Module1
Function RemoveVowels(s As String) As String
Dim sb As New StringBuilder
For Each c In s
Select Case c
Case "A", "a"
Case "E", "e"
Case "I", "i"
Case "O", "o"
Case "U", "u... |
Keep all operations the same but rewrite the snippet in VB. | program Remove_vowels_from_a_string;
uses
System.SysUtils;
function RemoveVowels(const s: string): string;
const
VOWELS =['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'];
var
c: char;
begin
Result := '';
for c in s do
begin
if not (c in VOWELS) then
Result := Result + c;
end;
end;
const... | Imports System.Text
Module Module1
Function RemoveVowels(s As String) As String
Dim sb As New StringBuilder
For Each c In s
Select Case c
Case "A", "a"
Case "E", "e"
Case "I", "i"
Case "O", "o"
Case "U", "u... |
Write a version of this Delphi function in Go with identical behavior. | program Remove_vowels_from_a_string;
uses
System.SysUtils;
function RemoveVowels(const s: string): string;
const
VOWELS =['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'];
var
c: char;
begin
Result := '';
for c in s do
begin
if not (c in VOWELS) then
Result := Result + c;
end;
end;
const... | package main
import (
"fmt"
"strings"
)
func removeVowels(s string) string {
var sb strings.Builder
vowels := "aeiouAEIOU"
for _, c := range s {
if !strings.ContainsAny(string(c), vowels) {
sb.WriteRune(c)
}
}
return sb.String()
}
func main() {
s := "Go Pro... |
Translate the given Delphi code snippet into Go without altering its behavior. | program Remove_vowels_from_a_string;
uses
System.SysUtils;
function RemoveVowels(const s: string): string;
const
VOWELS =['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'];
var
c: char;
begin
Result := '';
for c in s do
begin
if not (c in VOWELS) then
Result := Result + c;
end;
end;
const... | package main
import (
"fmt"
"strings"
)
func removeVowels(s string) string {
var sb strings.Builder
vowels := "aeiouAEIOU"
for _, c := range s {
if !strings.ContainsAny(string(c), vowels) {
sb.WriteRune(c)
}
}
return sb.String()
}
func main() {
s := "Go Pro... |
Generate an equivalent C version of this F# code. | let stripVowels n=let g=set['a';'e';'i';'o';'u';'A';'E';'I';'O';'U'] in n|>Seq.filter(fun n->not(g.Contains n))|>Array.ofSeq|>System.String
printfn "%s" (stripVowels "Nigel Galloway")
| #include <stdio.h>
void print_no_vowels(const char *s) {
for (; *s != 0; s++) {
switch (*s) {
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
break;
defaul... |
Convert the following code from F# to C#, ensuring the logic remains intact. | let stripVowels n=let g=set['a';'e';'i';'o';'u';'A';'E';'I';'O';'U'] in n|>Seq.filter(fun n->not(g.Contains n))|>Array.ofSeq|>System.String
printfn "%s" (stripVowels "Nigel Galloway")
| static string remove_vowels(string value)
{
var stripped = from c in value.ToCharArray()
where !"aeiouAEIOU".Contains(c)
select c;
return new string(stripped.ToArray());
}
static void test(string value)
{
Console.WriteLine("Input: " + value);
Console.WriteLine("O... |
Convert the following code from F# to C#, ensuring the logic remains intact. | let stripVowels n=let g=set['a';'e';'i';'o';'u';'A';'E';'I';'O';'U'] in n|>Seq.filter(fun n->not(g.Contains n))|>Array.ofSeq|>System.String
printfn "%s" (stripVowels "Nigel Galloway")
| static string remove_vowels(string value)
{
var stripped = from c in value.ToCharArray()
where !"aeiouAEIOU".Contains(c)
select c;
return new string(stripped.ToArray());
}
static void test(string value)
{
Console.WriteLine("Input: " + value);
Console.WriteLine("O... |
Produce a language-to-language conversion: from F# to C++, same semantics. | let stripVowels n=let g=set['a';'e';'i';'o';'u';'A';'E';'I';'O';'U'] in n|>Seq.filter(fun n->not(g.Contains n))|>Array.ofSeq|>System.String
printfn "%s" (stripVowels "Nigel Galloway")
| #include <algorithm>
#include <iostream>
class print_no_vowels {
private:
const std::string &str;
public:
print_no_vowels(const std::string &s) : str(s) {}
friend std::ostream &operator<<(std::ostream &, print_no_vowels);
};
std::ostream &operator<<(std::ostream &os, print_no_vowels pnv) {
auto it = p... |
Translate the given F# code snippet into C++ without altering its behavior. | let stripVowels n=let g=set['a';'e';'i';'o';'u';'A';'E';'I';'O';'U'] in n|>Seq.filter(fun n->not(g.Contains n))|>Array.ofSeq|>System.String
printfn "%s" (stripVowels "Nigel Galloway")
| #include <algorithm>
#include <iostream>
class print_no_vowels {
private:
const std::string &str;
public:
print_no_vowels(const std::string &s) : str(s) {}
friend std::ostream &operator<<(std::ostream &, print_no_vowels);
};
std::ostream &operator<<(std::ostream &os, print_no_vowels pnv) {
auto it = p... |
Can you help me rewrite this code in Java instead of F#, keeping it the same logically? | let stripVowels n=let g=set['a';'e';'i';'o';'u';'A';'E';'I';'O';'U'] in n|>Seq.filter(fun n->not(g.Contains n))|>Array.ofSeq|>System.String
printfn "%s" (stripVowels "Nigel Galloway")
| public static String removeVowelse(String str){
String re = "";
char c;
for(int x = 0; x<str.length(); x++){
c = str.charAt(x);
if(!(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'))
re+=c;
}
return re;
}
|
Change the programming language of this snippet from F# to Java without modifying what it does. | let stripVowels n=let g=set['a';'e';'i';'o';'u';'A';'E';'I';'O';'U'] in n|>Seq.filter(fun n->not(g.Contains n))|>Array.ofSeq|>System.String
printfn "%s" (stripVowels "Nigel Galloway")
| public static String removeVowelse(String str){
String re = "";
char c;
for(int x = 0; x<str.length(); x++){
c = str.charAt(x);
if(!(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'))
re+=c;
}
return re;
}
|
Produce a language-to-language conversion: from F# to Python, same semantics. | let stripVowels n=let g=set['a';'e';'i';'o';'u';'A';'E';'I';'O';'U'] in n|>Seq.filter(fun n->not(g.Contains n))|>Array.ofSeq|>System.String
printfn "%s" (stripVowels "Nigel Galloway")
|
def exceptGlyphs(exclusions):
def go(s):
return ''.join(
c for c in s if c not in exclusions
)
return go
def main():
txt =
print(
exceptGlyphs('eau')(txt)
)
if __name__ == '__main__':
main()
|
Change the following F# code into Python without altering its purpose. | let stripVowels n=let g=set['a';'e';'i';'o';'u';'A';'E';'I';'O';'U'] in n|>Seq.filter(fun n->not(g.Contains n))|>Array.ofSeq|>System.String
printfn "%s" (stripVowels "Nigel Galloway")
|
def exceptGlyphs(exclusions):
def go(s):
return ''.join(
c for c in s if c not in exclusions
)
return go
def main():
txt =
print(
exceptGlyphs('eau')(txt)
)
if __name__ == '__main__':
main()
|
Maintain the same structure and functionality when rewriting this code in VB. | let stripVowels n=let g=set['a';'e';'i';'o';'u';'A';'E';'I';'O';'U'] in n|>Seq.filter(fun n->not(g.Contains n))|>Array.ofSeq|>System.String
printfn "%s" (stripVowels "Nigel Galloway")
| Imports System.Text
Module Module1
Function RemoveVowels(s As String) As String
Dim sb As New StringBuilder
For Each c In s
Select Case c
Case "A", "a"
Case "E", "e"
Case "I", "i"
Case "O", "o"
Case "U", "u... |
Keep all operations the same but rewrite the snippet in VB. | let stripVowels n=let g=set['a';'e';'i';'o';'u';'A';'E';'I';'O';'U'] in n|>Seq.filter(fun n->not(g.Contains n))|>Array.ofSeq|>System.String
printfn "%s" (stripVowels "Nigel Galloway")
| Imports System.Text
Module Module1
Function RemoveVowels(s As String) As String
Dim sb As New StringBuilder
For Each c In s
Select Case c
Case "A", "a"
Case "E", "e"
Case "I", "i"
Case "O", "o"
Case "U", "u... |
Please provide an equivalent version of this F# code in Go. | let stripVowels n=let g=set['a';'e';'i';'o';'u';'A';'E';'I';'O';'U'] in n|>Seq.filter(fun n->not(g.Contains n))|>Array.ofSeq|>System.String
printfn "%s" (stripVowels "Nigel Galloway")
| package main
import (
"fmt"
"strings"
)
func removeVowels(s string) string {
var sb strings.Builder
vowels := "aeiouAEIOU"
for _, c := range s {
if !strings.ContainsAny(string(c), vowels) {
sb.WriteRune(c)
}
}
return sb.String()
}
func main() {
s := "Go Pro... |
Port the provided F# code into Go while preserving the original functionality. | let stripVowels n=let g=set['a';'e';'i';'o';'u';'A';'E';'I';'O';'U'] in n|>Seq.filter(fun n->not(g.Contains n))|>Array.ofSeq|>System.String
printfn "%s" (stripVowels "Nigel Galloway")
| package main
import (
"fmt"
"strings"
)
func removeVowels(s string) string {
var sb strings.Builder
vowels := "aeiouAEIOU"
for _, c := range s {
if !strings.ContainsAny(string(c), vowels) {
sb.WriteRune(c)
}
}
return sb.String()
}
func main() {
s := "Go Pro... |
Port the provided Factor code into C while preserving the original functionality. | USING: formatting kernel sets ;
: without-vowels ( str -- new-str ) "aeiouAEIOU" without ;
"Factor Programming Language" dup without-vowels
" Input string: %s\nWithout vowels: %s\n" printf
| #include <stdio.h>
void print_no_vowels(const char *s) {
for (; *s != 0; s++) {
switch (*s) {
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
break;
defaul... |
Generate an equivalent C version of this Factor code. | USING: formatting kernel sets ;
: without-vowels ( str -- new-str ) "aeiouAEIOU" without ;
"Factor Programming Language" dup without-vowels
" Input string: %s\nWithout vowels: %s\n" printf
| #include <stdio.h>
void print_no_vowels(const char *s) {
for (; *s != 0; s++) {
switch (*s) {
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
break;
defaul... |
Port the following code from Factor to C# with equivalent syntax and logic. | USING: formatting kernel sets ;
: without-vowels ( str -- new-str ) "aeiouAEIOU" without ;
"Factor Programming Language" dup without-vowels
" Input string: %s\nWithout vowels: %s\n" printf
| static string remove_vowels(string value)
{
var stripped = from c in value.ToCharArray()
where !"aeiouAEIOU".Contains(c)
select c;
return new string(stripped.ToArray());
}
static void test(string value)
{
Console.WriteLine("Input: " + value);
Console.WriteLine("O... |
Produce a functionally identical C# code for the snippet given in Factor. | USING: formatting kernel sets ;
: without-vowels ( str -- new-str ) "aeiouAEIOU" without ;
"Factor Programming Language" dup without-vowels
" Input string: %s\nWithout vowels: %s\n" printf
| static string remove_vowels(string value)
{
var stripped = from c in value.ToCharArray()
where !"aeiouAEIOU".Contains(c)
select c;
return new string(stripped.ToArray());
}
static void test(string value)
{
Console.WriteLine("Input: " + value);
Console.WriteLine("O... |
Write a version of this Factor function in C++ with identical behavior. | USING: formatting kernel sets ;
: without-vowels ( str -- new-str ) "aeiouAEIOU" without ;
"Factor Programming Language" dup without-vowels
" Input string: %s\nWithout vowels: %s\n" printf
| #include <algorithm>
#include <iostream>
class print_no_vowels {
private:
const std::string &str;
public:
print_no_vowels(const std::string &s) : str(s) {}
friend std::ostream &operator<<(std::ostream &, print_no_vowels);
};
std::ostream &operator<<(std::ostream &os, print_no_vowels pnv) {
auto it = p... |
Produce a language-to-language conversion: from Factor to C++, same semantics. | USING: formatting kernel sets ;
: without-vowels ( str -- new-str ) "aeiouAEIOU" without ;
"Factor Programming Language" dup without-vowels
" Input string: %s\nWithout vowels: %s\n" printf
| #include <algorithm>
#include <iostream>
class print_no_vowels {
private:
const std::string &str;
public:
print_no_vowels(const std::string &s) : str(s) {}
friend std::ostream &operator<<(std::ostream &, print_no_vowels);
};
std::ostream &operator<<(std::ostream &os, print_no_vowels pnv) {
auto it = p... |
Keep all operations the same but rewrite the snippet in Java. | USING: formatting kernel sets ;
: without-vowels ( str -- new-str ) "aeiouAEIOU" without ;
"Factor Programming Language" dup without-vowels
" Input string: %s\nWithout vowels: %s\n" printf
| public static String removeVowelse(String str){
String re = "";
char c;
for(int x = 0; x<str.length(); x++){
c = str.charAt(x);
if(!(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'))
re+=c;
}
return re;
}
|
Generate a Java translation of this Factor snippet without changing its computational steps. | USING: formatting kernel sets ;
: without-vowels ( str -- new-str ) "aeiouAEIOU" without ;
"Factor Programming Language" dup without-vowels
" Input string: %s\nWithout vowels: %s\n" printf
| public static String removeVowelse(String str){
String re = "";
char c;
for(int x = 0; x<str.length(); x++){
c = str.charAt(x);
if(!(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'))
re+=c;
}
return re;
}
|
Can you help me rewrite this code in Python instead of Factor, keeping it the same logically? | USING: formatting kernel sets ;
: without-vowels ( str -- new-str ) "aeiouAEIOU" without ;
"Factor Programming Language" dup without-vowels
" Input string: %s\nWithout vowels: %s\n" printf
|
def exceptGlyphs(exclusions):
def go(s):
return ''.join(
c for c in s if c not in exclusions
)
return go
def main():
txt =
print(
exceptGlyphs('eau')(txt)
)
if __name__ == '__main__':
main()
|
Change the programming language of this snippet from Factor to Python without modifying what it does. | USING: formatting kernel sets ;
: without-vowels ( str -- new-str ) "aeiouAEIOU" without ;
"Factor Programming Language" dup without-vowels
" Input string: %s\nWithout vowels: %s\n" printf
|
def exceptGlyphs(exclusions):
def go(s):
return ''.join(
c for c in s if c not in exclusions
)
return go
def main():
txt =
print(
exceptGlyphs('eau')(txt)
)
if __name__ == '__main__':
main()
|
Port the following code from Factor to VB with equivalent syntax and logic. | USING: formatting kernel sets ;
: without-vowels ( str -- new-str ) "aeiouAEIOU" without ;
"Factor Programming Language" dup without-vowels
" Input string: %s\nWithout vowels: %s\n" printf
| Imports System.Text
Module Module1
Function RemoveVowels(s As String) As String
Dim sb As New StringBuilder
For Each c In s
Select Case c
Case "A", "a"
Case "E", "e"
Case "I", "i"
Case "O", "o"
Case "U", "u... |
Write the same code in VB as shown below in Factor. | USING: formatting kernel sets ;
: without-vowels ( str -- new-str ) "aeiouAEIOU" without ;
"Factor Programming Language" dup without-vowels
" Input string: %s\nWithout vowels: %s\n" printf
| Imports System.Text
Module Module1
Function RemoveVowels(s As String) As String
Dim sb As New StringBuilder
For Each c In s
Select Case c
Case "A", "a"
Case "E", "e"
Case "I", "i"
Case "O", "o"
Case "U", "u... |
Convert this Factor block to Go, preserving its control flow and logic. | USING: formatting kernel sets ;
: without-vowels ( str -- new-str ) "aeiouAEIOU" without ;
"Factor Programming Language" dup without-vowels
" Input string: %s\nWithout vowels: %s\n" printf
| package main
import (
"fmt"
"strings"
)
func removeVowels(s string) string {
var sb strings.Builder
vowels := "aeiouAEIOU"
for _, c := range s {
if !strings.ContainsAny(string(c), vowels) {
sb.WriteRune(c)
}
}
return sb.String()
}
func main() {
s := "Go Pro... |
Write the same algorithm in Go as shown in this Factor implementation. | USING: formatting kernel sets ;
: without-vowels ( str -- new-str ) "aeiouAEIOU" without ;
"Factor Programming Language" dup without-vowels
" Input string: %s\nWithout vowels: %s\n" printf
| package main
import (
"fmt"
"strings"
)
func removeVowels(s string) string {
var sb strings.Builder
vowels := "aeiouAEIOU"
for _, c := range s {
if !strings.ContainsAny(string(c), vowels) {
sb.WriteRune(c)
}
}
return sb.String()
}
func main() {
s := "Go Pro... |
Write the same algorithm in C as shown in this Forth implementation. | : VOWELS S" aeiouAEIOU" ;
: VALIDATE ROT SCAN NIP ;
: C+! TUCK C@ + SWAP C! ;
: ]PAD PAD 1+ + ;
: PAD, PAD C@ ]PAD C! 1 PAD C+! ;
: NOVOWELS
0 PAD C!
BOUNDS
?DO
I C@ DUP VOWELS VALIDATE
IF DROP ... | #include <stdio.h>
void print_no_vowels(const char *s) {
for (; *s != 0; s++) {
switch (*s) {
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
break;
defaul... |
Generate a C# translation of this Forth snippet without changing its computational steps. | : VOWELS S" aeiouAEIOU" ;
: VALIDATE ROT SCAN NIP ;
: C+! TUCK C@ + SWAP C! ;
: ]PAD PAD 1+ + ;
: PAD, PAD C@ ]PAD C! 1 PAD C+! ;
: NOVOWELS
0 PAD C!
BOUNDS
?DO
I C@ DUP VOWELS VALIDATE
IF DROP ... | static string remove_vowels(string value)
{
var stripped = from c in value.ToCharArray()
where !"aeiouAEIOU".Contains(c)
select c;
return new string(stripped.ToArray());
}
static void test(string value)
{
Console.WriteLine("Input: " + value);
Console.WriteLine("O... |
Change the programming language of this snippet from Forth to C# without modifying what it does. | : VOWELS S" aeiouAEIOU" ;
: VALIDATE ROT SCAN NIP ;
: C+! TUCK C@ + SWAP C! ;
: ]PAD PAD 1+ + ;
: PAD, PAD C@ ]PAD C! 1 PAD C+! ;
: NOVOWELS
0 PAD C!
BOUNDS
?DO
I C@ DUP VOWELS VALIDATE
IF DROP ... | static string remove_vowels(string value)
{
var stripped = from c in value.ToCharArray()
where !"aeiouAEIOU".Contains(c)
select c;
return new string(stripped.ToArray());
}
static void test(string value)
{
Console.WriteLine("Input: " + value);
Console.WriteLine("O... |
Port the provided Forth code into C++ while preserving the original functionality. | : VOWELS S" aeiouAEIOU" ;
: VALIDATE ROT SCAN NIP ;
: C+! TUCK C@ + SWAP C! ;
: ]PAD PAD 1+ + ;
: PAD, PAD C@ ]PAD C! 1 PAD C+! ;
: NOVOWELS
0 PAD C!
BOUNDS
?DO
I C@ DUP VOWELS VALIDATE
IF DROP ... | #include <algorithm>
#include <iostream>
class print_no_vowels {
private:
const std::string &str;
public:
print_no_vowels(const std::string &s) : str(s) {}
friend std::ostream &operator<<(std::ostream &, print_no_vowels);
};
std::ostream &operator<<(std::ostream &os, print_no_vowels pnv) {
auto it = p... |
Translate the given Forth code snippet into C++ without altering its behavior. | : VOWELS S" aeiouAEIOU" ;
: VALIDATE ROT SCAN NIP ;
: C+! TUCK C@ + SWAP C! ;
: ]PAD PAD 1+ + ;
: PAD, PAD C@ ]PAD C! 1 PAD C+! ;
: NOVOWELS
0 PAD C!
BOUNDS
?DO
I C@ DUP VOWELS VALIDATE
IF DROP ... | #include <algorithm>
#include <iostream>
class print_no_vowels {
private:
const std::string &str;
public:
print_no_vowels(const std::string &s) : str(s) {}
friend std::ostream &operator<<(std::ostream &, print_no_vowels);
};
std::ostream &operator<<(std::ostream &os, print_no_vowels pnv) {
auto it = p... |
Rewrite this program in Java while keeping its functionality equivalent to the Forth version. | : VOWELS S" aeiouAEIOU" ;
: VALIDATE ROT SCAN NIP ;
: C+! TUCK C@ + SWAP C! ;
: ]PAD PAD 1+ + ;
: PAD, PAD C@ ]PAD C! 1 PAD C+! ;
: NOVOWELS
0 PAD C!
BOUNDS
?DO
I C@ DUP VOWELS VALIDATE
IF DROP ... | public static String removeVowelse(String str){
String re = "";
char c;
for(int x = 0; x<str.length(); x++){
c = str.charAt(x);
if(!(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'))
re+=c;
}
return re;
}
|
Convert this Forth block to Java, preserving its control flow and logic. | : VOWELS S" aeiouAEIOU" ;
: VALIDATE ROT SCAN NIP ;
: C+! TUCK C@ + SWAP C! ;
: ]PAD PAD 1+ + ;
: PAD, PAD C@ ]PAD C! 1 PAD C+! ;
: NOVOWELS
0 PAD C!
BOUNDS
?DO
I C@ DUP VOWELS VALIDATE
IF DROP ... | public static String removeVowelse(String str){
String re = "";
char c;
for(int x = 0; x<str.length(); x++){
c = str.charAt(x);
if(!(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'))
re+=c;
}
return re;
}
|
Generate an equivalent Python version of this Forth code. | : VOWELS S" aeiouAEIOU" ;
: VALIDATE ROT SCAN NIP ;
: C+! TUCK C@ + SWAP C! ;
: ]PAD PAD 1+ + ;
: PAD, PAD C@ ]PAD C! 1 PAD C+! ;
: NOVOWELS
0 PAD C!
BOUNDS
?DO
I C@ DUP VOWELS VALIDATE
IF DROP ... |
def exceptGlyphs(exclusions):
def go(s):
return ''.join(
c for c in s if c not in exclusions
)
return go
def main():
txt =
print(
exceptGlyphs('eau')(txt)
)
if __name__ == '__main__':
main()
|
Rewrite the snippet below in Python so it works the same as the original Forth code. | : VOWELS S" aeiouAEIOU" ;
: VALIDATE ROT SCAN NIP ;
: C+! TUCK C@ + SWAP C! ;
: ]PAD PAD 1+ + ;
: PAD, PAD C@ ]PAD C! 1 PAD C+! ;
: NOVOWELS
0 PAD C!
BOUNDS
?DO
I C@ DUP VOWELS VALIDATE
IF DROP ... |
def exceptGlyphs(exclusions):
def go(s):
return ''.join(
c for c in s if c not in exclusions
)
return go
def main():
txt =
print(
exceptGlyphs('eau')(txt)
)
if __name__ == '__main__':
main()
|
Change the following Forth code into VB without altering its purpose. | : VOWELS S" aeiouAEIOU" ;
: VALIDATE ROT SCAN NIP ;
: C+! TUCK C@ + SWAP C! ;
: ]PAD PAD 1+ + ;
: PAD, PAD C@ ]PAD C! 1 PAD C+! ;
: NOVOWELS
0 PAD C!
BOUNDS
?DO
I C@ DUP VOWELS VALIDATE
IF DROP ... | Imports System.Text
Module Module1
Function RemoveVowels(s As String) As String
Dim sb As New StringBuilder
For Each c In s
Select Case c
Case "A", "a"
Case "E", "e"
Case "I", "i"
Case "O", "o"
Case "U", "u... |
Translate the given Forth code snippet into VB without altering its behavior. | : VOWELS S" aeiouAEIOU" ;
: VALIDATE ROT SCAN NIP ;
: C+! TUCK C@ + SWAP C! ;
: ]PAD PAD 1+ + ;
: PAD, PAD C@ ]PAD C! 1 PAD C+! ;
: NOVOWELS
0 PAD C!
BOUNDS
?DO
I C@ DUP VOWELS VALIDATE
IF DROP ... | Imports System.Text
Module Module1
Function RemoveVowels(s As String) As String
Dim sb As New StringBuilder
For Each c In s
Select Case c
Case "A", "a"
Case "E", "e"
Case "I", "i"
Case "O", "o"
Case "U", "u... |
Convert this Forth block to Go, preserving its control flow and logic. | : VOWELS S" aeiouAEIOU" ;
: VALIDATE ROT SCAN NIP ;
: C+! TUCK C@ + SWAP C! ;
: ]PAD PAD 1+ + ;
: PAD, PAD C@ ]PAD C! 1 PAD C+! ;
: NOVOWELS
0 PAD C!
BOUNDS
?DO
I C@ DUP VOWELS VALIDATE
IF DROP ... | package main
import (
"fmt"
"strings"
)
func removeVowels(s string) string {
var sb strings.Builder
vowels := "aeiouAEIOU"
for _, c := range s {
if !strings.ContainsAny(string(c), vowels) {
sb.WriteRune(c)
}
}
return sb.String()
}
func main() {
s := "Go Pro... |
Rewrite the snippet below in Go so it works the same as the original Forth code. | : VOWELS S" aeiouAEIOU" ;
: VALIDATE ROT SCAN NIP ;
: C+! TUCK C@ + SWAP C! ;
: ]PAD PAD 1+ + ;
: PAD, PAD C@ ]PAD C! 1 PAD C+! ;
: NOVOWELS
0 PAD C!
BOUNDS
?DO
I C@ DUP VOWELS VALIDATE
IF DROP ... | package main
import (
"fmt"
"strings"
)
func removeVowels(s string) string {
var sb strings.Builder
vowels := "aeiouAEIOU"
for _, c := range s {
if !strings.ContainsAny(string(c), vowels) {
sb.WriteRune(c)
}
}
return sb.String()
}
func main() {
s := "Go Pro... |
Port the provided Fortran code into C# while preserving the original functionality. | program remove_vowels
implicit none
character(len=*), parameter :: string1="The quick brown fox jumps over the lazy dog."
character(len=*), parameter :: string2="Fortran programming language"
call print_no_vowels(string1)
call print_no_vowels(string2)
contains
subroutine print_no_vowels(string... | static string remove_vowels(string value)
{
var stripped = from c in value.ToCharArray()
where !"aeiouAEIOU".Contains(c)
select c;
return new string(stripped.ToArray());
}
static void test(string value)
{
Console.WriteLine("Input: " + value);
Console.WriteLine("O... |
Generate an equivalent C# version of this Fortran code. | program remove_vowels
implicit none
character(len=*), parameter :: string1="The quick brown fox jumps over the lazy dog."
character(len=*), parameter :: string2="Fortran programming language"
call print_no_vowels(string1)
call print_no_vowels(string2)
contains
subroutine print_no_vowels(string... | static string remove_vowels(string value)
{
var stripped = from c in value.ToCharArray()
where !"aeiouAEIOU".Contains(c)
select c;
return new string(stripped.ToArray());
}
static void test(string value)
{
Console.WriteLine("Input: " + value);
Console.WriteLine("O... |
Convert this Fortran block to C++, preserving its control flow and logic. | program remove_vowels
implicit none
character(len=*), parameter :: string1="The quick brown fox jumps over the lazy dog."
character(len=*), parameter :: string2="Fortran programming language"
call print_no_vowels(string1)
call print_no_vowels(string2)
contains
subroutine print_no_vowels(string... | #include <algorithm>
#include <iostream>
class print_no_vowels {
private:
const std::string &str;
public:
print_no_vowels(const std::string &s) : str(s) {}
friend std::ostream &operator<<(std::ostream &, print_no_vowels);
};
std::ostream &operator<<(std::ostream &os, print_no_vowels pnv) {
auto it = p... |
Keep all operations the same but rewrite the snippet in C++. | program remove_vowels
implicit none
character(len=*), parameter :: string1="The quick brown fox jumps over the lazy dog."
character(len=*), parameter :: string2="Fortran programming language"
call print_no_vowels(string1)
call print_no_vowels(string2)
contains
subroutine print_no_vowels(string... | #include <algorithm>
#include <iostream>
class print_no_vowels {
private:
const std::string &str;
public:
print_no_vowels(const std::string &s) : str(s) {}
friend std::ostream &operator<<(std::ostream &, print_no_vowels);
};
std::ostream &operator<<(std::ostream &os, print_no_vowels pnv) {
auto it = p... |
Produce a language-to-language conversion: from Fortran to C, same semantics. | program remove_vowels
implicit none
character(len=*), parameter :: string1="The quick brown fox jumps over the lazy dog."
character(len=*), parameter :: string2="Fortran programming language"
call print_no_vowels(string1)
call print_no_vowels(string2)
contains
subroutine print_no_vowels(string... | #include <stdio.h>
void print_no_vowels(const char *s) {
for (; *s != 0; s++) {
switch (*s) {
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
break;
defaul... |
Produce a functionally identical C code for the snippet given in Fortran. | program remove_vowels
implicit none
character(len=*), parameter :: string1="The quick brown fox jumps over the lazy dog."
character(len=*), parameter :: string2="Fortran programming language"
call print_no_vowels(string1)
call print_no_vowels(string2)
contains
subroutine print_no_vowels(string... | #include <stdio.h>
void print_no_vowels(const char *s) {
for (; *s != 0; s++) {
switch (*s) {
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
break;
defaul... |
Generate a Go translation of this Fortran snippet without changing its computational steps. | program remove_vowels
implicit none
character(len=*), parameter :: string1="The quick brown fox jumps over the lazy dog."
character(len=*), parameter :: string2="Fortran programming language"
call print_no_vowels(string1)
call print_no_vowels(string2)
contains
subroutine print_no_vowels(string... | package main
import (
"fmt"
"strings"
)
func removeVowels(s string) string {
var sb strings.Builder
vowels := "aeiouAEIOU"
for _, c := range s {
if !strings.ContainsAny(string(c), vowels) {
sb.WriteRune(c)
}
}
return sb.String()
}
func main() {
s := "Go Pro... |
Please provide an equivalent version of this Fortran code in Java. | program remove_vowels
implicit none
character(len=*), parameter :: string1="The quick brown fox jumps over the lazy dog."
character(len=*), parameter :: string2="Fortran programming language"
call print_no_vowels(string1)
call print_no_vowels(string2)
contains
subroutine print_no_vowels(string... | public static String removeVowelse(String str){
String re = "";
char c;
for(int x = 0; x<str.length(); x++){
c = str.charAt(x);
if(!(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'))
re+=c;
}
return re;
}
|
Generate an equivalent Java version of this Fortran code. | program remove_vowels
implicit none
character(len=*), parameter :: string1="The quick brown fox jumps over the lazy dog."
character(len=*), parameter :: string2="Fortran programming language"
call print_no_vowels(string1)
call print_no_vowels(string2)
contains
subroutine print_no_vowels(string... | public static String removeVowelse(String str){
String re = "";
char c;
for(int x = 0; x<str.length(); x++){
c = str.charAt(x);
if(!(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'))
re+=c;
}
return re;
}
|
Generate an equivalent Python version of this Fortran code. | program remove_vowels
implicit none
character(len=*), parameter :: string1="The quick brown fox jumps over the lazy dog."
character(len=*), parameter :: string2="Fortran programming language"
call print_no_vowels(string1)
call print_no_vowels(string2)
contains
subroutine print_no_vowels(string... |
def exceptGlyphs(exclusions):
def go(s):
return ''.join(
c for c in s if c not in exclusions
)
return go
def main():
txt =
print(
exceptGlyphs('eau')(txt)
)
if __name__ == '__main__':
main()
|
Write the same code in Python as shown below in Fortran. | program remove_vowels
implicit none
character(len=*), parameter :: string1="The quick brown fox jumps over the lazy dog."
character(len=*), parameter :: string2="Fortran programming language"
call print_no_vowels(string1)
call print_no_vowels(string2)
contains
subroutine print_no_vowels(string... |
def exceptGlyphs(exclusions):
def go(s):
return ''.join(
c for c in s if c not in exclusions
)
return go
def main():
txt =
print(
exceptGlyphs('eau')(txt)
)
if __name__ == '__main__':
main()
|
Convert this Fortran snippet to VB and keep its semantics consistent. | program remove_vowels
implicit none
character(len=*), parameter :: string1="The quick brown fox jumps over the lazy dog."
character(len=*), parameter :: string2="Fortran programming language"
call print_no_vowels(string1)
call print_no_vowels(string2)
contains
subroutine print_no_vowels(string... | Imports System.Text
Module Module1
Function RemoveVowels(s As String) As String
Dim sb As New StringBuilder
For Each c In s
Select Case c
Case "A", "a"
Case "E", "e"
Case "I", "i"
Case "O", "o"
Case "U", "u... |
Please provide an equivalent version of this Fortran code in VB. | program remove_vowels
implicit none
character(len=*), parameter :: string1="The quick brown fox jumps over the lazy dog."
character(len=*), parameter :: string2="Fortran programming language"
call print_no_vowels(string1)
call print_no_vowels(string2)
contains
subroutine print_no_vowels(string... | Imports System.Text
Module Module1
Function RemoveVowels(s As String) As String
Dim sb As New StringBuilder
For Each c In s
Select Case c
Case "A", "a"
Case "E", "e"
Case "I", "i"
Case "O", "o"
Case "U", "u... |
Rewrite the snippet below in C so it works the same as the original Haskell code. |
exceptGlyphs :: String -> String -> String
exceptGlyphs = filter . flip notElem
txt :: String
txt =
"Rosetta Code is a programming chrestomathy site.\n\
\The idea is to present solutions to the same\n\
\task in as many different languages as possible,\n\
\to demonstrate how languages are similar and\n... | #include <stdio.h>
void print_no_vowels(const char *s) {
for (; *s != 0; s++) {
switch (*s) {
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
break;
defaul... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.