Why is this `cursor` causing error ?

2023-04-27 Thread sls1005
I think it's a bug, and it just disappeared when I tried to echo everything before they're accessed. proc insert[T](list: var LinkedList[T], prev, next: ListNode[T], val: T) = echo [if prev != nil: prev.val else: 0, val, if next != nil: next.val else: 0] var node = ListN

Why is this `cursor` causing error ?

2023-04-27 Thread AmjadBHD
This actually makes things more confusing. Your version seems equivalent to the original, why does it work ? For reference, here's the `--expandArc:insert` result for: The original var node :tmpD node = ListNode[T](val: :tmpD = val_1 :tmpD)

Compiler limitation or wrong usage/expectation on my part?

2023-04-27 Thread ck
thanks! I'll use the `public export` best practice/workaround for now.

Compiler limitation or wrong usage/expectation on my part?

2023-04-27 Thread ck
thanks! Good to know that this issue has a name - "Generic sandwiches" and that it will be fixed eventually :)

Why is this `cursor` causing error ?

2023-04-27 Thread Smintheus98
I solved the same exercise some weeks ago, without using `.cursor` pragma though. After adding the pragma, my code kept working flawlessly. Even after changing the approach to use a similar `insert` proc as provided in the question. After some tinkering around I noticed that I used the object c

Any known means of sorting UTF8 strings?

2023-04-27 Thread grd
> You are right, it is a very non-trivial task. I'm suspecting 200+ hours of > work to write. I think that it is probably 200++ hours ;) I would just use c2nim with ICU.

Small experiment with compiling the Nim compiler with PGO

2023-04-27 Thread awr1
@Yadarnico have you tried MSVC's PGO at all w/ the Nim compiler (or are you not on Windows?)

Small experiment with compiling the Nim compiler with PGO

2023-04-27 Thread Yardanico
I dual-boot so I do have Windows, but honestly I haven't used MSVC in ages :)

Semcheck a NimNode tree?

2023-04-27 Thread shirleyquirk
I just submitted a stackoverflow question on this topic, I edited @PMunch's answer with how I ended up implementing it, but my edit wasn't accepted. It was essentially @choltreppe

Semcheck a NimNode tree?

2023-04-27 Thread awr1
> What are the use cases? There are four main things I can think of: * Parsing trees with mixed semantically-valid and DSL code (e.g. the prior example) * Including generated code from a cache that must be programmatically retrieved (such as Nimterop/Futhark etc.) with better semantic analy

Any known means of sorting UTF8 strings?

2023-04-27 Thread spip
Sorting code points is locale-dependant. Sorting in French is different from sorting in Spanish or German. The Unicode group has detailed the collation algorithm that uses the Unicode property files. If you want a general solution, ICU (or its variants) is the fastest path.

Why is this `cursor` causing error ?

2023-04-27 Thread Araq
Well it does append/prepend.

Why is this `cursor` causing error ?

2023-04-27 Thread AmjadBHD
Your code isn't equivalent to the original, it causes many tests to fail.

Any known means of sorting UTF8 strings?

2023-04-27 Thread JohnAD
@srd, You are right, it is a very non-trivial task. I'm suspecting 200+ hours of work to write. The sorting algorithm would be established by a very complex and convoluted comparator. It has been done in C and Java in a library called ICU here: Haskell has

Compiler limitation or wrong usage/expectation on my part?

2023-04-27 Thread Araq
I mind it quite a bit and hope to implement , eventually.

Why is this `cursor` causing error ?

2023-04-27 Thread Araq
Your `insert` was too complicated for me to understand so I rewrote the code to: proc push*[T](list: var LinkedList[T], val: T) = ## Appends a node with the given `val` to `list`. #list.insert list.last, nil, val var node = ListNode[T](val: val) node.prev = lis

Compiler limitation or wrong usage/expectation on my part?

2023-04-27 Thread pietroppeter
> the $ code fails silently the code is not failing, in `system` (automatically imported) is defined a generic `$` that is used by `echo` (and it would be overriden by the more specific `$` in `token.nim` if imported). I would say this behaviour is expected and there is nothing wrong about it.

Compiler limitation or wrong usage/expectation on my part?

2023-04-27 Thread ck
Hi, I have stumbled upon an issue with imports and `$`. Here is the sample code: nim_example/token.nim import strformat type Token* = object token_type*: string proc `$`*(self: Token): string = return fmt"TokenType: {self.token_type}" p

Any known means of sorting UTF8 strings?

2023-04-27 Thread grd
> Think A a à B... as being the correct means of sorting letters in a spelling > dictionary. I think that you are right, but how should the sorting order of `A a à ä á B` look like? Because I don't think that these special characters are in alphabetical order.

Optimise async request / code [For Beginners]

2023-04-27 Thread blackmius
poll() queues all futures in same thread, there is no difference

Optimise async request / code [For Beginners]

2023-04-27 Thread huantian
Wouldn't recommend this exact code though because you're leaking clients