> if you want to iterate and break after the first then you can use any of the
> table types
It is just a current implementation detail / coincidence, that your first
example returns `1` as the first key. Don't rely on that, please.
* * *
Btw, if you (plural) want sorted tables, there is a
Is there a competition on longest repo name I am not aware of? ;)
When loading the terminal command:
curl https://nim-lang.org/choosenim/init.sh -sSf | sh
Throws error:
exception: execution failed with exit code 1
... Team: SH build.sh
... Output: # OS: linux
... # Processor: amd64
... CCC-W-O3-TNF-strict
I still have issues...
I have some ref objects and trying to get the hex address of the objects using
repr(addr(x)) but when trying to echo the value the output is ... whitespace(!).
Is it possible that it has sth to do with my configuration and/or compilation
options? I cannot explain it
Fix went in. {. warning[UnusedImport]:off .}` works now, but it needs to be
active at the end of module as this is where the check is happening
I only meant that it is probably a more direct translation, and their full time
employees are actively developing and working on optimizing etc. so Nim can
benefit from that. I imagine in the future, instead of keeping up with js new
features and possibly deprecations, no effort is being lost
There was another similar attempt recently, see
[https://forum.nim-lang.org/t/5190#32541](https://forum.nim-lang.org/t/5190#32541)
Thank you for your effort, but I can not imagine that such an incomplete list
can be very helpful.
For example Araq listed the GUI packages recently, I think that
(Sometimes this path handle I am advocating is referred to as a "cursor" in
analogy with text-editing. I don't usually see it motivated by coding
economy/simplicity for optionally augmented trees, as I am motivating it here.
Anyway, these comments/analyses are probably better made as issues on
https://github.com/deech/LambdaWorldCadiz2019-WhatFPCanLearnFromStaticIntrospection
I don't use the Table object properly. I'm going to change my data structure.
Thank you.
Minor correction to @mratsim \- if you want to iterate and break after the
first then you can use _any_ of the table types, not only `OrderedTable`. E.g.
import tables
var a = {1: "one", 2: "two"}.toTable
for key, val in a:
echo key
break
Run
Of
Of course. I suppose I should have been explicit to mention things are
"system/data-structure ordered" not "key ordered". Any iteration has "an"
order, though. That weird order just may or may not be what is desired or it
might be fine.
In terms of your `sorta`/B-Tree I would say that (like
Hello everyone,
How to get the first element in a Table ?
My example :
import tables
var a = {1: "one", 2: "two"}.toTable
echo a.keys[0]
Run
The result, for me, should display **1**.
Thanks.
Given that a table is not an ordered collection, how is it possible to get any
first element?
As an alternative you could implement it as an array of tuples for example:
var a = @[ (1,"one"), (2,"two") ]
Run
and then you could easily retrieve a[0].
I sometimes use $cast[int](addr(x)). If you like it hex just transform the
integer into a hex string...
Note that it's fine to use them for logging or debugging but otherwise the GC
can and will move those ref addresses in memory for cycle detection purposes if
you have a cyclic type (unless you compile with pure refcounting with no cycle
detection or you tag your cyclic type acyclic).
When you are searching for packages for your projects, this [categorized
list](https://github.com/pmetras/packages/wiki) can help you to start.
They could be added to [Awesome Nim](https://github.com/VPashkov/awesome-nim)
too.
Thanks you very much for the link, however, the solution proposed is to use the
command that installs the headers, but attempting to install that throws the
follow scary error:
"Installing this package may damage your system, and the installation may fail.
To stop the program and the
I submitted a PR:
[https://github.com/Senketsu/nsu/pull/3](https://github.com/Senketsu/nsu/pull/3)
* Updates nsu to work with Nim 1.0
* Migrates from oldwinapi to winim
* Removes the dependency on the broken png library and libpng.dll (replacing
it with Flippy, thanks @treeform !)
*
In the end I kept it simple:
[https://gist.github.com/ingoogni/ed87bc92c5d2a2da5038dd368a238ac5](https://gist.github.com/ingoogni/ed87bc92c5d2a2da5038dd368a238ac5)
Thanks.
Install the "build-essentials" package or similar so that you have a working
clang/gcc installation.
21 matches
Mail list logo