This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc test[T](number: int): seq[T] = | |
return newSeq[T](number) | |
var x = test[int](5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last) | |
builder.nim(908) builder | |
asyncio.nim(585) poll | |
gc.nim(445) newSeq | |
gc.nim(438) newObj | |
gc.nim(414) rawNewObj | |
gc.nim(985) collectCT | |
gc.nim(953) collectCTBody | |
gc.nim(912) CollectZCT | |
gc.nim(352) forAllChildren |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iterator additionIterator(value: int): int {.closure.} = | |
var total = 0 | |
while True: | |
total += value | |
yield total | |
var addIter = additionIterator # Creates a *copy* of the original iterator procedure | |
for i in 1..5: | |
echo(addIter(i)) # The argument the iterator takes is updated each time we call it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# EXAMPLE A | |
iterator count* [T](start: T, step = 1): T {.closure.} = | |
## An iterator function that returns evenly spaced values of ordinal T, | |
## starting with `start` | |
## Note, this doesn't have any protections against overflow errors! | |
## | |
## Parameters: | |
## start: A starting ordinal | |
## step: The space between returned values. | |
var i = start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE language SYSTEM "language.dtd"> | |
<language | |
name="Nimrod" | |
version="1.0" | |
kateversion="2.4" | |
section="Sources" | |
extensions="*.nim" | |
mimetype="text/x-nimrod"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# [PackageDev] target_format: plist, ext: tmLanguage | |
--- | |
name: Nimrod | |
scopeName: source.nimrodtwo | |
fileTypes: [".nim2"] | |
uuid: fa6f2c1c-dd3f-4bcd-b2be-d05312be4080 | |
patterns: | |
- name: comment.line.number-sign.nimrod | |
match: (#).*$\n? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This will build nimrod using the specified settings. | |
import | |
osproc, json, sockets, asyncio, os, streams, parsecfg, parseopt, strutils, | |
ftpclient, times, strtabs | |
import types | |
const | |
builderVer = "0.2" | |
buildReadme = """ | |
This is a minimal distribution of the Nimrod compiler. Full source code can be |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc foo[T](): array[T, int] = | |
return result | |
discard foo[TSlice[int](a:1,b:5)]() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Folder PATH listing | |
Volume serial number is 0000001A 644F:8281 | |
C:. | |
├───.git | |
│ ├───hooks | |
│ ├───info | |
│ ├───logs | |
│ │ └───refs | |
│ │ ├───heads | |
│ │ │ ├───core |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc removeFile*(file: string) {.rtl, extern: "nos$1", tags: [FWriteDir].} = | |
## Removes the `file`. If this fails, `EOS` is raised. This does not fail | |
## if the file never existed in the first place. | |
## On Windows, ignores the read-only attribute. | |
when defined(Windows): # Would this be better using a template to | |
when useWinUnicode: | |
let f = newWideCString(file) | |
if DeleteFileW(f) == 0: | |
if GetLastError() == ERROR_ACCESS_DENIED: | |
if SetFileAttributesW(f, FILE_ATTRIBUTE_NORMAL) == 0: |