If you capture `cmdhdl` then your proc is a closure.
Here I am with a proc:
proc cmd_exit(input: string): string =
cmdhdl.exit()
return "exit"
Run
According to the [docs /
manual](https://nim-lang.org/docs/manual.html#types-procedural-type), `proc` s
without any calling conventions will default to `{.ni
* [https://forum.nim-lang.org/t/6274](https://forum.nim-lang.org/t/6274)
*
[https://github.com/nim-lang/Nim/issues/12835#issuecomment-562973489](https://github.com/nim-lang/Nim/issues/12835#issuecomment-562973489)
*
[https://github.com/nim-lang/Nim/issues/14142](https://github.com/nim-lang/
@douglas thanks for the feedback really appreciate the next videos will have a
better audio setup than the previous ones that I promise
The audio in the first video is fine. Nice and clear, a few pops here and there
but is ok. The second video has terrible audio. Even with volume 100%, I can
barely here you. Please go back to the setup you used in the first video.
Hi,
I wrote a random number generating library.
[Doc]([https://yesdrx.github.io/randgen/distributions.html](https://yesdrx.github.io/randgen/distributions.html))
[Github]([https://github.com/YesDrX/randgen](https://github.com/YesDrX/randgen))
import randgen
when isMainModule:
Hi,
I wrote a simple bits arary library, which can be applied to larger bits sets
(any length) or high precision numbers.
[Doc]([https://yesdrx.github.io/bitarray/](https://yesdrx.github.io/bitarray/))
[Github]([https://github.com/YesDrX/bitarray](https://github.com/YesDrX/bitarray))
# Example
It's disappointing that Nim doesn't allow cyclic procedural types, like the one
you wanted to write, but not too surprising. OCaml requires a special flag to
compile types like this
# type cont = int -> cont -> int list;;
Error: The type abbreviation cont is cyclic
Just add a new CSS rule, tune it and forget about buttons to keep those
dark-siders happy 😄
[https://web.dev/prefers-color-scheme](https://web.dev/prefers-color-scheme)/
@media (prefers-color-scheme: dark) {
body {
color:white;
background:#444
}
a:link {
Use `untyped` instead of `typed`, that will get you the template.
Thanks! That's cool
How about getting a template name? is it impossible?
> Also how can I disallow certain things...
Standard library has
[https://nim-lang.org/docs/macros.html#expectKind%2CNimNode%2CNimNodeKind](https://nim-lang.org/docs/macros.html#expectKind%2CNimNode%2CNimNodeKind)
but not expect-not or expect-in.
import std/macros
proc exp
I basically want this
[https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/nameof](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/nameof)
I thought It would be simple (btw I have almost no knowledge of macro)
macro nameof(x: typed
That's a good idea! However I've never done that before so it could take some
times.
@snej
I was looking for the same thing, especially something like Pug.js or Slim (a
Ruby thing).
Please let me know how Moustachu works for you, if you give it a try.
I opted for the stdlib’s **htmlgen** module which looks quite nice, though I do
have a thread asking about some ways to improve
👋
I'm trying to come up with a way build an HTML template in the cleanest way
possible.
I can do:
import htmlgen
proc layout(view: string): string =
result =
head(link(rel="stylesheet", href="styles.css")) &
h1("In time") &
p("yo
You could make both a light and a dark mode, using a switch to choose between
the two (just different CSS should work). This is what the Nim docs do and it
works well. A cookie could remember the selection.
17 matches
Mail list logo