Instruction
stringlengths
45
106
input_code
stringlengths
1
13.7k
output_code
stringlengths
1
13.7k
Change the programming language of this snippet from Clojure to C# without modifying what it does.
(import '(javax.swing JFrame)) (let [frame (JFrame. "A Window")] (doto frame (.setSize 600 800) (.setVisible true)))
using System; using System.Windows.Forms; public class Window { [STAThread] static void Main() { Form form = new Form(); form.Text = "Window"; form.Disposed += delegate { Application.Exit(); }; form.Show(); Application.Run(); } }
Maintain the same structure and functionality when rewriting this code in C++.
(import '(javax.swing JFrame)) (let [frame (JFrame. "A Window")] (doto frame (.setSize 600 800) (.setVisible true)))
#include <QApplication> #include <QMainWindow> int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow window; window.show(); return app.exec(); }
Write a version of this Clojure function in Java with identical behavior.
(import '(javax.swing JFrame)) (let [frame (JFrame. "A Window")] (doto frame (.setSize 600 800) (.setVisible true)))
import javax.swing.JFrame; public class Main { public static void main(String[] args) throws Exception { JFrame w = new JFrame("Title"); w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); w.setSize(800,600); w.setVisible(true); } }
Keep all operations the same but rewrite the snippet in Python.
(import '(javax.swing JFrame)) (let [frame (JFrame. "A Window")] (doto frame (.setSize 600 800) (.setVisible true)))
import Tkinter w = Tkinter.Tk() w.mainloop()
Generate a VB translation of this Clojure snippet without changing its computational steps.
(import '(javax.swing JFrame)) (let [frame (JFrame. "A Window")] (doto frame (.setSize 600 800) (.setVisible true)))
Option Explicit Sub InsertForm() Dim myForm As Object, strname As String Set myForm = ThisWorkbook.VBProject.VBComponents.Add(3) strname = myForm.Name VBA.UserForms.Add(strname).Show End Sub
Transform the following Clojure implementation into Go, maintaining the same output and logic.
(import '(javax.swing JFrame)) (let [frame (JFrame. "A Window")] (doto frame (.setSize 600 800) (.setVisible true)))
package main import ( "github.com/mattn/go-gtk/glib" "github.com/mattn/go-gtk/gtk" ) func main() { gtk.Init(nil) window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL) window.Connect("destroy", func(*glib.CallbackContext) { gtk.MainQuit() }, "") window.Show() gtk.Main() }
Generate a C translation of this Common_Lisp snippet without changing its computational steps.
(capi:display (make-instance 'capi:interface :title "A Window"))
#include <stdio.h> #include <stdlib.h> #include "SDL.h" int main() { SDL_Surface *screen; if (SDL_Init(SDL_INIT_VIDEO) != 0) { fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError()); return 1; } atexit(SDL_Quit); screen = SDL_SetVideoMode( 800, 600, 16, SDL_SWSURFACE | SDL_HWPALETTE ); return 0; }
Produce a functionally identical C# code for the snippet given in Common_Lisp.
(capi:display (make-instance 'capi:interface :title "A Window"))
using System; using System.Windows.Forms; public class Window { [STAThread] static void Main() { Form form = new Form(); form.Text = "Window"; form.Disposed += delegate { Application.Exit(); }; form.Show(); Application.Run(); } }
Preserve the algorithm and functionality while converting the code from Common_Lisp to C++.
(capi:display (make-instance 'capi:interface :title "A Window"))
#include <QApplication> #include <QMainWindow> int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow window; window.show(); return app.exec(); }
Write a version of this Common_Lisp function in Java with identical behavior.
(capi:display (make-instance 'capi:interface :title "A Window"))
import javax.swing.JFrame; public class Main { public static void main(String[] args) throws Exception { JFrame w = new JFrame("Title"); w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); w.setSize(800,600); w.setVisible(true); } }
Please provide an equivalent version of this Common_Lisp code in Python.
(capi:display (make-instance 'capi:interface :title "A Window"))
import Tkinter w = Tkinter.Tk() w.mainloop()
Port the provided Common_Lisp code into VB while preserving the original functionality.
(capi:display (make-instance 'capi:interface :title "A Window"))
Option Explicit Sub InsertForm() Dim myForm As Object, strname As String Set myForm = ThisWorkbook.VBProject.VBComponents.Add(3) strname = myForm.Name VBA.UserForms.Add(strname).Show End Sub
Preserve the algorithm and functionality while converting the code from Common_Lisp to Go.
(capi:display (make-instance 'capi:interface :title "A Window"))
package main import ( "github.com/mattn/go-gtk/glib" "github.com/mattn/go-gtk/gtk" ) func main() { gtk.Init(nil) window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL) window.Connect("destroy", func(*glib.CallbackContext) { gtk.MainQuit() }, "") window.Show() gtk.Main() }
Rewrite the snippet below in C so it works the same as the original D code.
module Window; import fltk4d.all; void main() { auto window = new Window(300, 300, "A window"); window.show; FLTK.run; }
#include <stdio.h> #include <stdlib.h> #include "SDL.h" int main() { SDL_Surface *screen; if (SDL_Init(SDL_INIT_VIDEO) != 0) { fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError()); return 1; } atexit(SDL_Quit); screen = SDL_SetVideoMode( 800, 600, 16, SDL_SWSURFACE | SDL_HWPALETTE ); return 0; }
Keep all operations the same but rewrite the snippet in C#.
module Window; import fltk4d.all; void main() { auto window = new Window(300, 300, "A window"); window.show; FLTK.run; }
using System; using System.Windows.Forms; public class Window { [STAThread] static void Main() { Form form = new Form(); form.Text = "Window"; form.Disposed += delegate { Application.Exit(); }; form.Show(); Application.Run(); } }
Convert this D snippet to C++ and keep its semantics consistent.
module Window; import fltk4d.all; void main() { auto window = new Window(300, 300, "A window"); window.show; FLTK.run; }
#include <QApplication> #include <QMainWindow> int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow window; window.show(); return app.exec(); }
Ensure the translated Java code behaves exactly like the original D snippet.
module Window; import fltk4d.all; void main() { auto window = new Window(300, 300, "A window"); window.show; FLTK.run; }
import javax.swing.JFrame; public class Main { public static void main(String[] args) throws Exception { JFrame w = new JFrame("Title"); w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); w.setSize(800,600); w.setVisible(true); } }
Maintain the same structure and functionality when rewriting this code in Python.
module Window; import fltk4d.all; void main() { auto window = new Window(300, 300, "A window"); window.show; FLTK.run; }
import Tkinter w = Tkinter.Tk() w.mainloop()
Convert the following code from D to VB, ensuring the logic remains intact.
module Window; import fltk4d.all; void main() { auto window = new Window(300, 300, "A window"); window.show; FLTK.run; }
Option Explicit Sub InsertForm() Dim myForm As Object, strname As String Set myForm = ThisWorkbook.VBProject.VBComponents.Add(3) strname = myForm.Name VBA.UserForms.Add(strname).Show End Sub
Port the provided D code into Go while preserving the original functionality.
module Window; import fltk4d.all; void main() { auto window = new Window(300, 300, "A window"); window.show; FLTK.run; }
package main import ( "github.com/mattn/go-gtk/glib" "github.com/mattn/go-gtk/gtk" ) func main() { gtk.Init(nil) window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL) window.Connect("destroy", func(*glib.CallbackContext) { gtk.MainQuit() }, "") window.Show() gtk.Main() }
Generate an equivalent C version of this Delphi code.
program Project1; uses Forms, Unit0 in 'Unit1.pas' ; begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end. unit Unit1; interface uses Forms; type TForm1 = class(TForm) end; var Form1: TForm1; implementation end. object Form1: TForm1 Left = 469 Top = 142 Width = 800 Height = 600 Caption = 'Form1' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Shell Dlg 2' Font.Style = [] OldCreateOrder = False Position = poScreenCenter PixelsPerInch = 96 TextHeight = 13 end
#include <stdio.h> #include <stdlib.h> #include "SDL.h" int main() { SDL_Surface *screen; if (SDL_Init(SDL_INIT_VIDEO) != 0) { fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError()); return 1; } atexit(SDL_Quit); screen = SDL_SetVideoMode( 800, 600, 16, SDL_SWSURFACE | SDL_HWPALETTE ); return 0; }
Port the provided Delphi code into C# while preserving the original functionality.
program Project1; uses Forms, Unit0 in 'Unit1.pas' ; begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end. unit Unit1; interface uses Forms; type TForm1 = class(TForm) end; var Form1: TForm1; implementation end. object Form1: TForm1 Left = 469 Top = 142 Width = 800 Height = 600 Caption = 'Form1' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Shell Dlg 2' Font.Style = [] OldCreateOrder = False Position = poScreenCenter PixelsPerInch = 96 TextHeight = 13 end
using System; using System.Windows.Forms; public class Window { [STAThread] static void Main() { Form form = new Form(); form.Text = "Window"; form.Disposed += delegate { Application.Exit(); }; form.Show(); Application.Run(); } }
Generate an equivalent C++ version of this Delphi code.
program Project1; uses Forms, Unit0 in 'Unit1.pas' ; begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end. unit Unit1; interface uses Forms; type TForm1 = class(TForm) end; var Form1: TForm1; implementation end. object Form1: TForm1 Left = 469 Top = 142 Width = 800 Height = 600 Caption = 'Form1' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Shell Dlg 2' Font.Style = [] OldCreateOrder = False Position = poScreenCenter PixelsPerInch = 96 TextHeight = 13 end
#include <QApplication> #include <QMainWindow> int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow window; window.show(); return app.exec(); }
Generate a Java translation of this Delphi snippet without changing its computational steps.
program Project1; uses Forms, Unit0 in 'Unit1.pas' ; begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end. unit Unit1; interface uses Forms; type TForm1 = class(TForm) end; var Form1: TForm1; implementation end. object Form1: TForm1 Left = 469 Top = 142 Width = 800 Height = 600 Caption = 'Form1' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Shell Dlg 2' Font.Style = [] OldCreateOrder = False Position = poScreenCenter PixelsPerInch = 96 TextHeight = 13 end
import javax.swing.JFrame; public class Main { public static void main(String[] args) throws Exception { JFrame w = new JFrame("Title"); w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); w.setSize(800,600); w.setVisible(true); } }
Convert the following code from Delphi to Python, ensuring the logic remains intact.
program Project1; uses Forms, Unit0 in 'Unit1.pas' ; begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end. unit Unit1; interface uses Forms; type TForm1 = class(TForm) end; var Form1: TForm1; implementation end. object Form1: TForm1 Left = 469 Top = 142 Width = 800 Height = 600 Caption = 'Form1' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Shell Dlg 2' Font.Style = [] OldCreateOrder = False Position = poScreenCenter PixelsPerInch = 96 TextHeight = 13 end
import Tkinter w = Tkinter.Tk() w.mainloop()
Maintain the same structure and functionality when rewriting this code in VB.
program Project1; uses Forms, Unit0 in 'Unit1.pas' ; begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end. unit Unit1; interface uses Forms; type TForm1 = class(TForm) end; var Form1: TForm1; implementation end. object Form1: TForm1 Left = 469 Top = 142 Width = 800 Height = 600 Caption = 'Form1' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Shell Dlg 2' Font.Style = [] OldCreateOrder = False Position = poScreenCenter PixelsPerInch = 96 TextHeight = 13 end
Option Explicit Sub InsertForm() Dim myForm As Object, strname As String Set myForm = ThisWorkbook.VBProject.VBComponents.Add(3) strname = myForm.Name VBA.UserForms.Add(strname).Show End Sub
Change the programming language of this snippet from Delphi to Go without modifying what it does.
program Project1; uses Forms, Unit0 in 'Unit1.pas' ; begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end. unit Unit1; interface uses Forms; type TForm1 = class(TForm) end; var Form1: TForm1; implementation end. object Form1: TForm1 Left = 469 Top = 142 Width = 800 Height = 600 Caption = 'Form1' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Shell Dlg 2' Font.Style = [] OldCreateOrder = False Position = poScreenCenter PixelsPerInch = 96 TextHeight = 13 end
package main import ( "github.com/mattn/go-gtk/glib" "github.com/mattn/go-gtk/gtk" ) func main() { gtk.Init(nil) window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL) window.Connect("destroy", func(*glib.CallbackContext) { gtk.MainQuit() }, "") window.Show() gtk.Main() }
Keep all operations the same but rewrite the snippet in C.
open System.Windows.Forms [<System.STAThread>] do Form(Text = "F# Window") |> Application.Run
#include <stdio.h> #include <stdlib.h> #include "SDL.h" int main() { SDL_Surface *screen; if (SDL_Init(SDL_INIT_VIDEO) != 0) { fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError()); return 1; } atexit(SDL_Quit); screen = SDL_SetVideoMode( 800, 600, 16, SDL_SWSURFACE | SDL_HWPALETTE ); return 0; }
Please provide an equivalent version of this F# code in C#.
open System.Windows.Forms [<System.STAThread>] do Form(Text = "F# Window") |> Application.Run
using System; using System.Windows.Forms; public class Window { [STAThread] static void Main() { Form form = new Form(); form.Text = "Window"; form.Disposed += delegate { Application.Exit(); }; form.Show(); Application.Run(); } }
Ensure the translated C++ code behaves exactly like the original F# snippet.
open System.Windows.Forms [<System.STAThread>] do Form(Text = "F# Window") |> Application.Run
#include <QApplication> #include <QMainWindow> int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow window; window.show(); return app.exec(); }
Convert the following code from F# to Java, ensuring the logic remains intact.
open System.Windows.Forms [<System.STAThread>] do Form(Text = "F# Window") |> Application.Run
import javax.swing.JFrame; public class Main { public static void main(String[] args) throws Exception { JFrame w = new JFrame("Title"); w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); w.setSize(800,600); w.setVisible(true); } }
Write the same algorithm in Python as shown in this F# implementation.
open System.Windows.Forms [<System.STAThread>] do Form(Text = "F# Window") |> Application.Run
import Tkinter w = Tkinter.Tk() w.mainloop()
Convert the following code from F# to VB, ensuring the logic remains intact.
open System.Windows.Forms [<System.STAThread>] do Form(Text = "F# Window") |> Application.Run
Option Explicit Sub InsertForm() Dim myForm As Object, strname As String Set myForm = ThisWorkbook.VBProject.VBComponents.Add(3) strname = myForm.Name VBA.UserForms.Add(strname).Show End Sub
Keep all operations the same but rewrite the snippet in Go.
open System.Windows.Forms [<System.STAThread>] do Form(Text = "F# Window") |> Application.Run
package main import ( "github.com/mattn/go-gtk/glib" "github.com/mattn/go-gtk/gtk" ) func main() { gtk.Init(nil) window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL) window.Connect("destroy", func(*glib.CallbackContext) { gtk.MainQuit() }, "") window.Show() gtk.Main() }
Keep all operations the same but rewrite the snippet in C.
USING: ui ui.gadgets.labels ; "This is a window..." <label> "Really?" open-window
#include <stdio.h> #include <stdlib.h> #include "SDL.h" int main() { SDL_Surface *screen; if (SDL_Init(SDL_INIT_VIDEO) != 0) { fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError()); return 1; } atexit(SDL_Quit); screen = SDL_SetVideoMode( 800, 600, 16, SDL_SWSURFACE | SDL_HWPALETTE ); return 0; }
Translate the given Factor code snippet into C# without altering its behavior.
USING: ui ui.gadgets.labels ; "This is a window..." <label> "Really?" open-window
using System; using System.Windows.Forms; public class Window { [STAThread] static void Main() { Form form = new Form(); form.Text = "Window"; form.Disposed += delegate { Application.Exit(); }; form.Show(); Application.Run(); } }
Write the same algorithm in C++ as shown in this Factor implementation.
USING: ui ui.gadgets.labels ; "This is a window..." <label> "Really?" open-window
#include <QApplication> #include <QMainWindow> int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow window; window.show(); return app.exec(); }
Translate this program into Java but keep the logic exactly as in Factor.
USING: ui ui.gadgets.labels ; "This is a window..." <label> "Really?" open-window
import javax.swing.JFrame; public class Main { public static void main(String[] args) throws Exception { JFrame w = new JFrame("Title"); w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); w.setSize(800,600); w.setVisible(true); } }
Write the same algorithm in Python as shown in this Factor implementation.
USING: ui ui.gadgets.labels ; "This is a window..." <label> "Really?" open-window
import Tkinter w = Tkinter.Tk() w.mainloop()
Write the same algorithm in VB as shown in this Factor implementation.
USING: ui ui.gadgets.labels ; "This is a window..." <label> "Really?" open-window
Option Explicit Sub InsertForm() Dim myForm As Object, strname As String Set myForm = ThisWorkbook.VBProject.VBComponents.Add(3) strname = myForm.Name VBA.UserForms.Add(strname).Show End Sub
Write the same algorithm in Go as shown in this Factor implementation.
USING: ui ui.gadgets.labels ; "This is a window..." <label> "Really?" open-window
package main import ( "github.com/mattn/go-gtk/glib" "github.com/mattn/go-gtk/gtk" ) func main() { gtk.Init(nil) window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL) window.Connect("destroy", func(*glib.CallbackContext) { gtk.MainQuit() }, "") window.Show() gtk.Main() }
Change the programming language of this snippet from Forth to C without modifying what it does.
include ffl/gsv.fs s" gtk-server.cfg" s" ffl-fifo" gsv+open 0= [IF] : event>widget 0. 2swap >number 2drop d>s ; 0 value window : window-creation gtk_init GTK_WINDOW_TOPLEVEL gtk_window_new to window window gtk_widget_show BEGIN s" WAIT" gtk_server_callback event>widget window = UNTIL 0 gtk_exit ; window-creation gsv+close drop [THEN]
#include <stdio.h> #include <stdlib.h> #include "SDL.h" int main() { SDL_Surface *screen; if (SDL_Init(SDL_INIT_VIDEO) != 0) { fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError()); return 1; } atexit(SDL_Quit); screen = SDL_SetVideoMode( 800, 600, 16, SDL_SWSURFACE | SDL_HWPALETTE ); return 0; }
Port the provided Forth code into C# while preserving the original functionality.
include ffl/gsv.fs s" gtk-server.cfg" s" ffl-fifo" gsv+open 0= [IF] : event>widget 0. 2swap >number 2drop d>s ; 0 value window : window-creation gtk_init GTK_WINDOW_TOPLEVEL gtk_window_new to window window gtk_widget_show BEGIN s" WAIT" gtk_server_callback event>widget window = UNTIL 0 gtk_exit ; window-creation gsv+close drop [THEN]
using System; using System.Windows.Forms; public class Window { [STAThread] static void Main() { Form form = new Form(); form.Text = "Window"; form.Disposed += delegate { Application.Exit(); }; form.Show(); Application.Run(); } }
Keep all operations the same but rewrite the snippet in C++.
include ffl/gsv.fs s" gtk-server.cfg" s" ffl-fifo" gsv+open 0= [IF] : event>widget 0. 2swap >number 2drop d>s ; 0 value window : window-creation gtk_init GTK_WINDOW_TOPLEVEL gtk_window_new to window window gtk_widget_show BEGIN s" WAIT" gtk_server_callback event>widget window = UNTIL 0 gtk_exit ; window-creation gsv+close drop [THEN]
#include <QApplication> #include <QMainWindow> int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow window; window.show(); return app.exec(); }
Ensure the translated Java code behaves exactly like the original Forth snippet.
include ffl/gsv.fs s" gtk-server.cfg" s" ffl-fifo" gsv+open 0= [IF] : event>widget 0. 2swap >number 2drop d>s ; 0 value window : window-creation gtk_init GTK_WINDOW_TOPLEVEL gtk_window_new to window window gtk_widget_show BEGIN s" WAIT" gtk_server_callback event>widget window = UNTIL 0 gtk_exit ; window-creation gsv+close drop [THEN]
import javax.swing.JFrame; public class Main { public static void main(String[] args) throws Exception { JFrame w = new JFrame("Title"); w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); w.setSize(800,600); w.setVisible(true); } }
Generate an equivalent Python version of this Forth code.
include ffl/gsv.fs s" gtk-server.cfg" s" ffl-fifo" gsv+open 0= [IF] : event>widget 0. 2swap >number 2drop d>s ; 0 value window : window-creation gtk_init GTK_WINDOW_TOPLEVEL gtk_window_new to window window gtk_widget_show BEGIN s" WAIT" gtk_server_callback event>widget window = UNTIL 0 gtk_exit ; window-creation gsv+close drop [THEN]
import Tkinter w = Tkinter.Tk() w.mainloop()
Ensure the translated VB code behaves exactly like the original Forth snippet.
include ffl/gsv.fs s" gtk-server.cfg" s" ffl-fifo" gsv+open 0= [IF] : event>widget 0. 2swap >number 2drop d>s ; 0 value window : window-creation gtk_init GTK_WINDOW_TOPLEVEL gtk_window_new to window window gtk_widget_show BEGIN s" WAIT" gtk_server_callback event>widget window = UNTIL 0 gtk_exit ; window-creation gsv+close drop [THEN]
Option Explicit Sub InsertForm() Dim myForm As Object, strname As String Set myForm = ThisWorkbook.VBProject.VBComponents.Add(3) strname = myForm.Name VBA.UserForms.Add(strname).Show End Sub
Preserve the algorithm and functionality while converting the code from Forth to Go.
include ffl/gsv.fs s" gtk-server.cfg" s" ffl-fifo" gsv+open 0= [IF] : event>widget 0. 2swap >number 2drop d>s ; 0 value window : window-creation gtk_init GTK_WINDOW_TOPLEVEL gtk_window_new to window window gtk_widget_show BEGIN s" WAIT" gtk_server_callback event>widget window = UNTIL 0 gtk_exit ; window-creation gsv+close drop [THEN]
package main import ( "github.com/mattn/go-gtk/glib" "github.com/mattn/go-gtk/gtk" ) func main() { gtk.Init(nil) window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL) window.Connect("destroy", func(*glib.CallbackContext) { gtk.MainQuit() }, "") window.Show() gtk.Main() }
Generate an equivalent C version of this Haskell code.
import Graphics.HGL aWindow = runGraphics $ withWindow_ "Rosetta Code task: Creating a window" (300, 200) $ \ w -> do drawInWindow w $ text (100, 100) "Hello World" getKey w
#include <stdio.h> #include <stdlib.h> #include "SDL.h" int main() { SDL_Surface *screen; if (SDL_Init(SDL_INIT_VIDEO) != 0) { fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError()); return 1; } atexit(SDL_Quit); screen = SDL_SetVideoMode( 800, 600, 16, SDL_SWSURFACE | SDL_HWPALETTE ); return 0; }
Write the same algorithm in C# as shown in this Haskell implementation.
import Graphics.HGL aWindow = runGraphics $ withWindow_ "Rosetta Code task: Creating a window" (300, 200) $ \ w -> do drawInWindow w $ text (100, 100) "Hello World" getKey w
using System; using System.Windows.Forms; public class Window { [STAThread] static void Main() { Form form = new Form(); form.Text = "Window"; form.Disposed += delegate { Application.Exit(); }; form.Show(); Application.Run(); } }
Keep all operations the same but rewrite the snippet in C++.
import Graphics.HGL aWindow = runGraphics $ withWindow_ "Rosetta Code task: Creating a window" (300, 200) $ \ w -> do drawInWindow w $ text (100, 100) "Hello World" getKey w
#include <QApplication> #include <QMainWindow> int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow window; window.show(); return app.exec(); }
Transform the following Haskell implementation into Java, maintaining the same output and logic.
import Graphics.HGL aWindow = runGraphics $ withWindow_ "Rosetta Code task: Creating a window" (300, 200) $ \ w -> do drawInWindow w $ text (100, 100) "Hello World" getKey w
import javax.swing.JFrame; public class Main { public static void main(String[] args) throws Exception { JFrame w = new JFrame("Title"); w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); w.setSize(800,600); w.setVisible(true); } }
Translate the given Haskell code snippet into Python without altering its behavior.
import Graphics.HGL aWindow = runGraphics $ withWindow_ "Rosetta Code task: Creating a window" (300, 200) $ \ w -> do drawInWindow w $ text (100, 100) "Hello World" getKey w
import Tkinter w = Tkinter.Tk() w.mainloop()
Produce a language-to-language conversion: from Haskell to VB, same semantics.
import Graphics.HGL aWindow = runGraphics $ withWindow_ "Rosetta Code task: Creating a window" (300, 200) $ \ w -> do drawInWindow w $ text (100, 100) "Hello World" getKey w
Option Explicit Sub InsertForm() Dim myForm As Object, strname As String Set myForm = ThisWorkbook.VBProject.VBComponents.Add(3) strname = myForm.Name VBA.UserForms.Add(strname).Show End Sub
Maintain the same structure and functionality when rewriting this code in Go.
import Graphics.HGL aWindow = runGraphics $ withWindow_ "Rosetta Code task: Creating a window" (300, 200) $ \ w -> do drawInWindow w $ text (100, 100) "Hello World" getKey w
package main import ( "github.com/mattn/go-gtk/glib" "github.com/mattn/go-gtk/gtk" ) func main() { gtk.Init(nil) window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL) window.Connect("destroy", func(*glib.CallbackContext) { gtk.MainQuit() }, "") window.Show() gtk.Main() }
Produce a functionally identical C code for the snippet given in Icon.
link graphics procedure main(arglist) WOpen("size=300, 300", "fg=blue", "bg=light gray") WDone() end
#include <stdio.h> #include <stdlib.h> #include "SDL.h" int main() { SDL_Surface *screen; if (SDL_Init(SDL_INIT_VIDEO) != 0) { fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError()); return 1; } atexit(SDL_Quit); screen = SDL_SetVideoMode( 800, 600, 16, SDL_SWSURFACE | SDL_HWPALETTE ); return 0; }
Translate this program into C# but keep the logic exactly as in Icon.
link graphics procedure main(arglist) WOpen("size=300, 300", "fg=blue", "bg=light gray") WDone() end
using System; using System.Windows.Forms; public class Window { [STAThread] static void Main() { Form form = new Form(); form.Text = "Window"; form.Disposed += delegate { Application.Exit(); }; form.Show(); Application.Run(); } }
Keep all operations the same but rewrite the snippet in C++.
link graphics procedure main(arglist) WOpen("size=300, 300", "fg=blue", "bg=light gray") WDone() end
#include <QApplication> #include <QMainWindow> int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow window; window.show(); return app.exec(); }
Write the same code in Java as shown below in Icon.
link graphics procedure main(arglist) WOpen("size=300, 300", "fg=blue", "bg=light gray") WDone() end
import javax.swing.JFrame; public class Main { public static void main(String[] args) throws Exception { JFrame w = new JFrame("Title"); w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); w.setSize(800,600); w.setVisible(true); } }
Convert this Icon snippet to Python and keep its semantics consistent.
link graphics procedure main(arglist) WOpen("size=300, 300", "fg=blue", "bg=light gray") WDone() end
import Tkinter w = Tkinter.Tk() w.mainloop()
Translate this program into VB but keep the logic exactly as in Icon.
link graphics procedure main(arglist) WOpen("size=300, 300", "fg=blue", "bg=light gray") WDone() end
Option Explicit Sub InsertForm() Dim myForm As Object, strname As String Set myForm = ThisWorkbook.VBProject.VBComponents.Add(3) strname = myForm.Name VBA.UserForms.Add(strname).Show End Sub
Produce a functionally identical Go code for the snippet given in Icon.
link graphics procedure main(arglist) WOpen("size=300, 300", "fg=blue", "bg=light gray") WDone() end
package main import ( "github.com/mattn/go-gtk/glib" "github.com/mattn/go-gtk/gtk" ) func main() { gtk.Init(nil) window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL) window.Connect("destroy", func(*glib.CallbackContext) { gtk.MainQuit() }, "") window.Show() gtk.Main() }
Convert this J block to C, preserving its control flow and logic.
wdinfo 'Hamlet';'To be, or not to be: that is the question:'
#include <stdio.h> #include <stdlib.h> #include "SDL.h" int main() { SDL_Surface *screen; if (SDL_Init(SDL_INIT_VIDEO) != 0) { fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError()); return 1; } atexit(SDL_Quit); screen = SDL_SetVideoMode( 800, 600, 16, SDL_SWSURFACE | SDL_HWPALETTE ); return 0; }
Rewrite the snippet below in C# so it works the same as the original J code.
wdinfo 'Hamlet';'To be, or not to be: that is the question:'
using System; using System.Windows.Forms; public class Window { [STAThread] static void Main() { Form form = new Form(); form.Text = "Window"; form.Disposed += delegate { Application.Exit(); }; form.Show(); Application.Run(); } }
Maintain the same structure and functionality when rewriting this code in C++.
wdinfo 'Hamlet';'To be, or not to be: that is the question:'
#include <QApplication> #include <QMainWindow> int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow window; window.show(); return app.exec(); }
Transform the following J implementation into Java, maintaining the same output and logic.
wdinfo 'Hamlet';'To be, or not to be: that is the question:'
import javax.swing.JFrame; public class Main { public static void main(String[] args) throws Exception { JFrame w = new JFrame("Title"); w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); w.setSize(800,600); w.setVisible(true); } }
Produce a functionally identical Python code for the snippet given in J.
wdinfo 'Hamlet';'To be, or not to be: that is the question:'
import Tkinter w = Tkinter.Tk() w.mainloop()
Rewrite this program in VB while keeping its functionality equivalent to the J version.
wdinfo 'Hamlet';'To be, or not to be: that is the question:'
Option Explicit Sub InsertForm() Dim myForm As Object, strname As String Set myForm = ThisWorkbook.VBProject.VBComponents.Add(3) strname = myForm.Name VBA.UserForms.Add(strname).Show End Sub
Rewrite the snippet below in Go so it works the same as the original J code.
wdinfo 'Hamlet';'To be, or not to be: that is the question:'
package main import ( "github.com/mattn/go-gtk/glib" "github.com/mattn/go-gtk/gtk" ) func main() { gtk.Init(nil) window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL) window.Connect("destroy", func(*glib.CallbackContext) { gtk.MainQuit() }, "") window.Show() gtk.Main() }
Please provide an equivalent version of this Julia code in C.
using Tk w = Toplevel("Example")
#include <stdio.h> #include <stdlib.h> #include "SDL.h" int main() { SDL_Surface *screen; if (SDL_Init(SDL_INIT_VIDEO) != 0) { fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError()); return 1; } atexit(SDL_Quit); screen = SDL_SetVideoMode( 800, 600, 16, SDL_SWSURFACE | SDL_HWPALETTE ); return 0; }
Maintain the same structure and functionality when rewriting this code in C#.
using Tk w = Toplevel("Example")
using System; using System.Windows.Forms; public class Window { [STAThread] static void Main() { Form form = new Form(); form.Text = "Window"; form.Disposed += delegate { Application.Exit(); }; form.Show(); Application.Run(); } }
Generate a C++ translation of this Julia snippet without changing its computational steps.
using Tk w = Toplevel("Example")
#include <QApplication> #include <QMainWindow> int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow window; window.show(); return app.exec(); }
Change the following Julia code into Java without altering its purpose.
using Tk w = Toplevel("Example")
import javax.swing.JFrame; public class Main { public static void main(String[] args) throws Exception { JFrame w = new JFrame("Title"); w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); w.setSize(800,600); w.setVisible(true); } }
Convert this Julia block to Python, preserving its control flow and logic.
using Tk w = Toplevel("Example")
import Tkinter w = Tkinter.Tk() w.mainloop()
Please provide an equivalent version of this Julia code in VB.
using Tk w = Toplevel("Example")
Option Explicit Sub InsertForm() Dim myForm As Object, strname As String Set myForm = ThisWorkbook.VBProject.VBComponents.Add(3) strname = myForm.Name VBA.UserForms.Add(strname).Show End Sub
Keep all operations the same but rewrite the snippet in Go.
using Tk w = Toplevel("Example")
package main import ( "github.com/mattn/go-gtk/glib" "github.com/mattn/go-gtk/gtk" ) func main() { gtk.Init(nil) window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL) window.Connect("destroy", func(*glib.CallbackContext) { gtk.MainQuit() }, "") window.Show() gtk.Main() }
Write a version of this Lua function in C# with identical behavior.
local iup = require "iuplua" iup.dialog{ title = "Window"; iup.vbox{ margin = "10x10"; iup.label{title = "A window"} } }:show() iup.MainLoop()
using System; using System.Windows.Forms; public class Window { [STAThread] static void Main() { Form form = new Form(); form.Text = "Window"; form.Disposed += delegate { Application.Exit(); }; form.Show(); Application.Run(); } }
Write a version of this Lua function in C++ with identical behavior.
local iup = require "iuplua" iup.dialog{ title = "Window"; iup.vbox{ margin = "10x10"; iup.label{title = "A window"} } }:show() iup.MainLoop()
#include <QApplication> #include <QMainWindow> int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow window; window.show(); return app.exec(); }
Preserve the algorithm and functionality while converting the code from Lua to Java.
local iup = require "iuplua" iup.dialog{ title = "Window"; iup.vbox{ margin = "10x10"; iup.label{title = "A window"} } }:show() iup.MainLoop()
import javax.swing.JFrame; public class Main { public static void main(String[] args) throws Exception { JFrame w = new JFrame("Title"); w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); w.setSize(800,600); w.setVisible(true); } }
Convert the following code from Lua to Python, ensuring the logic remains intact.
local iup = require "iuplua" iup.dialog{ title = "Window"; iup.vbox{ margin = "10x10"; iup.label{title = "A window"} } }:show() iup.MainLoop()
import Tkinter w = Tkinter.Tk() w.mainloop()
Write the same code in VB as shown below in Lua.
local iup = require "iuplua" iup.dialog{ title = "Window"; iup.vbox{ margin = "10x10"; iup.label{title = "A window"} } }:show() iup.MainLoop()
Option Explicit Sub InsertForm() Dim myForm As Object, strname As String Set myForm = ThisWorkbook.VBProject.VBComponents.Add(3) strname = myForm.Name VBA.UserForms.Add(strname).Show End Sub
Rewrite this program in Go while keeping its functionality equivalent to the Lua version.
local iup = require "iuplua" iup.dialog{ title = "Window"; iup.vbox{ margin = "10x10"; iup.label{title = "A window"} } }:show() iup.MainLoop()
package main import ( "github.com/mattn/go-gtk/glib" "github.com/mattn/go-gtk/gtk" ) func main() { gtk.Init(nil) window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL) window.Connect("destroy", func(*glib.CallbackContext) { gtk.MainQuit() }, "") window.Show() gtk.Main() }
Change the programming language of this snippet from Mathematica to C without modifying what it does.
CreateDocument[]
#include <stdio.h> #include <stdlib.h> #include "SDL.h" int main() { SDL_Surface *screen; if (SDL_Init(SDL_INIT_VIDEO) != 0) { fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError()); return 1; } atexit(SDL_Quit); screen = SDL_SetVideoMode( 800, 600, 16, SDL_SWSURFACE | SDL_HWPALETTE ); return 0; }
Can you help me rewrite this code in C# instead of Mathematica, keeping it the same logically?
CreateDocument[]
using System; using System.Windows.Forms; public class Window { [STAThread] static void Main() { Form form = new Form(); form.Text = "Window"; form.Disposed += delegate { Application.Exit(); }; form.Show(); Application.Run(); } }
Transform the following Mathematica implementation into C++, maintaining the same output and logic.
CreateDocument[]
#include <QApplication> #include <QMainWindow> int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow window; window.show(); return app.exec(); }
Write the same algorithm in Java as shown in this Mathematica implementation.
CreateDocument[]
import javax.swing.JFrame; public class Main { public static void main(String[] args) throws Exception { JFrame w = new JFrame("Title"); w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); w.setSize(800,600); w.setVisible(true); } }
Change the following Mathematica code into VB without altering its purpose.
CreateDocument[]
Option Explicit Sub InsertForm() Dim myForm As Object, strname As String Set myForm = ThisWorkbook.VBProject.VBComponents.Add(3) strname = myForm.Name VBA.UserForms.Add(strname).Show End Sub
Port the provided Mathematica code into Go while preserving the original functionality.
CreateDocument[]
package main import ( "github.com/mattn/go-gtk/glib" "github.com/mattn/go-gtk/gtk" ) func main() { gtk.Init(nil) window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL) window.Connect("destroy", func(*glib.CallbackContext) { gtk.MainQuit() }, "") window.Show() gtk.Main() }
Convert this Nim block to C, preserving its control flow and logic.
import gintro/[glib, gobject, gtk, gio] proc activate(app: Application) = let window = newApplicationWindow(app) window.setTitle("Window for Rosetta") window.setSizeRequest(640, 480) window.showAll() let app = newApplication(Application, "Rosetta.Window") discard app.connect("activate", activate) discard app.run()
#include <stdio.h> #include <stdlib.h> #include "SDL.h" int main() { SDL_Surface *screen; if (SDL_Init(SDL_INIT_VIDEO) != 0) { fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError()); return 1; } atexit(SDL_Quit); screen = SDL_SetVideoMode( 800, 600, 16, SDL_SWSURFACE | SDL_HWPALETTE ); return 0; }
Translate the given Nim code snippet into C# without altering its behavior.
import gintro/[glib, gobject, gtk, gio] proc activate(app: Application) = let window = newApplicationWindow(app) window.setTitle("Window for Rosetta") window.setSizeRequest(640, 480) window.showAll() let app = newApplication(Application, "Rosetta.Window") discard app.connect("activate", activate) discard app.run()
using System; using System.Windows.Forms; public class Window { [STAThread] static void Main() { Form form = new Form(); form.Text = "Window"; form.Disposed += delegate { Application.Exit(); }; form.Show(); Application.Run(); } }
Port the following code from Nim to C++ with equivalent syntax and logic.
import gintro/[glib, gobject, gtk, gio] proc activate(app: Application) = let window = newApplicationWindow(app) window.setTitle("Window for Rosetta") window.setSizeRequest(640, 480) window.showAll() let app = newApplication(Application, "Rosetta.Window") discard app.connect("activate", activate) discard app.run()
#include <QApplication> #include <QMainWindow> int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow window; window.show(); return app.exec(); }
Port the provided Nim code into Java while preserving the original functionality.
import gintro/[glib, gobject, gtk, gio] proc activate(app: Application) = let window = newApplicationWindow(app) window.setTitle("Window for Rosetta") window.setSizeRequest(640, 480) window.showAll() let app = newApplication(Application, "Rosetta.Window") discard app.connect("activate", activate) discard app.run()
import javax.swing.JFrame; public class Main { public static void main(String[] args) throws Exception { JFrame w = new JFrame("Title"); w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); w.setSize(800,600); w.setVisible(true); } }
Change the programming language of this snippet from Nim to Python without modifying what it does.
import gintro/[glib, gobject, gtk, gio] proc activate(app: Application) = let window = newApplicationWindow(app) window.setTitle("Window for Rosetta") window.setSizeRequest(640, 480) window.showAll() let app = newApplication(Application, "Rosetta.Window") discard app.connect("activate", activate) discard app.run()
import Tkinter w = Tkinter.Tk() w.mainloop()
Ensure the translated VB code behaves exactly like the original Nim snippet.
import gintro/[glib, gobject, gtk, gio] proc activate(app: Application) = let window = newApplicationWindow(app) window.setTitle("Window for Rosetta") window.setSizeRequest(640, 480) window.showAll() let app = newApplication(Application, "Rosetta.Window") discard app.connect("activate", activate) discard app.run()
Option Explicit Sub InsertForm() Dim myForm As Object, strname As String Set myForm = ThisWorkbook.VBProject.VBComponents.Add(3) strname = myForm.Name VBA.UserForms.Add(strname).Show End Sub
Port the following code from Nim to Go with equivalent syntax and logic.
import gintro/[glib, gobject, gtk, gio] proc activate(app: Application) = let window = newApplicationWindow(app) window.setTitle("Window for Rosetta") window.setSizeRequest(640, 480) window.showAll() let app = newApplication(Application, "Rosetta.Window") discard app.connect("activate", activate) discard app.run()
package main import ( "github.com/mattn/go-gtk/glib" "github.com/mattn/go-gtk/gtk" ) func main() { gtk.Init(nil) window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL) window.Connect("destroy", func(*glib.CallbackContext) { gtk.MainQuit() }, "") window.Show() gtk.Main() }
Translate this program into C but keep the logic exactly as in OCaml.
let () = let top = Tk.openTk() in Wm.title_set top "An Empty Window"; Wm.geometry_set top "240x180"; Tk.mainLoop (); ;;
#include <stdio.h> #include <stdlib.h> #include "SDL.h" int main() { SDL_Surface *screen; if (SDL_Init(SDL_INIT_VIDEO) != 0) { fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError()); return 1; } atexit(SDL_Quit); screen = SDL_SetVideoMode( 800, 600, 16, SDL_SWSURFACE | SDL_HWPALETTE ); return 0; }
Translate this program into C# but keep the logic exactly as in OCaml.
let () = let top = Tk.openTk() in Wm.title_set top "An Empty Window"; Wm.geometry_set top "240x180"; Tk.mainLoop (); ;;
using System; using System.Windows.Forms; public class Window { [STAThread] static void Main() { Form form = new Form(); form.Text = "Window"; form.Disposed += delegate { Application.Exit(); }; form.Show(); Application.Run(); } }
Keep all operations the same but rewrite the snippet in C++.
let () = let top = Tk.openTk() in Wm.title_set top "An Empty Window"; Wm.geometry_set top "240x180"; Tk.mainLoop (); ;;
#include <QApplication> #include <QMainWindow> int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow window; window.show(); return app.exec(); }
Transform the following OCaml implementation into Java, maintaining the same output and logic.
let () = let top = Tk.openTk() in Wm.title_set top "An Empty Window"; Wm.geometry_set top "240x180"; Tk.mainLoop (); ;;
import javax.swing.JFrame; public class Main { public static void main(String[] args) throws Exception { JFrame w = new JFrame("Title"); w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); w.setSize(800,600); w.setVisible(true); } }
Generate a Python translation of this OCaml snippet without changing its computational steps.
let () = let top = Tk.openTk() in Wm.title_set top "An Empty Window"; Wm.geometry_set top "240x180"; Tk.mainLoop (); ;;
import Tkinter w = Tkinter.Tk() w.mainloop()