@Araq:
> Much more problematic to me is that neither `owned` nor `dispose` can handle
> `async`'s complexities which is the most important requirement for us. If we
> cannot solve this problem, using the tracing GC aspect just for this would be
> valid option but then how can move the
OpenSSL is wrapped, but you need to know about OpenSSL functions and network
I/O.
> JUCE is not a GUI library. It is a specialized toolkit for
> audio/video/DSP/plugins/MIDI software creation which also includes some GUI
> support.
OK, I guess this means that Qt-related audio libraries (ex.
Thanks for the tips. Will check it.
Hi, flenniken's blog is very helpful. Thanks for the link.
Hi, Thaks a lot. Thats great. A book nim macros !
If you are just starting with Nim or teaching, I recommend to try first using
`parseStmt`.
macro name(argument: int): untyped = parseStmt "echo " & $(argument * 2)
Run
macro name(argument: float): untyped = parseStmt "echo " & $argument
Run
Basically
Araq, tut3 is really much too short and restricted -- I can not remember well,
but many open questions. I never asked, because I know Arne D. had to do much
work currently.
Generally I liked the flenniken tutorial better for beginners, because it is
easy to understood. But I don't know if it
> As soon as the book on Nim macros is ready,
A Nim macro book would be really great. I read
[https://nim-lang.org/docs/tut3.html](https://nim-lang.org/docs/tut3.html) and
[https://flenniken.net/blog/nim-macros](https://flenniken.net/blog/nim-macros)/
but have still a lot problems with macros.
Is [https://nim-lang.org/docs/tut3.html](https://nim-lang.org/docs/tut3.html)
so bad?
But yeah, macros in Nim might as well be harder than macros in Lisp. For
multiple reasons. Nim's syntax doesn't make compromises for homoiconicity as
most Nim code is written _outside_ of macros. ;-)
Hi, kcvinu.
I agree with your post in every point. Therefore, I am writing two books, one
on macros, and the other on why computer languages become obsolete, and how
this phenomenon impacts on long range projects, like Cyc, ACL2, Emacs and
Maxima:
[https://www.cyc.com](https://www.cyc.com)/
Hi, Vindaar. I am retired right now. However, one of my PhD students, Marcus
Tolentino, is a professor at Ryerson University, Toronto, Canada. He is
teaching Data Structures to 260 students. I myself worked at Utah State
University, Logan, Utah (but I am not Mormon nor believe that God lives in
Just generated the 1.0.0 docset:
[https://bintray.com/genotrance/binaries/download_file?file_path=nim-1.0.0.docset.zip](https://bintray.com/genotrance/binaries/download_file?file_path=nim-1.0.0.docset.zip)
The experimental feature, (), is a mine field. It works if you remove that
definition.
I support a smoother deprecation process, like the one Araq suggested, because
the abrupt change in #12321 creates conditions where csize has different
meaning in Nim 1.0.0 and the next release, making it difficult to maintain
backward compatibility in libraries. Also, the deprecation process
Hi, Juan Carlos.
Your example was of great help, indeed. I wrote a small macro based on it.
Please, take a look and let me know where it can be improved:
import macros
macro iter(i:untyped, c1:untyped,
c2:untyped, stm:untyped): untyped =
result =
Hi, thanks for this macro. I just changed little bit and now, i can call it
like this.
forLoop( i, 0, 2) :
echo "My loop statement"
Run
Well, i need to translate the comments to english though.
I think we need more tutorials about macro. These are the points to include in
a tutorial.
1. What are the elements we get inside a macro. (Like nnkIdent, nnkStmnt etc)
2. How do we separate the stuff on the left side of the macro, right side of
the macro, and the code after the macro name.
Nim, Support for https? Nim, library support UBL(XML) 2.1? Nim, Web Service Api
Secure Suport?
Hmm. This works too:
import typetraits
template toClosure*(i): auto =
iterator j: type(i) {.closure.} =
for x in i:
yield x
j
iterator countUp(i, j: int, k: var string): int =
for g in i..
This seems to work for me:
template toClosure*(i): auto =
iterator j: type(i) {.closure.} =
for x in i:
yield x
j
iterator countUp(i, j: int): int =
for g in i..
Before I attempt to write this is Nim:
[https://github.com/pixelogik/ColorCube/blob/master/Python/ColorCube.py](https://github.com/pixelogik/ColorCube/blob/master/Python/ColorCube.py)
I thought I'd check if anyone here knew if we had a library that'd let me
extract the most frequent colours in
My best guess is that there is a problem when an iterator parameter is passed
as "var". Or I might just be doing something wrong.
Not part of the stdlib, but NPeg shoild be able to do this for you at compile
time:
import npeg
static:
let p = peg rule:
rule <- "cd" * +Space * >Alpha * ":":
echo $1
discard p.match("cd c:\blue\monkey\bike")
Run
Some simple examples
Because the typing rules for literals are independent of the literal
representation you use. Back then this seemed to be the most simple, consistent
rule. I doubt changing it to `uint` would help, you're better off with the
explicit suffixes anyway.
Indeed, it will cover `var T` and `lent T` too.
But sadly, it also doesn't work at compile-time.
While creating GL bindings using glad i get some compile errors with two
constants of type `uint64` that has 0x, it says `type mismatch:
got but expected 'uint64`, the problem was fixed putting
`'u64` at the end but i wonder how this is strictly a signed int, as far i
known
@sky_khan
That's it! Perfect, thanks!
While I'm not sure what kind of features the times -> j syntax should allow (or
if times and -> are fixed), the simplest implementation for the second usage I
can come up with:
import macros, strutils, os
macro theMagicWord(statments: untyped): untyped =
result =
I'm trying to pass an iterator to a proc, the way I pass a generator in Python.
I've submitted a bug:
[https://github.com/nim-lang/Nim/issues/12487](https://github.com/nim-lang/Nim/issues/12487)
I have a feeling it's not really a bug, and I'm just doing it wrong. I have
searched this Forum,
To be honest, I've never used pegs in Nim before but looking at it's source, it
has MaxSubpatterns = 20. So, I guess either you can define matches as
newSeq[string](20) or you can use this,
if fixedString =~ peg"cd\s+{\D}\:":
echo matches[0]
Run
without
# Nim macros I confess that Nim macros defeated me. My expectations were that I
would learn Nim macros as easily as I had learned Lisp macros, but no, Nim
macros are tough. Then I started to create theories about my difficulty in
learning Nim macros.
## Theory 1: Lisp chauvinism Nim macros are
Hi Araq,
I hope this item: openArray[T] can be part of objects. Expand the existing
borrowing rule to ensure safety.
will also cover lent T types too.
This code:
import pegs
static:
var matches = newSeq[string](10)
let
fixedString = "mkdir D:\...\nimgen_test\build\libmodbus"
if fixedString.match(peg"cd\s+{\D}\:", matches): # <-- Error in this line
echo matches[0]
Run
@GordonBGood The legacy code is bad, I know. It's also "just" something we need
to sort out. Much more problematic to me is that neither `owned` nor `dispose`
can handle async's complexities which is _the_ most important requirement for
us. If we cannot solve this problem, using the tracing GC
Dosen't work as expected.
import tables
type
Dic = Table[string, int]
template `.`*(self: Dic, field: untyped): int = self[astToStr(field)]
template `.=`*(self: Dic, field: untyped, value: int) =
self[astToStr(field)] = value
proc
My first reply suggested to embrace `--gc:boehm`. Why doesn't it work for you?
There is the excellent msgpack4nim library that does exactly what you are
requesting:
[https://github.com/jangko/msgpack4nim](https://github.com/jangko/msgpack4nim)
Does that not fit your needs?
I use a Nim-decimal library of IBM origin ... it is licensed apache, is that
why we do not see it in the directory "directorie" is a fundamental lib to
make treatment in Business Management I came there by chance, I was almost to
tell me to do my own lib, and as I'm still too new in "Nim"
Thank you, it is from there that I asked the question, your answer confirms
what I thought.
The use of `*.` instead of `.*` is an excellent idea.
In Arraymancer I choose `.*` to be the same as Julia but it indeed breaks
precedence rules. I can do deprecate it to use `*.` as well.
Ideally @andreaferretti can adopt this dot convention as well in neo, instead
of `|*|` for the Hadamard
When (TM) I add Keras model loading support to Arraymancer, I will need the
HDF5 files reading/writing for sure.
you can't but you can use an init function that wrapps the complex
initialization logic.
`let viewTree = initTreeView()`
If there is one thing Java is good at it's multithreading with shared
references, it's basically the only language with a GC and multithreading
support.
However for high performance compute heavy engine, it will be much slower and
memory hungry than both Nim and C++ due to pointer
It's a compiler bug. Probably the var is not corretly seen when it's not the
top modifier.
For example I think `var (int | uint)` would work but `var int | int` would not.
I suggest you use overloading instead.
I see the problem.
import net
Run
. Nims file running error . Nim file is running correctly
I have a Gitter channel for Arraymancer, or people ping me on IRC/Gitter.
bbxiong1999: I think the following working code is what you were trying to do:
# example1:
let t1 = "Hello"
var
t2 = t1 # note that this must be indented in order to use the `var`
section
t3 : pointer = addr(t2) # note that you need a new line and
Isn't msgpack a binary json? You can reuse the concept of JObject for nested
types.
Thanks @sky_khan,
But how do I get the capture from the result? This now gives @["cd C:"], I need
it to return just the captured substring {D} ("C" in this case), like match
does.
53 matches
Mail list logo