Instruction stringlengths 45 106 | input_code stringlengths 1 13.7k | output_code stringlengths 1 13.7k |
|---|---|---|
Port the provided Clojure code into C while preserving the original functionality. | => (def *stack* 0)
=> ((fn overflow [] ((def *stack* (inc *stack*))(overflow))))
java.lang.StackOverflowError (NO_SOURCE_FILE:0)
=> *stack*
10498
| #include <stdio.h>
void recurse(unsigned int i)
{
printf("%d\n", i);
recurse(i+1);
}
int main()
{
recurse(0);
return 0;
}
|
Port the following code from Clojure to C with equivalent syntax and logic. | => (def *stack* 0)
=> ((fn overflow [] ((def *stack* (inc *stack*))(overflow))))
java.lang.StackOverflowError (NO_SOURCE_FILE:0)
=> *stack*
10498
| #include <stdio.h>
void recurse(unsigned int i)
{
printf("%d\n", i);
recurse(i+1);
}
int main()
{
recurse(0);
return 0;
}
|
Write the same algorithm in C# as shown in this Clojure implementation. | => (def *stack* 0)
=> ((fn overflow [] ((def *stack* (inc *stack*))(overflow))))
java.lang.StackOverflowError (NO_SOURCE_FILE:0)
=> *stack*
10498
| using System;
class RecursionLimit
{
static void Main(string[] args)
{
Recur(0);
}
private static void Recur(int i)
{
Console.WriteLine(i);
Recur(i + 1);
}
}
|
Preserve the algorithm and functionality while converting the code from Clojure to C#. | => (def *stack* 0)
=> ((fn overflow [] ((def *stack* (inc *stack*))(overflow))))
java.lang.StackOverflowError (NO_SOURCE_FILE:0)
=> *stack*
10498
| using System;
class RecursionLimit
{
static void Main(string[] args)
{
Recur(0);
}
private static void Recur(int i)
{
Console.WriteLine(i);
Recur(i + 1);
}
}
|
Rewrite the snippet below in C++ so it works the same as the original Clojure code. | => (def *stack* 0)
=> ((fn overflow [] ((def *stack* (inc *stack*))(overflow))))
java.lang.StackOverflowError (NO_SOURCE_FILE:0)
=> *stack*
10498
| #include <iostream>
void recurse(unsigned int i)
{
std::cout<<i<<"\n";
recurse(i+1);
}
int main()
{
recurse(0);
}
|
Translate this program into C++ but keep the logic exactly as in Clojure. | => (def *stack* 0)
=> ((fn overflow [] ((def *stack* (inc *stack*))(overflow))))
java.lang.StackOverflowError (NO_SOURCE_FILE:0)
=> *stack*
10498
| #include <iostream>
void recurse(unsigned int i)
{
std::cout<<i<<"\n";
recurse(i+1);
}
int main()
{
recurse(0);
}
|
Produce a language-to-language conversion: from Clojure to Java, same semantics. | => (def *stack* 0)
=> ((fn overflow [] ((def *stack* (inc *stack*))(overflow))))
java.lang.StackOverflowError (NO_SOURCE_FILE:0)
=> *stack*
10498
| public class RecursionTest {
private static void recurse(int i) {
try {
recurse(i+1);
} catch (StackOverflowError e) {
System.out.print("Recursion depth on this system is " + i + ".");
}
}
public static void main(String[] args) {
recurse(0);
}
}
|
Port the following code from Clojure to Java with equivalent syntax and logic. | => (def *stack* 0)
=> ((fn overflow [] ((def *stack* (inc *stack*))(overflow))))
java.lang.StackOverflowError (NO_SOURCE_FILE:0)
=> *stack*
10498
| public class RecursionTest {
private static void recurse(int i) {
try {
recurse(i+1);
} catch (StackOverflowError e) {
System.out.print("Recursion depth on this system is " + i + ".");
}
}
public static void main(String[] args) {
recurse(0);
}
}
|
Change the programming language of this snippet from Clojure to Python without modifying what it does. | => (def *stack* 0)
=> ((fn overflow [] ((def *stack* (inc *stack*))(overflow))))
java.lang.StackOverflowError (NO_SOURCE_FILE:0)
=> *stack*
10498
| import sys
print(sys.getrecursionlimit())
|
Translate the given Clojure code snippet into Python without altering its behavior. | => (def *stack* 0)
=> ((fn overflow [] ((def *stack* (inc *stack*))(overflow))))
java.lang.StackOverflowError (NO_SOURCE_FILE:0)
=> *stack*
10498
| import sys
print(sys.getrecursionlimit())
|
Maintain the same structure and functionality when rewriting this code in VB. | => (def *stack* 0)
=> ((fn overflow [] ((def *stack* (inc *stack*))(overflow))))
java.lang.StackOverflowError (NO_SOURCE_FILE:0)
=> *stack*
10498
| Option Explicit
Sub Main()
Debug.Print "The limit is : " & Limite_Recursivite(0)
End Sub
Function Limite_Recursivite(Cpt As Long) As Long
Cpt = Cpt + 1
On Error Resume Next
Limite_Recursivite Cpt
On Error GoTo 0
Limite_Recursivite = Cpt
End Function
|
Port the provided Clojure code into VB while preserving the original functionality. | => (def *stack* 0)
=> ((fn overflow [] ((def *stack* (inc *stack*))(overflow))))
java.lang.StackOverflowError (NO_SOURCE_FILE:0)
=> *stack*
10498
| Option Explicit
Sub Main()
Debug.Print "The limit is : " & Limite_Recursivite(0)
End Sub
Function Limite_Recursivite(Cpt As Long) As Long
Cpt = Cpt + 1
On Error Resume Next
Limite_Recursivite Cpt
On Error GoTo 0
Limite_Recursivite = Cpt
End Function
|
Write the same code in Go as shown below in Clojure. | => (def *stack* 0)
=> ((fn overflow [] ((def *stack* (inc *stack*))(overflow))))
java.lang.StackOverflowError (NO_SOURCE_FILE:0)
=> *stack*
10498
| package main
import (
"flag"
"fmt"
"runtime/debug"
)
func main() {
stack := flag.Int("stack", 0, "maximum per goroutine stack size or 0 for the default")
flag.Parse()
if *stack > 0 {
debug.SetMaxStack(*stack)
}
r(1)
}
func r(l int) {
if l%1000 == 0 {
fmt.Println(l)
}
r(l + 1)
}
|
Port the following code from Clojure to Go with equivalent syntax and logic. | => (def *stack* 0)
=> ((fn overflow [] ((def *stack* (inc *stack*))(overflow))))
java.lang.StackOverflowError (NO_SOURCE_FILE:0)
=> *stack*
10498
| package main
import (
"flag"
"fmt"
"runtime/debug"
)
func main() {
stack := flag.Int("stack", 0, "maximum per goroutine stack size or 0 for the default")
flag.Parse()
if *stack > 0 {
debug.SetMaxStack(*stack)
}
r(1)
}
func r(l int) {
if l%1000 == 0 {
fmt.Println(l)
}
r(l + 1)
}
|
Convert this Common_Lisp block to C, preserving its control flow and logic. | (defun recursion-limit (x)
(if (zp x)
0
(prog2$ (cw "~x0~%" x)
(1+ (recursion-limit (1+ x))))))
| #include <stdio.h>
void recurse(unsigned int i)
{
printf("%d\n", i);
recurse(i+1);
}
int main()
{
recurse(0);
return 0;
}
|
Translate this program into C but keep the logic exactly as in Common_Lisp. | (defun recursion-limit (x)
(if (zp x)
0
(prog2$ (cw "~x0~%" x)
(1+ (recursion-limit (1+ x))))))
| #include <stdio.h>
void recurse(unsigned int i)
{
printf("%d\n", i);
recurse(i+1);
}
int main()
{
recurse(0);
return 0;
}
|
Produce a functionally identical C# code for the snippet given in Common_Lisp. | (defun recursion-limit (x)
(if (zp x)
0
(prog2$ (cw "~x0~%" x)
(1+ (recursion-limit (1+ x))))))
| using System;
class RecursionLimit
{
static void Main(string[] args)
{
Recur(0);
}
private static void Recur(int i)
{
Console.WriteLine(i);
Recur(i + 1);
}
}
|
Convert this Common_Lisp snippet to C# and keep its semantics consistent. | (defun recursion-limit (x)
(if (zp x)
0
(prog2$ (cw "~x0~%" x)
(1+ (recursion-limit (1+ x))))))
| using System;
class RecursionLimit
{
static void Main(string[] args)
{
Recur(0);
}
private static void Recur(int i)
{
Console.WriteLine(i);
Recur(i + 1);
}
}
|
Rewrite the snippet below in C++ so it works the same as the original Common_Lisp code. | (defun recursion-limit (x)
(if (zp x)
0
(prog2$ (cw "~x0~%" x)
(1+ (recursion-limit (1+ x))))))
| #include <iostream>
void recurse(unsigned int i)
{
std::cout<<i<<"\n";
recurse(i+1);
}
int main()
{
recurse(0);
}
|
Rewrite the snippet below in C++ so it works the same as the original Common_Lisp code. | (defun recursion-limit (x)
(if (zp x)
0
(prog2$ (cw "~x0~%" x)
(1+ (recursion-limit (1+ x))))))
| #include <iostream>
void recurse(unsigned int i)
{
std::cout<<i<<"\n";
recurse(i+1);
}
int main()
{
recurse(0);
}
|
Rewrite the snippet below in Java so it works the same as the original Common_Lisp code. | (defun recursion-limit (x)
(if (zp x)
0
(prog2$ (cw "~x0~%" x)
(1+ (recursion-limit (1+ x))))))
| public class RecursionTest {
private static void recurse(int i) {
try {
recurse(i+1);
} catch (StackOverflowError e) {
System.out.print("Recursion depth on this system is " + i + ".");
}
}
public static void main(String[] args) {
recurse(0);
}
}
|
Convert this Common_Lisp snippet to Java and keep its semantics consistent. | (defun recursion-limit (x)
(if (zp x)
0
(prog2$ (cw "~x0~%" x)
(1+ (recursion-limit (1+ x))))))
| public class RecursionTest {
private static void recurse(int i) {
try {
recurse(i+1);
} catch (StackOverflowError e) {
System.out.print("Recursion depth on this system is " + i + ".");
}
}
public static void main(String[] args) {
recurse(0);
}
}
|
Generate a Python translation of this Common_Lisp snippet without changing its computational steps. | (defun recursion-limit (x)
(if (zp x)
0
(prog2$ (cw "~x0~%" x)
(1+ (recursion-limit (1+ x))))))
| import sys
print(sys.getrecursionlimit())
|
Keep all operations the same but rewrite the snippet in Python. | (defun recursion-limit (x)
(if (zp x)
0
(prog2$ (cw "~x0~%" x)
(1+ (recursion-limit (1+ x))))))
| import sys
print(sys.getrecursionlimit())
|
Port the following code from Common_Lisp to VB with equivalent syntax and logic. | (defun recursion-limit (x)
(if (zp x)
0
(prog2$ (cw "~x0~%" x)
(1+ (recursion-limit (1+ x))))))
| Option Explicit
Sub Main()
Debug.Print "The limit is : " & Limite_Recursivite(0)
End Sub
Function Limite_Recursivite(Cpt As Long) As Long
Cpt = Cpt + 1
On Error Resume Next
Limite_Recursivite Cpt
On Error GoTo 0
Limite_Recursivite = Cpt
End Function
|
Write the same algorithm in VB as shown in this Common_Lisp implementation. | (defun recursion-limit (x)
(if (zp x)
0
(prog2$ (cw "~x0~%" x)
(1+ (recursion-limit (1+ x))))))
| Option Explicit
Sub Main()
Debug.Print "The limit is : " & Limite_Recursivite(0)
End Sub
Function Limite_Recursivite(Cpt As Long) As Long
Cpt = Cpt + 1
On Error Resume Next
Limite_Recursivite Cpt
On Error GoTo 0
Limite_Recursivite = Cpt
End Function
|
Produce a functionally identical Go code for the snippet given in Common_Lisp. | (defun recursion-limit (x)
(if (zp x)
0
(prog2$ (cw "~x0~%" x)
(1+ (recursion-limit (1+ x))))))
| package main
import (
"flag"
"fmt"
"runtime/debug"
)
func main() {
stack := flag.Int("stack", 0, "maximum per goroutine stack size or 0 for the default")
flag.Parse()
if *stack > 0 {
debug.SetMaxStack(*stack)
}
r(1)
}
func r(l int) {
if l%1000 == 0 {
fmt.Println(l)
}
r(l + 1)
}
|
Produce a functionally identical Go code for the snippet given in Common_Lisp. | (defun recursion-limit (x)
(if (zp x)
0
(prog2$ (cw "~x0~%" x)
(1+ (recursion-limit (1+ x))))))
| package main
import (
"flag"
"fmt"
"runtime/debug"
)
func main() {
stack := flag.Int("stack", 0, "maximum per goroutine stack size or 0 for the default")
flag.Parse()
if *stack > 0 {
debug.SetMaxStack(*stack)
}
r(1)
}
func r(l int) {
if l%1000 == 0 {
fmt.Println(l)
}
r(l + 1)
}
|
Change the programming language of this snippet from D to C without modifying what it does. | import std.c.stdio;
void recurse(in uint i=0) {
printf("%u ", i);
recurse(i + 1);
}
void main() {
recurse();
}
| #include <stdio.h>
void recurse(unsigned int i)
{
printf("%d\n", i);
recurse(i+1);
}
int main()
{
recurse(0);
return 0;
}
|
Convert this D snippet to C and keep its semantics consistent. | import std.c.stdio;
void recurse(in uint i=0) {
printf("%u ", i);
recurse(i + 1);
}
void main() {
recurse();
}
| #include <stdio.h>
void recurse(unsigned int i)
{
printf("%d\n", i);
recurse(i+1);
}
int main()
{
recurse(0);
return 0;
}
|
Translate this program into C# but keep the logic exactly as in D. | import std.c.stdio;
void recurse(in uint i=0) {
printf("%u ", i);
recurse(i + 1);
}
void main() {
recurse();
}
| using System;
class RecursionLimit
{
static void Main(string[] args)
{
Recur(0);
}
private static void Recur(int i)
{
Console.WriteLine(i);
Recur(i + 1);
}
}
|
Maintain the same structure and functionality when rewriting this code in C#. | import std.c.stdio;
void recurse(in uint i=0) {
printf("%u ", i);
recurse(i + 1);
}
void main() {
recurse();
}
| using System;
class RecursionLimit
{
static void Main(string[] args)
{
Recur(0);
}
private static void Recur(int i)
{
Console.WriteLine(i);
Recur(i + 1);
}
}
|
Maintain the same structure and functionality when rewriting this code in C++. | import std.c.stdio;
void recurse(in uint i=0) {
printf("%u ", i);
recurse(i + 1);
}
void main() {
recurse();
}
| #include <iostream>
void recurse(unsigned int i)
{
std::cout<<i<<"\n";
recurse(i+1);
}
int main()
{
recurse(0);
}
|
Produce a language-to-language conversion: from D to C++, same semantics. | import std.c.stdio;
void recurse(in uint i=0) {
printf("%u ", i);
recurse(i + 1);
}
void main() {
recurse();
}
| #include <iostream>
void recurse(unsigned int i)
{
std::cout<<i<<"\n";
recurse(i+1);
}
int main()
{
recurse(0);
}
|
Port the provided D code into Java while preserving the original functionality. | import std.c.stdio;
void recurse(in uint i=0) {
printf("%u ", i);
recurse(i + 1);
}
void main() {
recurse();
}
| public class RecursionTest {
private static void recurse(int i) {
try {
recurse(i+1);
} catch (StackOverflowError e) {
System.out.print("Recursion depth on this system is " + i + ".");
}
}
public static void main(String[] args) {
recurse(0);
}
}
|
Please provide an equivalent version of this D code in Java. | import std.c.stdio;
void recurse(in uint i=0) {
printf("%u ", i);
recurse(i + 1);
}
void main() {
recurse();
}
| public class RecursionTest {
private static void recurse(int i) {
try {
recurse(i+1);
} catch (StackOverflowError e) {
System.out.print("Recursion depth on this system is " + i + ".");
}
}
public static void main(String[] args) {
recurse(0);
}
}
|
Convert the following code from D to Python, ensuring the logic remains intact. | import std.c.stdio;
void recurse(in uint i=0) {
printf("%u ", i);
recurse(i + 1);
}
void main() {
recurse();
}
| import sys
print(sys.getrecursionlimit())
|
Rewrite this program in Python while keeping its functionality equivalent to the D version. | import std.c.stdio;
void recurse(in uint i=0) {
printf("%u ", i);
recurse(i + 1);
}
void main() {
recurse();
}
| import sys
print(sys.getrecursionlimit())
|
Rewrite this program in VB while keeping its functionality equivalent to the D version. | import std.c.stdio;
void recurse(in uint i=0) {
printf("%u ", i);
recurse(i + 1);
}
void main() {
recurse();
}
| Option Explicit
Sub Main()
Debug.Print "The limit is : " & Limite_Recursivite(0)
End Sub
Function Limite_Recursivite(Cpt As Long) As Long
Cpt = Cpt + 1
On Error Resume Next
Limite_Recursivite Cpt
On Error GoTo 0
Limite_Recursivite = Cpt
End Function
|
Convert this D block to VB, preserving its control flow and logic. | import std.c.stdio;
void recurse(in uint i=0) {
printf("%u ", i);
recurse(i + 1);
}
void main() {
recurse();
}
| Option Explicit
Sub Main()
Debug.Print "The limit is : " & Limite_Recursivite(0)
End Sub
Function Limite_Recursivite(Cpt As Long) As Long
Cpt = Cpt + 1
On Error Resume Next
Limite_Recursivite Cpt
On Error GoTo 0
Limite_Recursivite = Cpt
End Function
|
Convert the following code from D to Go, ensuring the logic remains intact. | import std.c.stdio;
void recurse(in uint i=0) {
printf("%u ", i);
recurse(i + 1);
}
void main() {
recurse();
}
| package main
import (
"flag"
"fmt"
"runtime/debug"
)
func main() {
stack := flag.Int("stack", 0, "maximum per goroutine stack size or 0 for the default")
flag.Parse()
if *stack > 0 {
debug.SetMaxStack(*stack)
}
r(1)
}
func r(l int) {
if l%1000 == 0 {
fmt.Println(l)
}
r(l + 1)
}
|
Produce a language-to-language conversion: from D to Go, same semantics. | import std.c.stdio;
void recurse(in uint i=0) {
printf("%u ", i);
recurse(i + 1);
}
void main() {
recurse();
}
| package main
import (
"flag"
"fmt"
"runtime/debug"
)
func main() {
stack := flag.Int("stack", 0, "maximum per goroutine stack size or 0 for the default")
flag.Parse()
if *stack > 0 {
debug.SetMaxStack(*stack)
}
r(1)
}
func r(l int) {
if l%1000 == 0 {
fmt.Println(l)
}
r(l + 1)
}
|
Produce a language-to-language conversion: from Delphi to C, same semantics. | program Project2;
uses
SysUtils;
function Recursive(Level : Integer) : Integer;
begin
try
Level := Level + 1;
Result := Recursive(Level);
except
on E: EStackOverflow do
Result := Level;
end;
end;
begin
Writeln('Recursion Level is ', Recursive(0));
Writeln('Press any key to Exit');
Readln;
end.
| #include <stdio.h>
void recurse(unsigned int i)
{
printf("%d\n", i);
recurse(i+1);
}
int main()
{
recurse(0);
return 0;
}
|
Maintain the same structure and functionality when rewriting this code in C. | program Project2;
uses
SysUtils;
function Recursive(Level : Integer) : Integer;
begin
try
Level := Level + 1;
Result := Recursive(Level);
except
on E: EStackOverflow do
Result := Level;
end;
end;
begin
Writeln('Recursion Level is ', Recursive(0));
Writeln('Press any key to Exit');
Readln;
end.
| #include <stdio.h>
void recurse(unsigned int i)
{
printf("%d\n", i);
recurse(i+1);
}
int main()
{
recurse(0);
return 0;
}
|
Write the same code in C# as shown below in Delphi. | program Project2;
uses
SysUtils;
function Recursive(Level : Integer) : Integer;
begin
try
Level := Level + 1;
Result := Recursive(Level);
except
on E: EStackOverflow do
Result := Level;
end;
end;
begin
Writeln('Recursion Level is ', Recursive(0));
Writeln('Press any key to Exit');
Readln;
end.
| using System;
class RecursionLimit
{
static void Main(string[] args)
{
Recur(0);
}
private static void Recur(int i)
{
Console.WriteLine(i);
Recur(i + 1);
}
}
|
Rewrite the snippet below in C# so it works the same as the original Delphi code. | program Project2;
uses
SysUtils;
function Recursive(Level : Integer) : Integer;
begin
try
Level := Level + 1;
Result := Recursive(Level);
except
on E: EStackOverflow do
Result := Level;
end;
end;
begin
Writeln('Recursion Level is ', Recursive(0));
Writeln('Press any key to Exit');
Readln;
end.
| using System;
class RecursionLimit
{
static void Main(string[] args)
{
Recur(0);
}
private static void Recur(int i)
{
Console.WriteLine(i);
Recur(i + 1);
}
}
|
Preserve the algorithm and functionality while converting the code from Delphi to C++. | program Project2;
uses
SysUtils;
function Recursive(Level : Integer) : Integer;
begin
try
Level := Level + 1;
Result := Recursive(Level);
except
on E: EStackOverflow do
Result := Level;
end;
end;
begin
Writeln('Recursion Level is ', Recursive(0));
Writeln('Press any key to Exit');
Readln;
end.
| #include <iostream>
void recurse(unsigned int i)
{
std::cout<<i<<"\n";
recurse(i+1);
}
int main()
{
recurse(0);
}
|
Convert this Delphi block to C++, preserving its control flow and logic. | program Project2;
uses
SysUtils;
function Recursive(Level : Integer) : Integer;
begin
try
Level := Level + 1;
Result := Recursive(Level);
except
on E: EStackOverflow do
Result := Level;
end;
end;
begin
Writeln('Recursion Level is ', Recursive(0));
Writeln('Press any key to Exit');
Readln;
end.
| #include <iostream>
void recurse(unsigned int i)
{
std::cout<<i<<"\n";
recurse(i+1);
}
int main()
{
recurse(0);
}
|
Convert this Delphi block to Java, preserving its control flow and logic. | program Project2;
uses
SysUtils;
function Recursive(Level : Integer) : Integer;
begin
try
Level := Level + 1;
Result := Recursive(Level);
except
on E: EStackOverflow do
Result := Level;
end;
end;
begin
Writeln('Recursion Level is ', Recursive(0));
Writeln('Press any key to Exit');
Readln;
end.
| public class RecursionTest {
private static void recurse(int i) {
try {
recurse(i+1);
} catch (StackOverflowError e) {
System.out.print("Recursion depth on this system is " + i + ".");
}
}
public static void main(String[] args) {
recurse(0);
}
}
|
Port the following code from Delphi to Java with equivalent syntax and logic. | program Project2;
uses
SysUtils;
function Recursive(Level : Integer) : Integer;
begin
try
Level := Level + 1;
Result := Recursive(Level);
except
on E: EStackOverflow do
Result := Level;
end;
end;
begin
Writeln('Recursion Level is ', Recursive(0));
Writeln('Press any key to Exit');
Readln;
end.
| public class RecursionTest {
private static void recurse(int i) {
try {
recurse(i+1);
} catch (StackOverflowError e) {
System.out.print("Recursion depth on this system is " + i + ".");
}
}
public static void main(String[] args) {
recurse(0);
}
}
|
Write the same algorithm in Python as shown in this Delphi implementation. | program Project2;
uses
SysUtils;
function Recursive(Level : Integer) : Integer;
begin
try
Level := Level + 1;
Result := Recursive(Level);
except
on E: EStackOverflow do
Result := Level;
end;
end;
begin
Writeln('Recursion Level is ', Recursive(0));
Writeln('Press any key to Exit');
Readln;
end.
| import sys
print(sys.getrecursionlimit())
|
Ensure the translated Python code behaves exactly like the original Delphi snippet. | program Project2;
uses
SysUtils;
function Recursive(Level : Integer) : Integer;
begin
try
Level := Level + 1;
Result := Recursive(Level);
except
on E: EStackOverflow do
Result := Level;
end;
end;
begin
Writeln('Recursion Level is ', Recursive(0));
Writeln('Press any key to Exit');
Readln;
end.
| import sys
print(sys.getrecursionlimit())
|
Write the same algorithm in VB as shown in this Delphi implementation. | program Project2;
uses
SysUtils;
function Recursive(Level : Integer) : Integer;
begin
try
Level := Level + 1;
Result := Recursive(Level);
except
on E: EStackOverflow do
Result := Level;
end;
end;
begin
Writeln('Recursion Level is ', Recursive(0));
Writeln('Press any key to Exit');
Readln;
end.
| Option Explicit
Sub Main()
Debug.Print "The limit is : " & Limite_Recursivite(0)
End Sub
Function Limite_Recursivite(Cpt As Long) As Long
Cpt = Cpt + 1
On Error Resume Next
Limite_Recursivite Cpt
On Error GoTo 0
Limite_Recursivite = Cpt
End Function
|
Write the same code in VB as shown below in Delphi. | program Project2;
uses
SysUtils;
function Recursive(Level : Integer) : Integer;
begin
try
Level := Level + 1;
Result := Recursive(Level);
except
on E: EStackOverflow do
Result := Level;
end;
end;
begin
Writeln('Recursion Level is ', Recursive(0));
Writeln('Press any key to Exit');
Readln;
end.
| Option Explicit
Sub Main()
Debug.Print "The limit is : " & Limite_Recursivite(0)
End Sub
Function Limite_Recursivite(Cpt As Long) As Long
Cpt = Cpt + 1
On Error Resume Next
Limite_Recursivite Cpt
On Error GoTo 0
Limite_Recursivite = Cpt
End Function
|
Generate a Go translation of this Delphi snippet without changing its computational steps. | program Project2;
uses
SysUtils;
function Recursive(Level : Integer) : Integer;
begin
try
Level := Level + 1;
Result := Recursive(Level);
except
on E: EStackOverflow do
Result := Level;
end;
end;
begin
Writeln('Recursion Level is ', Recursive(0));
Writeln('Press any key to Exit');
Readln;
end.
| package main
import (
"flag"
"fmt"
"runtime/debug"
)
func main() {
stack := flag.Int("stack", 0, "maximum per goroutine stack size or 0 for the default")
flag.Parse()
if *stack > 0 {
debug.SetMaxStack(*stack)
}
r(1)
}
func r(l int) {
if l%1000 == 0 {
fmt.Println(l)
}
r(l + 1)
}
|
Can you help me rewrite this code in Go instead of Delphi, keeping it the same logically? | program Project2;
uses
SysUtils;
function Recursive(Level : Integer) : Integer;
begin
try
Level := Level + 1;
Result := Recursive(Level);
except
on E: EStackOverflow do
Result := Level;
end;
end;
begin
Writeln('Recursion Level is ', Recursive(0));
Writeln('Press any key to Exit');
Readln;
end.
| package main
import (
"flag"
"fmt"
"runtime/debug"
)
func main() {
stack := flag.Int("stack", 0, "maximum per goroutine stack size or 0 for the default")
flag.Parse()
if *stack > 0 {
debug.SetMaxStack(*stack)
}
r(1)
}
func r(l int) {
if l%1000 == 0 {
fmt.Println(l)
}
r(l + 1)
}
|
Translate the given F# code snippet into C without altering its behavior. | let rec recurse n =
recurse (n+1)
recurse 0
| #include <stdio.h>
void recurse(unsigned int i)
{
printf("%d\n", i);
recurse(i+1);
}
int main()
{
recurse(0);
return 0;
}
|
Translate this program into C but keep the logic exactly as in F#. | let rec recurse n =
recurse (n+1)
recurse 0
| #include <stdio.h>
void recurse(unsigned int i)
{
printf("%d\n", i);
recurse(i+1);
}
int main()
{
recurse(0);
return 0;
}
|
Translate the given F# code snippet into C# without altering its behavior. | let rec recurse n =
recurse (n+1)
recurse 0
| using System;
class RecursionLimit
{
static void Main(string[] args)
{
Recur(0);
}
private static void Recur(int i)
{
Console.WriteLine(i);
Recur(i + 1);
}
}
|
Rewrite the snippet below in C# so it works the same as the original F# code. | let rec recurse n =
recurse (n+1)
recurse 0
| using System;
class RecursionLimit
{
static void Main(string[] args)
{
Recur(0);
}
private static void Recur(int i)
{
Console.WriteLine(i);
Recur(i + 1);
}
}
|
Rewrite this program in C++ while keeping its functionality equivalent to the F# version. | let rec recurse n =
recurse (n+1)
recurse 0
| #include <iostream>
void recurse(unsigned int i)
{
std::cout<<i<<"\n";
recurse(i+1);
}
int main()
{
recurse(0);
}
|
Ensure the translated C++ code behaves exactly like the original F# snippet. | let rec recurse n =
recurse (n+1)
recurse 0
| #include <iostream>
void recurse(unsigned int i)
{
std::cout<<i<<"\n";
recurse(i+1);
}
int main()
{
recurse(0);
}
|
Port the provided F# code into Java while preserving the original functionality. | let rec recurse n =
recurse (n+1)
recurse 0
| public class RecursionTest {
private static void recurse(int i) {
try {
recurse(i+1);
} catch (StackOverflowError e) {
System.out.print("Recursion depth on this system is " + i + ".");
}
}
public static void main(String[] args) {
recurse(0);
}
}
|
Produce a language-to-language conversion: from F# to Java, same semantics. | let rec recurse n =
recurse (n+1)
recurse 0
| public class RecursionTest {
private static void recurse(int i) {
try {
recurse(i+1);
} catch (StackOverflowError e) {
System.out.print("Recursion depth on this system is " + i + ".");
}
}
public static void main(String[] args) {
recurse(0);
}
}
|
Preserve the algorithm and functionality while converting the code from F# to VB. | let rec recurse n =
recurse (n+1)
recurse 0
| Option Explicit
Sub Main()
Debug.Print "The limit is : " & Limite_Recursivite(0)
End Sub
Function Limite_Recursivite(Cpt As Long) As Long
Cpt = Cpt + 1
On Error Resume Next
Limite_Recursivite Cpt
On Error GoTo 0
Limite_Recursivite = Cpt
End Function
|
Write the same algorithm in VB as shown in this F# implementation. | let rec recurse n =
recurse (n+1)
recurse 0
| Option Explicit
Sub Main()
Debug.Print "The limit is : " & Limite_Recursivite(0)
End Sub
Function Limite_Recursivite(Cpt As Long) As Long
Cpt = Cpt + 1
On Error Resume Next
Limite_Recursivite Cpt
On Error GoTo 0
Limite_Recursivite = Cpt
End Function
|
Write the same algorithm in Go as shown in this F# implementation. | let rec recurse n =
recurse (n+1)
recurse 0
| package main
import (
"flag"
"fmt"
"runtime/debug"
)
func main() {
stack := flag.Int("stack", 0, "maximum per goroutine stack size or 0 for the default")
flag.Parse()
if *stack > 0 {
debug.SetMaxStack(*stack)
}
r(1)
}
func r(l int) {
if l%1000 == 0 {
fmt.Println(l)
}
r(l + 1)
}
|
Port the following code from F# to Go with equivalent syntax and logic. | let rec recurse n =
recurse (n+1)
recurse 0
| package main
import (
"flag"
"fmt"
"runtime/debug"
)
func main() {
stack := flag.Int("stack", 0, "maximum per goroutine stack size or 0 for the default")
flag.Parse()
if *stack > 0 {
debug.SetMaxStack(*stack)
}
r(1)
}
func r(l int) {
if l%1000 == 0 {
fmt.Println(l)
}
r(l + 1)
}
|
Preserve the algorithm and functionality while converting the code from Factor to C. | : recurse ( n -- n ) 1 + recurse ;
0 recurse
| #include <stdio.h>
void recurse(unsigned int i)
{
printf("%d\n", i);
recurse(i+1);
}
int main()
{
recurse(0);
return 0;
}
|
Change the following Factor code into C without altering its purpose. | : recurse ( n -- n ) 1 + recurse ;
0 recurse
| #include <stdio.h>
void recurse(unsigned int i)
{
printf("%d\n", i);
recurse(i+1);
}
int main()
{
recurse(0);
return 0;
}
|
Please provide an equivalent version of this Factor code in C#. | : recurse ( n -- n ) 1 + recurse ;
0 recurse
| using System;
class RecursionLimit
{
static void Main(string[] args)
{
Recur(0);
}
private static void Recur(int i)
{
Console.WriteLine(i);
Recur(i + 1);
}
}
|
Port the following code from Factor to C# with equivalent syntax and logic. | : recurse ( n -- n ) 1 + recurse ;
0 recurse
| using System;
class RecursionLimit
{
static void Main(string[] args)
{
Recur(0);
}
private static void Recur(int i)
{
Console.WriteLine(i);
Recur(i + 1);
}
}
|
Can you help me rewrite this code in C++ instead of Factor, keeping it the same logically? | : recurse ( n -- n ) 1 + recurse ;
0 recurse
| #include <iostream>
void recurse(unsigned int i)
{
std::cout<<i<<"\n";
recurse(i+1);
}
int main()
{
recurse(0);
}
|
Change the programming language of this snippet from Factor to C++ without modifying what it does. | : recurse ( n -- n ) 1 + recurse ;
0 recurse
| #include <iostream>
void recurse(unsigned int i)
{
std::cout<<i<<"\n";
recurse(i+1);
}
int main()
{
recurse(0);
}
|
Change the following Factor code into Java without altering its purpose. | : recurse ( n -- n ) 1 + recurse ;
0 recurse
| public class RecursionTest {
private static void recurse(int i) {
try {
recurse(i+1);
} catch (StackOverflowError e) {
System.out.print("Recursion depth on this system is " + i + ".");
}
}
public static void main(String[] args) {
recurse(0);
}
}
|
Ensure the translated Java code behaves exactly like the original Factor snippet. | : recurse ( n -- n ) 1 + recurse ;
0 recurse
| public class RecursionTest {
private static void recurse(int i) {
try {
recurse(i+1);
} catch (StackOverflowError e) {
System.out.print("Recursion depth on this system is " + i + ".");
}
}
public static void main(String[] args) {
recurse(0);
}
}
|
Port the following code from Factor to VB with equivalent syntax and logic. | : recurse ( n -- n ) 1 + recurse ;
0 recurse
| Option Explicit
Sub Main()
Debug.Print "The limit is : " & Limite_Recursivite(0)
End Sub
Function Limite_Recursivite(Cpt As Long) As Long
Cpt = Cpt + 1
On Error Resume Next
Limite_Recursivite Cpt
On Error GoTo 0
Limite_Recursivite = Cpt
End Function
|
Port the provided Factor code into VB while preserving the original functionality. | : recurse ( n -- n ) 1 + recurse ;
0 recurse
| Option Explicit
Sub Main()
Debug.Print "The limit is : " & Limite_Recursivite(0)
End Sub
Function Limite_Recursivite(Cpt As Long) As Long
Cpt = Cpt + 1
On Error Resume Next
Limite_Recursivite Cpt
On Error GoTo 0
Limite_Recursivite = Cpt
End Function
|
Convert this Factor snippet to Go and keep its semantics consistent. | : recurse ( n -- n ) 1 + recurse ;
0 recurse
| package main
import (
"flag"
"fmt"
"runtime/debug"
)
func main() {
stack := flag.Int("stack", 0, "maximum per goroutine stack size or 0 for the default")
flag.Parse()
if *stack > 0 {
debug.SetMaxStack(*stack)
}
r(1)
}
func r(l int) {
if l%1000 == 0 {
fmt.Println(l)
}
r(l + 1)
}
|
Please provide an equivalent version of this Factor code in Go. | : recurse ( n -- n ) 1 + recurse ;
0 recurse
| package main
import (
"flag"
"fmt"
"runtime/debug"
)
func main() {
stack := flag.Int("stack", 0, "maximum per goroutine stack size or 0 for the default")
flag.Parse()
if *stack > 0 {
debug.SetMaxStack(*stack)
}
r(1)
}
func r(l int) {
if l%1000 == 0 {
fmt.Println(l)
}
r(l + 1)
}
|
Translate the given Forth code snippet into C without altering its behavior. | : munge 1+ recurse ;
: test 0 ['] munge catch if ." Recursion limit at depth " . then ;
test
| #include <stdio.h>
void recurse(unsigned int i)
{
printf("%d\n", i);
recurse(i+1);
}
int main()
{
recurse(0);
return 0;
}
|
Convert the following code from Forth to C, ensuring the logic remains intact. | : munge 1+ recurse ;
: test 0 ['] munge catch if ." Recursion limit at depth " . then ;
test
| #include <stdio.h>
void recurse(unsigned int i)
{
printf("%d\n", i);
recurse(i+1);
}
int main()
{
recurse(0);
return 0;
}
|
Transform the following Forth implementation into C#, maintaining the same output and logic. | : munge 1+ recurse ;
: test 0 ['] munge catch if ." Recursion limit at depth " . then ;
test
| using System;
class RecursionLimit
{
static void Main(string[] args)
{
Recur(0);
}
private static void Recur(int i)
{
Console.WriteLine(i);
Recur(i + 1);
}
}
|
Write the same algorithm in C# as shown in this Forth implementation. | : munge 1+ recurse ;
: test 0 ['] munge catch if ." Recursion limit at depth " . then ;
test
| using System;
class RecursionLimit
{
static void Main(string[] args)
{
Recur(0);
}
private static void Recur(int i)
{
Console.WriteLine(i);
Recur(i + 1);
}
}
|
Write the same algorithm in C++ as shown in this Forth implementation. | : munge 1+ recurse ;
: test 0 ['] munge catch if ." Recursion limit at depth " . then ;
test
| #include <iostream>
void recurse(unsigned int i)
{
std::cout<<i<<"\n";
recurse(i+1);
}
int main()
{
recurse(0);
}
|
Generate a C++ translation of this Forth snippet without changing its computational steps. | : munge 1+ recurse ;
: test 0 ['] munge catch if ." Recursion limit at depth " . then ;
test
| #include <iostream>
void recurse(unsigned int i)
{
std::cout<<i<<"\n";
recurse(i+1);
}
int main()
{
recurse(0);
}
|
Produce a functionally identical Java code for the snippet given in Forth. | : munge 1+ recurse ;
: test 0 ['] munge catch if ." Recursion limit at depth " . then ;
test
| public class RecursionTest {
private static void recurse(int i) {
try {
recurse(i+1);
} catch (StackOverflowError e) {
System.out.print("Recursion depth on this system is " + i + ".");
}
}
public static void main(String[] args) {
recurse(0);
}
}
|
Convert this Forth snippet to Java and keep its semantics consistent. | : munge 1+ recurse ;
: test 0 ['] munge catch if ." Recursion limit at depth " . then ;
test
| public class RecursionTest {
private static void recurse(int i) {
try {
recurse(i+1);
} catch (StackOverflowError e) {
System.out.print("Recursion depth on this system is " + i + ".");
}
}
public static void main(String[] args) {
recurse(0);
}
}
|
Port the following code from Forth to Python with equivalent syntax and logic. | : munge 1+ recurse ;
: test 0 ['] munge catch if ." Recursion limit at depth " . then ;
test
| import sys
print(sys.getrecursionlimit())
|
Preserve the algorithm and functionality while converting the code from Forth to Python. | : munge 1+ recurse ;
: test 0 ['] munge catch if ." Recursion limit at depth " . then ;
test
| import sys
print(sys.getrecursionlimit())
|
Change the following Forth code into VB without altering its purpose. | : munge 1+ recurse ;
: test 0 ['] munge catch if ." Recursion limit at depth " . then ;
test
| Option Explicit
Sub Main()
Debug.Print "The limit is : " & Limite_Recursivite(0)
End Sub
Function Limite_Recursivite(Cpt As Long) As Long
Cpt = Cpt + 1
On Error Resume Next
Limite_Recursivite Cpt
On Error GoTo 0
Limite_Recursivite = Cpt
End Function
|
Generate a Go translation of this Forth snippet without changing its computational steps. | : munge 1+ recurse ;
: test 0 ['] munge catch if ." Recursion limit at depth " . then ;
test
| package main
import (
"flag"
"fmt"
"runtime/debug"
)
func main() {
stack := flag.Int("stack", 0, "maximum per goroutine stack size or 0 for the default")
flag.Parse()
if *stack > 0 {
debug.SetMaxStack(*stack)
}
r(1)
}
func r(l int) {
if l%1000 == 0 {
fmt.Println(l)
}
r(l + 1)
}
|
Port the following code from Forth to Go with equivalent syntax and logic. | : munge 1+ recurse ;
: test 0 ['] munge catch if ." Recursion limit at depth " . then ;
test
| package main
import (
"flag"
"fmt"
"runtime/debug"
)
func main() {
stack := flag.Int("stack", 0, "maximum per goroutine stack size or 0 for the default")
flag.Parse()
if *stack > 0 {
debug.SetMaxStack(*stack)
}
r(1)
}
func r(l int) {
if l%1000 == 0 {
fmt.Println(l)
}
r(l + 1)
}
|
Rewrite the snippet below in C# so it works the same as the original Fortran code. | program recursion_depth
implicit none
call recurse (1)
contains
recursive subroutine recurse (i)
implicit none
integer, intent (in) :: i
write (*, '(i0)') i
call recurse (i + 1)
end subroutine recurse
end program recursion_depth
| using System;
class RecursionLimit
{
static void Main(string[] args)
{
Recur(0);
}
private static void Recur(int i)
{
Console.WriteLine(i);
Recur(i + 1);
}
}
|
Produce a functionally identical C# code for the snippet given in Fortran. | program recursion_depth
implicit none
call recurse (1)
contains
recursive subroutine recurse (i)
implicit none
integer, intent (in) :: i
write (*, '(i0)') i
call recurse (i + 1)
end subroutine recurse
end program recursion_depth
| using System;
class RecursionLimit
{
static void Main(string[] args)
{
Recur(0);
}
private static void Recur(int i)
{
Console.WriteLine(i);
Recur(i + 1);
}
}
|
Produce a language-to-language conversion: from Fortran to C++, same semantics. | program recursion_depth
implicit none
call recurse (1)
contains
recursive subroutine recurse (i)
implicit none
integer, intent (in) :: i
write (*, '(i0)') i
call recurse (i + 1)
end subroutine recurse
end program recursion_depth
| #include <iostream>
void recurse(unsigned int i)
{
std::cout<<i<<"\n";
recurse(i+1);
}
int main()
{
recurse(0);
}
|
Please provide an equivalent version of this Fortran code in C++. | program recursion_depth
implicit none
call recurse (1)
contains
recursive subroutine recurse (i)
implicit none
integer, intent (in) :: i
write (*, '(i0)') i
call recurse (i + 1)
end subroutine recurse
end program recursion_depth
| #include <iostream>
void recurse(unsigned int i)
{
std::cout<<i<<"\n";
recurse(i+1);
}
int main()
{
recurse(0);
}
|
Ensure the translated C code behaves exactly like the original Fortran snippet. | program recursion_depth
implicit none
call recurse (1)
contains
recursive subroutine recurse (i)
implicit none
integer, intent (in) :: i
write (*, '(i0)') i
call recurse (i + 1)
end subroutine recurse
end program recursion_depth
| #include <stdio.h>
void recurse(unsigned int i)
{
printf("%d\n", i);
recurse(i+1);
}
int main()
{
recurse(0);
return 0;
}
|
Generate an equivalent C version of this Fortran code. | program recursion_depth
implicit none
call recurse (1)
contains
recursive subroutine recurse (i)
implicit none
integer, intent (in) :: i
write (*, '(i0)') i
call recurse (i + 1)
end subroutine recurse
end program recursion_depth
| #include <stdio.h>
void recurse(unsigned int i)
{
printf("%d\n", i);
recurse(i+1);
}
int main()
{
recurse(0);
return 0;
}
|
Keep all operations the same but rewrite the snippet in Java. | program recursion_depth
implicit none
call recurse (1)
contains
recursive subroutine recurse (i)
implicit none
integer, intent (in) :: i
write (*, '(i0)') i
call recurse (i + 1)
end subroutine recurse
end program recursion_depth
| public class RecursionTest {
private static void recurse(int i) {
try {
recurse(i+1);
} catch (StackOverflowError e) {
System.out.print("Recursion depth on this system is " + i + ".");
}
}
public static void main(String[] args) {
recurse(0);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.