@demotomohiro
The Nim nightlies repo has been updated so that the releases are named with a
new scheme: `--`.
New releases with this new naming scheme will be out in about 1-2 hours.
Then you can get the JSON data
[https://api.github.com/repos/nim-lang/nightlies/releases](https://api.github.co
Don't `include` the same file twice, neither directly nor indirectly. Use
`import` instead of `include`.
I put together a Nim program that works and then I tore it apart to put pieces
in separate files (to collect type, var, proc which concern separate parts of
the program) - combining them all with 'include xx' in a main program, plus
other additions. Thus I have a small main program and 3 more or
I think you would need to look at both 0th and 1st elements returned in the
JSON at
[https://api.github.com/repos/nim-lang/nightlies/releases](https://api.github.com/repos/nim-lang/nightlies/releases),
and then get the element where the `name` field matches `"-bdevel-"`.
_I just committed this
> Problem is this URL doesn't always return latest devel version
That's correct.
You will need to use the GitHub API and get the required release after parsing
the JSON. Here's an example I found in wild:
[https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c](https://gist.github.
That PR has been merged and official nightly build is available on wandbox. But
when I select a nim HEAD on wandbox, it uses nim-0.19.2 not 0.19.9.
Problem is this URL doesn't always return latest devel version (currently, it
is ver 0.19.9), but it could return a latest stable version (0.19.2)
Well inheritance works too, it's the `method` keyword which doesn't. Use
case/if instead of method and you will be fine. :-)
@Araq, The advantage I am trying to achieve is to minimize memory utilization.
If I use variants to represent my nodes, I get a union from the Nim code
generator:
struct tyObject_BBTreecolonObjectType__J7jcHxXTiq5WhuKk2uaAGQ {
tyEnum_NodeKind_9bCibRYMAQfBZ6GB8aWzvUA kind;
I like @Araq s suggestion as well lol
> I have the feeling that finding find is hard for beginners, as it is hidden
> in system. How can we improve that?
I currently don't have the answer, but maybe @dom96's
[proposal](https://github.com/nim-lang/Nim/issues/10385) would be the way to go?
It works just fine for me,
[https://github.com/nim-lang/Nim/blob/devel/compiler/btrees.nim](https://github.com/nim-lang/Nim/blob/devel/compiler/btrees.nim)
but indeed I don't use inheritance or methods for it, because even if they
don't make Nim explode, they have no advantages.
You can use this with (almost?) no overhead:
iterator span(s: string; first: int, last: BackwardsIndex): char =
for i in first..s.len - last.int: yield s[i]
let s = ".something"
for c in s.span(1, ^1):
echo c
Run
miran, I have the feeling that finding find is hard for beginners, as it is
hidden in system. How can we improve that? So that people looking for seq
"class" see all related procs immediately. And we should have a proc
findByValue().
When performance is really critical you should test it yourself, otherwise all
solutions are ok.
Second and third example should be identical. The question is of both of them
do copy the initial string s. I don't know, but a copy is fast. You may also
consider using pairs iterator, which gives
I ended up writing these templates to convert bracket notation to dot notation:
import macros
macro `[]`*(obj: object, fieldName: string): untyped =
## Access object field value by name: ``obj["field"]`` translates to
``obj.field``.
runnableExamples:
You would use system.find() to get the index and then del() or delete() to
delete the entry. Of course find() is O(N) so it is not that fast for large
seqs.
[https://nim-lang.org/docs/system.html#find%2CT%2CS](https://nim-lang.org/docs/system.html#find%2CT%2CS)
Maybe use another data structure
`import sequtils var a = @[1, 2, 3] a.delete(a.find(3)) `
Run
Note, when your keys are integers you may consider using a seq or array for
your objects, especially when keys are am continues range. That may be more
efficient.
What you now use is a hash table with keys as int and seq as values, but you
seems not to delete the entries when done, but you repl
Example:
a = @[1, 2, 3]
Run
I want to delete the value 3 from the sequence without using its index.
Is there a way to specify a value to delete from a sequence?
I know you can do:
a.del(2)
Run
But this isn't what I want. Any ideas?
I am trying to figure out how to determine whether all values in a Table are
empty.
starting graph: {1: @[0], 2: @[1, 6], 3: @[2], 4: @[2], 5: @[4], 6: @[5,
8], 7: @[9], 8: @[7], 9: @[6], 0: @[3]}
Run
I delete a value after doing something for several iterations. I st
20 matches
Mail list logo