Dataset Viewer
Auto-converted to Parquet Duplicate
conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Allow toggling of menu by clicking on the user icon.\n" }, { "from": "human", "value": "\nwhen defined(js):\n import sugar\n\n include karax/prelude\n import karax/[vstyles]\n import karaxutils\n\n import threadlist\n type\n UserMenu* = ref object\n sh...
nimrod
chosen
[ { "from": "system", "value": "Use search paths for after effects\n" }, { "from": "human", "value": "import nake\nimport os\n\nwhen defined(windows):\n let afterEffectsScripts = \"C:/Program Files/Adobe/Adobe After Effects CC 2015.3/Support Files/Scripts\"\nelse:\n let afterEffectsScripts =...
nimrod
chosen
[ { "from": "system", "value": "Set Content-Type as application/json for the Jester benchmark.\n" }, { "from": "human", "value": "import jester, strtabs, json, asyncio, sockets\n\nget \"/json\":\n var obj = %{\"message\": %\"Hello, World!\"}\n resp($obj)\n\nvar disp = newDispatcher()\ndisp.regis...
nimrod
chosen
[ { "from": "human", "value": "Add a toy program to set up a minimal environment\n\nIncoming: changes to nakefile.nim to facilitate building of this\n" }, { "from": "gpt", "value": "import types, objects, querying, verbs, builtins, rdstdin, strutils\n\nvar world = createWorld()\nvar root = blankOb...
nimrod
chosen
[ { "from": "system", "value": "Add tests for empty or non-empty match\n" }, { "from": "human", "value": "import unittest, nre, optional_t.nonstrict\n\nsuite \"Misc tests\":\n test \"unicode\":\n check(\"\".find(re(\"\", \"8\")).match == \"\")\n check(\"перевірка\".replace(re(r\"\\w\", \"uW...
nimrod
chosen
[ { "from": "system", "value": "Add host OS/CPU to version output.\n" }, { "from": "human", "value": "import parseopt2, strutils\n\nimport common\n\ntype\n CliParams = ref object\n version*: string\n\nlet doc = \"\"\"\nchoosenim: The Nim toolchain installer.\n\nChoose a job. Choose a mortgage....
nimrod
chosen
[ { "from": "system", "value": "Add `enumerate` for Python refugees/porting other CLI utility code.\n" }, { "from": "human", "value": "proc `:=`*[T](x: var T, y: T): T =\n ## A assignment expression like convenience operator\n x = y\n x\n\niterator maybePar*(parallel: bool, a, b: int): int =\n ...
nimrod
chosen
[ { "from": "system", "value": "Add a way to both be quiet and not raise an exception.\n" }, { "from": "human", "value": "import os, parsecfg, streams\n\nproc cfToCL*(path: string, subCmdName=\"\", quiet=false): seq[string] =\n ## Drive Nim stdlib parsecfg to get either specific subcommand parame...
nimrod
chosen
[ { "from": "system", "value": "Add an optional quiet mode for various best-effort/search path situations.\n" }, { "from": "human", "value": "import os, parsecfg, streams\n\nproc cfToCL*(path: string, subCmdName=\"\"): seq[string] =\n ## Drive Nim stdlib parsecfg to get either specific subcommand...
nimrod
chosen
[ { "from": "system", "value": "Test JS proc header codegen\n" }, { "from": "human", "value": "discard \"\"\"\n output: '''foo\njs 3.14'''\n\"\"\"\n\n# This file tests the JavaScript generator\n\n# #335 \nproc foo() =\n var bar = \"foo\"\n proc baz() =\n echo bar\n baz()\nfoo()\n \n# #376...
nimrod
chosen
[ { "from": "system", "value": "Add count to the measurement\n" }, { "from": "human", "value": "import times\nimport os\nimport re \nimport strformat\n\nif paramCount() == 0:\n echo \"Usage: ./benchmark <filename>\"\n quit(QuitFailure)\n\nproc measure(data:string, pattern:string) =\n let time =...
nimrod
chosen
[ { "from": "system", "value": "Fix typo in new test" }, { "from": "human", "value": "discard \"\"\"\n output: '''9'''\n\"\"\"\n\ntype\n n32 = range[0..high(int)]\n n8* = range[0'i8..high(int8)]\n\nproc `+`*(a: n32, b: n32{nkIntLit}): n32 = discard\n\nproc `-`*(a: n8, b: n8): n8 = n8(system.`-`...
nimrod
chosen
[ { "from": "system", "value": "Rename ``version`` to ``bypass`` so that people don't get the wrong idea\nhow to proceed with --version-type activity.\n" }, { "from": "human", "value": "proc demo(alpha: int, version=false, item: string, args: seq[string]): int =\n ## demo entry point with varied,...
nimrod
chosen
[ { "from": "system", "value": "Use git describe in example for a better version string.\n" }, { "from": "human", "value": "proc demo(alpha: int=1, item: string=\"hi\", args: seq[string]): int =\n ## demo entry point with varied, meaningless parameters. A Nim invocation\n ## might be: demo(alph...
nimrod
chosen
[ { "from": "system", "value": "Add single shot and periodic timer examples\n" }, { "from": "human", "value": "import narmos\nimport stdio\nimport usart\nimport shell\nimport cstrmatch\nimport assertions\n\nvar tickCount: int\n\n#timerHandler(tickCallback):\n# inc(tickCount)\n\nshellHandler(prin...
nimrod
chosen
[ { "from": "system", "value": "Return \" \" when country code is invalid.\n" }, { "from": "human", "value": "import unicode\n\nwhen not defined(js):\n import httpclient, logging, asyncdispatch, json\n\n proc getCountryForIP*(ip: string): Future[string] {.async.} =\n ## Returns a two-letter ...
nimrod
chosen
[ { "from": "system", "value": "Enable debug shell in hello world app\n" }, { "from": "human", "value": "import rtos\nimport stdio\nimport usart\n\nvar tick_count: int\n\nproc blink_callback(exp_timer: timer_handle): void =\n printf(\"tick_count: %d\\n\", tick_count)\n tick_count += 1\n\nproc se...
nimrod
chosen
[ { "from": "system", "value": "Make help for positionals look a little more like auto-generated (but diff\nto be a good demo!).\n" }, { "from": "human", "value": "proc demo(alpha=1, verb=false, args: seq[string], stuff: seq[string]): int=\n ## demo entry point with varied, meaningless parameters...
nimrod
chosen
[ { "from": "system", "value": "VM: Fix test: `graph` needs to be a var.\n" }, { "from": "human", "value": "discard \"\"\"\n matrix: \"--gc:boehm\"\n\"\"\"\n\nimport \"../../src/schema_order.nim\"\n\n# Objective: Create, sort, and validate a simple Option schema order.\nblock:\n let graph = new_s...
nimrod
chosen
[ { "from": "system", "value": "Speed up Nim again by making it simpler\n" }, { "from": "human", "value": "# Set cc = clang in compiler's config/nim.cfg for better performance\nimport strutils, sequtils, times\n\ntype\n Route = object\n dest, cost: int\n Node = object\n neighbo...
nimrod
chosen
[ { "from": "system", "value": "Remove spurious import added in the last commit.\n" }, { "from": "human", "value": "discard \"\"\"\n output: '''140\n5-120-120\n359'''\n\"\"\"\nimport math\n\nproc optarg(x:int, y:int = 0):int = x + 3 * y\nproc singlearg(x:int):int = 20*x\necho optarg 1, singlearg ...
nimrod
chosen
[ { "from": "system", "value": "Add setup and setupmin tasks\n\nsetupmin builds the setupmin program\nsetup sets up a minimal world\n" }, { "from": "human", "value": "import nake\n\nconst\n DefaultOptions = \"--verbosity:0 --hint[XDeclaredButNotUsed]:off\"\n MainDeps =\n @[\"types\", \"object...
nimrod
chosen
[ { "from": "system", "value": "Add more features to the nim client\n" }, { "from": "human", "value": "import httpclient\nimport json\n\ntype\n Episode* = object of RootObj\n name: string\n air_date: int\n season: int\n episode: int\n is_movie: bool\n\nconst\n API_ENDPOINT: string...
nimrod
chosen
[ { "from": "system", "value": "Add multiarg shell handler to hello_world example\n" }, { "from": "human", "value": "import rtos\nimport stdio\nimport usart\nimport shell\n\nvar tick_count: int\n\nproc tick_callback(exp_timer: timer_handle): void =\n tick_count += 1\n\nshell_handler(print_ticks):...
nimrod
chosen
[ { "from": "system", "value": "Fix optarg() and added two more tests.\n\nOne for 'do notation' in a single function in an expression, another the trick of using the method call syntax to pass two parameters.\n" }, { "from": "human", "value": "discard \"\"\"\n output: '''140\n5-120'''\n\"\"\"\n\n...
nimrod
chosen
[ { "from": "system", "value": "Use purpose of program for test command doc.\n" }, { "from": "human", "value": "# This tests if things work if the wrapped user-proc uses identifiers also in\n# our generated dispatch proc. Should be fine as long as no imports pull in a\n# name like \"disapatcherFo...
nimrod
chosen
[ { "from": "system", "value": "Fix test case expected output" }, { "from": "human", "value": "discard \"\"\"\nerrormsg: \"Error: ordinal type expected\"\nline: 10\n\"\"\"\n\n# https://github.com/nim-lang/Nim/issues/9908\n\ntype\n X = enum\n a = (\"a\", \"b\")\n" }, { "from": "gp...
nimrod
chosen
[ { "from": "system", "value": "Add persist as a dependency\n" }, { "from": "human", "value": "import nake\n\nconst\n DefaultOptions = \"--verbosity:0\"\n MainDeps =\n @[\"types\", \"objects\", \"scripting\", \"querying\", \"verbs\", \"builtins\"]\n Exes = {\n \"main\": MainDeps,\n \"t...
nimrod
chosen
[ { "from": "system", "value": "Make compile on FreeBSD. Not well tested for ACL presence, though.\n" }, { "from": "human", "value": "import posix\n\nvar lastBadDev = 0.Dev\nproc getxattr*(path: string, name: string, dev: Dev=0): int =\n proc getxattr(path:cstring; name:cstring; value:pointer; s...
nimrod
chosen
[ { "from": "system", "value": "Clean up output proc of the player in question\n" }, { "from": "human", "value": "import types, objects, querying, verbs, builtins, rdstdin, strutils, persist\n\nlet\n world = loadWorld(\"min\")\n player = world.getObjects()[8]\n\nwhile true:\n let command = read...
nimrod
chosen
[ { "from": "system", "value": "Add tool for editing verbs\n\nsyntax is vedit #<object ID>:<verb name>\n\nfor example, vedit #0:look\n" }, { "from": "human", "value": "import types, objects, querying, verbs, builtins, persist, os, strutils, rdstdin\n\nlet\n world = loadWorld(\"min\")\n player = ...
nimrod
chosen
[ { "from": "system", "value": "Convert CudaTensor to Tensor for display\n" }, { "from": "human", "value": "# Copyright 2017 Mamy André-Ratsimbazafy\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You ma...
nimrod
chosen
[ { "from": "system", "value": "Destroy CuBLAS handle before CUDA stream\n" }, { "from": "human", "value": "# Copyright 2017 Mamy André-Ratsimbazafy\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You ma...
nimrod
chosen
[ { "from": "system", "value": "Set syntax to scheme in the correct place\n" }, { "from": "human", "value": "import types, objects, querying, verbs, builtins, persist, os, strutils, rdstdin, re, tables\n\nlet\n world = loadWorld(\"min\")\n player = world.getObjects()[8]\n\nworld.check()\n\nplaye...
nimrod
chosen
[ { "from": "system", "value": "Add OpenMP flag and export proc\n" }, { "from": "human", "value": "\nconst OMP_FOR_ANNOTATION = \"if(ompsize > \" & $OMP_FOR_THRESHOLD & \")\"\n\ntemplate omp_parallel_countup(i: untyped, size: Natural, body: untyped): untyped =\n let ompsize = size\n for i in `||...
nimrod
chosen
[ { "from": "system", "value": "Set a special \"program\" for idle peroid\n" }, { "from": "human", "value": "import os\nimport times\nimport parsecfg\nimport subs_mysql\nimport subs_windows\nimport types\n\nvar\n currJob, lastJob: Job = getCurrentJob()\n currAct: Activity\n conn = OpenDbConnect...
nimrod
chosen
[ { "from": "system", "value": "Make more robust in case `cmdNames` is the empty seq.\n" }, { "from": "human", "value": "import os, strutils, cligen/cfUt\n\n{.push warning[ProveField]: off.}\nproc mergeParams(cmdNames: seq[string],\n cmdLine=os.commandLineParams()): seq[string] =\n...
nimrod
chosen
[ { "from": "system", "value": "Fix JS compilation with newer nim\n" }, { "from": "human", "value": "import os, strutils\nimport abstract_asset_bundle, url_stream\n\nimport nimx/pathutils\n\nvar resourceUrlMapper*: proc(p: string): string # Deprecated\n\nwhen defined(js) or defined(emscripten):\n ...
nimrod
chosen
[ { "from": "human", "value": "Add an example that uses different framing for request & replies.\n" }, { "from": "gpt", "value": "import std/[posix, strutils, tables], cligen/[osUt, mslice, magic, procpool]\n\ntype Excl = enum compress,tar,soft,apptype,elf,text,cdf,tokens,encoding,ascii\nconst e2F...
nimrod
chosen
[ { "from": "human", "value": "htmlparser: Add test for paragraph inside <dd,li>\n" }, { "from": "gpt", "value": "discard \"\"\"\n output: \"@[]\"\n\"\"\"\nimport htmlparser\nimport xmltree\nimport strutils\nfrom streams import newStringStream\n\n\n## builds the two cases below and test that\n## ...
nimrod
chosen
[ { "from": "human", "value": "Add sum of Digits in Nim\n" }, { "from": "gpt", "value": "import strutils\n\nproc sum_digits(n: int): int =\n for c in $ n:\n result += parseInt($ c)\n\nwhen isMainModule:\n echo \"Enter a number\"\n let num = readLine(stdin).parseInt()\n echo \"Sum of digits ...
nimrod
chosen
[ { "from": "human", "value": "Add program to generate docs for builtins\n\nIt's laughably simplistic but it works. I'll add a task to the nakefile\nto generate docs.\n" }, { "from": "gpt", "value": "import strutils\nimport nre\nimport options\nimport streams\n\nconst\n builtinsSourceFile = \"src...
nimrod
chosen
[ { "from": "human", "value": "Add tests for standard targets\n" }, { "from": "gpt", "value": "discard \"\"\"\n output: '''likely occurrence\nunlikely occurrence'''\n\"\"\"\n\nif likely(true):\n echo \"likely occurrence\"\n\nif unlikely 4 == 34:\n echo \"~~wrong branch taken~~\"\nelse:\n ...
nimrod
chosen
[ { "from": "human", "value": "Make it easy to test code\n" }, { "from": "gpt", "value": "import md5, re, os, strutils, osproc\n\nlet\n markdownFilesGlob = getCurrentDir() / \"content\" / \"*.md\"\n configFilePath = getCurrentDir() / \"validcodehashes.txt\"\n\nfor filePath in walkFiles(markdownF...
nimrod
chosen
[ { "from": "human", "value": "Add a very simple timing program to measure procpool dispatch overhead.\n" }, { "from": "gpt", "value": "import std/posix, cligen/[procpool, osUt, posixUt], cligen\n\nvar ibuf, obuf: string\n\nproc doSin() =\n var buf: string\n buf.setLen ibuf.len + 1\n while stdi...
nimrod
chosen
[ { "from": "human", "value": "Add Nim version of the converter from SQL scripts to SQLite database\n" }, { "from": "gpt", "value": "import sqlite3\nimport parseopt2\nimport strutils\nimport times\nimport os\n\nproc writeHelp()=\n echo(\"SQL2SQLite <SQL Filename>\")\n\nproc writeVersion()=\n ech...
nimrod
chosen
[ { "from": "system", "value": "Add os tests for directory creation, iteration and deletion\n" }, { "from": "human", "value": "# test some things of the os module\n\nimport os\n\nproc walkDirTree(root: string) =\n for k, f in walkDir(root):\n case k\n of pcFile, pcLinkToFile: echo(f)\n o...
nimrod
chosen
[ { "from": "human", "value": "Add Coin state machine in Nim\n" }, { "from": "gpt", "value": "var state = 0\n\nwhile state != 25:\n echo \"Balance: \" , state\n echo \"Insert a coin (penny, nickel, dime, quarter)\"\n\n let coin = readLine(stdin)\n\n case coin\n of \"penny\":\n state +=...
nimrod
chosen
[ { "from": "human", "value": "Add 100 Doors Puzzle in Nim\n" }, { "from": "gpt", "value": "var doors: array[100, bool]\n\n# Initialize doors to be closed\nfor i in 0..99:\n doors[i] = false\n\nfor i in 0..99:\n var j = i\n while j < 100:\n doors[j] = (not doors[j])\n j += i + 1\n\n# Prin...
nimrod
chosen
[ { "from": "human", "value": "Add 99 Bottles puzzle in Nim\n" }, { "from": "gpt", "value": "from strformat import fmt\n\nproc lyric_99_bottles(num: int) =\n if num == 99:\n echo \"99 bottles of beer on the wall, 99 bottles of beer.\"\n elif num == 0:\n echo \"Take one down and pass it aro...
nimrod
chosen
[ { "from": "human", "value": "Add Euler totient in Nim\n" }, { "from": "gpt", "value": "from strutils import parseInt\n\nproc gcd(x, y: int): int =\n if x == 0:\n return y\n result = gcd(y mod x, x)\n\nproc euler_totient(n: int): int =\n result = 1\n for i in 2..< n:\n if gcd(n,i) == 1:...
nimrod
chosen
[ { "from": "system", "value": "Use declaredInScope instead of definedInScope\n" }, { "from": "human", "value": "type\n Regex = distinct string\n\nconst maxSubpatterns = 10\n\nproc re(x: string): Regex =\n result = Regex(x)\n\nproc match(s: string, pattern: Regex, captures: var openArray[string]...
nimrod
chosen
[ { "from": "human", "value": "Introduce fused ops to avoid catastrophic cancellation\n" }, { "from": "gpt", "value": "# Copyright 2017 the Arraymancer contributors\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the Li...
nimrod
chosen
[ { "from": "human", "value": "Add tests for unpacking simple variant\n" }, { "from": "gpt", "value": "import dbus\n\nlet bus = getBus(dbus.DBUS_BUS_SESSION)\nvar msg = makeCall(\"com.zielmicha.test\",\n ObjectPath(\"/com/zielmicha/test\"),\n \"com.zielmicha.test\",\n ...
nimrod
chosen
[ { "from": "human", "value": "Add spawn test. Hangs most of the time on linux x64 at least.\n" }, { "from": "gpt", "value": "discard \"\"\"\n output: '''4\n8'''\n cmd: \"nimrod $target --threads:on $options $file\"\n\"\"\"\n\nvar\n x, y = 0\n\nproc p1 =\n for i in 0 .. 1_000_000:\n discard...
nimrod
chosen
[ { "from": "human", "value": "Add test for bad spawn argument.\n" }, { "from": "gpt", "value": "discard \"\"\"\n line: 7\n errormsg: \"'spawn' takes a call expression of type void\"\n cmd: \"nimrod $target --threads:on $options $file\"\n\"\"\"\n\nspawn(1)\n" } ]
nimrod
chosen
[ { "from": "human", "value": "Add test case for infinite recursion in semtypes\n" }, { "from": "gpt", "value": "discard \"\"\"\n errormsg: \"illegal recursion in type 'XIM'\"\n line: 8\n\"\"\"\n\ntype\n XIM* = ptr XIM\n XIMProc* = proc (a2: XIM)\n" } ]
nimrod
chosen
[ { "from": "human", "value": "Add a test case for the EvError handling issue\n" }, { "from": "gpt", "value": "discard \"\"\"\n file: \"tasynceverror.nim\"\n exitcode: 1\n outputsub: \"Error: unhandled exception: Connection reset by peer [Exception]\"\n\"\"\"\n\nimport\n asyncdispatch,\n ...
nimrod
chosen
[ { "from": "system", "value": "Update htmlparser test ``output`` variable\n" }, { "from": "human", "value": "discard \"\"\"\n output: \"@[]\"\n\"\"\"\nimport htmlparser\nimport xmltree\nimport strutils\nfrom streams import newStringStream\n\n\n## builds the two cases below and test that\n## ``//...
nimrod
chosen
[ { "from": "human", "value": "[NN] Add reshape and flatten layers\n" }, { "from": "gpt", "value": "# Copyright 2017 the Arraymancer contributors\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may o...
nimrod
chosen
[ { "from": "human", "value": "macros: Add test for node comparsion\n" }, { "from": "gpt", "value": "discard \"\"\"\noutput: '''1\n0\n1\n0\n1\n0\n1\n0'''\n\"\"\"\n\nimport macros\n\nmacro test(a: typed, b: typed): expr =\n newLit(a == b)\n\necho test(1, 1)\necho test(1, 2)\n\ntype\n Obj = object...
nimrod
chosen
[ { "from": "human", "value": "Add Sum of Digits in Nim\n" }, { "from": "gpt", "value": "import strutils\n\nproc sum_digits(n: int): int =\n for c in $ n:\n result += parseInt($ c)\n\nwhen isMainModule:\n echo \"Enter a number\"\n let num = readLine(stdin).parseInt()\n echo \"Sum of digits ...
nimrod
chosen
[ { "from": "human", "value": "Add a new example of `forPath` that actually cares about hierarchy/\nhas a non-trivial post-recurse clause.\n" }, { "from": "gpt", "value": "import strformat, cligen, posix, cligen/[dents, posixUt, statx]\n\nproc rr*(roots: seq[string], xdev=false): int =\n ## Like ...
nimrod
chosen
[ { "from": "human", "value": "Add semi-automatic multi-cmd example. Does not quite work, though.\n" }, { "from": "gpt", "value": "proc demo(alpha=1, beta=2.0, verb=false, item=\"\", files: seq[string]): int =\n ## demo entry point with varied, meaningless parameters.\n echo \"alpha:\", alpha, ...
nimrod
chosen
[ { "from": "human", "value": "Add test for objvariant construction order\n\nFixes #4665\n" }, { "from": "gpt", "value": "discard \"\"\"\n output: \"SUCCESS\"\n\"\"\"\n\n# A test to ensure that the order in which a variant\n# object is constructed doesn't matter.\n\ntype\n NodeKind = enum\n L...
nimrod
chosen
[ { "from": "system", "value": "Fix accidentally deleted inp argument.\n" }, { "from": "human", "value": "import memfiles\nvar inp = memfiles.open(\"readme.txt\")\nvar buffer: TaintedString = \"\"\nfor line in lines(, buffer):\n echo(\"#\" & line & \"#\")\nclose(inp)\n" }, { "from": "gpt"...
nimrod
chosen
README.md exists but content is empty.
Downloads last month
7