Hey, there.
I'm getting a permission error when I go to compile a program built in Nim. I
can compile fine if I use sudo nim, but that makes me enter the password each
time into Visual Studio Code, so I'd rather not have to do that. Any advice?
Here's the error in full:
Thanks. My problem was using the wrong escape code.
Here are some examples of showing [Suite] in bold blue.
Python: python -c "print '033[1;34m[Suite]033[0m'"
Nim: echo "e[1;34m[Suite]e[00mn"
Bash: printf "e[1;34m[Suite]e[00mn"
Ok.
Araq, you are doubtlessly correct in that the right way to do it is a hook that
receives structured data. Perhaps there is something worth putting in the
standard library even in this case (e.g., an easy, consistent way to timestamp
and mark severity - even if only as a concept).
Nevertheless,
That makes sense.
In case anyone cares, this how I eventually did it:
let first = hostent.addrList[0]
let a = uint8(first[0])
let b = uint8(first[1])
let c = uint8(first[2])
let d = uint8(first[3])
let ipstr = $a & "." & $b & "." & $c & "." & $d
try:
ip =
That works. Thank you! I think I'm starting to get the picture of how it works.
Speaking of the VM, is there an approved way to instantiate and use it at
runtime, or does it involve mucking about with the compiler source code?
Yeah we probably need to offer a sort that inlines the comparator. That said, I
have seen the C compilers remove indirect calls if they can prove the jump
destination (and for `sort` that is actually rather easy to determine).
Your Python program runs once over the input, your Nim program twice. If I read
it correctly.
The VM is not allowed to perform symbol lookups. If you pass `someProc` to a
`typed` macro parameter you should be able to inspect the symbol(s) though.
Email notification used to work but got broken when we moved to HTTPS iirc. Not
sure what it takes to fix it.
> But, well, does anyone maintain the repo? Issues and PRs opened in 2015 are
> still there :/ I am afraid to just do the job which will never be merged.
Yes, we do maintain it. The
On Unix you can write escape sequences, it doesn't need NimScript support. On
Windows escape sequences can be enabled for a terminal too, but it's not the
default and the API call to enable it is not avaiable for Nimscript either.
As you may have found out yourself already, when I was talking about replace()
proc I had in mind this type of replace:
var s = "This is a test"
s[5 .. 6] = "was"
echo s
For finding the start and end position you may use find proc searching for ','
or whatever is
It is generally a bad idea to send the whole seq to C function because there
may reside additional data like seq length at start of memory chunk. Try to use
address of first element of the sequence instead.
Thanks again cdome.
I have another question with C but I want to avoid polluting the homepage with
noobish topics. And strings are kind of sequence isn't it ?
I want to pass a sequence to a C function but the result is unexpected.
Two files for minimal example.
proc
The [blog entry about profiling
etc.](https://nim-lang.org/blog/2017/10/02/documenting-profiling-and-debugging-nim-code.html#profiling-with-valgrind)
might help. Here's the short version:
If your'e on Windows: can't help you. Maybe try Linux Subsystem for Windows 10.
If your'e on MacOs or
Yeah, I suspected as much. In fact, I was compiling the project from the
command line with the nim executable. I'll have to see if compiling from an IDE
actually changes things.
It should be clear that your code is not IO bound.
You are using split(), which creates a seq of substrings for each call. Of
course such operation is expensive, as for each call a new seq is allocated,
and for each entry in the seq a string is allocated. If performance is really a
concern,
As a new user, I'd love to know about I/O optimization techniques for Nim.
Hence, I have this simple function for
[https://www.fluentcpp.com/2017/09/25/expressive-cpp17-coding-challenge/](https://www.fluentcpp.com/2017/09/25/expressive-cpp17-coding-challenge/).
import os, strutils
19 matches
Mail list logo